Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: segfault on compile...

  1. #1
    Junior Member Newbie
    Join Date
    Sep 2009
    Location
    France, Norway
    Posts
    23

    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??...

    Code :
    // 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);
    }

  2. #2
    Member Regular Contributor
    Join Date
    Apr 2009
    Posts
    258

    Re: segfault on compile...

    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 ...

  3. #3
    Junior Member Newbie
    Join Date
    Sep 2009
    Location
    France, Norway
    Posts
    23

    Re: segfault on compile...

    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...

  4. #4
    Intern Contributor
    Join Date
    Feb 2010
    Location
    China
    Posts
    69

    Re: segfault on compile...

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •