Index: gpu/command_buffer/service/texture_manager.cc |
diff --git a/gpu/command_buffer/service/texture_manager.cc b/gpu/command_buffer/service/texture_manager.cc |
index e4d109dbebf6d3215657a00d6823f88e05c90b4b..9b7dd0b1ec4815df2ef7c29be27dab835422b544 100644 |
--- a/gpu/command_buffer/service/texture_manager.cc |
+++ b/gpu/command_buffer/service/texture_manager.cc |
@@ -17,6 +17,7 @@ |
#include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
#include "gpu/command_buffer/service/mailbox_manager.h" |
#include "gpu/command_buffer/service/memory_tracking.h" |
+#include "ui/gl/gl_implementation.h" |
namespace gpu { |
namespace gles2 { |
@@ -1640,6 +1641,16 @@ void TextureManager::ValidateAndDoTexImage2D( |
texture_ref, args); |
} |
+GLenum TextureManager::AdjustTexFormat(GLenum format) const { |
+ if (gfx::GetGLImplementation() == gfx::kGLImplementationDesktopGL) { |
Ken Russell (switch to Gerrit)
2014/10/11 03:20:43
Is this going to have to change for the coming GLE
|
+ if (format == GL_SRGB_EXT) |
+ return GL_RGB; |
+ if (format == GL_SRGB_ALPHA_EXT) |
+ return GL_RGBA; |
+ } |
+ return format; |
+} |
+ |
void TextureManager::DoTexImage2D( |
DecoderTextureState* texture_state, |
ErrorState* error_state, |
@@ -1676,7 +1687,7 @@ void TextureManager::DoTexImage2D( |
{ |
ScopedTextureUploadTimer timer(texture_state); |
glTexSubImage2D(args.target, args.level, 0, 0, args.width, args.height, |
- args.format, args.type, args.pixels); |
+ AdjustTexFormat(args.format), args.type, args.pixels); |
} |
SetLevelCleared(texture_ref, args.target, args.level, true); |
texture_state->tex_image_2d_failed = false; |
@@ -1688,7 +1699,7 @@ void TextureManager::DoTexImage2D( |
ScopedTextureUploadTimer timer(texture_state); |
glTexImage2D( |
args.target, args.level, args.internal_format, args.width, args.height, |
- args.border, args.format, args.type, args.pixels); |
+ args.border, AdjustTexFormat(args.format), args.type, args.pixels); |
} |
GLenum error = ERRORSTATE_PEEK_GL_ERROR(error_state, "glTexImage2D"); |
if (error == GL_NO_ERROR) { |