Jim Van Verth | 8026ccc | 2018-10-04 13:10:39 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2018 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 8 | #include "include/core/SkPromiseImageTexture.h" |
| 9 | #include "include/gpu/GrBackendSurface.h" |
| 10 | #include "include/gpu/GrContext.h" |
| 11 | #include "include/gpu/GrTexture.h" |
| 12 | #include "include/private/GrRecordingContext.h" |
| 13 | #include "src/core/SkBitmapCache.h" |
| 14 | #include "src/core/SkTLList.h" |
| 15 | #include "src/gpu/GrClip.h" |
| 16 | #include "src/gpu/GrContextPriv.h" |
Brian Salomon | f2ebdd9 | 2019-09-30 12:15:30 -0400 | [diff] [blame] | 17 | #include "src/gpu/GrImageInfo.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 18 | #include "src/gpu/GrRecordingContextPriv.h" |
| 19 | #include "src/gpu/GrRenderTargetContext.h" |
| 20 | #include "src/gpu/GrTextureAdjuster.h" |
| 21 | #include "src/gpu/effects/GrYUVtoRGBEffect.h" |
| 22 | #include "src/image/SkImage_Gpu.h" |
| 23 | #include "src/image/SkImage_GpuBase.h" |
| 24 | #include "src/image/SkReadPixelsRec.h" |
Jim Van Verth | 8026ccc | 2018-10-04 13:10:39 -0400 | [diff] [blame] | 25 | |
| 26 | SkImage_GpuBase::SkImage_GpuBase(sk_sp<GrContext> context, int width, int height, uint32_t uniqueID, |
Brian Salomon | 5ad6fd3 | 2019-03-21 15:30:08 -0400 | [diff] [blame] | 27 | SkColorType ct, SkAlphaType at, sk_sp<SkColorSpace> cs) |
| 28 | : INHERITED(SkImageInfo::Make(width, height, ct, at, std::move(cs)), uniqueID) |
| 29 | , fContext(std::move(context)) {} |
Jim Van Verth | 8026ccc | 2018-10-04 13:10:39 -0400 | [diff] [blame] | 30 | |
Brian Salomon | 729fc0c | 2019-09-30 16:33:11 +0000 | [diff] [blame] | 31 | SkImage_GpuBase::~SkImage_GpuBase() {} |
| 32 | |
Jim Van Verth | 8026ccc | 2018-10-04 13:10:39 -0400 | [diff] [blame] | 33 | ////////////////////////////////////////////////////////////////////////////////////////////////// |
| 34 | |
Robert Phillips | fd0d970 | 2019-02-01 10:19:42 -0500 | [diff] [blame] | 35 | #if GR_TEST_UTILS |
| 36 | void SkImage_GpuBase::resetContext(sk_sp<GrContext> newContext) { |
Robert Phillips | fe0963c | 2019-02-07 13:25:07 -0500 | [diff] [blame] | 37 | SkASSERT(fContext->priv().matches(newContext.get())); |
Robert Phillips | fd0d970 | 2019-02-01 10:19:42 -0500 | [diff] [blame] | 38 | fContext = newContext; |
| 39 | } |
| 40 | #endif |
| 41 | |
Robert Phillips | 62221e7 | 2019-07-24 15:07:38 -0400 | [diff] [blame] | 42 | bool SkImage_GpuBase::ValidateBackendTexture(const GrCaps* caps, const GrBackendTexture& tex, |
| 43 | GrColorType grCT, SkColorType ct, SkAlphaType at, |
Jim Van Verth | 8026ccc | 2018-10-04 13:10:39 -0400 | [diff] [blame] | 44 | sk_sp<SkColorSpace> cs) { |
| 45 | if (!tex.isValid()) { |
| 46 | return false; |
| 47 | } |
| 48 | // TODO: Create a SkImageColorInfo struct for color, alpha, and color space so we don't need to |
| 49 | // create a fake image info here. |
| 50 | SkImageInfo info = SkImageInfo::Make(1, 1, ct, at, cs); |
| 51 | if (!SkImageInfoIsValid(info)) { |
| 52 | return false; |
| 53 | } |
Brian Salomon | f391d0f | 2018-12-14 09:18:50 -0500 | [diff] [blame] | 54 | GrBackendFormat backendFormat = tex.getBackendFormat(); |
| 55 | if (!backendFormat.isValid()) { |
| 56 | return false; |
| 57 | } |
Greg Daniel | e877dce | 2019-07-11 10:52:43 -0400 | [diff] [blame] | 58 | |
Robert Phillips | 62221e7 | 2019-07-24 15:07:38 -0400 | [diff] [blame] | 59 | return caps->areColorTypeAndFormatCompatible(grCT, backendFormat); |
Jim Van Verth | 8026ccc | 2018-10-04 13:10:39 -0400 | [diff] [blame] | 60 | } |
| 61 | |
| 62 | ////////////////////////////////////////////////////////////////////////////////////////////////// |
| 63 | |
Brian Osman | e50cdf0 | 2018-10-19 13:02:14 -0400 | [diff] [blame] | 64 | bool SkImage_GpuBase::getROPixels(SkBitmap* dst, CachingHint chint) const { |
Robert Phillips | 920d488 | 2019-03-04 15:16:44 -0500 | [diff] [blame] | 65 | auto direct = fContext->priv().asDirectContext(); |
| 66 | if (!direct) { |
Jim Van Verth | 8026ccc | 2018-10-04 13:10:39 -0400 | [diff] [blame] | 67 | // DDL TODO: buffer up the readback so it occurs when the DDL is drawn? |
| 68 | return false; |
| 69 | } |
| 70 | |
Jim Van Verth | 8026ccc | 2018-10-04 13:10:39 -0400 | [diff] [blame] | 71 | const auto desc = SkBitmapCacheDesc::Make(this); |
| 72 | if (SkBitmapCache::Find(desc, dst)) { |
Jim Van Verth | 8026ccc | 2018-10-04 13:10:39 -0400 | [diff] [blame] | 73 | SkASSERT(dst->isImmutable()); |
| 74 | SkASSERT(dst->getPixels()); |
| 75 | return true; |
| 76 | } |
| 77 | |
| 78 | SkBitmapCache::RecPtr rec = nullptr; |
| 79 | SkPixmap pmap; |
| 80 | if (kAllow_CachingHint == chint) { |
Brian Salomon | 5ad6fd3 | 2019-03-21 15:30:08 -0400 | [diff] [blame] | 81 | rec = SkBitmapCache::Alloc(desc, this->imageInfo(), &pmap); |
Jim Van Verth | 8026ccc | 2018-10-04 13:10:39 -0400 | [diff] [blame] | 82 | if (!rec) { |
| 83 | return false; |
| 84 | } |
| 85 | } else { |
Brian Salomon | 5ad6fd3 | 2019-03-21 15:30:08 -0400 | [diff] [blame] | 86 | if (!dst->tryAllocPixels(this->imageInfo()) || !dst->peekPixels(&pmap)) { |
Jim Van Verth | 8026ccc | 2018-10-04 13:10:39 -0400 | [diff] [blame] | 87 | return false; |
| 88 | } |
| 89 | } |
| 90 | |
Greg Daniel | ba88ab6 | 2019-07-26 09:14:01 -0400 | [diff] [blame] | 91 | sk_sp<GrTextureProxy> texProxy = this->asTextureProxyRef(direct); |
| 92 | GrColorType grColorType = SkColorTypeAndFormatToGrColorType(fContext->priv().caps(), |
| 93 | this->colorType(), |
| 94 | texProxy->backendFormat()); |
| 95 | |
Brian Salomon | bf6b979 | 2019-08-21 09:38:10 -0400 | [diff] [blame] | 96 | auto sContext = direct->priv().makeWrappedSurfaceContext( |
| 97 | std::move(texProxy), grColorType, this->alphaType(), this->refColorSpace()); |
Jim Van Verth | 8026ccc | 2018-10-04 13:10:39 -0400 | [diff] [blame] | 98 | if (!sContext) { |
| 99 | return false; |
| 100 | } |
| 101 | |
Brian Salomon | 1d43530 | 2019-07-01 13:05:28 -0400 | [diff] [blame] | 102 | if (!sContext->readPixels(pmap.info(), pmap.writable_addr(), pmap.rowBytes(), {0, 0})) { |
Jim Van Verth | 8026ccc | 2018-10-04 13:10:39 -0400 | [diff] [blame] | 103 | return false; |
| 104 | } |
| 105 | |
| 106 | if (rec) { |
| 107 | SkBitmapCache::Add(std::move(rec), dst); |
| 108 | this->notifyAddedToRasterCache(); |
| 109 | } |
| 110 | return true; |
| 111 | } |
| 112 | |
Robert Phillips | 6603a17 | 2019-03-05 12:35:44 -0500 | [diff] [blame] | 113 | sk_sp<SkImage> SkImage_GpuBase::onMakeSubset(GrRecordingContext* context, |
| 114 | const SkIRect& subset) const { |
| 115 | if (!context || !fContext->priv().matches(context)) { |
| 116 | return nullptr; |
| 117 | } |
| 118 | |
| 119 | sk_sp<GrSurfaceProxy> proxy = this->asTextureProxyRef(context); |
Greg Daniel | c594e62 | 2019-10-15 14:01:49 -0400 | [diff] [blame] | 120 | GrColorType srcColorType = SkColorTypeToGrColorType(this->colorType()); |
Jim Van Verth | 8026ccc | 2018-10-04 13:10:39 -0400 | [diff] [blame] | 121 | |
Greg Daniel | 46cfbc6 | 2019-06-07 11:43:30 -0400 | [diff] [blame] | 122 | sk_sp<GrTextureProxy> copyProxy = GrSurfaceProxy::Copy( |
Greg Daniel | c594e62 | 2019-10-15 14:01:49 -0400 | [diff] [blame] | 123 | context, proxy.get(), srcColorType, GrMipMapped::kNo, subset, SkBackingFit::kExact, |
Greg Daniel | 46cfbc6 | 2019-06-07 11:43:30 -0400 | [diff] [blame] | 124 | proxy->isBudgeted()); |
Jim Van Verth | 8026ccc | 2018-10-04 13:10:39 -0400 | [diff] [blame] | 125 | |
Greg Daniel | 46cfbc6 | 2019-06-07 11:43:30 -0400 | [diff] [blame] | 126 | if (!copyProxy) { |
Jim Van Verth | 8026ccc | 2018-10-04 13:10:39 -0400 | [diff] [blame] | 127 | return nullptr; |
| 128 | } |
| 129 | |
| 130 | // MDB: this call is okay bc we know 'sContext' was kExact |
Brian Salomon | 729fc0c | 2019-09-30 16:33:11 +0000 | [diff] [blame] | 131 | return sk_make_sp<SkImage_Gpu>(fContext, kNeedNewImageUniqueID, this->alphaType(), |
| 132 | std::move(copyProxy), this->refColorSpace()); |
Jim Van Verth | 8026ccc | 2018-10-04 13:10:39 -0400 | [diff] [blame] | 133 | } |
| 134 | |
Jim Van Verth | 8bbce0e | 2018-10-08 14:34:52 -0400 | [diff] [blame] | 135 | bool SkImage_GpuBase::onReadPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRB, |
| 136 | int srcX, int srcY, CachingHint) const { |
Robert Phillips | 920d488 | 2019-03-04 15:16:44 -0500 | [diff] [blame] | 137 | auto direct = fContext->priv().asDirectContext(); |
| 138 | if (!direct) { |
Jim Van Verth | 8bbce0e | 2018-10-08 14:34:52 -0400 | [diff] [blame] | 139 | // DDL TODO: buffer up the readback so it occurs when the DDL is drawn? |
| 140 | return false; |
| 141 | } |
| 142 | |
Brian Salomon | 5ad6fd3 | 2019-03-21 15:30:08 -0400 | [diff] [blame] | 143 | if (!SkImageInfoValidConversion(dstInfo, this->imageInfo())) { |
Jim Van Verth | 8bbce0e | 2018-10-08 14:34:52 -0400 | [diff] [blame] | 144 | return false; |
| 145 | } |
| 146 | |
Greg Daniel | ba88ab6 | 2019-07-26 09:14:01 -0400 | [diff] [blame] | 147 | sk_sp<GrTextureProxy> texProxy = this->asTextureProxyRef(direct); |
| 148 | GrColorType grColorType = SkColorTypeAndFormatToGrColorType(fContext->priv().caps(), |
| 149 | this->colorType(), |
| 150 | texProxy->backendFormat()); |
| 151 | |
Brian Salomon | bf6b979 | 2019-08-21 09:38:10 -0400 | [diff] [blame] | 152 | auto sContext = direct->priv().makeWrappedSurfaceContext( |
Greg Daniel | ba88ab6 | 2019-07-26 09:14:01 -0400 | [diff] [blame] | 153 | std::move(texProxy), grColorType, this->alphaType(), this->refColorSpace()); |
Jim Van Verth | 8bbce0e | 2018-10-08 14:34:52 -0400 | [diff] [blame] | 154 | if (!sContext) { |
| 155 | return false; |
| 156 | } |
| 157 | |
Brian Salomon | 1d43530 | 2019-07-01 13:05:28 -0400 | [diff] [blame] | 158 | return sContext->readPixels(dstInfo, dstPixels, dstRB, {srcX, srcY}); |
Jim Van Verth | 8bbce0e | 2018-10-08 14:34:52 -0400 | [diff] [blame] | 159 | } |
| 160 | |
Robert Phillips | 9338c60 | 2019-02-19 12:52:29 -0500 | [diff] [blame] | 161 | sk_sp<GrTextureProxy> SkImage_GpuBase::asTextureProxyRef(GrRecordingContext* context, |
Jim Van Verth | 8026ccc | 2018-10-04 13:10:39 -0400 | [diff] [blame] | 162 | const GrSamplerState& params, |
Jim Van Verth | 8026ccc | 2018-10-04 13:10:39 -0400 | [diff] [blame] | 163 | SkScalar scaleAdjust[2]) const { |
Robert Phillips | 6603a17 | 2019-03-05 12:35:44 -0500 | [diff] [blame] | 164 | if (!context || !fContext->priv().matches(context)) { |
Jim Van Verth | 8026ccc | 2018-10-04 13:10:39 -0400 | [diff] [blame] | 165 | SkASSERT(0); |
| 166 | return nullptr; |
| 167 | } |
| 168 | |
Brian Salomon | d628747 | 2019-06-24 15:50:07 -0400 | [diff] [blame] | 169 | GrTextureAdjuster adjuster(fContext.get(), this->asTextureProxyRef(context), |
| 170 | SkColorTypeToGrColorType(this->colorType()), this->alphaType(), |
Brian Salomon | 5ad6fd3 | 2019-03-21 15:30:08 -0400 | [diff] [blame] | 171 | this->uniqueID(), this->colorSpace()); |
Brian Osman | 6064e1c | 2018-10-19 14:27:54 -0400 | [diff] [blame] | 172 | return adjuster.refTextureProxyForParams(params, scaleAdjust); |
Jim Van Verth | 8026ccc | 2018-10-04 13:10:39 -0400 | [diff] [blame] | 173 | } |
| 174 | |
| 175 | GrBackendTexture SkImage_GpuBase::onGetBackendTexture(bool flushPendingGrContextIO, |
| 176 | GrSurfaceOrigin* origin) const { |
Robert Phillips | 920d488 | 2019-03-04 15:16:44 -0500 | [diff] [blame] | 177 | auto direct = fContext->priv().asDirectContext(); |
| 178 | if (!direct) { |
| 179 | // This image was created with a DDL context and cannot be instantiated. |
Robert Phillips | 6603a17 | 2019-03-05 12:35:44 -0500 | [diff] [blame] | 180 | return GrBackendTexture(); // invalid |
Robert Phillips | 920d488 | 2019-03-04 15:16:44 -0500 | [diff] [blame] | 181 | } |
| 182 | |
Robert Phillips | 6603a17 | 2019-03-05 12:35:44 -0500 | [diff] [blame] | 183 | sk_sp<GrTextureProxy> proxy = this->asTextureProxyRef(direct); |
Jim Van Verth | 8026ccc | 2018-10-04 13:10:39 -0400 | [diff] [blame] | 184 | SkASSERT(proxy); |
| 185 | |
Robert Phillips | 920d488 | 2019-03-04 15:16:44 -0500 | [diff] [blame] | 186 | if (!proxy->isInstantiated()) { |
| 187 | auto resourceProvider = direct->priv().resourceProvider(); |
Jim Van Verth | 8026ccc | 2018-10-04 13:10:39 -0400 | [diff] [blame] | 188 | |
Robert Phillips | 920d488 | 2019-03-04 15:16:44 -0500 | [diff] [blame] | 189 | if (!proxy->instantiate(resourceProvider)) { |
| 190 | return GrBackendTexture(); // invalid |
| 191 | } |
Jim Van Verth | 8026ccc | 2018-10-04 13:10:39 -0400 | [diff] [blame] | 192 | } |
| 193 | |
| 194 | GrTexture* texture = proxy->peekTexture(); |
Jim Van Verth | 8026ccc | 2018-10-04 13:10:39 -0400 | [diff] [blame] | 195 | if (texture) { |
| 196 | if (flushPendingGrContextIO) { |
Greg Daniel | 4aa13e7 | 2019-04-15 14:42:20 -0400 | [diff] [blame] | 197 | direct->priv().flushSurface(proxy.get()); |
Jim Van Verth | 8026ccc | 2018-10-04 13:10:39 -0400 | [diff] [blame] | 198 | } |
| 199 | if (origin) { |
| 200 | *origin = proxy->origin(); |
| 201 | } |
| 202 | return texture->getBackendTexture(); |
| 203 | } |
| 204 | return GrBackendTexture(); // invalid |
| 205 | } |
| 206 | |
| 207 | GrTexture* SkImage_GpuBase::onGetTexture() const { |
| 208 | GrTextureProxy* proxy = this->peekProxy(); |
Robert Phillips | 193c421 | 2019-03-04 12:18:53 -0500 | [diff] [blame] | 209 | if (proxy && proxy->isInstantiated()) { |
| 210 | return proxy->peekTexture(); |
Jim Van Verth | 8026ccc | 2018-10-04 13:10:39 -0400 | [diff] [blame] | 211 | } |
| 212 | |
Robert Phillips | 193c421 | 2019-03-04 12:18:53 -0500 | [diff] [blame] | 213 | auto direct = fContext->priv().asDirectContext(); |
| 214 | if (!direct) { |
Jim Van Verth | 8026ccc | 2018-10-04 13:10:39 -0400 | [diff] [blame] | 215 | // This image was created with a DDL context and cannot be instantiated. |
| 216 | return nullptr; |
| 217 | } |
| 218 | |
Robert Phillips | 6603a17 | 2019-03-05 12:35:44 -0500 | [diff] [blame] | 219 | sk_sp<GrTextureProxy> proxyRef = this->asTextureProxyRef(direct); |
Robert Phillips | 193c421 | 2019-03-04 12:18:53 -0500 | [diff] [blame] | 220 | SkASSERT(proxyRef && !proxyRef->isInstantiated()); |
| 221 | |
| 222 | if (!proxyRef->instantiate(direct->priv().resourceProvider())) { |
Jim Van Verth | 8026ccc | 2018-10-04 13:10:39 -0400 | [diff] [blame] | 223 | return nullptr; |
| 224 | } |
| 225 | |
Robert Phillips | 193c421 | 2019-03-04 12:18:53 -0500 | [diff] [blame] | 226 | return proxyRef->peekTexture(); |
Jim Van Verth | 8026ccc | 2018-10-04 13:10:39 -0400 | [diff] [blame] | 227 | } |
| 228 | |
Jim Van Verth | 8026ccc | 2018-10-04 13:10:39 -0400 | [diff] [blame] | 229 | bool SkImage_GpuBase::onIsValid(GrContext* context) const { |
| 230 | // The base class has already checked that context isn't abandoned (if it's not nullptr) |
Robert Phillips | 920d488 | 2019-03-04 15:16:44 -0500 | [diff] [blame] | 231 | if (fContext->priv().abandoned()) { |
Jim Van Verth | 8026ccc | 2018-10-04 13:10:39 -0400 | [diff] [blame] | 232 | return false; |
| 233 | } |
| 234 | |
Robert Phillips | 920d488 | 2019-03-04 15:16:44 -0500 | [diff] [blame] | 235 | if (context && !fContext->priv().matches(context)) { |
Jim Van Verth | 8026ccc | 2018-10-04 13:10:39 -0400 | [diff] [blame] | 236 | return false; |
| 237 | } |
| 238 | |
| 239 | return true; |
| 240 | } |
Jim Van Verth | 8bbce0e | 2018-10-08 14:34:52 -0400 | [diff] [blame] | 241 | |
Jim Van Verth | 0e67194 | 2018-11-09 12:03:57 -0500 | [diff] [blame] | 242 | bool SkImage_GpuBase::MakeTempTextureProxies(GrContext* ctx, const GrBackendTexture yuvaTextures[], |
Jim Van Verth | 5327536 | 2018-11-09 15:42:35 -0500 | [diff] [blame] | 243 | int numTextures, const SkYUVAIndex yuvaIndices[4], |
| 244 | GrSurfaceOrigin imageOrigin, |
Jim Van Verth | 0e67194 | 2018-11-09 12:03:57 -0500 | [diff] [blame] | 245 | sk_sp<GrTextureProxy> tempTextureProxies[4]) { |
Robert Phillips | 9da87e0 | 2019-02-04 13:26:26 -0500 | [diff] [blame] | 246 | GrProxyProvider* proxyProvider = ctx->priv().proxyProvider(); |
Robert Phillips | c80b0e9 | 2019-07-23 10:27:09 -0400 | [diff] [blame] | 247 | const GrCaps* caps = ctx->priv().caps(); |
Jim Van Verth | 0e67194 | 2018-11-09 12:03:57 -0500 | [diff] [blame] | 248 | |
Jim Van Verth | 0e67194 | 2018-11-09 12:03:57 -0500 | [diff] [blame] | 249 | for (int textureIndex = 0; textureIndex < numTextures; ++textureIndex) { |
Robert Phillips | 62221e7 | 2019-07-24 15:07:38 -0400 | [diff] [blame] | 250 | GrBackendFormat backendFormat = yuvaTextures[textureIndex].getBackendFormat(); |
Brian Salomon | f391d0f | 2018-12-14 09:18:50 -0500 | [diff] [blame] | 251 | if (!backendFormat.isValid()) { |
| 252 | return false; |
| 253 | } |
Robert Phillips | 1cd1ed8 | 2019-07-23 13:21:01 -0400 | [diff] [blame] | 254 | |
Robert Phillips | 00c9f0d | 2019-08-02 17:17:35 -0400 | [diff] [blame] | 255 | GrColorType grColorType = caps->getYUVAColorTypeFromBackendFormat( |
| 256 | backendFormat, |
| 257 | yuvaIndices[3].fIndex == textureIndex); |
Robert Phillips | c80b0e9 | 2019-07-23 10:27:09 -0400 | [diff] [blame] | 258 | if (GrColorType::kUnknown == grColorType) { |
| 259 | return false; |
| 260 | } |
| 261 | |
Robert Phillips | 62221e7 | 2019-07-24 15:07:38 -0400 | [diff] [blame] | 262 | SkASSERT(yuvaTextures[textureIndex].isValid()); |
Jim Van Verth | 0e67194 | 2018-11-09 12:03:57 -0500 | [diff] [blame] | 263 | |
Brian Salomon | aa6ca0a | 2019-01-24 16:03:07 -0500 | [diff] [blame] | 264 | tempTextureProxies[textureIndex] = proxyProvider->wrapBackendTexture( |
Robert Phillips | 62221e7 | 2019-07-24 15:07:38 -0400 | [diff] [blame] | 265 | yuvaTextures[textureIndex], grColorType, imageOrigin, kBorrow_GrWrapOwnership, |
Brian Salomon | aa6ca0a | 2019-01-24 16:03:07 -0500 | [diff] [blame] | 266 | GrWrapCacheable::kNo, kRead_GrIOType); |
Jim Van Verth | 0e67194 | 2018-11-09 12:03:57 -0500 | [diff] [blame] | 267 | if (!tempTextureProxies[textureIndex]) { |
| 268 | return false; |
| 269 | } |
Jim Van Verth | 5327536 | 2018-11-09 15:42:35 -0500 | [diff] [blame] | 270 | |
| 271 | // Check that each texture contains the channel data for the corresponding YUVA index |
Robert Phillips | c80b0e9 | 2019-07-23 10:27:09 -0400 | [diff] [blame] | 272 | auto componentFlags = GrColorTypeComponentFlags(grColorType); |
Jim Van Verth | 5327536 | 2018-11-09 15:42:35 -0500 | [diff] [blame] | 273 | for (int yuvaIndex = 0; yuvaIndex < SkYUVAIndex::kIndexCount; ++yuvaIndex) { |
| 274 | if (yuvaIndices[yuvaIndex].fIndex == textureIndex) { |
| 275 | switch (yuvaIndices[yuvaIndex].fChannel) { |
| 276 | case SkColorChannel::kR: |
Robert Phillips | c80b0e9 | 2019-07-23 10:27:09 -0400 | [diff] [blame] | 277 | // TODO: Chrome needs to be patched before this can be |
| 278 | // enforced. |
| 279 | // if (!(kRed_SkColorTypeComponentFlag & componentFlags)) { |
| 280 | // return false; |
| 281 | // } |
| 282 | break; |
| 283 | case SkColorChannel::kG: |
| 284 | if (!(kGreen_SkColorTypeComponentFlag & componentFlags)) { |
Jim Van Verth | 5327536 | 2018-11-09 15:42:35 -0500 | [diff] [blame] | 285 | return false; |
| 286 | } |
| 287 | break; |
Jim Van Verth | 5327536 | 2018-11-09 15:42:35 -0500 | [diff] [blame] | 288 | case SkColorChannel::kB: |
Robert Phillips | c80b0e9 | 2019-07-23 10:27:09 -0400 | [diff] [blame] | 289 | if (!(kBlue_SkColorTypeComponentFlag & componentFlags)) { |
Jim Van Verth | 5327536 | 2018-11-09 15:42:35 -0500 | [diff] [blame] | 290 | return false; |
| 291 | } |
| 292 | break; |
| 293 | case SkColorChannel::kA: |
Robert Phillips | c80b0e9 | 2019-07-23 10:27:09 -0400 | [diff] [blame] | 294 | if (!(kAlpha_SkColorTypeComponentFlag & componentFlags)) { |
Jim Van Verth | 5327536 | 2018-11-09 15:42:35 -0500 | [diff] [blame] | 295 | return false; |
| 296 | } |
| 297 | break; |
| 298 | } |
| 299 | } |
| 300 | } |
Jim Van Verth | 0e67194 | 2018-11-09 12:03:57 -0500 | [diff] [blame] | 301 | } |
| 302 | |
| 303 | return true; |
| 304 | } |
| 305 | |
| 306 | bool SkImage_GpuBase::RenderYUVAToRGBA(GrContext* ctx, GrRenderTargetContext* renderTargetContext, |
| 307 | const SkRect& rect, SkYUVColorSpace yuvColorSpace, |
Brian Osman | e956049 | 2019-02-05 17:00:03 -0500 | [diff] [blame] | 308 | sk_sp<GrColorSpaceXform> colorSpaceXform, |
Jim Van Verth | 0e67194 | 2018-11-09 12:03:57 -0500 | [diff] [blame] | 309 | const sk_sp<GrTextureProxy> proxies[4], |
| 310 | const SkYUVAIndex yuvaIndices[4]) { |
| 311 | SkASSERT(renderTargetContext); |
| 312 | if (!renderTargetContext->asSurfaceProxy()) { |
| 313 | return false; |
| 314 | } |
| 315 | |
| 316 | GrPaint paint; |
| 317 | paint.setPorterDuffXPFactory(SkBlendMode::kSrc); |
| 318 | |
Brian Osman | e956049 | 2019-02-05 17:00:03 -0500 | [diff] [blame] | 319 | auto fp = GrYUVtoRGBEffect::Make(proxies, yuvaIndices, yuvColorSpace, |
| 320 | GrSamplerState::Filter::kNearest); |
| 321 | if (colorSpaceXform) { |
| 322 | fp = GrColorSpaceXformEffect::Make(std::move(fp), std::move(colorSpaceXform)); |
| 323 | } |
| 324 | paint.addColorFragmentProcessor(std::move(fp)); |
Jim Van Verth | 0e67194 | 2018-11-09 12:03:57 -0500 | [diff] [blame] | 325 | |
| 326 | renderTargetContext->drawRect(GrNoClip(), std::move(paint), GrAA::kNo, SkMatrix::I(), rect); |
Jim Van Verth | 0e67194 | 2018-11-09 12:03:57 -0500 | [diff] [blame] | 327 | return true; |
| 328 | } |
| 329 | |
Brian Salomon | be5a093 | 2018-12-10 10:03:26 -0500 | [diff] [blame] | 330 | sk_sp<GrTextureProxy> SkImage_GpuBase::MakePromiseImageLazyProxy( |
Robert Phillips | c80b0e9 | 2019-07-23 10:27:09 -0400 | [diff] [blame] | 331 | GrContext* context, int width, int height, GrSurfaceOrigin origin, GrColorType colorType, |
Brian Salomon | be5a093 | 2018-12-10 10:03:26 -0500 | [diff] [blame] | 332 | GrBackendFormat backendFormat, GrMipMapped mipMapped, |
Brian Salomon | cdd8a0a | 2019-01-10 12:09:52 -0500 | [diff] [blame] | 333 | PromiseImageTextureFulfillProc fulfillProc, |
| 334 | PromiseImageTextureReleaseProc releaseProc, |
| 335 | PromiseImageTextureDoneProc doneProc, |
Brian Salomon | 0cc5754 | 2019-03-08 13:28:46 -0500 | [diff] [blame] | 336 | PromiseImageTextureContext textureContext, |
| 337 | PromiseImageApiVersion version) { |
Brian Salomon | be5a093 | 2018-12-10 10:03:26 -0500 | [diff] [blame] | 338 | SkASSERT(context); |
| 339 | SkASSERT(width > 0 && height > 0); |
| 340 | SkASSERT(doneProc); |
Robert Phillips | c80b0e9 | 2019-07-23 10:27:09 -0400 | [diff] [blame] | 341 | SkASSERT(colorType != GrColorType::kUnknown); |
Brian Salomon | be5a093 | 2018-12-10 10:03:26 -0500 | [diff] [blame] | 342 | |
| 343 | if (!fulfillProc || !releaseProc) { |
| 344 | doneProc(textureContext); |
| 345 | return nullptr; |
Jim Van Verth | 8bbce0e | 2018-10-08 14:34:52 -0400 | [diff] [blame] | 346 | } |
| 347 | |
Brian Salomon | be5a093 | 2018-12-10 10:03:26 -0500 | [diff] [blame] | 348 | if (mipMapped == GrMipMapped::kYes && |
| 349 | GrTextureTypeHasRestrictedSampling(backendFormat.textureType())) { |
| 350 | // It is invalid to have a GL_TEXTURE_EXTERNAL or GL_TEXTURE_RECTANGLE and have mips as |
| 351 | // well. |
| 352 | doneProc(textureContext); |
| 353 | return nullptr; |
Jim Van Verth | 8bbce0e | 2018-10-08 14:34:52 -0400 | [diff] [blame] | 354 | } |
Brian Salomon | be5a093 | 2018-12-10 10:03:26 -0500 | [diff] [blame] | 355 | |
| 356 | /** |
Brian Salomon | cdd8a0a | 2019-01-10 12:09:52 -0500 | [diff] [blame] | 357 | * This class is the lazy instantiation callback for promise images. It manages calling the |
| 358 | * client's Fulfill, Release, and Done procs. It attempts to reuse a GrTexture instance in |
Brian Salomon | b2c5dae | 2019-03-04 10:25:17 -0500 | [diff] [blame] | 359 | * cases where the client provides the same SkPromiseImageTexture as Fulfill results for |
| 360 | * multiple SkImages. The created GrTexture is given a key based on a unique ID associated with |
| 361 | * the SkPromiseImageTexture. |
Brian Salomon | cdd8a0a | 2019-01-10 12:09:52 -0500 | [diff] [blame] | 362 | * |
Brian Salomon | b2c5dae | 2019-03-04 10:25:17 -0500 | [diff] [blame] | 363 | * The GrTexutre idle proc mechanism is used to call the Release and Done procs. We use this |
| 364 | * instead of the GrSurface release proc because the GrTexture is cached and therefore may |
| 365 | * outlive the proxy into which this callback is installed. |
| 366 | * |
| 367 | * A key invalidation message is installed on the SkPromiseImageTexture so that the GrTexture |
| 368 | * is deleted once it can no longer be used to instantiate a proxy. |
Brian Salomon | be5a093 | 2018-12-10 10:03:26 -0500 | [diff] [blame] | 369 | */ |
| 370 | class PromiseLazyInstantiateCallback { |
| 371 | public: |
Brian Salomon | cdd8a0a | 2019-01-10 12:09:52 -0500 | [diff] [blame] | 372 | PromiseLazyInstantiateCallback(PromiseImageTextureFulfillProc fulfillProc, |
| 373 | PromiseImageTextureReleaseProc releaseProc, |
| 374 | PromiseImageTextureDoneProc doneProc, |
| 375 | PromiseImageTextureContext context, |
Robert Phillips | c80b0e9 | 2019-07-23 10:27:09 -0400 | [diff] [blame] | 376 | GrColorType colorType, |
Brian Salomon | 0cc5754 | 2019-03-08 13:28:46 -0500 | [diff] [blame] | 377 | PromiseImageApiVersion version) |
| 378 | : fFulfillProc(fulfillProc) |
| 379 | , fReleaseProc(releaseProc) |
Robert Phillips | c80b0e9 | 2019-07-23 10:27:09 -0400 | [diff] [blame] | 380 | , fColorType(colorType) |
Brian Salomon | 0cc5754 | 2019-03-08 13:28:46 -0500 | [diff] [blame] | 381 | , fVersion(version) { |
Brian Salomon | e80b809 | 2019-03-08 13:25:19 -0500 | [diff] [blame] | 382 | fDoneCallback = sk_make_sp<GrRefCntedCallback>(doneProc, context); |
Brian Salomon | b2c5dae | 2019-03-04 10:25:17 -0500 | [diff] [blame] | 383 | } |
| 384 | PromiseLazyInstantiateCallback(PromiseLazyInstantiateCallback&&) = default; |
| 385 | PromiseLazyInstantiateCallback(const PromiseLazyInstantiateCallback&) { |
| 386 | // Because we get wrapped in std::function we must be copyable. But we should never |
| 387 | // be copied. |
| 388 | SkASSERT(false); |
| 389 | } |
| 390 | PromiseLazyInstantiateCallback& operator=(PromiseLazyInstantiateCallback&&) = default; |
| 391 | PromiseLazyInstantiateCallback& operator=(const PromiseLazyInstantiateCallback&) { |
| 392 | SkASSERT(false); |
| 393 | return *this; |
Brian Salomon | cdd8a0a | 2019-01-10 12:09:52 -0500 | [diff] [blame] | 394 | } |
Brian Salomon | 553610d | 2019-01-14 17:34:12 -0500 | [diff] [blame] | 395 | |
Brian Salomon | 88b8d11 | 2019-03-07 15:25:34 +0000 | [diff] [blame] | 396 | ~PromiseLazyInstantiateCallback() { |
Brian Salomon | 876a017 | 2019-03-08 11:12:14 -0500 | [diff] [blame] | 397 | // Our destructor can run on any thread. We trigger the unref of fTexture by message. |
Robert Phillips | ddc2148 | 2019-10-16 14:30:09 -0400 | [diff] [blame^] | 398 | // This unreffed texture pointer is a real problem! When the context has been |
| 399 | // abandoned, the GrTexture pointed to by this pointer is deleted! Due to virtual |
| 400 | // inheritance any manipulation of this pointer at that point will cause a crash. |
| 401 | // For now we "work around" the problem by just passing it, untouched, into the |
| 402 | // message bus but this very fragile. |
| 403 | // In the future the GrSurface class hierarchy refactoring should eliminate this |
| 404 | // difficulty by removing the virtual inheritance. |
Brian Salomon | 876a017 | 2019-03-08 11:12:14 -0500 | [diff] [blame] | 405 | if (fTexture) { |
Robert Phillips | ddc2148 | 2019-10-16 14:30:09 -0400 | [diff] [blame^] | 406 | SkMessageBus<GrTextureFreedMessage>::Post({fTexture, fTextureContextID}); |
Brian Salomon | 876a017 | 2019-03-08 11:12:14 -0500 | [diff] [blame] | 407 | } |
Brian Salomon | 88b8d11 | 2019-03-07 15:25:34 +0000 | [diff] [blame] | 408 | } |
| 409 | |
Brian Salomon | beb7f52 | 2019-08-30 16:19:42 -0400 | [diff] [blame] | 410 | GrSurfaceProxy::LazyCallbackResult operator()(GrResourceProvider* resourceProvider) { |
Brian Salomon | b6a3a3b | 2019-04-01 12:29:34 -0400 | [diff] [blame] | 411 | // We use the unique key in a way that is unrelated to the SkImage-based key that the |
| 412 | // proxy may receive, hence kUnsynced. |
| 413 | static constexpr auto kKeySyncMode = |
| 414 | GrSurfaceProxy::LazyInstantiationKeyMode::kUnsynced; |
| 415 | |
Brian Salomon | beb7f52 | 2019-08-30 16:19:42 -0400 | [diff] [blame] | 416 | // In order to make the SkImage "thread safe" we rely on holding an extra ref to the |
| 417 | // texture in the callback and signalling the unref via a message to the resource cache. |
| 418 | // We need to extend the callback's lifetime to that of the proxy. |
| 419 | static constexpr auto kReleaseCallbackOnInstantiation = false; |
| 420 | |
Brian Salomon | 876a017 | 2019-03-08 11:12:14 -0500 | [diff] [blame] | 421 | // Our proxy is getting instantiated for the second+ time. We are only allowed to call |
| 422 | // Fulfill once. So return our cached result. |
| 423 | if (fTexture) { |
Brian Salomon | beb7f52 | 2019-08-30 16:19:42 -0400 | [diff] [blame] | 424 | return {sk_ref_sp(fTexture), kReleaseCallbackOnInstantiation, kKeySyncMode}; |
Robert Phillips | c80b0e9 | 2019-07-23 10:27:09 -0400 | [diff] [blame] | 425 | } else if (fColorType == GrColorType::kUnknown) { |
Brian Salomon | d538d3d | 2019-04-04 12:18:17 -0400 | [diff] [blame] | 426 | // We've already called fulfill and it failed. Our contract says that we should only |
| 427 | // call each callback once. |
| 428 | return {}; |
Brian Salomon | 876a017 | 2019-03-08 11:12:14 -0500 | [diff] [blame] | 429 | } |
Brian Salomon | e80b809 | 2019-03-08 13:25:19 -0500 | [diff] [blame] | 430 | SkASSERT(fDoneCallback); |
| 431 | PromiseImageTextureContext textureContext = fDoneCallback->context(); |
Brian Salomon | b2c5dae | 2019-03-04 10:25:17 -0500 | [diff] [blame] | 432 | sk_sp<SkPromiseImageTexture> promiseTexture = fFulfillProc(textureContext); |
| 433 | // From here on out our contract is that the release proc must be called, even if |
| 434 | // the return from fulfill was invalid or we fail for some other reason. |
Brian Salomon | e80b809 | 2019-03-08 13:25:19 -0500 | [diff] [blame] | 435 | auto releaseCallback = sk_make_sp<GrRefCntedCallback>(fReleaseProc, textureContext); |
Brian Salomon | cdd8a0a | 2019-01-10 12:09:52 -0500 | [diff] [blame] | 436 | if (!promiseTexture) { |
Brian Salomon | d538d3d | 2019-04-04 12:18:17 -0400 | [diff] [blame] | 437 | // This records that we have failed. |
Robert Phillips | c80b0e9 | 2019-07-23 10:27:09 -0400 | [diff] [blame] | 438 | fColorType = GrColorType::kUnknown; |
Brian Salomon | b6a3a3b | 2019-04-01 12:29:34 -0400 | [diff] [blame] | 439 | return {}; |
Brian Salomon | cdd8a0a | 2019-01-10 12:09:52 -0500 | [diff] [blame] | 440 | } |
Brian Salomon | cdd8a0a | 2019-01-10 12:09:52 -0500 | [diff] [blame] | 441 | |
Robert Phillips | 62221e7 | 2019-07-24 15:07:38 -0400 | [diff] [blame] | 442 | const GrBackendTexture& backendTexture = promiseTexture->backendTexture(); |
Brian Salomon | cdd8a0a | 2019-01-10 12:09:52 -0500 | [diff] [blame] | 443 | if (!backendTexture.isValid()) { |
Brian Salomon | b6a3a3b | 2019-04-01 12:29:34 -0400 | [diff] [blame] | 444 | return {}; |
Brian Salomon | 559c617 | 2019-01-10 10:23:44 -0500 | [diff] [blame] | 445 | } |
| 446 | |
Brian Salomon | f55e8d5 | 2019-01-30 17:28:20 -0500 | [diff] [blame] | 447 | sk_sp<GrTexture> tex; |
Brian Salomon | cdd8a0a | 2019-01-10 12:09:52 -0500 | [diff] [blame] | 448 | static const GrUniqueKey::Domain kDomain = GrUniqueKey::GenerateDomain(); |
Brian Salomon | 7d88f31 | 2019-02-28 10:03:03 -0500 | [diff] [blame] | 449 | GrUniqueKey key; |
| 450 | GrUniqueKey::Builder builder(&key, kDomain, 2, "promise"); |
Brian Salomon | cdd8a0a | 2019-01-10 12:09:52 -0500 | [diff] [blame] | 451 | builder[0] = promiseTexture->uniqueID(); |
Robert Phillips | c80b0e9 | 2019-07-23 10:27:09 -0400 | [diff] [blame] | 452 | builder[1] = (uint32_t) fColorType; |
Brian Salomon | cdd8a0a | 2019-01-10 12:09:52 -0500 | [diff] [blame] | 453 | builder.finish(); |
Brian Salomon | 0d60676 | 2019-01-25 09:58:38 -0500 | [diff] [blame] | 454 | // A texture with this key may already exist from a different instance of this lazy |
| 455 | // callback. This could happen if the client fulfills a promise image with a texture |
| 456 | // that was previously used to fulfill a different promise image. |
Brian Salomon | 7d88f31 | 2019-02-28 10:03:03 -0500 | [diff] [blame] | 457 | if (auto surf = resourceProvider->findByUniqueKey<GrSurface>(key)) { |
Brian Salomon | 0d60676 | 2019-01-25 09:58:38 -0500 | [diff] [blame] | 458 | tex = sk_ref_sp(surf->asTexture()); |
| 459 | SkASSERT(tex); |
| 460 | } else { |
| 461 | if ((tex = resourceProvider->wrapBackendTexture( |
Robert Phillips | c80b0e9 | 2019-07-23 10:27:09 -0400 | [diff] [blame] | 462 | backendTexture, fColorType, kBorrow_GrWrapOwnership, |
| 463 | GrWrapCacheable::kYes, kRead_GrIOType))) { |
Brian Salomon | 7d88f31 | 2019-02-28 10:03:03 -0500 | [diff] [blame] | 464 | tex->resourcePriv().setUniqueKey(key); |
Brian Salomon | 0d60676 | 2019-01-25 09:58:38 -0500 | [diff] [blame] | 465 | } else { |
Brian Salomon | b6a3a3b | 2019-04-01 12:29:34 -0400 | [diff] [blame] | 466 | return {}; |
Brian Salomon | 0d60676 | 2019-01-25 09:58:38 -0500 | [diff] [blame] | 467 | } |
| 468 | } |
Brian Salomon | 0cc5754 | 2019-03-08 13:28:46 -0500 | [diff] [blame] | 469 | auto releaseIdleState = fVersion == PromiseImageApiVersion::kLegacy |
| 470 | ? GrTexture::IdleState::kFinished |
| 471 | : GrTexture::IdleState::kFlushed; |
| 472 | tex->addIdleProc(std::move(releaseCallback), releaseIdleState); |
Brian Salomon | e80b809 | 2019-03-08 13:25:19 -0500 | [diff] [blame] | 473 | tex->addIdleProc(std::move(fDoneCallback), GrTexture::IdleState::kFinished); |
Brian Salomon | b2c5dae | 2019-03-04 10:25:17 -0500 | [diff] [blame] | 474 | promiseTexture->addKeyToInvalidate(tex->getContext()->priv().contextID(), key); |
Brian Salomon | 876a017 | 2019-03-08 11:12:14 -0500 | [diff] [blame] | 475 | fTexture = tex.get(); |
| 476 | // We need to hold on to the GrTexture in case our proxy gets reinstantiated. However, |
| 477 | // we can't unref in our destructor because we may be on another thread then. So we |
| 478 | // let the cache know it is waiting on an unref message. We will send that message from |
| 479 | // our destructor. |
| 480 | GrContext* context = fTexture->getContext(); |
Robert Phillips | ddc2148 | 2019-10-16 14:30:09 -0400 | [diff] [blame^] | 481 | context->priv().getResourceCache()->insertDelayedTextureUnref(fTexture); |
Brian Salomon | 876a017 | 2019-03-08 11:12:14 -0500 | [diff] [blame] | 482 | fTextureContextID = context->priv().contextID(); |
Brian Salomon | beb7f52 | 2019-08-30 16:19:42 -0400 | [diff] [blame] | 483 | return {std::move(tex), kReleaseCallbackOnInstantiation, kKeySyncMode}; |
Brian Salomon | be5a093 | 2018-12-10 10:03:26 -0500 | [diff] [blame] | 484 | } |
| 485 | |
| 486 | private: |
Brian Salomon | e80b809 | 2019-03-08 13:25:19 -0500 | [diff] [blame] | 487 | PromiseImageTextureFulfillProc fFulfillProc; |
| 488 | PromiseImageTextureReleaseProc fReleaseProc; |
| 489 | sk_sp<GrRefCntedCallback> fDoneCallback; |
Brian Salomon | 876a017 | 2019-03-08 11:12:14 -0500 | [diff] [blame] | 490 | GrTexture* fTexture = nullptr; |
| 491 | uint32_t fTextureContextID = SK_InvalidUniqueID; |
Robert Phillips | c80b0e9 | 2019-07-23 10:27:09 -0400 | [diff] [blame] | 492 | GrColorType fColorType; |
Brian Salomon | 0cc5754 | 2019-03-08 13:28:46 -0500 | [diff] [blame] | 493 | PromiseImageApiVersion fVersion; |
Robert Phillips | c80b0e9 | 2019-07-23 10:27:09 -0400 | [diff] [blame] | 494 | } callback(fulfillProc, releaseProc, doneProc, textureContext, colorType, version); |
Brian Salomon | be5a093 | 2018-12-10 10:03:26 -0500 | [diff] [blame] | 495 | |
Robert Phillips | 9da87e0 | 2019-02-04 13:26:26 -0500 | [diff] [blame] | 496 | GrProxyProvider* proxyProvider = context->priv().proxyProvider(); |
Brian Salomon | be5a093 | 2018-12-10 10:03:26 -0500 | [diff] [blame] | 497 | |
Robert Phillips | c80b0e9 | 2019-07-23 10:27:09 -0400 | [diff] [blame] | 498 | GrPixelConfig config = context->priv().caps()->getConfigFromBackendFormat( |
| 499 | backendFormat, |
| 500 | colorType); |
| 501 | |
Brian Salomon | be5a093 | 2018-12-10 10:03:26 -0500 | [diff] [blame] | 502 | GrSurfaceDesc desc; |
| 503 | desc.fWidth = width; |
| 504 | desc.fHeight = height; |
| 505 | desc.fConfig = config; |
| 506 | |
Chris Dalton | 95d8ceb | 2019-07-30 11:17:59 -0600 | [diff] [blame] | 507 | // Ganesh assumes that, when wrapping a mipmapped backend texture from a client, that its |
| 508 | // mipmaps are fully fleshed out. |
| 509 | GrMipMapsStatus mipMapsStatus = (GrMipMapped::kYes == mipMapped) |
| 510 | ? GrMipMapsStatus::kValid : GrMipMapsStatus::kNotAllocated; |
| 511 | |
Brian Salomon | be5a093 | 2018-12-10 10:03:26 -0500 | [diff] [blame] | 512 | // We pass kReadOnly here since we should treat content of the client's texture as immutable. |
Brian Salomon | e8a766b | 2019-07-19 14:24:36 -0400 | [diff] [blame] | 513 | // The promise API provides no way for the client to indicated that the texture is protected. |
Brian Salomon | f2c2ba9 | 2019-07-17 09:59:59 -0400 | [diff] [blame] | 514 | return proxyProvider->createLazyProxy( |
Brian Salomon | 27b4d8d | 2019-07-22 14:23:45 -0400 | [diff] [blame] | 515 | std::move(callback), backendFormat, desc, GrRenderable::kNo, 1, origin, mipMapped, |
Chris Dalton | 95d8ceb | 2019-07-30 11:17:59 -0600 | [diff] [blame] | 516 | mipMapsStatus, GrInternalSurfaceFlags::kReadOnly, SkBackingFit::kExact, SkBudgeted::kNo, |
Brian Salomon | beb7f52 | 2019-08-30 16:19:42 -0400 | [diff] [blame] | 517 | GrProtected::kNo, GrSurfaceProxy::UseAllocator::kYes); |
Jim Van Verth | 8bbce0e | 2018-10-08 14:34:52 -0400 | [diff] [blame] | 518 | } |