GLSL vs ASM performance

Hello, I would like to know whether the average performance of GLSL in the current drivers is optimized enough to compite with shaders written in pure ASM (vertex and fragment programs in ASM).

Doesn’t matter. The “assembly” shaders have so few features compared to what modern hardware is capable of that it’s irrelevant. Only nVidia provides updated assembly languages, and ATi doesn’t implement them; they’re following the ARB’s advice and going straight for glslang.

Hello, I would like to know whether the average performance of GLSL in the current drivers is optimized enough to compite with shaders written in pure ASM (vertex and fragment programs in ASM).
Features notwithstanding, the only way to know for sure is to test this yourself on your target hardware. But it’s a good bet that it is competitive, perhaps even better in some cases.

I didn’t know that there where some features hidden to the assembly language. So the general idea is that GLSL drivers are mature enough and GLSL can sucessfully replace assembly shaders.

Thanks gor your responses.

When comparing GLSL to ASM I was wondering if the GLSL compilers benefit from const values. Or will the shader be any faster if anything could be const, become const?

BTW: and I just noticed - why does the first one work, but the 2nd one not:
const vec4 texel0 = vec4(0.0);
const vec4 texel1 = texture2D(tex, UV);

thank you!

Originally posted by hbuel:

BTW: and I just noticed - why does the first one work, but the 2nd one not:
const vec4 texel0 = vec4(0.0);
const vec4 texel1 = texture2D(tex, UV);


Unlike C++ the GLSL only allows the const qualifier for compile time constants (which is the case in the first equation) and function parameters.

Or will the shader be any faster if anything could be const, become const?
Consider what Komat said, but also consider this.

A compile-time constant may not have to take up uniform space necessarily; it could be built directly into the program. If it’s a temporary (“stack” variable), then it also may not take up actual room.

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