diff --git a/src/vrend_blitter.c b/src/vrend_blitter.c index f2bc556..44c4eab 100644 --- a/src/vrend_blitter.c +++ b/src/vrend_blitter.c @@ -700,7 +700,8 @@ void vrend_renderer_blit_gl(UNUSED struct vrend_context *ctx, struct vrend_resource *src_res, struct vrend_resource *dst_res, const struct pipe_blit_info *info, - bool has_texture_srgb_decode) + bool has_texture_srgb_decode, + bool has_srgb_write_control) { struct vrend_blitter_ctx *blit_ctx = &vrend_blit_ctx; GLuint buffers; @@ -842,6 +843,13 @@ void vrend_renderer_blit_gl(UNUSED struct vrend_context *ctx, glBindFramebuffer(GL_FRAMEBUFFER, blit_ctx->fb_id); vrend_fb_bind_texture(dst_res, 0, info->dst.level, layer); + if (has_srgb_write_control) { + if (util_format_is_srgb(info->dst.format)) + glEnable(GL_FRAMEBUFFER_SRGB); + else + glDisable(GL_FRAMEBUFFER_SRGB); + } + buffers = GL_COLOR_ATTACHMENT0; glDrawBuffers(1, &buffers); blitter_set_texcoords(blit_ctx, src_res, info->src.level, diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c index 5bd3b99..47de241 100644 --- a/src/vrend_renderer.c +++ b/src/vrend_renderer.c @@ -7346,7 +7346,8 @@ static void vrend_renderer_blit_int(struct vrend_context *ctx, if (use_gl) { VREND_DEBUG(dbg_blit, ctx, "BLIT_INT: use GL fallback\n"); vrend_renderer_blit_gl(ctx, src_res, dst_res, info, - has_feature(feat_texture_srgb_decode)); + has_feature(feat_texture_srgb_decode), + has_feature(feat_srgb_write_control)); vrend_clicbs->make_current(ctx->sub->gl_context); return; } diff --git a/src/vrend_renderer.h b/src/vrend_renderer.h index fdb02fb..8579006 100644 --- a/src/vrend_renderer.h +++ b/src/vrend_renderer.h @@ -405,7 +405,8 @@ void vrend_renderer_blit_gl(struct vrend_context *ctx, struct vrend_resource *src_res, struct vrend_resource *dst_res, const struct pipe_blit_info *info, - bool has_texture_srgb_decode); + bool has_texture_srgb_decode, + bool has_srgb_write_control); void vrend_blitter_fini(void); void vrend_renderer_reset(void);