1

How to use geometry shaders with CgFX? Actually how to specify geometry shader within the 'technique'?

The listing is below, vertex and fragment shaders are compiled well. But 'NVIDIA FX Composer 2.5' fires an 'error C3001 no program defined' after I added 'GeometryProgram' to the 'technique'.

float4x4 WorldITXf : WorldInverseTranspose;
float4x4 WorldViewProjXf : WorldViewProjection;
float4x4 WorldXf : World;

struct appdata
{
    float4 Position : POSITION;
    float4 Color    : COLOR0;
};

struct vertexOutput
{
    float4 Position : POSITION;
    float4 Color : COLOR0;
};


TRIANGLE void gshader1(AttribArray<float4> pos : POSITION,
                      AttribArray<float4> col : COLOR0)
{
//    some code will be here;
}


vertexOutput vshader1(appdata IN)
{
    vertexOutput OUT;
    float4 Po = float4(IN.Position.xyz,1.0f);
    OUT.Position = mul(WorldViewProjXf, Po);

    OUT.Color = IN.Color;

    return OUT;
}

float4 fshader1(vertexOutput IN) : COLOR
{
    return  IN.Color;
}

technique Tec1 {
    pass p0 {
        GeometryProgram = compile glslg gshader1();
        VertexProgram = compile glslv vshader1();
        FragmentProgram = compile glslf fshader1();
    }
}
ChatCloud
  • 1,152
  • 2
  • 8
  • 22

1 Answers1

1

Solved. Something is wrong with 'glslg' profile, changing it to 'gp4gp' fixes the issue.

ChatCloud
  • 1,152
  • 2
  • 8
  • 22