Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1044)

Unified Diff: gpu/command_buffer/service/gles2_cmd_srgb_converter.cc

Issue 2420813002: optimize precision for conversion from srgb to linear (Closed)
Patch Set: rebase code Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gpu/command_buffer/service/feature_info.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/service/gles2_cmd_srgb_converter.cc
diff --git a/gpu/command_buffer/service/gles2_cmd_srgb_converter.cc b/gpu/command_buffer/service/gles2_cmd_srgb_converter.cc
index 8300d6190f3f9068868984d02274fd5b37f95b21..1f85360f6777f2a4d9382d30df4b21b239cc4b0b 100644
--- a/gpu/command_buffer/service/gles2_cmd_srgb_converter.cc
+++ b/gpu/command_buffer/service/gles2_cmd_srgb_converter.cc
@@ -360,10 +360,15 @@ void SRGBConverter::GenerateMipmap(const gles2::GLES2Decoder* decoder,
const GLint mipmap_levels =
TextureManager::ComputeMipMapCount(target, width, height, depth);
- // bind srgb_decoder_textures_[1] to draw framebuffer
glBindTexture(GL_TEXTURE_2D, srgb_converter_textures_[1]);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA,
- GL_UNSIGNED_BYTE, nullptr);
+ if (feature_info_->ext_color_buffer_float_available() &&
+ feature_info_->oes_texture_float_linear_available()) {
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, width, height, 0, GL_RGBA,
+ GL_UNSIGNED_BYTE, nullptr);
+ } else {
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_RGBA,
+ GL_UNSIGNED_BYTE, nullptr);
+ }
glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER, srgb_decoder_fbo_);
glFramebufferTexture2DEXT(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
GL_TEXTURE_2D, srgb_converter_textures_[1], 0);
@@ -387,7 +392,6 @@ void SRGBConverter::GenerateMipmap(const gles2::GLES2Decoder* decoder,
glDrawArrays(GL_TRIANGLES, 0, 6);
- // generateMipmap for srgb_decoder_textures_[1]
glBindTexture(GL_TEXTURE_2D, srgb_converter_textures_[1]);
glGenerateMipmapEXT(GL_TEXTURE_2D);
« no previous file with comments | « gpu/command_buffer/service/feature_info.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698