vrend, blit: Use GL 4.4 logic for blitting

On GL 4.4 (and GLES with EXT_sRGB_write_control) blits will decode and
encode sRGB when GL_FRAMEBUFFER_SRGB is supported, and they don't decode
when it isn't supported. Enabling or disabling this is signalled from
the guest by using the according surfaces.

In summary, there is no need to use the GL fallback for a blit decoding
sRGB, because this can also be handled in a normal blit.

Fixes piglits on a GL host:
  blit texture srgb_to_linear downsample enabled render
  blit renderbuffer srgb_to_linear msaa enabled render
  blit renderbuffer srgb_to_linear msaa enabled clear
  blit renderbuffer srgb_to_linear downsample enabled clear

v2: Fix typo in commit message (Erik)

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
macos/master
Gert Wollny 6 years ago
parent 6f1adc2be8
commit 989738137c
  1. 7
      src/vrend_blitter.c
  2. 8
      src/vrend_renderer.c

@ -843,10 +843,13 @@ void vrend_renderer_blit_gl(struct vrend_resource *src_res,
vrend_fb_bind_texture(dst_res, 0, info->dst.level, layer); vrend_fb_bind_texture(dst_res, 0, info->dst.level, layer);
if (has_srgb_write_control) { if (has_srgb_write_control) {
if (util_format_is_srgb(info->dst.format)) if (util_format_is_srgb(info->dst.format) || util_format_is_srgb(info->src.format)) {
VREND_DEBUG(dbg_blit, ctx, "%s: Enable GL_FRAMEBUFFER_SRGB\n", __func__);
glEnable(GL_FRAMEBUFFER_SRGB); glEnable(GL_FRAMEBUFFER_SRGB);
else } else {
VREND_DEBUG(dbg_blit, ctx, "%s: Disable GL_FRAMEBUFFER_SRGB\n", __func__);
glDisable(GL_FRAMEBUFFER_SRGB); glDisable(GL_FRAMEBUFFER_SRGB);
}
} }
buffers = GL_COLOR_ATTACHMENT0; buffers = GL_COLOR_ATTACHMENT0;

@ -7563,11 +7563,6 @@ static void vrend_renderer_blit_int(struct vrend_context *ctx,
!vrend_format_is_ds(dst_res->base.format)) !vrend_format_is_ds(dst_res->base.format))
use_gl = true; use_gl = true;
if (util_format_is_srgb(info->src.format) &&
!util_format_is_srgb(info->dst.format)) {
VREND_DEBUG(dbg_blit, ctx, "BLIT: Use GL fallback because src is SRGB but dest not.");
use_gl = true;
}
/* different depth formats */ /* different depth formats */
if (vrend_format_is_ds(src_res->base.format) && if (vrend_format_is_ds(src_res->base.format) &&
vrend_format_is_ds(dst_res->base.format)) { vrend_format_is_ds(dst_res->base.format)) {
@ -7726,7 +7721,8 @@ static void vrend_renderer_blit_int(struct vrend_context *ctx,
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, ctx->sub->blit_fb_ids[1]); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, ctx->sub->blit_fb_ids[1]);
if (has_feature(feat_srgb_write_control)) { if (has_feature(feat_srgb_write_control)) {
if (util_format_is_srgb(info->dst.format)) if (util_format_is_srgb(info->dst.format) ||
util_format_is_srgb(info->src.format))
glEnable(GL_FRAMEBUFFER_SRGB); glEnable(GL_FRAMEBUFFER_SRGB);
else else
glDisable(GL_FRAMEBUFFER_SRGB); glDisable(GL_FRAMEBUFFER_SRGB);

Loading…
Cancel
Save