OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
6 | 6 |
7 #include <limits.h> | 7 #include <limits.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 17 matching lines...) Expand all Loading... |
28 #include "ui/gl/gl_implementation.h" | 28 #include "ui/gl/gl_implementation.h" |
29 #include "ui/gl/gl_mock.h" | 29 #include "ui/gl/gl_mock.h" |
30 #include "ui/gl/gl_surface_stub.h" | 30 #include "ui/gl/gl_surface_stub.h" |
31 | 31 |
32 #if !defined(GL_DEPTH24_STENCIL8) | 32 #if !defined(GL_DEPTH24_STENCIL8) |
33 #define GL_DEPTH24_STENCIL8 0x88F0 | 33 #define GL_DEPTH24_STENCIL8 0x88F0 |
34 #endif | 34 #endif |
35 | 35 |
36 using ::gfx::MockGLInterface; | 36 using ::gfx::MockGLInterface; |
37 using ::testing::_; | 37 using ::testing::_; |
| 38 using ::testing::AnyNumber; |
38 using ::testing::DoAll; | 39 using ::testing::DoAll; |
39 using ::testing::InSequence; | 40 using ::testing::InSequence; |
40 using ::testing::Invoke; | 41 using ::testing::Invoke; |
41 using ::testing::MatcherCast; | 42 using ::testing::MatcherCast; |
42 using ::testing::Mock; | 43 using ::testing::Mock; |
43 using ::testing::Pointee; | 44 using ::testing::Pointee; |
44 using ::testing::Return; | 45 using ::testing::Return; |
45 using ::testing::SaveArg; | 46 using ::testing::SaveArg; |
46 using ::testing::SetArrayArgument; | 47 using ::testing::SetArrayArgument; |
47 using ::testing::SetArgPointee; | 48 using ::testing::SetArgPointee; |
(...skipping 2712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2760 | 2761 |
2761 // EXPECT_EQ can't be used to compare function pointers | 2762 // EXPECT_EQ can't be used to compare function pointers |
2762 EXPECT_TRUE( | 2763 EXPECT_TRUE( |
2763 gfx::MockGLInterface::GetGLProcAddress("glInvalidateFramebuffer") != | 2764 gfx::MockGLInterface::GetGLProcAddress("glInvalidateFramebuffer") != |
2764 gfx::g_driver_gl.fn.glDiscardFramebufferEXTFn); | 2765 gfx::g_driver_gl.fn.glDiscardFramebufferEXTFn); |
2765 EXPECT_TRUE( | 2766 EXPECT_TRUE( |
2766 gfx::MockGLInterface::GetGLProcAddress("glInvalidateFramebuffer") != | 2767 gfx::MockGLInterface::GetGLProcAddress("glInvalidateFramebuffer") != |
2767 gfx::MockGLInterface::GetGLProcAddress("glDiscardFramebufferEXT")); | 2768 gfx::MockGLInterface::GetGLProcAddress("glDiscardFramebufferEXT")); |
2768 } | 2769 } |
2769 | 2770 |
| 2771 TEST_P(GLES2DecoderTest, ClearBackbufferBitsOnFlipSwap) { |
| 2772 surface_->set_buffers_flipped(true); |
| 2773 |
| 2774 EXPECT_EQ(0u, GetAndClearBackbufferClearBitsForTest()); |
| 2775 |
| 2776 SwapBuffers& cmd = *GetImmediateAs<SwapBuffers>(); |
| 2777 cmd.Init(); |
| 2778 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 2779 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 2780 EXPECT_EQ(static_cast<uint32_t>(GL_COLOR_BUFFER_BIT), |
| 2781 GetAndClearBackbufferClearBitsForTest()); |
| 2782 |
| 2783 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 2784 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 2785 EXPECT_EQ(0u, GetAndClearBackbufferClearBitsForTest()); |
| 2786 |
| 2787 EXPECT_CALL(*gl_, Finish()).Times(AnyNumber()); |
| 2788 ResizeCHROMIUM& resize_cmd = *GetImmediateAs<ResizeCHROMIUM>(); |
| 2789 resize_cmd.Init(1, 1, 1.0f, GL_TRUE); |
| 2790 EXPECT_EQ(error::kNoError, ExecuteCmd(resize_cmd)); |
| 2791 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 2792 EXPECT_EQ(static_cast<uint32_t>(GL_COLOR_BUFFER_BIT), |
| 2793 GetAndClearBackbufferClearBitsForTest()); |
| 2794 |
| 2795 cmd.Init(); |
| 2796 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 2797 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 2798 EXPECT_EQ(static_cast<uint32_t>(GL_COLOR_BUFFER_BIT), |
| 2799 GetAndClearBackbufferClearBitsForTest()); |
| 2800 |
| 2801 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 2802 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 2803 EXPECT_EQ(0u, GetAndClearBackbufferClearBitsForTest()); |
| 2804 } |
| 2805 |
2770 TEST_P(GLES2DecoderManualInitTest, DiscardFramebufferEXT) { | 2806 TEST_P(GLES2DecoderManualInitTest, DiscardFramebufferEXT) { |
2771 InitState init; | 2807 InitState init; |
2772 init.extensions = "GL_EXT_discard_framebuffer"; | 2808 init.extensions = "GL_EXT_discard_framebuffer"; |
2773 init.gl_version = "opengl es 2.0"; | 2809 init.gl_version = "opengl es 2.0"; |
2774 InitDecoder(init); | 2810 InitDecoder(init); |
2775 | 2811 |
2776 // EXPECT_EQ can't be used to compare function pointers | 2812 // EXPECT_EQ can't be used to compare function pointers |
2777 EXPECT_TRUE( | 2813 EXPECT_TRUE( |
2778 gfx::MockGLInterface::GetGLProcAddress("glDiscardFramebufferEXT") == | 2814 gfx::MockGLInterface::GetGLProcAddress("glDiscardFramebufferEXT") == |
2779 gfx::g_driver_gl.fn.glDiscardFramebufferEXTFn); | 2815 gfx::g_driver_gl.fn.glDiscardFramebufferEXTFn); |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3090 EXPECT_EQ(1, result->GetNumResults()); | 3126 EXPECT_EQ(1, result->GetNumResults()); |
3091 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 3127 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
3092 } | 3128 } |
3093 | 3129 |
3094 // TODO(gman): PixelStorei | 3130 // TODO(gman): PixelStorei |
3095 | 3131 |
3096 // TODO(gman): SwapBuffers | 3132 // TODO(gman): SwapBuffers |
3097 | 3133 |
3098 } // namespace gles2 | 3134 } // namespace gles2 |
3099 } // namespace gpu | 3135 } // namespace gpu |
OLD | NEW |