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