Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1122)

Unified Diff: gpu/command_buffer/service/gles2_cmd_decoder_unittest_framebuffers.cc

Issue 1387143003: Add missing break in switch-case statements in gles2_cmd_decoder (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes to go through the clang compiler error! Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..d6e5c948c0b487bff3a49973a5eabca426049336 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,66 @@ 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.
+ 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());
+ EXPECT_EQ(static_cast<uint32_t>(GL_COLOR_BUFFER_BIT),
+ GetAndClearBackbufferClearBitsForTest());
+
+ 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());
+ EXPECT_EQ(static_cast<uint32_t>(GL_DEPTH_BUFFER_BIT),
+ GetAndClearBackbufferClearBitsForTest());
+
+ 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());
+ EXPECT_EQ(static_cast<uint32_t>(GL_STENCIL_BUFFER_BIT),
+ GetAndClearBackbufferClearBitsForTest());
+
+ 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());
+ EXPECT_EQ(static_cast<uint32_t>(GL_COLOR_BUFFER_BIT |
+ GL_DEPTH_BUFFER_BIT |
+ GL_STENCIL_BUFFER_BIT),
+ GetAndClearBackbufferClearBitsForTest());
+}
+
TEST_P(GLES2DecoderTest, DiscardFramebufferEXTUnsupported) {
const GLenum target = GL_FRAMEBUFFER;
const GLsizei count = 1;
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698