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

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

Issue 1881883002: SRGB_EXT is a valid format of texture in WebGL1.0 and ES2.0 contexts (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Correct texture format parameter Created 4 years, 8 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
Index: gpu/command_buffer/service/gles2_cmd_decoder.cc
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index c9e8470b6cca2e031b61a22bbd12e737b48a5c55..de035ddd4b176b9d64e693f639b939d37a75dd89 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -11442,6 +11442,24 @@ error::Error GLES2DecoderImpl::HandleTexImage2D(uint32_t immediate_data_size,
// service side.
params.alignment = state_.unpack_alignment;
}
+
+ // When the client is providing ES 2.0 or WebGL 1.0 contexts, but the
+ // command buffer is running on top of desktop GL or ES 3.0, it would
+ // have to translate these unsized internal formats to the appropriate
+ // sized internal formats.
+ if ((internal_format == GL_SRGB_EXT ||
+ internal_format == GL_SRGB_ALPHA_EXT) &&
+ (feature_info_->context_type() == CONTEXT_TYPE_WEBGL2 ||
+ feature_info_->context_type() == CONTEXT_TYPE_OPENGLES3)) {
Zhenyao Mo 2016/04/27 17:12:26 I just realized we have a different place for such
xinghua.cao 2016/04/28 09:59:27 I have put this mapping in gl_gl_api_implementatio
+ if (internal_format == GL_SRGB_EXT) {
+ internal_format = GL_SRGB8;
+ format = GL_RGB;
+ } else if (internal_format == GL_SRGB_ALPHA_EXT) {
+ internal_format = GL_SRGB8_ALPHA8;
+ format = GL_RGBA;
+ }
+ }
+
uint32_t pixels_size;
uint32_t skip_size;
uint32_t padding;
@@ -12008,6 +12026,21 @@ error::Error GLES2DecoderImpl::HandleTexSubImage2D(uint32_t immediate_data_size,
// service side.
params.alignment = state_.unpack_alignment;
}
+
+ // When the client is providing ES 2.0 or WebGL 1.0 contexts, but the
+ // command buffer is running on top of desktop GL or ES 3.0, it would
+ // have to translate these unsized internal formats to the appropriate
+ // sized internal formats.
+ if ((format == GL_SRGB_EXT || format == GL_SRGB_ALPHA_EXT) &&
Zhenyao Mo 2016/04/27 17:12:26 Same here. Let's do the mapping in ui/gl/gl_gl_api
+ (feature_info_->context_type() == CONTEXT_TYPE_WEBGL2 ||
+ feature_info_->context_type() == CONTEXT_TYPE_OPENGLES3)) {
+ if (format == GL_SRGB_EXT) {
+ format = GL_RGB;
+ } else if (format == GL_SRGB_ALPHA_EXT) {
+ format = GL_RGBA;
+ }
+ }
+
uint32_t pixels_size;
uint32_t skip_size;
uint32_t padding;

Powered by Google App Engine
This is Rietveld 408576698