Segfault on compile

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;

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;
	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);

Compiling … shader … segfault

Is there something obvious I missed??..

This is always driver bug.

You could try to simplify the shader to workaround this. Id try removing the ‘if’ and/or sampler parameter (ie, use global) first …

Yes, I had to remove the if/else to have it worked…
separate the one shader into 2 programs…

It will do for now, I guess, but it is not reassuring…

This shader works for me. Which driver do you use?

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