diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c index 89e4342..68ea039 100644 --- a/src/vrend_renderer.c +++ b/src/vrend_renderer.c @@ -1236,8 +1236,23 @@ static void vrend_hw_emit_framebuffer_state(struct vrend_context *ctx) }; glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, ctx->sub->fb_id); - if (ctx->sub->nr_cbufs == 0) + if (ctx->sub->nr_cbufs == 0) { glReadBuffer(GL_NONE); + glDisable(GL_FRAMEBUFFER_SRGB_EXT); + } else { + struct vrend_surface *surf = NULL; + int i; + for (i = 0; i < ctx->sub->nr_cbufs; i++) { + if (ctx->sub->surf[i]) { + surf = ctx->sub->surf[i]; + } + } + if (util_format_is_srgb(surf->format)) { + glEnable(GL_FRAMEBUFFER_SRGB_EXT); + } else { + glDisable(GL_FRAMEBUFFER_SRGB_EXT); + } + } glDrawBuffers(ctx->sub->nr_cbufs, buffers); }