Chromium Code Reviews| 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 f50e03020936ed1e65120ccdfb45d8d285738cdc..c7ccadfb30c7e46c8e2b4117aaf958c6bf8d43cc 100644 |
| --- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_framebuffers.cc |
| +++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_framebuffers.cc |
| @@ -2515,6 +2515,73 @@ TEST_P(GLES2DecoderManualInitTest, DiscardFramebufferEXT) { |
| EXPECT_FALSE(framebuffer->IsCleared()); |
| } |
| +TEST_P(GLES2DecoderManualInitTest, ClearBackbufferBitsOnDiscardFramebufferEXT) { |
| + InitState init; |
| + init.extensions = "GL_EXT_discard_framebuffer"; |
| + init.gl_version = "opengl es 2.0"; |
| + InitDecoder(init); |
| + |
| + // EXPECT_EQ can't be used to compare function pointers |
|
Sami
2015/11/04 11:55:52
nit: append a full stop.
RaviKasibhatla
2015/11/04 14:59:40
Done.
|
| + EXPECT_TRUE( |
| + gfx::MockGLInterface::GetGLProcAddress("glDiscardFramebufferEXT") == |
| + gfx::g_driver_gl.fn.glDiscardFramebufferEXTFn); |
| + |
| + const GLenum target = GL_FRAMEBUFFER; |
| + const GLsizei count = 1; |
| + GLenum attachments[] = {GL_COLOR_EXT}; |
| + |
| + EXPECT_CALL(*gl_, DiscardFramebufferEXT(target, count, _)) |
| + .Times(1) |
| + .RetiresOnSaturation(); |
| + DiscardFramebufferEXTImmediate& cmd = |
| + *GetImmediateAs<DiscardFramebufferEXTImmediate>(); |
| + cmd.Init(target, count, attachments); |
| + EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(attachments))); |
| + EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| + |
| + uint32 clear_bits = GetBackbufferClearBits(); |
| + EXPECT_EQ(GL_COLOR_BUFFER_BIT, clear_bits); |
| + ClearBackbufferClearBits(); |
| + |
| + attachments[0] = GL_DEPTH_EXT; |
| + EXPECT_CALL(*gl_, DiscardFramebufferEXT(target, count, _)) |
| + .Times(1) |
| + .RetiresOnSaturation(); |
| + cmd.Init(target, count, attachments); |
| + EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(attachments))); |
| + EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| + |
| + clear_bits = GetBackbufferClearBits(); |
| + EXPECT_EQ(GL_DEPTH_BUFFER_BIT, clear_bits); |
| + ClearBackbufferClearBits(); |
| + |
| + attachments[0] = GL_STENCIL_EXT; |
| + EXPECT_CALL(*gl_, DiscardFramebufferEXT(target, count, _)) |
| + .Times(1) |
| + .RetiresOnSaturation(); |
| + cmd.Init(target, count, attachments); |
| + EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(attachments))); |
| + EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| + |
| + clear_bits = GetBackbufferClearBits(); |
| + EXPECT_EQ(GL_STENCIL_BUFFER_BIT, clear_bits); |
| + ClearBackbufferClearBits(); |
| + |
| + const GLsizei count0 = 3; |
| + const GLenum attachments0[] = {GL_COLOR_EXT, GL_DEPTH_EXT, GL_STENCIL_EXT}; |
| + EXPECT_CALL(*gl_, DiscardFramebufferEXT(target, count0, _)) |
| + .Times(1) |
| + .RetiresOnSaturation(); |
| + cmd.Init(target, count0, attachments0); |
| + EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(attachments0))); |
| + EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| + |
| + clear_bits = GetBackbufferClearBits(); |
| + EXPECT_EQ(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT, |
| + clear_bits); |
| + ClearBackbufferClearBits(); |
| +} |
| + |
| TEST_P(GLES2DecoderTest, DiscardFramebufferEXTUnsupported) { |
| const GLenum target = GL_FRAMEBUFFER; |
| const GLsizei count = 1; |