Slang's .plan

スポンサーサイト

上記の広告は1ヶ月以上更新のないブログに表示されています。
新しい記事を書く事で広告が消せます。

11/17/06

Geometry Shaders At Work (2)

I wrote a geometry shader that performs silhouette edge detection (it's a good way to learn how geometry shaders work); however, it seems that TRIANGLES_ADJACENCYT for PRIMITIVE_IN is not supported in NVIDIA ForceWare 96.89.

Since 97.02 is a G80-exclusive driver, I hope NVIDIA to shortly release the driver for NV40 as well (I know the implementation of GL_EXT_geometry_shader4 extension in 97.02 is still currently in beta form and I'm not sure whether TRIANGLES_ADJACENCYT is supported in that version or not). But again, I gotta buy a G80 card sooner or later to fully take the advantage of geometry shaders.

----------------------------------------------------------------
!!NVgp4.0
PRIMITIVE_IN TRIANGLES_ADJACENCY;
PRIMITIVE_OUT LINE_STRIP;
VERTICES_OUT 6;
# cgc version 1.6.0011, build date Oct 16 2006 23:39:35
# command line args:
#vendor NVIDIA Corporation
#version 1.6.0.11
#profile gp4gp
#program main
#var float4 gl_Position : $vout.POSITION : HPOS : -1 : 1
#var float4 gl_PositionIn[0] : $vin.VERTEX[0].POSITION : HPOS[0][32] : -1 : 1
#var float4 gl_PositionIn[1] : $vin.VERTEX[1].POSITION : HPOS[1][32] : -1 : 1
#var float4 gl_PositionIn[2] : $vin.VERTEX[2].POSITION : HPOS[2][32] : -1 : 1
#var float4 gl_PositionIn[3] : $vin.VERTEX[3].POSITION : HPOS[3][32] : -1 : 1
#var float4 gl_PositionIn[4] : $vin.VERTEX[4].POSITION : HPOS[4][32] : -1 : 1
#var float4 gl_PositionIn[5] : $vin.VERTEX[5].POSITION : HPOS[5][32] : -1 : 1
TEMP R0, R1, R2;
TEMP RC, HC;
MOV.F R0.xyz, vertex[0].position;
ADD.F R1.xyz, -R0, vertex[2].position;
ADD.F R0.xyz, vertex[4].position, -R0;
MUL.F R2.xyz, R0.zxyw, R1.yzxw;
MAD.F R0.xyz, R0.yzxw, R1.zxyw, -R2;
DP3.F R0.x, R0, -vertex[0].position;
SGT.F R0.x, R0, {0, 0, 0, 0};
TRUNC.U.CC HC.x, R0;
IF NE.x;
MOV.F R0.xyz, vertex[1].position;
ADD.F R1.xyz, -R0, vertex[2].position;
ADD.F R0.xyz, vertex[0].position, -R0;
MUL.F R2.xyz, R0.zxyw, R1.yzxw;
MAD.F R0.xyz, R0.yzxw, R1.zxyw, -R2;
DP3.F R0.x, -vertex[0].position, R0;
SLT.F R0.x, R0, {0, 0, 0, 0};
TRUNC.U.CC HC.x, R0;
IF NE.x;
MOV.F result.position, vertex[0].position;
EMIT;
MOV.F result.position, vertex[2].position;
EMIT;
ENDPRIM;
ENDIF;
MOV.F R0.xyz, vertex[3].position;
ADD.F R1.xyz, -R0, vertex[4].position;
ADD.F R0.xyz, vertex[2].position, -R0;
MUL.F R2.xyz, R0.zxyw, R1.yzxw;
MAD.F R0.xyz, R0.yzxw, R1.zxyw, -R2;
DP3.F R0.x, -vertex[0].position, R0;
SLT.F R0.x, R0, {0, 0, 0, 0};
TRUNC.U.CC HC.x, R0;
IF NE.x;
MOV.F result.position, vertex[2].position;
EMIT;
MOV.F result.position, vertex[4].position;
EMIT;
ENDPRIM;
ENDIF;
MOV.F R0.xyz, vertex[5].position;
ADD.F R1.xyz, vertex[0].position, -R0;
ADD.F R0.xyz, vertex[4].position, -R0;
MUL.F R2.xyz, R0.zxyw, R1.yzxw;
MAD.F R0.xyz, R0.yzxw, R1.zxyw, -R2;
DP3.F R0.x, -vertex[0].position, R0;
SLT.F R0.x, R0, {0, 0, 0, 0};
TRUNC.U.CC HC.x, R0;
IF NE.x;
MOV.F result.position, vertex[4].position;
EMIT;
MOV.F result.position, vertex[0].position;
EMIT;
ENDPRIM;
ENDIF;
ENDIF;
END
# 55 instructions, 3 R-regs
----------------------------------------------------------------

All these low-level GL_NV_geometry_program4 geometry shaders are based on GL_NV_gpu_program4 assembly instruction set.
スポンサーサイト

11/15/06

Geometry Shaders At Work



I've just experimented with the new GL_EXT_geometry_shader4 extension using GeForce 8800 (G80) feature set emulation and GLSL compiler device support enabled by NVemulate.

o GPU: NVIDIA GeForce 6800 GT (NV40)
o Driver: NVIDIA ForceWare 96.89 for 32-bit Windows XP
o OpenGL Version: 2.1.0
o GLSL Version: 1.20 NVIDIA via Cg compiler

Here's the test geometry shader (output as low-level GL_NV_geometry_program4):
----------------------------------------------------------------
!!NVgp4.0
PRIMITIVE_IN TRIANGLES;
PRIMITIVE_OUT TRIANGLE_STRIP;
VERTICES_OUT 6;
# cgc version 1.6.0011, build date Oct 16 2006 23:39:35
# command line args:
#vendor NVIDIA Corporation
#version 1.6.0.11
#profile gp4gp
#program main
#var float4 gl_Position : $vout.POSITION : HPOS : -1 : 1
#var float4 gl_PositionIn[0] : $vin.VERTEX[0].POSITION : HPOS[0][32] : -1 : 1
#var float4 gl_PositionIn[1] : $vin.VERTEX[1].POSITION : HPOS[1][32] : -1 : 1
#var float4 gl_PositionIn[2] : $vin.VERTEX[2].POSITION : HPOS[2][32] : -1 : 1
TEMP R0, R1;
TEMP RC, HC;
MOV.F result.position, vertex[0].position;
EMIT;
MOV.F result.position, vertex[1].position;
EMIT;
MOV.F result.position, vertex[2].position;
EMIT;
ENDPRIM;
MOV.F R0, vertex[1].position;
ADD.F R0, vertex[0].position, R0;
ADD.F R0, R0, vertex[2].position;
MUL.F R0, R0, {0.33333334, 0, 0, 0}.x;
MAD.F R1, vertex[0].position, {2, 0, 0, 0}.x, -R0;
MOV.F result.position, R1;
EMIT;
MAD.F R1, vertex[1].position, {2, 0, 0, 0}.x, -R0;
MOV.F result.position, R1;
EMIT;
MAD.F R0, vertex[2].position, {2, 0, 0, 0}.x, -R0;
MOV.F result.position, R0;
EMIT;
ENDPRIM;
END
# 21 instructions, 2 R-regs
----------------------------------------------------------------

It's quite easy to use as usual. But anyway software emulation is damn slow, so I really need to get a GeForce 8800 video card for further experimentations like stencil shadow volumes extraction and thus IQ/PF comparison against the omnidirectional cubic shadow mapping that I've worked on so far (I am now much more interested in the CUDA technology rather than geometry shaders stuff, though).

11/09/06

Shader Model 4.0 Functionality w/o Windows Vista

OpenGL extension rumor (OpenGL.org Discussion & Help Forums)
http://www.opengl.org/discussion_boards/ubb/ultimatebb.php...

Cass Everitt (an NVIDIA guy) says:

[QUOTE]
Originally posted by Slang:
Are those extensions going to be implemented in ICDs for Windows XP?
[/QUOTE]

Of course!

Now, this is one of the reasons why I use OpenGL primarily; independent from a specific system architecture due to the driver-implementation model.
| Top Page |
上記広告は1ヶ月以上更新のないブログに表示されています。新しい記事を書くことで広告を消せます。