GLSL: ATI vs NVIDIA
Today two new differences between Radeon and Geforce GLSL support.
1 – float2 / vec2
vec2 is the GLSL type to hold a 2d vector. vec2 is supported by NVIDIA and ATI. float2 is a 2d vector but for Direct3D HLSL and for Cg. The GLSL compilation for Geforce is done via the NVIDIA Cg compiler. Here is the GLSL version displayed by GPU Caps Viewer: 1.20 NVIDIA via Cg compiler. That explains why a GLSL source that contains a float2 is compilable on NVIDIA hardware. But the GLSL compiler of ATI is strict and doesn’t recognize the float2 type.
2 – the following line:
vec2 vec = texture2D( tex, gl_TexCoord.st );
is valid for NVIDIA compiler but produces an error with ATI compiler. One again, the ATI GLSL compiler has done a good job. By default, texture2D() returns a 4d vector. The right syntax is:
vec2 vec = texture2D( tex, gl_TexCoord.st ).xy;
Conclusion: always test your shaders on both ATI and NVIDIA platforms unless you target one platform only.