Jump to content
  • Advertisement
Sign in to follow this  
AverageJoeSSU

Cg Compiler Errors -FIXED

This topic is 3902 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I made a recent post about deferred shading with Cg... well... here is my Fragment Program

struct fs_mrt
{   
   float4 color0 : COLOR0;
   float4 color1 : COLOR1;
   float4 color2 : COLOR2;
};

void GbufferF( float4 oPosition : POSITION,
			   float2 oTexCoord : TEXCOORD0,
			   float3 oNormal : TEXCOORD1,
               float3 Sem : TEXCOORD3,
		
		uniform sampler2D Texture, 
		uniform sampler2D NormalMap,
		uniform float4x4 ModelViewProj
		
		)
	{
		fs_mrt OUT;

		OUT.color0 = float4( (oPosition).xyz, Sem.x );

		float4 normal = tex2D(NormalMap, oTexCoord);
		OUT.color1 = float4( (normal).xyz , Sem.y);

		float4 diffuse = tex2D( Texture , oTexCoord);	//line 26	
		OUT.color2 = float4( (diffuse).xyz , Sem.z);    //line 27

		return OUT
	}



and i am getting compiler errors that dont make sense.(at least to me and i am fairly new at writing Cg Shaders) Deferred_Shading: creating fragment program from file: CG ERROR : The compile re turned an error. ..\Shaders\GbufferF.cg(26) : error C0000: syntax error, unexpected ',', expectin g '(' at token "," ..\Shaders\GbufferF.cg(26) : error C0501: type name expected at token "," ..\Shaders\GbufferF.cg(27) : error C1068: too much data in type constructor ..\Shaders\GbufferF.cg(27) : error C0000: syntax error, unexpected ';', expectin g ')' at token ";" ..\Shaders\GbufferF.cg(27) : error C0501: type name expected at token ";" [Edited by - AverageJoeSSU on January 13, 2008 7:35:15 PM]

Share this post


Link to post
Share on other sites
Advertisement
If this is a vertex shader, you need to set the value for mipmap selection for tex2D() and also the function would be tex2dlod

Share this post


Link to post
Share on other sites
Nah... its a pixel shader.

The thing that confuses me the most is the first error about the comma, every example i have seen uses that format and it works fine...

.\Shaders\GbufferF.cg(26) : error C0000: syntax error, unexpected ',', expectin
g '(' at token ","

which leads me to believe i'm not seeing something right.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!