4 Replies Latest reply on Aug 1, 2012 8:05 AM by jbizcocho

    OpenGL texture3D sample3D problem

    jbizcocho

      Hello guys,

      Right now i'm preparing a shader that contains glow, bloom and FXAA on a single pass. The problem is that i'm using one sample3D for a texture lookup in the glow part. and I don't know why, when I try to validate the shader it appears the error:

      "Validation Error!, Different sampler types for same sample texture unit in fragment shader". here is a summary of the problematic part of the code:

       

      #version 130 
      #extension GL_EXT_gpu_shader4 : enable 
      
      precision mediump float; 
      
      uniform vec2            vInvViewport; 
      uniform float            fGlowMultiplier; 
      uniform int                iDebug;
      uniform sampler3D sourceLUT; 
      uniform sampler2D sourceTex; 
      uniform sampler2D sourceBloom; 
      uniform sampler2D sourceBlurData; 
      
      
      void main() 
      { 
          vec3 vColor; 
          if( iDebug == 0 ) 
          { 
              vColor = FxaaPixelShader( gl_TexCoord[0].xy, sourceTex, vInvViewport ); 
          } 
          else 
          { 
              vColor = texture2D( sourceTex, gl_TexCoord[0].xy ).rgb; 
          }
      
      
      
          vec3 vBloom = texture2D( sourceBloom, gl_TexCoord[0].xy ).rgb; 
          vColor += fGlowMultiplier * vBloom;
      
      
          vec4  vBlak = texture3D( sourceLUT, vColor.xyz ).xyzw;
          float  fBlik    = texture2D( sourceBlurData, gl_TexCoord[0].xy ).x; 
      
          gl_FragColor = vec4( vBlak.xyz, fBlik ); 
      }
      
      

       

      If I comment the line 33, it works perfectly. So I dont know If I'm not using the function / variables in the proper way, or maybe its a driver confilct.

       

      Does anyone have dealed with this issue before? .

       

      My configuration is: Ubuntu 12.04, latest catalyst and ATI HD6870. I'm forcing the app to use OpenGL 2.1 with extensions when its possible to apply ^_^.

       

       

      Thanks in advance people! .

        • Re: OpenGL texture3D sample3D problem
          gsellers

          Hi,

           

          Without seeing the application-side code that's driving the shader, my first guess would be that at the time that you validate the program, you have not set the sampler uniforms and thus they all refer to texture unit 0. Now you have a sampler3D and a sampler2D uniform referring to the same texture unit, which isn't really supported. When you comment line 33, the sourceLUT uniform is no longer referenced by the program and is optimized away, eliminating the issue.

           

          Try setting the uniforms to different values using glUniform1i(location, unit) before calling glValidateProgram.

           

          Thanks,

           

          Graham