Ati X1950 shader version?

onesvenus

Newcomer
I'm having a little problem in an app I'm building.

I'm using OpenGL with GLSL and I want to use a sampler2D array. The problem is it doesn't link.
My friend google tells me that sampler2D array came on shader model 2. Looking at the specs of the Ati X1950 (the one that I'm using) lists it as Shader model 3.0 compatible.

So do you have any idea why when I'm making the following call glGetString(GL_SHADING_LANGUAGE_VERSION), 1.20 returned??

I've installed the latest catalysts.
Does this card not support shader model 2 under OpenGL??

Thanks for your help!!!
 
So do you have any idea why when I'm making the following call glGetString(GL_SHADING_LANGUAGE_VERSION), 1.20 returned??

I've installed the latest catalysts.
Does this card not support shader model 2 under OpenGL??
glsl shader are different to directx shader versions.
glsl 1.30 would be current.
One of the differences between glsl 1.2 and 1.3 would be the support of texture arrays.
I think though texture arrays needed DX10 (so shader model 4), pretty sure your card can't support this feature.
 
Thanks for your quick reply.
I'm reading the OpenGL Shading Language Second Edition book that it's based on the OpenGL 2.0 specification.

On the page 72 of that book the following example can be found.

const int numTextures = 4;
uniform sampler2D textures[numTextures];
uniform vec2 texCoord;

void main()
{
vec4 color = vec4(0.,0.,0.,1.);
for(int i=0; i<numTextures; i++)
{

vec4 colorTexture = texture2D(textures,texCoord);
color = color * colorTexture;

}

gl_FragColor = color;

}

The error the compiler is giving me now is the following "Compiler error: Sampler array indexes must be integral constant expressions". I can't undertand how this code works on OpenGL on all the Nvidias I have at work and not on this Ati.
 
const int numTextures = 4;
uniform sampler2D textures[numTextures];
uniform vec2 texCoord;

void main()
{
vec4 color = vec4(0.,0.,0.,1.);
for(int i=0; i<numTextures; i++)
{

vec4 colorTexture = texture2D(textures,texCoord);
color = color * colorTexture;

}

gl_FragColor = color;

}

Ah ok I think I misunderstood what you were trying to do.

The error the compiler is giving me now is the following "Compiler error: Sampler array indexes must be integral constant expressions". I can't undertand how this code works on OpenGL on all the Nvidias I have at work and not on this Ati.
Hmm, not sure if what you're doing is allowed. The 1.2 spec doesn't mention it, but 1.3 clears this up "...Samplers aggregated into arrays within a shader (using square brackets []) can only be indexed with integral constant expressions". Nvidia might allow this nonetheless because the compiler can evaluate the value at compile time anyway (neither nvidia's nor ati's pre-DX10 hardware could handle dynamic indexing there).
 
The error the compiler is giving me now is the following "Compiler error: Sampler array indexes must be integral constant expressions". I can't undertand how this code works on OpenGL on all the Nvidias I have at work and not on this Ati.
You are probably hitting a compiler limitation, the nV shader compiler probably fully unrolls the loop and ends up with constant expressions, the ATi compiler on the other hand may be bailing out before optimizations just because you are using a feature which isn't supported without trying to lower it to what your card supports.

Unrolling the loop by hand should work on both cards (though it doesn't,look pretty):

vec4 colorTexture;

colorTexture = texture2D(textures[0], texCoord);
color = color * colorTexture;
colorTexture = texture2D(textures[1], texCoord);
color = color * colorTexture;
colorTexture = texture2D(textures[2], texCoord);
color = color * colorTexture;
colorTexture = texture2D(textures[3], texCoord);
color = color * colorTexture;
 
(neither nvidia's nor ati's pre-DX10 hardware could handle dynamic indexing there).

I don't think any of the DX10 level hardware can do that either. There's texture arrays, but that's a single resource on a single sampler. I don't think there's any hardware that can index different units (although that would be very useful in many cases).
 
Back
Top