[Mesa-dev] [PATCH] st/mesa: call update_renderbuffer_surface for sRGB renderbuffers, too

Christoph Bumiller e0425955 at student.tuwien.ac.at
Fri Jul 20 12:04:48 PDT 2012


sRGBEnabled should affect both textures and renderbuffers, so we need
to check/update the pipe_surface format for both.

Fixes, for instance, rendering appearing too bright in wine applications
using sRGB multisample renderbuffers.
---
 src/mesa/state_tracker/st_atom_framebuffer.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/mesa/state_tracker/st_atom_framebuffer.c b/src/mesa/state_tracker/st_atom_framebuffer.c
index a8907c1..1886292 100644
--- a/src/mesa/state_tracker/st_atom_framebuffer.c
+++ b/src/mesa/state_tracker/st_atom_framebuffer.c
@@ -52,7 +52,7 @@ update_renderbuffer_surface(struct st_context *st,
                             struct st_renderbuffer *strb)
 {
    struct pipe_context *pipe = st->pipe;
-   struct pipe_resource *resource = strb->rtt->pt;
+   struct pipe_resource *resource = strb->rtt ? strb->rtt->pt : strb->texture;
    int rtt_width = strb->Base.Width;
    int rtt_height = strb->Base.Height;
    enum pipe_format format = st->ctx->Color.sRGBEnabled ? resource->format : util_format_linear(resource->format);
@@ -117,7 +117,8 @@ update_framebuffer_state( struct st_context *st )
 
       if (strb) {
          /*printf("--------- framebuffer surface rtt %p\n", strb->rtt);*/
-         if (strb->rtt) {
+         if (strb->rtt ||
+             (strb->texture && util_format_is_srgb(strb->texture->format))) {
             /* rendering to a GL texture, may have to update surface */
             update_renderbuffer_surface(st, strb);
          }
-- 
1.7.3.4



More information about the mesa-dev mailing list