Jump to content

  • Log In with Google      Sign In   
  • Create Account


CG Technique doesnt validate on linux


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 Nanook   Members   -  Reputation: 476

Like
0Likes
Like

Posted 12 December 2012 - 09:59 AM

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;
	}
}


Sponsor:

#2 Nanook   Members   -  Reputation: 476

Like
0Likes
Like

Posted 12 December 2012 - 10:52 AM

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;
	    }
}





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS