aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrProxyProvider.cpp
diff options
context:
space:
mode:
authorGravatar Greg Daniel <egdaniel@google.com>2018-02-14 21:10:02 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-02-14 21:10:15 +0000
commit7080a431a70c8323f127ee4ed76375d438c9a860 (patch)
treef52eb6ea80c25ce19417e1878ae65da74ee0e65a /src/gpu/GrProxyProvider.cpp
parentcb25659eb152fe89efb7a44147853dda5e62b38d (diff)
Revert "Revert "Revert "When creating emptyp MipMap proxies, don't instantiate them immediately."""
This reverts commit 95edb43251e8fcef4286c91d334c3259940a0095. Reason for revert: breaking Ubuntu Linux GMs Original change's description: > Revert "Revert "When creating emptyp MipMap proxies, don't instantiate them immediately."" > > This reverts commit 0ee866dac78b60497b4c107995d3c2747309ef8b. > > Reason for revert: <INSERT REASONING HERE> > > Original change's description: > > Revert "When creating emptyp MipMap proxies, don't instantiate them immediately." > > > > This reverts commit 8242c5c199f5d04e4209222b265f9e27f7c55fa7. > > > > Reason for revert: Hitting assert on intel bots on skbug6850overlay2.skp, SkASSERT(proxy->getUniqueKey().isValid()); in processInvalidProxyUniqueKey > > > > Original change's description: > > > When creating emptyp MipMap proxies, don't instantiate them immediately. > > > > > > This chnages makes it match how we handle non mipped proxies where we > > > don't actually instantiate them until we need to. > > > > > > Bug: skia: > > > Change-Id: Id0c50eefce43ef1458a3ff0bb1881a817b045279 > > > Reviewed-on: https://skia-review.googlesource.com/106966 > > > Commit-Queue: Greg Daniel <egdaniel@google.com> > > > Reviewed-by: Robert Phillips <robertphillips@google.com> > > > > TBR=egdaniel@google.com,robertphillips@google.com > > > > Change-Id: I1fa6165b69c5bbb1d6bb10abba33dcdb55a27ba3 > > No-Presubmit: true > > No-Tree-Checks: true > > No-Try: true > > Bug: skia: > > Reviewed-on: https://skia-review.googlesource.com/107263 > > Reviewed-by: Greg Daniel <egdaniel@google.com> > > Commit-Queue: Greg Daniel <egdaniel@google.com> > > TBR=egdaniel@google.com,robertphillips@google.com > > Bug: skia: > Change-Id: Ice34283f9ac183faed6e061d8162cf2226b18289 > Reviewed-on: https://skia-review.googlesource.com/107320 > Reviewed-by: Robert Phillips <robertphillips@google.com> > Commit-Queue: Greg Daniel <egdaniel@google.com> TBR=egdaniel@google.com,robertphillips@google.com Change-Id: I53f166d508cc8ccd71e7473934a12a52f2eba7bb No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: skia: Reviewed-on: https://skia-review.googlesource.com/107321 Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'src/gpu/GrProxyProvider.cpp')
-rw-r--r--src/gpu/GrProxyProvider.cpp40
1 files changed, 25 insertions, 15 deletions
diff --git a/src/gpu/GrProxyProvider.cpp b/src/gpu/GrProxyProvider.cpp
index e520046e7c..d051bfdc13 100644
--- a/src/gpu/GrProxyProvider.cpp
+++ b/src/gpu/GrProxyProvider.cpp
@@ -252,7 +252,28 @@ sk_sp<GrTextureProxy> GrProxyProvider::createMipMapProxy(const GrSurfaceDesc& de
return nullptr;
}
- return this->createProxy(desc, GrMipMapped::kYes, SkBackingFit::kExact, budgeted, 0);
+ // SkMipMap doesn't include the base level in the level count so we have to add 1
+ int mipCount = SkMipMap::ComputeLevelCount(desc.fWidth, desc.fHeight) + 1;
+ if (1 == mipCount) {
+ return this->createProxy(desc, SkBackingFit::kExact, budgeted);
+ }
+
+ std::unique_ptr<GrMipLevel[]> texels(new GrMipLevel[mipCount]);
+
+ // We don't want to upload any texel data
+ for (int i = 0; i < mipCount; i++) {
+ texels[i].fPixels = nullptr;
+ texels[i].fRowBytes = 0;
+ }
+
+ sk_sp<GrTexture> tex(fResourceProvider->createTexture(desc, budgeted,
+ texels.get(), mipCount,
+ SkDestinationSurfaceColorMode::kLegacy));
+ if (!tex) {
+ return nullptr;
+ }
+
+ return this->createWrapped(std::move(tex), desc.fOrigin);
}
sk_sp<GrTextureProxy> GrProxyProvider::createMipMapProxyFromBitmap(const SkBitmap& bitmap,
@@ -340,21 +361,12 @@ sk_sp<GrTextureProxy> GrProxyProvider::createMipMapProxyFromBitmap(const SkBitma
}
sk_sp<GrTextureProxy> GrProxyProvider::createProxy(const GrSurfaceDesc& desc,
- GrMipMapped mipMapped,
SkBackingFit fit,
SkBudgeted budgeted,
uint32_t flags) {
SkASSERT(0 == flags || GrResourceProvider::kNoPendingIO_Flag == flags);
- if (GrMipMapped::kYes == mipMapped) {
- // SkMipMap doesn't include the base level in the level count so we have to add 1
- int mipCount = SkMipMap::ComputeLevelCount(desc.fWidth, desc.fHeight) + 1;
- if (1 == mipCount) {
- mipMapped = GrMipMapped::kNo;
- }
- }
-
- if (!this->caps()->validateSurfaceDesc(desc, mipMapped)) {
+ if (!this->caps()->validateSurfaceDesc(desc, GrMipMapped::kNo)) {
return nullptr;
}
GrSurfaceDesc copyDesc = desc;
@@ -367,12 +379,10 @@ sk_sp<GrTextureProxy> GrProxyProvider::createProxy(const GrSurfaceDesc& desc,
// We know anything we instantiate later from this deferred path will be
// both texturable and renderable
return sk_sp<GrTextureProxy>(
- new GrTextureRenderTargetProxy(*this->caps(), copyDesc, mipMapped, fit, budgeted,
- flags));
+ new GrTextureRenderTargetProxy(*this->caps(), copyDesc, fit, budgeted, flags));
}
- return sk_sp<GrTextureProxy>(new GrTextureProxy(copyDesc, mipMapped, fit, budgeted, nullptr, 0,
- flags));
+ return sk_sp<GrTextureProxy>(new GrTextureProxy(copyDesc, fit, budgeted, nullptr, 0, flags));
}
sk_sp<GrTextureProxy> GrProxyProvider::createWrappedTextureProxy(