ARB shading, varying parameters

Using glsl, I can declare varying parameters to pass between vertex and fragment programs. Is there any way to do something similar using ARB assembly? Using glsl, I can get up to 40 varying parameters, but I only have 8 texcoords available in ARB assembly.

Using glsl, I can get up to 40 varying parameters, but I only have 8 texcoords available in ARB assembly.

That’s 40 varying floats, not parameters. Which means you have the equivalent of 10 varying vec4s. That’s basically the 8 texture coordinates and 2 colors.

Fair enough. So in glsl, I have something like this:

varying vec4 connect[10];

To get the same effect in ARB, should I just pack my connections into the 8 texture coords and 2 colors? Is this the “proper” way to do things?

Well, it would work. But be advised: the two colors may have reduced precision. And the values may be clamped to the [0,1] range. You should test it first to see if this happens.

OK, I will give it a try. But these shaders are supposed to run on a wide range of video cards. Is there a more reliable way?

But these shaders are supposed to run on a wide range of video cards.

Your GLSL example isn’t guaranteed to run on a wide range of video cards either. Any hardware that can’t provide 40 varying floats won’t work.

> Your GLSL example isn’t guaranteed to run on a wide range of video cards either

Hopefully the GLSL code would just fail to compile, and I can fall back to a different technique. Is there any way to query whether result.color.secondary is a full float[4], or just a 32 bit rgba? Otherwise, I will just have to hope that it provides the full range, and have it silently fail with incorrect results on certain video cards.

Thanks for all your help by the way.

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