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 3461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3472 uint32 temp_size; | 3472 uint32 temp_size; |
3473 uint32 unpadded_row_size; | 3473 uint32 unpadded_row_size; |
3474 uint32 padded_row_size; | 3474 uint32 padded_row_size; |
3475 if (!GLES2Util::ComputeImageDataSizes( | 3475 if (!GLES2Util::ComputeImageDataSizes( |
3476 width, 2, 1, format, type, pack_alignment_, &temp_size, | 3476 width, 2, 1, format, type, pack_alignment_, &temp_size, |
3477 &unpadded_row_size, &padded_row_size)) { | 3477 &unpadded_row_size, &padded_row_size)) { |
3478 SetGLError(GL_INVALID_VALUE, "glReadPixels", "size too large."); | 3478 SetGLError(GL_INVALID_VALUE, "glReadPixels", "size too large."); |
3479 return; | 3479 return; |
3480 } | 3480 } |
3481 | 3481 |
| 3482 if (bound_pixel_pack_buffer_) { |
| 3483 GLuint offset = ToGLuint(pixels); |
| 3484 helper_->ReadPixels( |
| 3485 xoffset, yoffset, width, height, format, type, 0, offset, 0, 0, false); |
| 3486 CheckGLError(); |
| 3487 return; |
| 3488 } |
| 3489 |
3482 if (bound_pixel_pack_transfer_buffer_id_) { | 3490 if (bound_pixel_pack_transfer_buffer_id_) { |
3483 GLuint offset = ToGLuint(pixels); | 3491 GLuint offset = ToGLuint(pixels); |
3484 BufferTracker::Buffer* buffer = GetBoundPixelUnpackTransferBufferIfValid( | 3492 BufferTracker::Buffer* buffer = GetBoundPixelUnpackTransferBufferIfValid( |
3485 bound_pixel_pack_transfer_buffer_id_, | 3493 bound_pixel_pack_transfer_buffer_id_, |
3486 "glReadPixels", offset, padded_row_size * height); | 3494 "glReadPixels", offset, padded_row_size * height); |
3487 if (buffer && buffer->shm_id() != -1) { | 3495 if (buffer && buffer->shm_id() != -1) { |
3488 helper_->ReadPixels(xoffset, yoffset, width, height, format, type, | 3496 helper_->ReadPixels(xoffset, yoffset, width, height, format, type, |
3489 buffer->shm_id(), buffer->shm_offset(), | 3497 buffer->shm_id(), buffer->shm_offset(), |
3490 0, 0, true); | 3498 0, 0, true); |
3491 CheckGLError(); | 3499 CheckGLError(); |
(...skipping 2900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6392 CheckGLError(); | 6400 CheckGLError(); |
6393 } | 6401 } |
6394 | 6402 |
6395 // Include the auto-generated part of this file. We split this because it means | 6403 // Include the auto-generated part of this file. We split this because it means |
6396 // we can easily edit the non-auto generated parts right here in this file | 6404 // we can easily edit the non-auto generated parts right here in this file |
6397 // instead of having to edit some template or the code generator. | 6405 // instead of having to edit some template or the code generator. |
6398 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" | 6406 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" |
6399 | 6407 |
6400 } // namespace gles2 | 6408 } // namespace gles2 |
6401 } // namespace gpu | 6409 } // namespace gpu |
OLD | NEW |