PDA

View Full Version : GLSL vs ASM performance



Sansus
11-27-2006, 09:09 AM
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).

Korval
11-27-2006, 09:55 AM
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.

Brolingstanz
11-27-2006, 11:37 AM
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.

Sansus
11-27-2006, 12:50 PM
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.

hbuel
12-12-2006, 02:13 AM
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!

Komat
12-12-2006, 03:15 AM
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.

Korval
12-12-2006, 10:47 AM
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.