Soft emulator necessary in the driver for GLSL?

From what I understand, the driver has to kick into sw emulation when the program exceeds the hw limits. Is this correct?

I guess it won’t (or is it optional) for the driver to do a multipass.

Another thing.
If I have

vec3 val;
vec4 val2;
result=dot(val, val2);

The compiler complains about dot because one is vec3 and the other vec4. Can’t it do dot3 here?

Originally posted by V-man:
From what I understand, the driver has to kick into sw emulation when the program exceeds the hw limits. Is this correct?

No, if you exceed the maximum number of instructions, the compiler will tell you that. So you’ll have to split your shaders by yourself. But if you use some function that isn’t available through HW, then a (final) glSlang-implementation has to support a SW-Emulation for that (see noise in FS on ATI for example).

Another thing.
If I have

vec3 val;
vec4 val2;
result=dot(val, val2);

The compiler complains about dot because one is vec3 and the other vec4. Can’t it do dot3 here?

result = dot(val, vec3(val))
or
result = dot(vec4(val), vec3)

[This message has been edited by PanzerSchreck (edited 01-31-2004).]

No, if you exceed the maximum number of instructions, the compiler will tell you that. So you’ll have to split your shaders by yourself. But if you use some function that isn’t available through HW, then a (final) glSlang-implementation has to support a SW-Emulation for that (see noise in FS on ATI for example).

That’s actually an odd part of the spec.

Let’s say that the problem with a noise function is that it would take 250 opcodes to pull off. So, ATi could easily claim that they “support” the noise function, but it just so happens to throw every shader over the resource limits. By the spec, this behavior is OK. Just as if your shader was near the resource limits, and then you add an instruction that transates to more hardware ops than are avaliable.

To be honest, I’d prefer it this way. Better to get a “shader compile failed error” than have to actually test the shader on the hardware to know if it’s going to kill your performance.

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