| Index: gpu/command_buffer/service/gles2_cmd_decoder_unittest_framebuffers.cc
|
| diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_framebuffers.cc b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_framebuffers.cc
|
| index ce6fbb8c83b5e44c6f4c950f7dc0623d7bc65733..b88506d9bff96074a4c81ec650bdfa930fa80966 100644
|
| --- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_framebuffers.cc
|
| +++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_framebuffers.cc
|
| @@ -660,6 +660,90 @@ TEST_P(GLES2DecoderTest, ReadPixels) {
|
| }
|
| }
|
|
|
| +TEST_P(GLES3DecoderTest, ReadPixels2PixelPackBufferNoBufferBound) {
|
| + const GLsizei kWidth = 5;
|
| + const GLsizei kHeight = 3;
|
| + EXPECT_CALL(*gl_, ReadPixels(_, _, _, _, _, _, _)).Times(0);
|
| +
|
| + ReadPixels cmd;
|
| + cmd.Init(0,
|
| + 0,
|
| + kWidth,
|
| + kHeight,
|
| + GL_RGBA,
|
| + GL_UNSIGNED_BYTE,
|
| + 0,
|
| + 0,
|
| + 0,
|
| + 0,
|
| + false);
|
| + EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
|
| + EXPECT_EQ(GL_INVALID_OPERATION, GetGLError());
|
| +}
|
| +
|
| +TEST_P(GLES3DecoderTest, ReadPixels2BufferBound) {
|
| + const GLsizei kWidth = 5;
|
| + const GLsizei kHeight = 3;
|
| + const GLint kBytesPerPixel = 4;
|
| + GLint size = kWidth * kHeight * kBytesPerPixel;
|
| + EXPECT_CALL(*gl_, ReadPixels(_, _, _, _, _, _, _)).Times(0);
|
| + typedef ReadPixels::Result Result;
|
| + Result* result = GetSharedMemoryAs<Result*>();
|
| + uint32 result_shm_id = kSharedMemoryId;
|
| + uint32 result_shm_offset = kSharedMemoryOffset;
|
| + uint32 pixels_shm_id = kSharedMemoryId;
|
| + uint32 pixels_shm_offset = kSharedMemoryOffset + sizeof(*result);
|
| +
|
| + DoBindBuffer(GL_PIXEL_PACK_BUFFER, client_buffer_id_, kServiceBufferId);
|
| + DoBufferData(GL_PIXEL_PACK_BUFFER, size);
|
| +
|
| + ReadPixels cmd;
|
| + cmd.Init(0,
|
| + 0,
|
| + kWidth,
|
| + kHeight,
|
| + GL_RGBA,
|
| + GL_UNSIGNED_BYTE,
|
| + pixels_shm_id,
|
| + pixels_shm_offset,
|
| + result_shm_id,
|
| + result_shm_offset,
|
| + false);
|
| + EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
|
| + EXPECT_EQ(GL_INVALID_OPERATION, GetGLError());
|
| +}
|
| +
|
| +TEST_P(GLES3DecoderTest, ReadPixels2PixelPackBuffer) {
|
| + const GLsizei kWidth = 5;
|
| + const GLsizei kHeight = 3;
|
| + const GLint kBytesPerPixel = 4;
|
| + GLint size = kWidth * kHeight * kBytesPerPixel;
|
| +
|
| + DoBindBuffer(GL_PIXEL_PACK_BUFFER, client_buffer_id_, kServiceBufferId);
|
| + DoBufferData(GL_PIXEL_PACK_BUFFER, size);
|
| +
|
| + EXPECT_CALL(*gl_, GetError())
|
| + .WillOnce(Return(GL_NO_ERROR))
|
| + .WillOnce(Return(GL_NO_ERROR))
|
| + .RetiresOnSaturation();
|
| + EXPECT_CALL(*gl_,
|
| + ReadPixels(0, 0, kWidth, kHeight, GL_RGBA, GL_UNSIGNED_BYTE, _));
|
| + ReadPixels cmd;
|
| + cmd.Init(0,
|
| + 0,
|
| + kWidth,
|
| + kHeight,
|
| + GL_RGBA,
|
| + GL_UNSIGNED_BYTE,
|
| + 0,
|
| + 0,
|
| + 0,
|
| + 0,
|
| + false);
|
| + EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
|
| + EXPECT_EQ(GL_NO_ERROR, GetGLError());
|
| +}
|
| +
|
| TEST_P(GLES2DecoderRGBBackbufferTest, ReadPixelsNoAlphaBackbuffer) {
|
| const GLsizei kWidth = 3;
|
| const GLsizei kHeight = 3;
|
|
|