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

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

Issue 12892005: Implement client side PBOs for glReadPixel (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: make GLHelper constructor explicit Created 7 years, 9 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 ec5b2abd19fde36ab46ebf8054cd5a048e70db81..545c4c77b74c6fc6e19753fcc603805a7fccbb17 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -6947,11 +6947,17 @@ error::Error GLES2DecoderImpl::HandleReadPixels(
}
void* pixels = GetSharedMemoryAs<void*>(
c.pixels_shm_id, c.pixels_shm_offset, pixels_size);
- Result* result = GetSharedMemoryAs<Result*>(
- c.result_shm_id, c.result_shm_offset, sizeof(*result));
- if (!pixels || !result) {
+ if (!pixels) {
return error::kOutOfBounds;
}
+ Result* result = NULL;
+ if (c.result_shm_id != 0) {
+ result = GetSharedMemoryAs<Result*>(
+ c.result_shm_id, c.result_shm_offset, sizeof(*result));
+ if (!result) {
+ return error::kOutOfBounds;
+ }
+ }
if (!validators_->read_pixel_format.IsValid(format)) {
LOCAL_SET_GL_ERROR_INVALID_ENUM("glReadPixels", format, "format");
@@ -7031,7 +7037,9 @@ error::Error GLES2DecoderImpl::HandleReadPixels(
}
GLenum error = LOCAL_PEEK_GL_ERROR("glReadPixels");
if (error == GL_NO_ERROR) {
- *result = true;
+ if (result != NULL) {
+ *result = true;
+ }
GLenum read_format = GetBoundReadFrameBufferInternalFormat();
uint32 channels_exist = GLES2Util::GetChannelsForFormat(read_format);
« no previous file with comments | « gpu/command_buffer/client/gles2_implementation_unittest.cc ('k') | gpu/command_buffer/tests/gl_readback_unittests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698