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 e3c6598d7251cbf2107f410a332b2c205b97347e..462247b9399e84ceb2e7910c44145bc90f6305bd 100644 |
--- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc |
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc |
@@ -51,6 +51,18 @@ class GLES2DecoderTest : public GLES2DecoderTestBase { |
bool init); |
}; |
+class GLES2DecoderANGLETest : public GLES2DecoderTestBase { |
+ public: |
+ GLES2DecoderANGLETest() |
+ : GLES2DecoderTestBase() { |
+ GLES2Decoder::set_testing_force_is_angle(true); |
+ } |
+ |
+ virtual ~GLES2DecoderANGLETest() { |
+ GLES2Decoder::set_testing_force_is_angle(false); |
+ } |
+}; |
+ |
class GLES2DecoderWithShaderTest : public GLES2DecoderWithShaderTestBase { |
public: |
GLES2DecoderWithShaderTest() |
@@ -5134,6 +5146,59 @@ TEST_F(GLES2DecoderTest, TexSubImage2DClearsAfterTexImage2DNULL) { |
EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
} |
+TEST_F(GLES2DecoderTest, TexSubImage2DDoesNotClearAfterTexImage2DNULLThenData) { |
+ DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
+ DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
+ 0, 0); |
+ DoTexImage2DSameSize( |
+ GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
+ kSharedMemoryId, kSharedMemoryOffset); |
+ EXPECT_CALL(*gl_, TexSubImage2D( |
+ GL_TEXTURE_2D, 0, 1, 1, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, |
+ shared_memory_address_)) |
+ .Times(1) |
+ .RetiresOnSaturation(); |
+ TexSubImage2D cmd; |
+ cmd.Init( |
+ GL_TEXTURE_2D, 0, 1, 1, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, |
+ kSharedMemoryId, kSharedMemoryOffset, GL_FALSE); |
+ EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
+ // Test if we call it again it does not clear. |
+ EXPECT_CALL(*gl_, TexSubImage2D( |
+ GL_TEXTURE_2D, 0, 1, 1, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, |
+ shared_memory_address_)) |
+ .Times(1) |
+ .RetiresOnSaturation(); |
+ EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
+} |
+ |
+TEST_F(GLES2DecoderANGLETest, |
+ TexSubImage2DDoesNotClearAfterTexImage2DNULLThenData) { |
+ DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
+ DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
+ 0, 0); |
+ DoTexImage2DSameSize( |
+ GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
+ kSharedMemoryId, kSharedMemoryOffset); |
+ EXPECT_CALL(*gl_, TexSubImage2D( |
+ GL_TEXTURE_2D, 0, 1, 1, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, |
+ shared_memory_address_)) |
+ .Times(1) |
+ .RetiresOnSaturation(); |
+ TexSubImage2D cmd; |
+ cmd.Init( |
+ GL_TEXTURE_2D, 0, 1, 1, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, |
+ kSharedMemoryId, kSharedMemoryOffset, GL_FALSE); |
+ EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
+ // Test if we call it again it does not clear. |
+ EXPECT_CALL(*gl_, TexSubImage2D( |
+ GL_TEXTURE_2D, 0, 1, 1, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, |
+ shared_memory_address_)) |
+ .Times(1) |
+ .RetiresOnSaturation(); |
+ EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
+} |
+ |
TEST_F(GLES2DecoderTest, TexSubImage2DClearsAfterTexImage2DWithDataThenNULL) { |
DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
// Put in data (so it should be marked as cleared) |