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

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

Issue 638143003: Enabled EXT_sRGB WebGL extension support in the command buffer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added suggested comment Created 6 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/texture_manager.h ('k') | ui/gl/gl_bindings.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..45aaa658e6809b67cf65373f3aab16ee271388a0 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,18 @@ void TextureManager::ValidateAndDoTexImage2D(
texture_ref, args);
}
+GLenum TextureManager::AdjustTexFormat(GLenum format) const {
+ // TODO: GLES 3 allows for internal format and format to differ. This logic
+ // may need to change as a result.
+ if (gfx::GetGLImplementation() == gfx::kGLImplementationDesktopGL) {
+ 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 +1689,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 +1701,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) {
« no previous file with comments | « gpu/command_buffer/service/texture_manager.h ('k') | ui/gl/gl_bindings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698