Loops in Cg?

Can I perform loop e.g for loops inside Cg? my GPU is a pre-war intel GMA 3100, SM2.0 lol

What do you mean by "Cg" ?

well, as the tag says, Cg = C for Graphics :), Cg in Shaderlab

1 Answer

1

I believe that, while the Cg for loop syntax is identical to that in C, Cg only supports for loops that can be fully unrolled at compile-time.

Well, how does that go? I mean a little example?

for(i = 0; i<5; i++) is ok, because the number of loop iterations is entirely deterministic and known at compile-time. Therefore it is possible to unroll - rewrite this code omitting the for loop by just duplicating that block of code five times. for(i = 0; i

Thanks, I'll try looping some code ;)

Thanks, it looped. But I can't seem to swizzle inside the loops :/ how about that?