Skip to main content
gamedev.net
🔒 Locked

Cg Compiler Errors -FIXED

Started by AverageJoeSSU 2 replies 3.4k views
Original Post
AverageJoeSSU
AverageJoeSSU
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]
------------------------------ redwoodpixel.com
V-man
V-man
If this is a vertex shader, you need to set the value for mipmap selection for tex2D() and also the function would be tex2dlod
AverageJoeSSU
AverageJoeSSU
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.
------------------------------ redwoodpixel.com
AverageJoeSSU
AverageJoeSSU
WOW

leave it to the noob to use a reserved word... i thought the capital T would work... but NNOOOO..lol
------------------------------ redwoodpixel.com

Topic Locked

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

Sign in to reply to this topic.