Skip to content

Commit

Permalink
Use high precision texture format during srgb conversion emulation fo…
Browse files Browse the repository at this point in the history
…r blitFramebuffer

BUG=634525
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel

Review-Url: https://codereview.chromium.org/2419153003
Cr-Commit-Position: refs/heads/master@{#425968}
  • Loading branch information
Richard-Yunchao authored and Commit bot committed Oct 18, 2016
1 parent bb3db4f commit b3ef484
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions gpu/command_buffer/service/gles2_cmd_srgb_converter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,10 @@ void SRGBConverter::Blit(
// If we need to blit from linear to srgb or vice versa, some steps will be
// skipped.
DCHECK(srgb_converter_initialized_);
// Use RGBA32F as the temp texture's internalformat to prevent precision
// loss during srgb conversion. But it is not color-renderable and
// texture-filterable in ES context.
DCHECK(!feature_info_->gl_version_info().is_es);

// Set the states
glActiveTexture(GL_TEXTURE0);
Expand Down Expand Up @@ -239,7 +243,7 @@ void SRGBConverter::Blit(
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);

glBindTexture(GL_TEXTURE_2D, srgb_converter_textures_[1]);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA,
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F,
c.width(), c.height(),
0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
glBindFramebufferEXT(GL_FRAMEBUFFER, srgb_decoder_fbo_);
Expand Down Expand Up @@ -272,7 +276,7 @@ void SRGBConverter::Blit(
height_draw = dstY1 > dstY0 ? dstY1 - dstY0 : dstY0 - dstY1;
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
glTexImage2D(
GL_TEXTURE_2D, 0, decode ? GL_RGBA : src_framebuffer_internal_format,
GL_TEXTURE_2D, 0, decode ? GL_RGBA32F : src_framebuffer_internal_format,
width_draw, height_draw, 0,
decode ? GL_RGBA : src_framebuffer_format,
decode ? GL_UNSIGNED_BYTE : src_framebuffer_type,
Expand Down

0 comments on commit b3ef484

Please sign in to comment.