2 Replies Latest reply on Feb 1, 2013 7:40 AM by Robert_U

    HD4000 OpenGL Shading Language Texture bug?

    cdyk

      Dear Support Team,

       

      Our OpenGL-based library fails to run correctly on Intel HD 4000. After a lot of debugging, I've managed to isolate a problem that concerns building a custom mip-map-pyramid using shaders.

       

      I've created a small reproduction case for this problem (source code is available at https://github.com/hetcomp/hpmc/blob/iss9/tests/simplemipmapbuildup.cpp ):

       

      First, I create a mipmap'ed texture 2D and create an FBO for each level.

       

      Then, I populate the base level with a GPGPU pass, and then use the following shader to reduce the pyramid:

       

      uniform sampler2D  tex;
      uniform vec2       delta; // = vec2( -0.5/w, 0.5/w ), w is width of prev level
      void
      main(){
          vec4 sums = vec4(
              texture2D( tex, gl_TexCoord[0].xy+delta.xx )+
              texture2D( tex, gl_TexCoord[0].xy+delta.yx )+
              texture2D( tex, gl_TexCoord[0].xy+delta.xy )+
              texture2D( tex, gl_TexCoord[0].xy+delta.yy ) );
          gl_FragColor = sums;
      }
      
      

       

      using

       

      for(GLsizei k=1; k<=size_l2; k++ ) {
          glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, k-1 );
          glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, k-1 );
      
      

       

      to steer which texture level that should be sampled from.

       

      The correct result is

       

      Level 0
      [0,0,1,1] [0,0,1,1] [0,0,1,1] [0,0,1,1] [0,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [0,0,1,1] [0,0,1,1] [0,0,1,1] [0,0,1,1] [0,0,1,1]
      [0,0,1,1] [0,0,1,1] [0,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [0,0,1,1] [0,0,1,1] [0,0,1,1]
      [0,0,1,1] [0,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [0,0,1,1] [0,0,1,1]
      [0,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [0,0,1,1]
      [0,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [0,0,1,1]
      [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1]
      [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1]
      [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1]
      [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1]
      [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1]
      [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1]
      [0,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [0,0,1,1]
      [0,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [0,0,1,1]
      [0,0,1,1] [0,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [0,0,1,1] [0,0,1,1]
      [0,0,1,1] [0,0,1,1] [0,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [0,0,1,1] [0,0,1,1] [0,0,1,1]
      [0,0,1,1] [0,0,1,1] [0,0,1,1] [0,0,1,1] [0,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [0,0,1,1] [0,0,1,1] [0,0,1,1] [0,0,1,1] [0,0,1,1]
      Level 1
      [0,0,4,4] [1,0,4,4] [3,0,4,4] [4,0,4,4] [4,0,4,4] [3,0,4,4] [1,0,4,4] [0,0,4,4]
      [1,0,4,4] [4,0,4,4] [4,0,4,4] [4,0,4,4] [4,0,4,4] [4,0,4,4] [4,0,4,4] [1,0,4,4]
      [3,0,4,4] [4,0,4,4] [4,0,4,4] [4,0,4,4] [4,0,4,4] [4,0,4,4] [4,0,4,4] [3,0,4,4]
      [4,0,4,4] [4,0,4,4] [4,0,4,4] [4,0,4,4] [4,0,4,4] [4,0,4,4] [4,0,4,4] [4,0,4,4]
      [4,0,4,4] [4,0,4,4] [4,0,4,4] [4,0,4,4] [4,0,4,4] [4,0,4,4] [4,0,4,4] [4,0,4,4]
      [3,0,4,4] [4,0,4,4] [4,0,4,4] [4,0,4,4] [4,0,4,4] [4,0,4,4] [4,0,4,4] [3,0,4,4]
      [1,0,4,4] [4,0,4,4] [4,0,4,4] [4,0,4,4] [4,0,4,4] [4,0,4,4] [4,0,4,4] [1,0,4,4]
      [0,0,4,4] [1,0,4,4] [3,0,4,4] [4,0,4,4] [4,0,4,4] [3,0,4,4] [1,0,4,4] [0,0,4,4]
      Level 2
      [6,0,16,16] [15,0,16,16] [15,0,16,16] [6,0,16,16]
      [15,0,16,16] [16,0,16,16] [16,0,16,16] [15,0,16,16]
      [15,0,16,16] [16,0,16,16] [16,0,16,16] [15,0,16,16]
      [6,0,16,16] [15,0,16,16] [15,0,16,16] [6,0,16,16]
      Level 3
      [52,0,64,64] [52,0,64,64]
      [52,0,64,64] [52,0,64,64]
      Level 4
      [208,0,256,256]
      
      

       

      However, when running the code on an HD 4000, I get the following:

       

      Level 0
      [0,0,1,1] [0,0,1,1] [0,0,1,1] [0,0,1,1] [0,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [0,0,1,1] [0,0,1,1] [0,0,1,1] [0,0,1,1] [0,0,1,1]
      [0,0,1,1] [0,0,1,1] [0,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [0,0,1,1] [0,0,1,1] [0,0,1,1]
      [0,0,1,1] [0,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [0,0,1,1] [0,0,1,1]
      [0,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [0,0,1,1]
      [0,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [0,0,1,1]
      [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1]
      [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1]
      [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1]
      [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1]
      [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1]
      [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1]
      [0,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [0,0,1,1]
      [0,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [0,0,1,1]
      [0,0,1,1] [0,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [0,0,1,1] [0,0,1,1]
      [0,0,1,1] [0,0,1,1] [0,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [0,0,1,1] [0,0,1,1] [0,0,1,1]
      [0,0,1,1] [0,0,1,1] [0,0,1,1] [0,0,1,1] [0,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [1,0,1,1] [0,0,1,1] [0,0,1,1] [0,0,1,1] [0,0,1,1] [0,0,1,1]
      Level 1
      [0,0,4,4] [1,0,4,4] [3,0,4,4] [4,0,4,4] [4,0,4,4] [3,0,4,4] [1,0,4,4] [0,0,4,4]
      [1,0,4,4] [4,0,4,4] [4,0,4,4] [4,0,4,4] [4,0,4,4] [4,0,4,4] [4,0,4,4] [1,0,4,4]
      [3,0,4,4] [4,0,4,4] [4,0,4,4] [4,0,4,4] [4,0,4,4] [4,0,4,4] [4,0,4,4] [3,0,4,4]
      [4,0,4,4] [4,0,4,4] [4,0,4,4] [4,0,4,4] [4,0,4,4] [4,0,4,4] [4,0,4,4] [4,0,4,4]
      [4,0,4,4] [4,0,4,4] [4,0,4,4] [4,0,4,4] [4,0,4,4] [4,0,4,4] [4,0,4,4] [4,0,4,4]
      [3,0,4,4] [4,0,4,4] [4,0,4,4] [4,0,4,4] [4,0,4,4] [4,0,4,4] [4,0,4,4] [3,0,4,4]
      [1,0,4,4] [4,0,4,4] [4,0,4,4] [4,0,4,4] [4,0,4,4] [4,0,4,4] [4,0,4,4] [1,0,4,4]
      [0,0,4,4] [1,0,4,4] [3,0,4,4] [4,0,4,4] [4,0,4,4] [3,0,4,4] [1,0,4,4] [0,0,4,4]
      Level 2
      [6,0,16,16] [15,0,16,16] [15,0,16,16] [6,0,16,16]
      [15,0,16,16] [16,0,16,16] [16,0,16,16] [15,0,16,16]
      [15,0,16,16] [16,0,16,16] [16,0,16,16] [15,0,16,16]
      [6,0,16,16] [15,0,16,16] [15,0,16,16] [6,0,16,16]
      Level 3
      [16,0,16,16] [13,0,16,16]
      [13,0,16,16] [10,0,16,16]
      Level 4
      [16,0,16,16]
      
      

       

      where level 3 and 4 is wrong.

       

      I tried to repopulate the base level with a fixed value after the first reduction, to see if level 0 was sampled somehow after the first reduction, but this was not the case.

       

      Using texelFetch seems to work though.

       

      Version of driver etc, is:

      hd4000-settings.png

       

      Thanks,

      cdyk

        • 1. Re: HD4000 OpenGL Shading Language Texture bug?

          Hello,

           

          We truly appreciate your feedback. Our software support and engineering group is working on future generations of this software that may implement better features. Your feedback for sure is important and will be forwarded to higher levels of support.

           

          Thank you one more time for your interest in our products and how to improve their range of features.

           

          Looking forward to assisting you further.

           

          Regards,

          Michael

          • 2. Re: HD4000 OpenGL Shading Language Texture bug?
            Robert_U

            @cdyk Great work at narrowing down the issue with OGL. Your analysis was very helpful with debugging the issue. A fix will be available in a future release if the Intel HD Graphics driver. I will post an update when the driver is available.