Chromium Code Reviews| Index: gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc |
| diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc b/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc |
| index 25d96c71b4d72312cdbe8984e748f7e779527c27..aec2e2d87b4ae4e1ae5ede1fdc9c00c0f87905b9 100644 |
| --- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc |
| +++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc |
| @@ -5459,6 +5459,67 @@ TEST_F(GLES2DecoderWithShaderTest, UnClearedAttachmentsGetClearedOnReadPixels) { |
| EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| } |
| +TEST_F(GLES2DecoderManualInitTest, |
| + UnClearedAttachmentsGetClearedOnReadPixelsAndDrawBufferGetsRestored) { |
| + InitDecoder( |
| + "GL_EXT_framebuffer_multisample", // extensions |
| + false, // has alpha |
| + false, // has depth |
| + false, // has stencil |
| + false, // request alpha |
| + false, // request depth |
| + false, // request stencil |
| + true); // bind generates resource |
| + const GLuint kFBOClientTextureId = 4100; |
| + const GLuint kFBOServiceTextureId = 4101; |
| + |
| + // Register a texture id. |
| + EXPECT_CALL(*gl_, GenTextures(_, _)) |
| + .WillOnce(SetArgumentPointee<1>(kFBOServiceTextureId)) |
| + .RetiresOnSaturation(); |
| + GenHelper<GenTexturesImmediate>(kFBOClientTextureId); |
| + |
| + // Setup "render from" texture. |
| + DoBindTexture(GL_TEXTURE_2D, kFBOClientTextureId, kFBOServiceTextureId); |
| + DoTexImage2D( |
| + GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); |
| + DoBindFramebuffer( |
| + GL_READ_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); |
| + DoFramebufferTexture2D( |
| + GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, |
| + kFBOClientTextureId, kFBOServiceTextureId, 0, GL_NO_ERROR); |
| + |
| + SetupExpectationsForFramebufferClearingMulti( |
| + kServiceFramebufferId, // read framebuffer service id |
| + 0, // backbuffer service id |
| + GL_READ_FRAMEBUFFER, // target |
| + GL_COLOR_BUFFER_BIT, // clear bits |
| + 0, 0, 0, 0, // color |
| + 0, // stencil |
| + 1.0f, // depth |
| + false); // scissor test |
| + |
| + EXPECT_CALL(*gl_, GetError()) |
| + .WillOnce(Return(GL_NO_ERROR)) |
| + .WillOnce(Return(GL_NO_ERROR)) |
| + .RetiresOnSaturation(); |
| + EXPECT_CALL(*gl_, ReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, _)) |
| + .Times(1) |
| + .RetiresOnSaturation(); |
| + typedef ReadPixels::Result Result; |
| + Result* result = GetSharedMemoryAs<Result*>(); |
|
jbates
2011/11/30 22:00:51
It doesn't look like result is ever accessed (ther
greggman
2011/11/30 22:13:15
Yea, actual results from readPixels are checked in
|
| + uint32 result_shm_id = kSharedMemoryId; |
| + uint32 result_shm_offset = kSharedMemoryOffset; |
| + uint32 pixels_shm_id = kSharedMemoryId; |
| + uint32 pixels_shm_offset = kSharedMemoryOffset + sizeof(*result); |
| + ReadPixels cmd; |
| + cmd.Init(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, |
| + pixels_shm_id, pixels_shm_offset, |
| + result_shm_id, result_shm_offset); |
| + EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| + EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| +} |
| + |
| TEST_F(GLES2DecoderWithShaderTest, DrawClearsAfterRenderbufferStorageInFBO) { |
| SetupTexture(); |
| DoBindRenderbuffer(GL_RENDERBUFFER, client_renderbuffer_id_, |