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

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

Issue 2158283002: deal with invalid readpixel format and type (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address zhenyao's comment Created 4 years, 5 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 | « no previous file | 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_decoder.cc
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index 670782ecb6243bb97252cfe4918b8eb3cc585274..348495b62b85a5984d28e644b033cc90da4134f7 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -5918,7 +5918,13 @@ bool GLES2DecoderImpl::GetHelper(
ScopedGLErrorSuppressor suppressor("GLES2DecoderImpl::GetHelper",
GetErrorState());
glGetIntegerv(pname, params);
- if (glGetError() != GL_NO_ERROR) {
+ bool is_valid = glGetError() == GL_NO_ERROR;
+ if (is_valid) {
+ is_valid = pname == GL_IMPLEMENTATION_COLOR_READ_FORMAT ?
+ validators_->read_pixel_format.IsValid(*params) :
+ validators_->read_pixel_type.IsValid(*params);
+ }
+ if (!is_valid) {
if (pname == GL_IMPLEMENTATION_COLOR_READ_FORMAT) {
*params = GLES2Util::GetGLReadPixelsImplementationFormat(
GetBoundReadFrameBufferInternalFormat(),
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698