2 Replies Latest reply on Dec 17, 2012 4:13 PM by nightz85

    FBO blending corruption

    swoop

      Ive been getting this problem on my AMD 5870 card for a couple of driver releases now (at least since 11.9), the recent 12.2 drivers dont seem to change much.

      I have an OpenGL FBO with an attached depth/stencil texture, and two color texture rectangle. I then attach and share the depth/stencil texture from the first FBO with another FBO, which itself has another four texture rectangles attached, this is for a deferred rendering setup.

      Once the scene is drawn and lighting is blended in on the second FBO, with the depth/stencil and a single color texture active, I forward render some blended quads (shaders off), when quads intersect with the existing world it produces a checker pattern not seen on my other non amd card. See attached image.

        • Re: FBO blending corruption
          gsellers

          Hi,

           

          We've recently reworked the way we handle depth and stencil validation for FBOs and it has resolved a number of reported issues. Is there any chance we can get access to your application? If so, we'll validate our fixes for your situation and if the problem is not resolved yet we'll dig deeper.

           

          Thanks,

           

          Graham

            • Re: FBO blending corruption
              nightz85

              Hi, i just registered cause i couldn't reach you on twitter. I have an example (binaries and source code) which illustrates that bug and i was wondering if it could be fixed, I am all in to help. Reach me back asap  , just to give some background:

               

              Depth stencil texture creation:

              glBindTexture(GL_TEXTURE_2D, m_bufferTextures[GBT_DEPTH]);
              glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
              glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
              glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
              glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
              glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_FALSE); 
              
              glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH32F_STENCIL8, width, height, 0, GL_DEPTH_STENCIL, GL_FLOAT_32_UNSIGNED_INT_24_8_REV, 0);
              

               

              Buffers creation:

                checkedGL(glGenRenderbuffers(1, &m_stencilRenderBuffer));
                checkedGL(glBindRenderbuffer(GL_RENDERBUFFER, m_stencilRenderBuffer));
                checkedGL(glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_STENCIL, m_bufferSize.x, m_bufferSize.y));
                checkedGL(glBindRenderbuffer(GL_RENDERBUFFER, 0));
              
                checkedGL(glGenFramebuffers(1, &m_multiBufferPtr));
                checkedGL(glBindFramebuffer(GL_FRAMEBUFFER, m_multiBufferPtr));
                checkedGL(glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_TEXTURE_2D, m_bufferTextures[GBT_DEPTH], 0));
                checkedGL(glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_bufferTextures[GBT_NORMAL], 0));
                checkedGL(glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT1, GL_TEXTURE_2D, m_bufferTextures[GBT_COLOR], 0));
                checkedGL(glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT2, GL_TEXTURE_2D, m_bufferTextures[GBT_AUX], 0));
                checkFBOCompleteness();
              
                 // Light Buffer
                checkedGL(glGenFramebuffers(1, &m_lightBufferPtr));
                checkedGL(glBindFramebuffer(GL_FRAMEBUFFER, m_lightBufferPtr));
                checkedGL(glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_TEXTURE_2D, m_bufferTextures[GBT_DEPTH], 0));
                checkedGL(glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_bufferTextures[GBT_LIGHT], 0));
                checkFBOCompleteness();
              
              
                // Color Buffer
                checkedGL(glGenFramebuffers(1, &m_colorBufferPtr));
                checkedGL(glBindFramebuffer(GL_FRAMEBUFFER, m_colorBufferPtr));
                checkedGL(glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_TEXTURE_2D, m_bufferTextures[GBT_DEPTH], 0));
                checkedGL(glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_bufferTextures[GBT_COLOR], 0));
                checkFBOCompleteness();
              
              

               

              Then we have one "depth-only" pass that writes to depth / stencil followed by a light pass that reads from the depth texture to calculate light (in a deferred shader). After that stencil is used again for drawing the skybox. I can provide binaries if code is insufficient.

               

              Message was edited by: Romulo Fernandes