aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/SkGr.cpp
diff options
context:
space:
mode:
authorGravatar krajcevski <krajcevski@google.com>2014-06-05 07:03:39 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-06-05 07:03:39 -0700
commit9a3cdbb3d0957ad3f04d02277a4ce839752f4efd (patch)
treede439666242e8524cb859b5c50151d14300e1125 /src/gpu/SkGr.cpp
parent4962140c9e6623b29417a2fb9ad903641fb0159c (diff)
Two new benches for ETC1 bitmaps.
First bench: Simply render from a compressed ETC1 bitmap. This is roughly equal between compressed and uncompressed data. Second bench: Notify the bitmap that the pixels have changed (that's right, like a liar) to force a re-upload to the GPU. On this bench, decompressed textures seem to inexplicably do an order of magnitude better than compressed textures when it should be the other way around, but that investigation is reserved for a future CL. R=robertphillips@google.com Author: krajcevski@google.com Review URL: https://codereview.chromium.org/317023002
Diffstat (limited to 'src/gpu/SkGr.cpp')
-rw-r--r--src/gpu/SkGr.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp
index 31372cd02a..fb2ebdd53f 100644
--- a/src/gpu/SkGr.cpp
+++ b/src/gpu/SkGr.cpp
@@ -244,7 +244,18 @@ static GrTexture* sk_gr_create_bitmap_texture(GrContext* ctx,
// Is this an ETC1 encoded texture?
#ifndef SK_IGNORE_ETC1_SUPPORT
- else if (cache && ctx->getGpu()->caps()->isConfigTexturable(kETC1_GrPixelConfig)) {
+ else if (
+ // We do not support scratch ETC1 textures, hence they should all be at least
+ // trying to go to the cache.
+ cache
+ // Make sure that the underlying device supports ETC1 textures before we go ahead
+ // and check the data.
+ && ctx->getGpu()->caps()->isConfigTexturable(kETC1_GrPixelConfig)
+ // If the bitmap had compressed data and was then uncompressed, it'll still return
+ // compressed data on 'refEncodedData' and upload it. Probably not good, since if
+ // the bitmap has available pixels, then they might not be what the decompressed
+ // data is.
+ && !(bitmap->readyToDraw())) {
GrTexture *texture = load_etc1_texture(ctx, params, *bitmap, desc);
if (NULL != texture) {
return texture;