switch case statement in cg shaders not working, possible?

A place for Ogre users to discuss non-Ogre subjects with friends from the community.
Post Reply
User avatar
toglia
Gnome
Posts: 336
Joined: Sat Dec 08, 2007 4:28 am
Location: Canada
x 7

switch case statement in cg shaders not working, possible?

Post by toglia »

Quick question:
In the nvidia's cg tutorial http://http.developer.nvidia.com/CgTuto ... dix_d.html it lists the switch and case statement like reserved words, but I tried using it this way:

Code: Select all

	int x = 1;
	switch(x){
		case 0:
			colorIn0 = tex2D(texture0,uv0);
		break;
		case 1:
			colorIn0 = tex2D(texture1,uv0);
		break;
		case 2:
			colorIn0 = tex2D(texture2,uv0);
		break;
	}
And I'm getting:

Code: Select all

(17) : error C0000: syntax error, unexpected reserved word "switch" at token "switch"
(17) : error C0501: type name expected at token "switch"
(17) : error C1033: cast not allowed
(17) : error C0000: syntax error, unexpected '{', expecting ';' or ',' at token "{"
(17) : error C0501: type name expected at token "{"
(19) : error C1038: declaration of "colorIn0" conflicts with previous declaration at (13)
(19) : error C1038: declaration of "colorIn0" conflicts with previous declaration at (13)
(21) : error C0000: syntax error, unexpected reserved word "case" at token "case"
(21) : error C0501: type name expected at token "case"
(22) : error C1038: declaration of "colorIn0" conflicts with previous declaration at (13)
(22) : error C1038: declaration of "colorIn0" conflicts with previous declaration at (13)
(24) : error C0000: syntax error, unexpected reserved word "case" at token "case"
Any ideas?
User avatar
tuan kuranes
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 2653
Joined: Wed Sep 24, 2003 8:07 am
Location: Haute Garonne, France
x 4
Contact:

Re: switch case statement in cg shaders not working, possible?

Post by tuan kuranes »

It's not supported in CG.
Might be in future version, that's why it's "reserver"
Post Reply