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

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

Issue 2497013002: Fix a bug in compressed texture code path. (Closed)
Patch Set: Created 4 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 | « no previous file | 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.cc
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index 8be63b095c41b3833ddc5b4f8029d28cf47203c0..6f0d2e8db079242a81d3e81a1c5dcb2d04f1e9c2 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -13677,11 +13677,24 @@ error::Error GLES2DecoderImpl::DoCompressedTexSubImage(
return error::kNoError;
}
- // Note: There is no need to deal with texture cleared tracking here
- // because the validation above means you can only get here if the level
- // is already a matching compressed format and in that case
- // CompressedTexImage{2|3}D already cleared the texture.
- DCHECK(texture->IsLevelCleared(target, level));
+ if (!texture->IsLevelCleared(target, level)) {
+ // This can only happen if the compressed texture was allocated
+ // using TexStorage{2|3}D.
+ DCHECK(texture->IsImmutable());
+ GLsizei level_width = 0, level_height = 0, level_depth = 0;
+ bool success = texture->GetLevelSize(
+ target, level, &level_width, &level_height, &level_depth);
+ DCHECK(success);
+ if (xoffset == 0 && width == level_width &&
+ yoffset == 0 && height == level_height &&
+ zoffset == 0 && depth == level_depth) {
+ // We can skip the clear if we're uploading the entire level.
+ texture_manager()->SetLevelCleared(texture_ref, target, level, true);
+ } else {
+ texture_manager()->ClearTextureLevel(this, texture_ref, target, level);
+ }
+ DCHECK(texture->IsLevelCleared(target, level));
+ }
const CompressedFormatInfo* format_info =
GetCompressedFormatInfo(internal_format);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698