diff options
author | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-08 20:49:31 +0000 |
---|---|---|
committer | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-08 20:49:31 +0000 |
commit | 612d2f8ad02a0e9f7de2fe7073022b4b212f2b5d (patch) | |
tree | f280136c44d614c3198a8953c44a3dbb4a7a1c94 /gpu | |
parent | c8f489795d6b149aafb6f9c8e97e21c0904ec3d4 (diff) | |
download | chromium_src-612d2f8ad02a0e9f7de2fe7073022b4b212f2b5d.zip chromium_src-612d2f8ad02a0e9f7de2fe7073022b4b212f2b5d.tar.gz chromium_src-612d2f8ad02a0e9f7de2fe7073022b4b212f2b5d.tar.bz2 |
TEST=none
BUG=none
Add glReadPixel service implemenation.
the GLES2 client side implemenation needs to wait
for me to implement buckets. For now though, a
client app can use the GLES2CmdHelper, allocate
shared memory and call ReadPixels.
Review URL: http://codereview.chromium.org/468024
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34081 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rw-r--r-- | gpu/command_buffer/client/gles2_implementation.h | 6 | ||||
-rw-r--r-- | gpu/command_buffer/service/gles2_cmd_decoder.cc | 17 |
2 files changed, 22 insertions, 1 deletions
diff --git a/gpu/command_buffer/client/gles2_implementation.h b/gpu/command_buffer/client/gles2_implementation.h index fec3de9..bfd0d32 100644 --- a/gpu/command_buffer/client/gles2_implementation.h +++ b/gpu/command_buffer/client/gles2_implementation.h @@ -28,6 +28,12 @@ class GLES2Implementation { void* transfer_buffer, int32 transfer_buffer_id); + // The GLES2CmdHelper being used by this GLES2Implementation. You can use + // this to issue cmds at a lower level for certain kinds of optimization. + GLES2CmdHelper* helper() const { + return helper_; + } + // Include the auto-generated part of this class. We split this because // it means we can easily edit the non-auto generated parts right here in // this file instead of having to edit some template or the code generator. diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc index d6f2aba..b6a1414 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc @@ -921,7 +921,22 @@ parse_error::ParseError GLES2DecoderImpl::HandleVertexAttribPointer( parse_error::ParseError GLES2DecoderImpl::HandleReadPixels( uint32 immediate_data_size, const gles2::ReadPixels& c) { - // TODO(gman): Implement. + GLint x = c.x; + GLint y = c.y; + GLsizei width = c.width; + GLsizei height = c.height; + GLenum format = c.format; + GLenum type = c.type; + uint32 pixels_size = GLES2Util::ComputeImageDataSize( + width, height, format, type, pack_alignment_); + void* pixels = GetSharedMemoryAs<void*>( + c.pixels_shm_id, c.pixels_shm_offset, pixels_size); + parse_error::ParseError result = ValidateReadPixels( + this, immediate_data_size, x, y, width, height, format, type, pixels); + if (result != parse_error::kParseNoError) { + return result; + } + glReadPixels(x, y, width, height, format, type, pixels); return parse_error::kParseNoError; } |