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

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

Issue 1925093002: Handle compressed textures allocated via TexStorage2D. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed gpu_unittests after last refactor. Created 4 years, 8 months 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
Index: gpu/command_buffer/service/texture_manager.cc
diff --git a/gpu/command_buffer/service/texture_manager.cc b/gpu/command_buffer/service/texture_manager.cc
index b904fc9558b9d933df5eb00f4599ad0cb4937ba6..9b61279b3db06d85b65ee3cc765a65866e012374 100644
--- a/gpu/command_buffer/service/texture_manager.cc
+++ b/gpu/command_buffer/service/texture_manager.cc
@@ -1424,30 +1424,45 @@ bool Texture::ClearLevel(
if (!cleared)
return false;
} else {
- // Clear all remaining sub regions.
- const int x[] = {
+ if (decoder->IsCompressedTextureFormat(info.internal_format)) {
+ // An uncleared level of a compressed texture can only occur when
+ // allocating the texture with TexStorage2D. In this case the level
+ // is cleared just before a call to CompressedTexSubImage2D, to avoid
+ // having to clear a sub-rectangle of a compressed texture, which
+ // would be problematic.
+ DCHECK(IsImmutable());
+ DCHECK(info.cleared_rect == gfx::Rect());
+ bool cleared = decoder->ClearCompressedTextureLevel(
+ this, info.target, info.level, info.internal_format,
+ info.width, info.height);
+ if (!cleared)
+ return false;
+ } else {
+ // Clear all remaining sub regions.
+ const int x[] = {
0, info.cleared_rect.x(), info.cleared_rect.right(), info.width};
- const int y[] = {
+ const int y[] = {
0, info.cleared_rect.y(), info.cleared_rect.bottom(), info.height};
- for (size_t j = 0; j < 3; ++j) {
- for (size_t i = 0; i < 3; ++i) {
- // Center of nine patch is already cleared.
- if (j == 1 && i == 1)
- continue;
-
- gfx::Rect rect(x[i], y[j], x[i + 1] - x[i], y[j + 1] - y[j]);
- if (rect.IsEmpty())
- continue;
-
- // NOTE: It seems kind of gross to call back into the decoder for this
- // but only the decoder knows all the state (like unpack_alignment_)
- // that's needed to be able to call GL correctly.
- bool cleared = decoder->ClearLevel(
- this, info.target, info.level, info.format, info.type,
- rect.x(), rect.y(), rect.width(), rect.height());
- if (!cleared)
- return false;
+ for (size_t j = 0; j < 3; ++j) {
+ for (size_t i = 0; i < 3; ++i) {
+ // Center of nine patch is already cleared.
+ if (j == 1 && i == 1)
+ continue;
+
+ gfx::Rect rect(x[i], y[j], x[i + 1] - x[i], y[j + 1] - y[j]);
+ if (rect.IsEmpty())
+ continue;
+
+ // NOTE: It seems kind of gross to call back into the decoder for this
+ // but only the decoder knows all the state (like unpack_alignment_)
+ // that's needed to be able to call GL correctly.
+ bool cleared = decoder->ClearLevel(
+ this, info.target, info.level, info.format, info.type,
+ rect.x(), rect.y(), rect.width(), rect.height());
+ if (!cleared)
+ return false;
+ }
}
}
}
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder_mock.h ('k') | gpu/command_buffer/service/texture_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698