Chromium Code Reviews| Index: gpu/command_buffer/client/gles2_implementation_unittest.cc |
| diff --git a/gpu/command_buffer/client/gles2_implementation_unittest.cc b/gpu/command_buffer/client/gles2_implementation_unittest.cc |
| index edc7c6a08b920d1aabd338fef8b678c58bcdd6b9..860116eb286e836c3613569b86709b596444d0da 100644 |
| --- a/gpu/command_buffer/client/gles2_implementation_unittest.cc |
| +++ b/gpu/command_buffer/client/gles2_implementation_unittest.cc |
| @@ -1420,6 +1420,45 @@ TEST_F(GLES2ImplementationTest, ReadPixelsBadFormatType) { |
| gl_->ReadPixels(0, 0, kWidth, kHeight, kFormat, kType, buffer.get()); |
| } |
| +TEST_F(GLES2ImplementationTest, ReadPixelsWithPBO) { |
| + struct Cmds { |
| + cmds::ReadPixels read; |
| + cmd::SetToken set_token; |
| + }; |
| + const GLint kBytesPerPixel = 4; |
| + const GLint kWidth = 2; |
| + const GLint kHeight = 2; |
| + const GLenum kFormat = 0; |
| + const GLenum kType = 0; |
| + |
| + ExpectedMemoryInfo mem1 = |
| + GetExpectedMemory(kWidth * kHeight * kBytesPerPixel); |
| + ExpectedMemoryInfo result1 = |
| + GetExpectedResultMemory(sizeof(cmds::ReadPixels::Result)); |
| + |
| + Cmds expected; |
| + expected.read.Init( |
| + 0, 0, kWidth, kHeight, kFormat, kType, |
| + mem1.id, mem1.offset, result1.id, result1.offset); |
| + expected.set_token.Init(GetNextToken()); |
| + scoped_array<int8> buffer(new int8[kWidth * kHeight * kBytesPerPixel]); |
| + |
| + GLuint b; |
| + gl_->GenBuffers(1, &b); |
| + gl_->BindBuffer(GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM, b); |
| + gl_->BufferData(GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM, |
| + kWidth * kHeight * kBytesPerPixel, |
| + NULL, |
| + 0 /* GL_STREAM_READ */ ); |
| + gl_->ReadPixels(0, 0, kWidth, kHeight, kFormat, kType, 0); |
| + EXPECT_TRUE(gl_->MapBufferCHROMIUM( |
| + GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM, |
| + GL_READ_ONLY)); |
| + gl_->UnmapBufferCHROMIUM(GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM); |
| + gl_->BindBuffer(GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM, 0); |
| + gl_->DeleteBuffers(1, &b); |
|
greggman
2013/03/20 00:42:17
Ideally you want to check that gl_->ReadPixels ins
|
| +} |
| + |
| TEST_F(GLES2ImplementationTest, FreeUnusedSharedMemory) { |
| struct Cmds { |
| cmds::BufferSubData buf; |
| @@ -2809,4 +2848,3 @@ TEST_F(GLES2ImplementationTest, Enable) { |
| } // namespace gles2 |
| } // namespace gpu |
| - |