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

Unified Diff: gpu/command_buffer/client/gles2_implementation.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/client/gles2_implementation.cc
diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc
index 0da78bcf19e1b95aa67024383ddda891e37e9eb4..1d797d8519aa0bc49cf3e25ab4dda564d7856875 100644
--- a/gpu/command_buffer/client/gles2_implementation.cc
+++ b/gpu/command_buffer/client/gles2_implementation.cc
@@ -2103,6 +2103,25 @@ void GLES2Implementation::ReadPixels(
SetGLError(GL_INVALID_VALUE, "glReadPixels", "size too large.");
return;
}
+
+ if (bound_pixel_unpack_transfer_buffer_id_) {
greggman 2013/03/19 20:54:11 As pointed out else where, "unpack" is for providi
hubbe 2013/03/19 22:42:42 Done.
+ GLuint offset = ToGLuint(pixels);
+ BufferTracker::Buffer* buffer = GetBoundPixelUnpackTransferBufferIfValid(
+ "glReadPixels", offset, temp_size);
+ if (buffer) {
+ helper_->ReadPixels(xoffset, yoffset, width, height, format, type,
+ buffer->shm_id(), buffer->shm_offset(),
+ 0, 0);
+ buffer->set_transfer_ready_token(helper_->InsertToken());
+ }
+ return;
apatrick_chromium 2013/03/19 18:34:48 Should this not generate INVALID_OPERATION?
hubbe 2013/03/19 22:42:42 Done. (And in other similar places)
+ }
+
+ if (!pixels) {
+ SetGLError(GL_INVALID_VALUE, "glReadPixels", "pixels = NULL");
+ return;
+ }
+
// Transfer by rows.
// The max rows we can transfer.
while (height) {
@@ -3304,7 +3323,7 @@ void* GLES2Implementation::MapBufferCHROMIUM(GLuint target, GLenum access) {
GL_INVALID_ENUM, "glMapBufferCHROMIUM", "invalid target");
return NULL;
}
- if (access != GL_WRITE_ONLY) {
+ if (access != GL_WRITE_ONLY && access != GL_READ_ONLY) {
SetGLError(GL_INVALID_ENUM, "glMapBufferCHROMIUM", "bad access mode");
return NULL;
}
@@ -3318,6 +3337,10 @@ void* GLES2Implementation::MapBufferCHROMIUM(GLuint target, GLenum access) {
SetGLError(GL_INVALID_OPERATION, "glMapBufferCHROMIUM", "already mapped");
return NULL;
}
+ if (buffer->transfer_ready_token()) {
greggman 2013/03/19 20:54:11 It seems like if you're going to add this check yo
hubbe 2013/03/19 22:42:42 I can do it either way. I think I prefer implement
+ helper_->WaitForToken(buffer->transfer_ready_token());
+ buffer->set_transfer_ready_token(0);
+ }
buffer->set_mapped(true);
GPU_DCHECK(buffer->address());

Powered by Google App Engine
This is Rietveld 408576698