Does Nvidia support "for" loops yet?

I’m using ForceWare 62.11 and Shader Developer and the GSLDemo complain about not being able to use “for” loops. I also noticed this was an issue for current official ATI drivers.

Is there a Version of Forceware available that supports for loops?

Simple for loops are allowed (but it’s useless). You will have to wait for real SM3.0 support.
AFAIK, SM3.0 will be supported in further driver releases.
You can use all SM3.0 features in ARBVP/FP with NV_fragment_program2 and NV_vertex_program3 extensions.

yooyo

does this mean it is just a matter of waiting for driver releases or upgrading hardware.

I’m talking about my 5900XT

For fragment shaders on a 5900, you’ll only be able to write loops that the compiler can unroll at compile time.

In the vertex shader, current drivers already allow you to write loops where the loop count is based on a uniform value. You can see this in the glsl_skinning demo:

http://download.nvidia.com/developer/SDK/Individual_Samples/samples.html#glsl_skinning

Thanks, all the other OpenGL examples there look good too.

I suppose the lack of proper for loops means I can’t get a Mandelbrot shader working on my 5900XT

Originally posted by dingo_aus:
[b]Thanks, all the other OpenGL examples there look good too.

I suppose the lack of proper for loops means I can’t get a Mandelbrot shader working on my 5900XT[/b]
You have to manually unroll loop. If you using Shader Designer, load Mandelbrot project then in fragment shader comment for line and copy/paste nested block 20+ times.

Only 6800 will be able to run shaders with loops.
All other hw (incl. X800) doesn’t support loops in shader.

yooyo

Only 6800 will be able to run shaders with loops.
All other hw (incl. X800) doesn’t support loops in shader.

3DLabs Wildcat VP cards supports real loops/branches in the fragment shaders too (I figure out that the Realizm cards too)

Thanks for the help.

Got a basic black Mandelbrot working. Now i have to look closer to tweak those pretty colours :slight_smile:

Interesting… using the Nvidia FX Composer (DX HLSL tool) I looked at a Mandelbrot shader example there, and it had a “for” loop and it worked happily for me.

The number of “rolls” was hardcoded as a #define statement.

Does this mean eventually NVidia drivers will support a “for” loop when that loop can be unwound easily?

BTW just tested it with a variable define as
int MIXIMUM_ITERATIONS = 10; (ie not const or #define) and the shader compiles happily.

This appears like the limitation on for loops is not my lack of a NV40 (6800) (I have a 5900xt) but a lack of OpenGL 2.0 driver support (I mean DX9 can do it)

On GeForce FX GPUs, you should have no problem using for loops in the fragment shader, as long as they can be unrolled by the compiler.

Loops that depend on a uniform or varying value for the number of iterations cannot be unrolled by the compiler and require a GPU with support for branching and looping, such as the GeForce 6 Series GPUs.

Originally posted by Ffelagund:
[b] [quote]Only 6800 will be able to run shaders with loops.
All other hw (incl. X800) doesn’t support loops in shader.

3DLabs Wildcat VP cards supports real loops/branches in the fragment shaders too (I figure out that the Realizm cards too)[/b][/QUOTE]You’re exactly right. The Wildcat VP supports loops in the vertex and fragment shaders. In fact it supports full flow control. The Wildcat Realizm cards offers the same, and also expand the size of fragment shaders significantly. Up to 256K machine instructions per shader. Its up to you guys to write big enough shaders :slight_smile:

Barthold

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.