On 08/17/2016 03:55 AM, Nicolai Hähnle wrote:
From: Nicolai Hähnle <nicolai.haeh...@amd.com>

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97285

Hi Nicolai,

The commit message seems a bit sparse. It would be nice if one didn't have to wade through the bug report to know what's being done.

-Brian

---
  src/mesa/state_tracker/st_cb_blit.c | 34 ++++++++++++++++++----------------
  1 file changed, 18 insertions(+), 16 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_blit.c 
b/src/mesa/state_tracker/st_cb_blit.c
index cfcf3f7..8aa849b 100644
--- a/src/mesa/state_tracker/st_cb_blit.c
+++ b/src/mesa/state_tracker/st_cb_blit.c
@@ -38,29 +38,20 @@
  #include "st_texture.h"
  #include "st_cb_bitmap.h"
  #include "st_cb_blit.h"
  #include "st_cb_fbo.h"
  #include "st_manager.h"
  #include "st_scissor.h"

  #include "util/u_format.h"

  static void
-st_adjust_blit_for_srgb(struct pipe_blit_info *blit, bool framebuffer_srgb)
-{
-   if (!framebuffer_srgb) {
-      blit->dst.format = util_format_linear(blit->dst.format);
-      blit->src.format = util_format_linear(blit->src.format);
-   }
-}
-
-static void
  st_BlitFramebuffer(struct gl_context *ctx,
                     struct gl_framebuffer *readFB,
                     struct gl_framebuffer *drawFB,
                     GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
                     GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
                     GLbitfield mask, GLenum filter)
  {
     const GLbitfield depthStencil = (GL_DEPTH_BUFFER_BIT |
                                      GL_STENCIL_BUFFER_BIT);
     struct st_context *st = st_context(ctx);
@@ -192,73 +183,84 @@ st_BlitFramebuffer(struct gl_context *ctx,

           if (!srcObj || !srcObj->pt) {
              return;
           }

           for (i = 0; i < drawFB->_NumColorDrawBuffers; i++) {
              struct st_renderbuffer *dstRb =
                 st_renderbuffer(drawFB->_ColorDrawBuffers[i]);

              if (dstRb) {
-               struct pipe_surface *dstSurf = dstRb->surface;
+               struct pipe_surface *dstSurf;
+
+               st_update_renderbuffer_surface(st, dstRb);
+
+               dstSurf = dstRb->surface;

                 if (dstSurf) {
                    blit.dst.resource = dstSurf->texture;
                    blit.dst.level = dstSurf->u.tex.level;
                    blit.dst.box.z = dstSurf->u.tex.first_layer;
                    blit.dst.format = dstSurf->format;

                    blit.src.resource = srcObj->pt;
                    blit.src.level = srcAtt->TextureLevel;
                    blit.src.box.z = srcAtt->Zoffset + srcAtt->CubeMapFace;
                    blit.src.format = srcObj->pt->format;

-                  st_adjust_blit_for_srgb(&blit, ctx->Color.sRGBEnabled);
+                  if (!ctx->Color.sRGBEnabled)
+                     blit.src.format = util_format_linear(blit.src.format);

                    st->pipe->blit(st->pipe, &blit);
                    dstRb->defined = true; /* front buffer tracking */
                 }
              }
           }
        }
        else {
           struct st_renderbuffer *srcRb =
              st_renderbuffer(readFB->_ColorReadBuffer);
           struct pipe_surface *srcSurf;
           GLuint i;

-         if (!srcRb || !srcRb->surface) {
+         if (!srcRb)
+            return;
+
+         st_update_renderbuffer_surface(st, srcRb);
+
+         if (!srcRb->surface)
              return;
-         }

           srcSurf = srcRb->surface;

           for (i = 0; i < drawFB->_NumColorDrawBuffers; i++) {
              struct st_renderbuffer *dstRb =
                 st_renderbuffer(drawFB->_ColorDrawBuffers[i]);

              if (dstRb) {
-               struct pipe_surface *dstSurf = dstRb->surface;
+               struct pipe_surface *dstSurf;
+
+               st_update_renderbuffer_surface(st, dstRb);
+
+               dstSurf = dstRb->surface;

                 if (dstSurf) {
                    blit.dst.resource = dstSurf->texture;
                    blit.dst.level = dstSurf->u.tex.level;
                    blit.dst.box.z = dstSurf->u.tex.first_layer;
                    blit.dst.format = dstSurf->format;

                    blit.src.resource = srcSurf->texture;
                    blit.src.level = srcSurf->u.tex.level;
                    blit.src.box.z = srcSurf->u.tex.first_layer;
                    blit.src.format = srcSurf->format;

-                  st_adjust_blit_for_srgb(&blit, ctx->Color.sRGBEnabled);
-
                    st->pipe->blit(st->pipe, &blit);
                    dstRb->defined = true; /* front buffer tracking */
                 }
              }
           }
        }
     }

     if (mask & depthStencil) {
        /* depth and/or stencil blit */


_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to