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

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: pbo unit test added 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 1d366022bbbf05cdc616133fdaf42eacefb51552..2f02ee210cdadc8b31e0e86261a4d9e54280106d 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -6945,11 +6945,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");
@@ -7029,7 +7035,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);

Powered by Google App Engine
This is Rietveld 408576698