Skip to main content
GameDev.net gamedev.net
🔒 Locked

CG Technique doesnt validate on linux

Started by Nanook Dec 12, 2012 at 3:59 PM 0 replies 1.9k views
Original Post
Nanook
Nanook
I have a really simple cgfx file.. On windows it works fine with both OpenGL and DirectX, but on linux it doesn't validate.

cgGetErrorString says: "Invalid technique handle."

If I run the cgfx file through cgc specifying fp40 and vp40 which is the profiles of the basic_textured_ogl_40 technique I get 0 errors..

This is the code that loads the technique..


m_cgEffect = cgCreateEffect(cgContext, data, NULL);
m_cgTechnique = cgGetFirstTechnique(m_cgEffect);
while (m_cgEffect && cgValidateTechnique(m_cgTechnique) == CG_FALSE)
{
std::cout << "Technique " << cgGetTechniqueName(m_cgTechnique) << " did not validate" << std::endl;
m_cgTechnique = cgGetNextTechnique(m_cgTechnique);
}
if (!m_cgTechnique)
{
std::clog << "Your GPU does not support any of the techniques available" << std::endl;
exit(1);
}


The cgfx file:


void mainVS(float4 position : ATTR0,
float3 normal : ATTR2,
float2 texCoord : ATTR8,
out float4 oPosition : POSITION,
out float2 oTexCoord : TEXCOORD0,
uniform float4x4 viewProjection,
uniform float4x4 world)
{
oPosition = mul(world, position);
oPosition = mul(viewProjection, oPosition);
oTexCoord = texCoord;
}
void mainFS(float2 texCoord : TEXCOORD0,
out float4 color : COLOR,
uniform sampler2D texSampler0)
{
color = tex2D(texSampler0, texCoord);
}

float4x4 world : World;
float4x4 viewProjection : ViewProjection;

sampler2D texSampler0 = sampler_state {
generateMipMap = true;
MinFilter = LinearMipMapLinear;
MagFilter = Linear;
WrapS = Repeat;
WrapT = Repeat;
};
technique basic_textured_dx_40
{
pass
{
FragmentProgram = compile ps_4_0 mainFS(texSampler0);
VertexProgram = compile vs_4_0 mainVS(viewProjection, world);
DepthTestEnable = true;
DepthMask = true;
}
}
technique basic_textured_ogl_40
{
pass
{
FragmentProgram = compile fp40 mainFS(texSampler0);
VertexProgram = compile vp40 mainVS(viewProjection, world);
DepthTestEnable = true;
DepthMask = true;
}
}
Nanook
Nanook
Found out I had to add in another technique as I got an ATI card on this linux computer and apparently cg doesnt support the other profiles on ATI cards?


technique basic_textured_ogl_arb1
{
pass
{
FragmentProgram = compile arbfp1 mainFS(texSampler0);
VertexProgram = compile arbvp1 mainVS(viewProjection, world);
DepthTestEnable = true;
DepthMask = true;
//CullFaceEnable = false;
//BlendEnable = false;
//DepthFunc = LEqual;
}
}

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.