PDA

View Full Version : arb_vertex_program extension.



christiancoder
10-02-2006, 10:59 AM
I am playing around with CgFX on various video card generations trying to get a sense for what I can do when certain extensions are supported. My thinking was that if arb_vertex_program is supported I should be able to write vertex programs and use fixed function state for the fragment. I was testing this on a ATI 9250 (ibook) and with a simple vertex program that passes the normal through as vertex color everything worked great, i then tried a slightly more complex program that performed three transforms and a dot3. The dot3 caused the technique with the program to fail validation, does anybody know why this would be the case? Is there a way to get an explanation why the technique failed to vaildate?

Komat
10-02-2006, 02:09 PM
Can you post the source code of the failing shader?

christiancoder
10-03-2006, 11:34 AM
Sure, I don't have it with me (I am at work) but it was basically the following:


float4 TestVtxProg( uniform float4x4 mvp,
uniform float4x4 mv,
uniform float4x4 mvit,
float4 inpos : POSITION,
float4 innorm : NORMAL,
out float4 outclr : COLOR0 ) : POSITION
{
float4 outpos = mul( mvp, inpos );
float3 light = normalize( mul( mv, inpos ).xyz );
float3 norm = normalize( mul( mvit, innorm ).xyz );
float clr = max( -dot( light, norm ), 0.0 );
outclr = float4( clr, clr, clr, 1.0 );
return outpos;
}

technique Test
{
pass Pass0
{
DepthTestEnable = true;
DepthMask = true;
DepthFunc = Less;
CullFaceEnable = true;
CullFace = Front;
VertexProgram = compile arbvp1 TestVtxProg( mvp, mv, mvit );
}
}

christiancoder
10-03-2006, 11:36 AM
Just place this technique at the top of runtime_cgfx/simple.cgfx in the cg examples dir to test it.

Komat
10-03-2006, 03:56 PM
On my computer (PC with nvidia card) the program works as expected and even the compiled output looks nonproblematic when compiled by the 1.5 Cg compiler. If I remember correctly, older versions of the Cg compiler offten generated code that relied on arbvp GL state tracking feature combined with with constructs that are ussualy not present within the arbvp code generated by human. As far as I know, some older ati drivers had problem with that combination.

You can try to use the standalone cgc compiler to generate assember corresponding to the program. When you upload that assember directly trough the arb_vertex_program extension, you can query error string that might indicate, what the driver does not like.

christiancoder
10-04-2006, 09:40 AM
I will give that a try.