Mesa (master): st/mesa: fix sRGB BlitFramebuffer regression

Marek Olšák mareko at kemper.freedesktop.org
Thu Aug 25 11:21:43 UTC 2016


Module: Mesa
Branch: master
Commit: b662c70aeab6a92751514f30719c13a6de253b40
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=b662c70aeab6a92751514f30719c13a6de253b40

Author: Nicolai Hähnle <nicolai.haehnle at amd.com>
Date:   Thu Aug 11 13:06:47 2016 +0200

st/mesa: fix sRGB BlitFramebuffer regression

Broken since: 3190c7ee9727161d627f107c2e7f8ec3a11941c1

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

Tested-by: Edmondo Tommasina <edmondo.tommasina at gmail.com>
Signed-off-by: Marek Olšák <marek.olsak at amd.com>

---

 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
@@ -45,15 +45,6 @@
 #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,
@@ -199,7 +190,11 @@ st_BlitFramebuffer(struct gl_context *ctx,
                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;
@@ -212,7 +207,8 @@ st_BlitFramebuffer(struct gl_context *ctx,
                   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 */
@@ -226,9 +222,13 @@ st_BlitFramebuffer(struct gl_context *ctx,
          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;
 
@@ -237,7 +237,11 @@ st_BlitFramebuffer(struct gl_context *ctx,
                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;
@@ -250,8 +254,6 @@ st_BlitFramebuffer(struct gl_context *ctx,
                   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 */
                }




More information about the mesa-commit mailing list