summaryrefslogtreecommitdiffstats
path: root/gpu
diff options
context:
space:
mode:
Diffstat (limited to 'gpu')
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder.cc7
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc12
2 files changed, 15 insertions, 4 deletions
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index dde33df..9b038f8 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -6440,6 +6440,11 @@ error::Error GLES2DecoderImpl::DoTexImage2D(
type == tex_type && format == tex_format;
if (level_is_same && !pixels) {
+ // Just set the level info but mark the texture as uncleared.
+ texture_manager()->SetLevelInfo(
+ feature_info_, info,
+ target, level, internal_format, width, height, 1, border, format, type,
+ false);
tex_image_2d_failed_ = false;
return error::kNoError;
}
@@ -6451,7 +6456,7 @@ error::Error GLES2DecoderImpl::DoTexImage2D(
framebuffer_manager()->IncFramebufferStateChangeCount();
}
- if (!teximage2d_faster_than_texsubimage2d_ && level_is_same) {
+ if (!teximage2d_faster_than_texsubimage2d_ && level_is_same && pixels) {
glTexSubImage2D(target, level, 0, 0, width, height, format, type, pixels);
tex_image_2d_failed_ = false;
return error::kNoError;
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc b/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc
index 3bb9299..e3c6598 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc
@@ -3977,6 +3977,9 @@ TEST_F(GLES2DecoderTest, TexImage2DRedefinitionSucceeds) {
GL_TEXTURE_2D, 0, GL_RGBA, kWidth, kHeight, 0, GL_RGBA,
GL_UNSIGNED_BYTE, kSharedMemoryId, kSharedMemoryOffset);
} else {
+ SetupClearTextureExpections(
+ kServiceTextureId, kServiceTextureId, GL_TEXTURE_2D, GL_TEXTURE_2D,
+ 0, GL_RGBA, GL_UNSIGNED_BYTE, kWidth, kHeight);
cmd.Init(
GL_TEXTURE_2D, 0, GL_RGBA, kWidth, kHeight, 0, GL_RGBA,
GL_UNSIGNED_BYTE, 0, 0);
@@ -5131,8 +5134,7 @@ TEST_F(GLES2DecoderTest, TexSubImage2DClearsAfterTexImage2DNULL) {
EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
}
-TEST_F(GLES2DecoderTest,
- TexSubImage2DDoesNotClearAfterTexImage2DWithDataThenNULL) {
+TEST_F(GLES2DecoderTest, TexSubImage2DClearsAfterTexImage2DWithDataThenNULL) {
DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
// Put in data (so it should be marked as cleared)
DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE,
@@ -5141,8 +5143,12 @@ TEST_F(GLES2DecoderTest,
TexImage2D tex_cmd;
tex_cmd.Init(
GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0);
- // There is no expectation. Same size, no data = no-op.
+ // It won't actually call TexImage2D, just mark it as uncleared.
EXPECT_EQ(error::kNoError, ExecuteCmd(tex_cmd));
+ // Next call to TexSubImage2d should clear.
+ SetupClearTextureExpections(
+ kServiceTextureId, kServiceTextureId, GL_TEXTURE_2D, GL_TEXTURE_2D,
+ 0, GL_RGBA, GL_UNSIGNED_BYTE, 2, 2);
EXPECT_CALL(*gl_, TexSubImage2D(
GL_TEXTURE_2D, 0, 1, 1, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE,
shared_memory_address_))