| 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 3467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3478 uint32 unpadded_row_size; | 3478 uint32 unpadded_row_size; |
| 3479 uint32 padded_row_size; | 3479 uint32 padded_row_size; |
| 3480 if (!GLES2Util::ComputeImageDataSizes( | 3480 if (!GLES2Util::ComputeImageDataSizes( |
| 3481 width, 2, 1, format, type, pack_alignment_, &temp_size, | 3481 width, 2, 1, format, type, pack_alignment_, &temp_size, |
| 3482 &unpadded_row_size, &padded_row_size)) { | 3482 &unpadded_row_size, &padded_row_size)) { |
| 3483 SetGLError(GL_INVALID_VALUE, "glReadPixels", "size too large."); | 3483 SetGLError(GL_INVALID_VALUE, "glReadPixels", "size too large."); |
| 3484 return; | 3484 return; |
| 3485 } | 3485 } |
| 3486 | 3486 |
| 3487 if (bound_pixel_pack_buffer_) { | 3487 if (bound_pixel_pack_buffer_) { |
| 3488 // TODO(zmo): Need to handle the case of reading into a PIXEL_PACK_BUFFER | 3488 GLuint offset = ToGLuint(pixels); |
| 3489 // in ES3. For now, generate a GL error. | 3489 helper_->ReadPixels( |
| 3490 SetGLError(GL_INVALID_OPERATION, "glReadPixels", | 3490 xoffset, yoffset, width, height, format, type, 0, offset, 0, 0, false); |
| 3491 "ReadPixels to a pixel pack buffer isn't implemented"); | 3491 CheckGLError(); |
| 3492 return; | 3492 return; |
| 3493 } | 3493 } |
| 3494 | 3494 |
| 3495 if (bound_pixel_pack_transfer_buffer_id_) { | 3495 if (bound_pixel_pack_transfer_buffer_id_) { |
| 3496 GLuint offset = ToGLuint(pixels); | 3496 GLuint offset = ToGLuint(pixels); |
| 3497 BufferTracker::Buffer* buffer = GetBoundPixelUnpackTransferBufferIfValid( | 3497 BufferTracker::Buffer* buffer = GetBoundPixelUnpackTransferBufferIfValid( |
| 3498 bound_pixel_pack_transfer_buffer_id_, | 3498 bound_pixel_pack_transfer_buffer_id_, |
| 3499 "glReadPixels", offset, padded_row_size * height); | 3499 "glReadPixels", offset, padded_row_size * height); |
| 3500 if (buffer && buffer->shm_id() != -1) { | 3500 if (buffer && buffer->shm_id() != -1) { |
| 3501 helper_->ReadPixels(xoffset, yoffset, width, height, format, type, | 3501 helper_->ReadPixels(xoffset, yoffset, width, height, format, type, |
| (...skipping 2943 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6445 CheckGLError(); | 6445 CheckGLError(); |
| 6446 } | 6446 } |
| 6447 | 6447 |
| 6448 // Include the auto-generated part of this file. We split this because it means | 6448 // Include the auto-generated part of this file. We split this because it means |
| 6449 // we can easily edit the non-auto generated parts right here in this file | 6449 // we can easily edit the non-auto generated parts right here in this file |
| 6450 // instead of having to edit some template or the code generator. | 6450 // instead of having to edit some template or the code generator. |
| 6451 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" | 6451 #include "gpu/command_buffer/client/gles2_implementation_impl_autogen.h" |
| 6452 | 6452 |
| 6453 } // namespace gles2 | 6453 } // namespace gles2 |
| 6454 } // namespace gpu | 6454 } // namespace gpu |
| OLD | NEW |