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

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

Issue 1308313008: Fix ReadPixels implementation specific read format/type on desktop GL. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@clear
Patch Set: Created 5 years, 4 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 03f87167a04d297bb1826612e44f9736efba132d..fc94af76b9a81d95613893620f4d58226daa1020 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -5066,8 +5066,10 @@ bool GLES2DecoderImpl::GetHelper(
if (glGetError() == GL_NO_ERROR)
return true;
}
- *params = GLES2Util::GetPreferredGLReadPixelsFormat(
- GetBoundReadFrameBufferInternalFormat());
+ GLES2Util::TargetESVersion target_es_version =
+ feature_info_->IsES3Enabled() ? GLES2Util::kES3 : GLES2Util::kES2;
+ *params = GLES2Util::GetGLReadPixelsImplementationFormat(
+ GetBoundReadFrameBufferInternalFormat(), target_es_version);
}
return true;
case GL_IMPLEMENTATION_COLOR_READ_TYPE:
@@ -5080,9 +5082,12 @@ bool GLES2DecoderImpl::GetHelper(
if (glGetError() == GL_NO_ERROR)
return true;
}
- *params = GLES2Util::GetPreferredGLReadPixelsType(
+ GLES2Util::TargetESVersion target_es_version =
+ feature_info_->IsES3Enabled() ? GLES2Util::kES3 : GLES2Util::kES2;
+ *params = GLES2Util::GetGLReadPixelsImplementationType(
GetBoundReadFrameBufferInternalFormat(),
- GetBoundReadFrameBufferTextureType());
+ GetBoundReadFrameBufferTextureType(),
+ target_es_version);
}
return true;
case GL_MAX_FRAGMENT_UNIFORM_VECTORS:
@@ -8752,9 +8757,6 @@ error::Error GLES2DecoderImpl::HandleReadPixels(uint32 immediate_data_size,
std::vector<GLenum> accepted_formats;
std::vector<GLenum> accepted_types;
switch (src_internal_format) {
- case GL_RGB10_A2UI:
- accepted_formats.push_back(GL_RGBA);
- accepted_types.push_back(GL_UNSIGNED_INT_2_10_10_10_REV);
case GL_R8UI:
case GL_R16UI:
case GL_R32UI:
@@ -8763,6 +8765,7 @@ error::Error GLES2DecoderImpl::HandleReadPixels(uint32 immediate_data_size,
case GL_RG32UI:
// All the RGB_INTEGER formats are not renderable.
case GL_RGBA8UI:
+ case GL_RGB10_A2UI:
case GL_RGBA16UI:
case GL_RGBA32UI:
accepted_formats.push_back(GL_RGBA_INTEGER);
@@ -8780,6 +8783,13 @@ error::Error GLES2DecoderImpl::HandleReadPixels(uint32 immediate_data_size,
accepted_formats.push_back(GL_RGBA_INTEGER);
accepted_types.push_back(GL_INT);
break;
+ case GL_RGB10_A2:
+ accepted_formats.push_back(GL_RGBA);
+ accepted_types.push_back(GL_UNSIGNED_BYTE);
+ // Special case with an extra supported format/type.
+ accepted_formats.push_back(GL_RGBA);
+ accepted_types.push_back(GL_UNSIGNED_INT_2_10_10_10_REV);
+ break;
default:
accepted_formats.push_back(GL_RGBA);
{
@@ -8789,7 +8799,11 @@ error::Error GLES2DecoderImpl::HandleReadPixels(uint32 immediate_data_size,
case GL_HALF_FLOAT_OES:
case GL_FLOAT:
case GL_UNSIGNED_INT_10F_11F_11F_REV:
- accepted_types.push_back(GL_FLOAT);
+ if (!feature_info_->IsES3Enabled()) {
+ accepted_types.push_back(GL_UNSIGNED_BYTE);
+ } else {
+ accepted_types.push_back(GL_FLOAT);
+ }
Ken Russell (switch to Gerrit) 2015/08/27 01:45:45 I'm having difficulty understanding how the earlie
Zhenyao Mo 2015/08/27 03:13:31 It turned out we never tested RGBA/UNSIGNED_BYTE r
break;
default:
accepted_types.push_back(GL_UNSIGNED_BYTE);

Powered by Google App Engine
This is Rietveld 408576698