| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/atomicops.h" | 7 #include "base/atomicops.h" |
| 8 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 8 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
| 9 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 9 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
| 10 #include "gpu/command_buffer/common/gl_mock.h" | 10 #include "gpu/command_buffer/common/gl_mock.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 public: | 44 public: |
| 45 GLES2DecoderTest() { } | 45 GLES2DecoderTest() { } |
| 46 | 46 |
| 47 protected: | 47 protected: |
| 48 void CheckReadPixelsOutOfRange( | 48 void CheckReadPixelsOutOfRange( |
| 49 GLint in_read_x, GLint in_read_y, | 49 GLint in_read_x, GLint in_read_y, |
| 50 GLsizei in_read_width, GLsizei in_read_height, | 50 GLsizei in_read_width, GLsizei in_read_height, |
| 51 bool init); | 51 bool init); |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 class GLES2DecoderANGLETest : public GLES2DecoderTestBase { |
| 55 public: |
| 56 GLES2DecoderANGLETest() |
| 57 : GLES2DecoderTestBase() { |
| 58 GLES2Decoder::set_testing_force_is_angle(true); |
| 59 } |
| 60 |
| 61 virtual ~GLES2DecoderANGLETest() { |
| 62 GLES2Decoder::set_testing_force_is_angle(false); |
| 63 } |
| 64 }; |
| 65 |
| 54 class GLES2DecoderWithShaderTest : public GLES2DecoderWithShaderTestBase { | 66 class GLES2DecoderWithShaderTest : public GLES2DecoderWithShaderTestBase { |
| 55 public: | 67 public: |
| 56 GLES2DecoderWithShaderTest() | 68 GLES2DecoderWithShaderTest() |
| 57 : GLES2DecoderWithShaderTestBase() { | 69 : GLES2DecoderWithShaderTestBase() { |
| 58 } | 70 } |
| 59 | 71 |
| 60 void CheckTextureChangesMarkFBOAsNotComplete(bool bound_fbo); | 72 void CheckTextureChangesMarkFBOAsNotComplete(bool bound_fbo); |
| 61 void CheckRenderbufferChangesMarkFBOAsNotComplete(bool bound_fbo); | 73 void CheckRenderbufferChangesMarkFBOAsNotComplete(bool bound_fbo); |
| 62 }; | 74 }; |
| 63 | 75 |
| (...skipping 5063 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5127 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 5139 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 5128 // Test if we call it again it does not clear. | 5140 // Test if we call it again it does not clear. |
| 5129 EXPECT_CALL(*gl_, TexSubImage2D( | 5141 EXPECT_CALL(*gl_, TexSubImage2D( |
| 5130 GL_TEXTURE_2D, 0, 1, 1, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, | 5142 GL_TEXTURE_2D, 0, 1, 1, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, |
| 5131 shared_memory_address_)) | 5143 shared_memory_address_)) |
| 5132 .Times(1) | 5144 .Times(1) |
| 5133 .RetiresOnSaturation(); | 5145 .RetiresOnSaturation(); |
| 5134 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 5146 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 5135 } | 5147 } |
| 5136 | 5148 |
| 5149 TEST_F(GLES2DecoderTest, TexSubImage2DDoesNotClearAfterTexImage2DNULLThenData) { |
| 5150 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 5151 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
| 5152 0, 0); |
| 5153 DoTexImage2DSameSize( |
| 5154 GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
| 5155 kSharedMemoryId, kSharedMemoryOffset); |
| 5156 EXPECT_CALL(*gl_, TexSubImage2D( |
| 5157 GL_TEXTURE_2D, 0, 1, 1, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, |
| 5158 shared_memory_address_)) |
| 5159 .Times(1) |
| 5160 .RetiresOnSaturation(); |
| 5161 TexSubImage2D cmd; |
| 5162 cmd.Init( |
| 5163 GL_TEXTURE_2D, 0, 1, 1, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, |
| 5164 kSharedMemoryId, kSharedMemoryOffset, GL_FALSE); |
| 5165 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 5166 // Test if we call it again it does not clear. |
| 5167 EXPECT_CALL(*gl_, TexSubImage2D( |
| 5168 GL_TEXTURE_2D, 0, 1, 1, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, |
| 5169 shared_memory_address_)) |
| 5170 .Times(1) |
| 5171 .RetiresOnSaturation(); |
| 5172 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 5173 } |
| 5174 |
| 5175 TEST_F(GLES2DecoderANGLETest, |
| 5176 TexSubImage2DDoesNotClearAfterTexImage2DNULLThenData) { |
| 5177 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 5178 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
| 5179 0, 0); |
| 5180 DoTexImage2DSameSize( |
| 5181 GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
| 5182 kSharedMemoryId, kSharedMemoryOffset); |
| 5183 EXPECT_CALL(*gl_, TexSubImage2D( |
| 5184 GL_TEXTURE_2D, 0, 1, 1, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, |
| 5185 shared_memory_address_)) |
| 5186 .Times(1) |
| 5187 .RetiresOnSaturation(); |
| 5188 TexSubImage2D cmd; |
| 5189 cmd.Init( |
| 5190 GL_TEXTURE_2D, 0, 1, 1, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, |
| 5191 kSharedMemoryId, kSharedMemoryOffset, GL_FALSE); |
| 5192 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 5193 // Test if we call it again it does not clear. |
| 5194 EXPECT_CALL(*gl_, TexSubImage2D( |
| 5195 GL_TEXTURE_2D, 0, 1, 1, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, |
| 5196 shared_memory_address_)) |
| 5197 .Times(1) |
| 5198 .RetiresOnSaturation(); |
| 5199 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 5200 } |
| 5201 |
| 5137 TEST_F(GLES2DecoderTest, TexSubImage2DClearsAfterTexImage2DWithDataThenNULL) { | 5202 TEST_F(GLES2DecoderTest, TexSubImage2DClearsAfterTexImage2DWithDataThenNULL) { |
| 5138 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | 5203 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 5139 // Put in data (so it should be marked as cleared) | 5204 // Put in data (so it should be marked as cleared) |
| 5140 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, | 5205 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
| 5141 kSharedMemoryId, kSharedMemoryOffset); | 5206 kSharedMemoryId, kSharedMemoryOffset); |
| 5142 // Put in no data. | 5207 // Put in no data. |
| 5143 TexImage2D tex_cmd; | 5208 TexImage2D tex_cmd; |
| 5144 tex_cmd.Init( | 5209 tex_cmd.Init( |
| 5145 GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); | 5210 GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); |
| 5146 // It won't actually call TexImage2D, just mark it as uncleared. | 5211 // It won't actually call TexImage2D, just mark it as uncleared. |
| (...skipping 816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5963 // TODO(gman): TexImage2DImmediate | 6028 // TODO(gman): TexImage2DImmediate |
| 5964 | 6029 |
| 5965 // TODO(gman): TexSubImage2DImmediate | 6030 // TODO(gman): TexSubImage2DImmediate |
| 5966 | 6031 |
| 5967 // TODO(gman): UseProgram | 6032 // TODO(gman): UseProgram |
| 5968 | 6033 |
| 5969 // TODO(gman): SwapBuffers | 6034 // TODO(gman): SwapBuffers |
| 5970 | 6035 |
| 5971 } // namespace gles2 | 6036 } // namespace gles2 |
| 5972 } // namespace gpu | 6037 } // namespace gpu |
| OLD | NEW |