| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
| 6 | 6 |
| 7 #include <limits.h> | 7 #include <limits.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 812 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 812 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 813 } | 813 } |
| 814 | 814 |
| 815 TEST_P(GLES3DecoderTest, ReadPixelsPixelPackBufferMapped) { | 815 TEST_P(GLES3DecoderTest, ReadPixelsPixelPackBufferMapped) { |
| 816 const GLsizei kWidth = 5; | 816 const GLsizei kWidth = 5; |
| 817 const GLsizei kHeight = 3; | 817 const GLsizei kHeight = 3; |
| 818 const GLint kBytesPerPixel = 4; | 818 const GLint kBytesPerPixel = 4; |
| 819 GLint size = kWidth * kHeight * kBytesPerPixel; | 819 GLint size = kWidth * kHeight * kBytesPerPixel; |
| 820 | 820 |
| 821 DoBindBuffer(GL_PIXEL_PACK_BUFFER, client_buffer_id_, kServiceBufferId); | 821 DoBindBuffer(GL_PIXEL_PACK_BUFFER, client_buffer_id_, kServiceBufferId); |
| 822 DoBufferData(GL_PIXEL_PACK_BUFFER, size); |
| 823 |
| 824 std::vector<int8_t> mapped_data(size); |
| 822 | 825 |
| 823 uint32_t result_shm_id = kSharedMemoryId; | 826 uint32_t result_shm_id = kSharedMemoryId; |
| 824 uint32_t result_shm_offset = kSharedMemoryOffset; | 827 uint32_t result_shm_offset = kSharedMemoryOffset; |
| 825 uint32_t data_shm_id = kSharedMemoryId; | 828 uint32_t data_shm_id = kSharedMemoryId; |
| 826 // uint32_t is Result for both MapBufferRange and UnmapBuffer commands. | 829 // uint32_t is Result for both MapBufferRange and UnmapBuffer commands. |
| 827 uint32_t data_shm_offset = kSharedMemoryOffset + sizeof(uint32_t); | 830 uint32_t data_shm_offset = kSharedMemoryOffset + sizeof(uint32_t); |
| 828 EXPECT_CALL(*gl_, | 831 EXPECT_CALL(*gl_, |
| 829 MapBufferRange(GL_PIXEL_PACK_BUFFER, 0, size, GL_MAP_READ_BIT)) | 832 MapBufferRange(GL_PIXEL_PACK_BUFFER, 0, size, GL_MAP_READ_BIT)) |
| 833 .WillOnce(Return(mapped_data.data())) |
| 830 .RetiresOnSaturation(); | 834 .RetiresOnSaturation(); |
| 831 MapBufferRange map_buffer_range; | 835 MapBufferRange map_buffer_range; |
| 832 map_buffer_range.Init(GL_PIXEL_PACK_BUFFER, 0, size, GL_MAP_READ_BIT, | 836 map_buffer_range.Init(GL_PIXEL_PACK_BUFFER, 0, size, GL_MAP_READ_BIT, |
| 833 data_shm_id, data_shm_offset, | 837 data_shm_id, data_shm_offset, |
| 834 result_shm_id, result_shm_offset); | 838 result_shm_id, result_shm_offset); |
| 835 EXPECT_EQ(error::kNoError, ExecuteCmd(map_buffer_range)); | 839 EXPECT_EQ(error::kNoError, ExecuteCmd(map_buffer_range)); |
| 836 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 840 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 837 | 841 |
| 838 EXPECT_CALL(*gl_, ReadPixels(_, _, _, _, _, _, _)).Times(0); | 842 EXPECT_CALL(*gl_, ReadPixels(_, _, _, _, _, _, _)).Times(0); |
| 839 ReadPixels cmd; | 843 ReadPixels cmd; |
| (...skipping 2959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3799 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 3803 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 3800 } | 3804 } |
| 3801 } | 3805 } |
| 3802 | 3806 |
| 3803 // TODO(gman): PixelStorei | 3807 // TODO(gman): PixelStorei |
| 3804 | 3808 |
| 3805 // TODO(gman): SwapBuffers | 3809 // TODO(gman): SwapBuffers |
| 3806 | 3810 |
| 3807 } // namespace gles2 | 3811 } // namespace gles2 |
| 3808 } // namespace gpu | 3812 } // namespace gpu |
| OLD | NEW |