Compiling this fragment shader is giving me a segfault on the ATI card I have (hd3400 mobility)…
I have a lot of troubles figuring out what’s going.
I know that ATI is stricter than NVidia on syntax, but still…
Is there something obvious I missed??..
// Fragment shader
// the texture data
uniform sampler2D dataTexture;
// the color map texture
uniform sampler1D colorLut;
// texture pixel size...
uniform vec2 pixelSize;
// nearest or bi-linear?
uniform int switch_interp;
//prototype
vec4 texture2D_bilinear (sampler2D, vec2, vec2, sampler1D);
//
void main(void)
{
// position dans la data texture
vec2 uv = gl_TexCoord[0].xy;
// look up in the data texture
vec4 lkup;
vec4 couleur;
if (switch_interp == 0){
lkup = texture2D_bilinear(dataTexture, uv, pixelSize, colorLut);
couleur = lkup;
}
else
{
float intensity;
intensity = texture2D(dataTexture, uv).a;
couleur = texture1D(colorLut, intensity);
}
gl_FragColor = couleur;
}
vec4 texture2D_bilinear(sampler2D texture, vec2 uv, vec2 pixel, sampler1D lut)
{
/* vec2 texel = uv/pixel;
vec2 f = fract(uv/pixel);
vec4 toto = texture2D(texture, uv);
vec4 tl = texture1D(lut, toto.a);
toto = texture2D(texture, uv+vec2(1,0)*pixel);
vec4 tr = texture1D(lut, toto.a);
toto = texture2D(texture, uv+vec2(0,1)*pixel);
vec4 bl = texture1D(lut, toto.a);
toto = texture2D(texture, uv+vec2(1,1)*pixel);
vec4 br = texture1D(lut, toto.a);
vec4 sum1 = mix(tl,tr,f.x);
vec4 sum2 = mix(bl,br,f.x);
*/
//return mix(sum1, sum2, f.y);
return vec4(1.0, 0.0, 0.0, 1.0);
}