OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // A class to emulate GLES2 over command buffers. | 5 // A class to emulate GLES2 over command buffers. |
6 | 6 |
7 #include "gpu/command_buffer/client/gles2_implementation.h" | 7 #include "gpu/command_buffer/client/gles2_implementation.h" |
8 | 8 |
9 #include <GLES2/gl2.h> | 9 #include <GLES2/gl2.h> |
10 #include <GLES2/gl2ext.h> | 10 #include <GLES2/gl2ext.h> |
(...skipping 3523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3534 uint32 unpadded_row_size; | 3534 uint32 unpadded_row_size; |
3535 uint32 padded_row_size; | 3535 uint32 padded_row_size; |
3536 if (!GLES2Util::ComputeImageDataSizes( | 3536 if (!GLES2Util::ComputeImageDataSizes( |
3537 width, 2, 1, format, type, pack_alignment_, &temp_size, | 3537 width, 2, 1, format, type, pack_alignment_, &temp_size, |
3538 &unpadded_row_size, &padded_row_size)) { | 3538 &unpadded_row_size, &padded_row_size)) { |
3539 SetGLError(GL_INVALID_VALUE, "glReadPixels", "size too large."); | 3539 SetGLError(GL_INVALID_VALUE, "glReadPixels", "size too large."); |
3540 return; | 3540 return; |
3541 } | 3541 } |
3542 | 3542 |
3543 if (bound_pixel_pack_buffer_) { | 3543 if (bound_pixel_pack_buffer_) { |
3544 // TODO(zmo): Need to handle the case of reading into a PIXEL_PACK_BUFFER | 3544 GLuint offset = ToGLuint(pixels); |
3545 // in ES3. For now, generate a GL error. | 3545 helper_->ReadPixels( |
3546 SetGLError(GL_INVALID_OPERATION, "glReadPixels", | 3546 xoffset, yoffset, width, height, format, type, 0, offset, 0, 0, false); |
3547 "ReadPixels to a pixel pack buffer isn't implemented"); | 3547 CheckGLError(); |
3548 return; | 3548 return; |
3549 } | 3549 } |
3550 | 3550 |
3551 if (bound_pixel_pack_transfer_buffer_id_) { | 3551 if (bound_pixel_pack_transfer_buffer_id_) { |
3552 GLuint offset = ToGLuint(pixels); | 3552 GLuint offset = ToGLuint(pixels); |
3553 BufferTracker::Buffer* buffer = GetBoundPixelUnpackTransferBufferIfValid( | 3553 BufferTracker::Buffer* buffer = GetBoundPixelUnpackTransferBufferIfValid( |
3554 bound_pixel_pack_transfer_buffer_id_, | 3554 bound_pixel_pack_transfer_buffer_id_, |
3555 "glReadPixels", offset, padded_row_size * height); | 3555 "glReadPixels", offset, padded_row_size * height); |
3556 if (buffer && buffer->shm_id() != -1) { | 3556 if (buffer && buffer->shm_id() != -1) { |
3557 helper_->ReadPixels(xoffset, yoffset, width, height, format, type, | 3557 helper_->ReadPixels(xoffset, yoffset, width, height, format, type, |
(...skipping 2981 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6539 CheckGLError(); | 6539 CheckGLError(); |
6540 } | 6540 } |
6541 | 6541 |
6542 // Include the auto-generated part of this file. We split this because it means | 6542 // Include the auto-generated part of this file. We split this because it means |
6543 // we can easily edit the non-auto generated parts right here in this file | 6543 // we can easily edit the non-auto generated parts right here in this file |
6544 // instead of having to edit some template or the code generator. | 6544 // instead of having to edit some template or the code generator. |
6545 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" | 6545 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" |
6546 | 6546 |
6547 } // namespace gles2 | 6547 } // namespace gles2 |
6548 } // namespace gpu | 6548 } // namespace gpu |
OLD | NEW |