Robert Phillips | dbaf317 | 2019-02-06 15:12:53 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2019 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 "src/gpu/GrContextPriv.h" |
Robert Phillips | dbaf317 | 2019-02-06 15:12:53 -0500 | [diff] [blame] | 9 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 10 | #include "include/gpu/GrContextThreadSafeProxy.h" |
| 11 | #include "include/gpu/GrTexture.h" |
| 12 | #include "include/private/GrSkSLFPFactoryCache.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 13 | #include "src/gpu/GrContextThreadSafeProxyPriv.h" |
| 14 | #include "src/gpu/GrDrawingManager.h" |
| 15 | #include "src/gpu/GrGpu.h" |
| 16 | #include "src/gpu/GrMemoryPool.h" |
| 17 | #include "src/gpu/GrRenderTargetContext.h" |
Greg Daniel | 46cfbc6 | 2019-06-07 11:43:30 -0400 | [diff] [blame^] | 18 | #include "src/gpu/GrSurfaceContextPriv.h" |
Mike Klein | 4b432fa | 2019-06-06 11:44:05 -0500 | [diff] [blame] | 19 | #include "src/gpu/GrSurfacePriv.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 20 | #include "src/gpu/GrTextureContext.h" |
| 21 | #include "src/gpu/SkGr.h" |
Greg Daniel | 6eb8c24 | 2019-06-05 10:22:24 -0400 | [diff] [blame] | 22 | #include "src/gpu/effects/generated/GrConfigConversionEffect.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 23 | #include "src/gpu/text/GrTextBlobCache.h" |
| 24 | #include "src/image/SkImage_Base.h" |
| 25 | #include "src/image/SkImage_Gpu.h" |
Robert Phillips | dbaf317 | 2019-02-06 15:12:53 -0500 | [diff] [blame] | 26 | |
Brian Salomon | f9a1fdf | 2019-05-09 10:30:12 -0400 | [diff] [blame] | 27 | #define ASSERT_OWNED_PROXY(P) \ |
Robert Phillips | dbaf317 | 2019-02-06 15:12:53 -0500 | [diff] [blame] | 28 | SkASSERT(!(P) || !((P)->peekTexture()) || (P)->peekTexture()->getContext() == fContext) |
Brian Salomon | f9a1fdf | 2019-05-09 10:30:12 -0400 | [diff] [blame] | 29 | #define ASSERT_SINGLE_OWNER \ |
Robert Phillips | a41c685 | 2019-02-07 10:44:10 -0500 | [diff] [blame] | 30 | SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(fContext->singleOwner());) |
Brian Salomon | f9a1fdf | 2019-05-09 10:30:12 -0400 | [diff] [blame] | 31 | #define RETURN_VALUE_IF_ABANDONED(value) if (fContext->abandoned()) { return (value); } |
| 32 | #define RETURN_IF_ABANDONED RETURN_VALUE_IF_ABANDONED(void) |
Robert Phillips | dbaf317 | 2019-02-06 15:12:53 -0500 | [diff] [blame] | 33 | |
Robert Phillips | a41c685 | 2019-02-07 10:44:10 -0500 | [diff] [blame] | 34 | sk_sp<const GrCaps> GrContextPriv::refCaps() const { |
| 35 | return fContext->refCaps(); |
| 36 | } |
| 37 | |
Robert Phillips | dbaf317 | 2019-02-06 15:12:53 -0500 | [diff] [blame] | 38 | sk_sp<GrSkSLFPFactoryCache> GrContextPriv::fpFactoryCache() { |
| 39 | return fContext->fpFactoryCache(); |
| 40 | } |
| 41 | |
| 42 | sk_sp<GrOpMemoryPool> GrContextPriv::refOpMemoryPool() { |
Robert Phillips | d684148 | 2019-02-08 10:29:20 -0500 | [diff] [blame] | 43 | return fContext->refOpMemoryPool(); |
Robert Phillips | dbaf317 | 2019-02-06 15:12:53 -0500 | [diff] [blame] | 44 | } |
| 45 | |
Robert Phillips | c5058a6 | 2019-02-15 12:52:59 -0500 | [diff] [blame] | 46 | void GrContextPriv::addOnFlushCallbackObject(GrOnFlushCallbackObject* onFlushCBObject) { |
| 47 | fContext->addOnFlushCallbackObject(onFlushCBObject); |
| 48 | } |
| 49 | |
Robert Phillips | 292a6b2 | 2019-02-14 14:49:02 -0500 | [diff] [blame] | 50 | sk_sp<GrSurfaceContext> GrContextPriv::makeWrappedSurfaceContext( |
| 51 | sk_sp<GrSurfaceProxy> proxy, |
| 52 | sk_sp<SkColorSpace> colorSpace, |
| 53 | const SkSurfaceProps* props) { |
| 54 | return fContext->makeWrappedSurfaceContext(std::move(proxy), std::move(colorSpace), props); |
| 55 | } |
| 56 | |
| 57 | sk_sp<GrSurfaceContext> GrContextPriv::makeDeferredSurfaceContext( |
| 58 | const GrBackendFormat& format, |
| 59 | const GrSurfaceDesc& dstDesc, |
| 60 | GrSurfaceOrigin origin, |
| 61 | GrMipMapped mipMapped, |
| 62 | SkBackingFit fit, |
| 63 | SkBudgeted isDstBudgeted, |
| 64 | sk_sp<SkColorSpace> colorSpace, |
| 65 | const SkSurfaceProps* props) { |
| 66 | return fContext->makeDeferredSurfaceContext(format, dstDesc, origin, mipMapped, fit, |
| 67 | isDstBudgeted, std::move(colorSpace), props); |
| 68 | } |
| 69 | |
Robert Phillips | b97da53 | 2019-02-12 15:24:12 -0500 | [diff] [blame] | 70 | sk_sp<GrRenderTargetContext> GrContextPriv::makeDeferredRenderTargetContext( |
Robert Phillips | 6f0e02f | 2019-02-13 11:02:28 -0500 | [diff] [blame] | 71 | const GrBackendFormat& format, |
| 72 | SkBackingFit fit, |
| 73 | int width, int height, |
| 74 | GrPixelConfig config, |
| 75 | sk_sp<SkColorSpace> colorSpace, |
| 76 | int sampleCnt, |
| 77 | GrMipMapped mipMapped, |
| 78 | GrSurfaceOrigin origin, |
| 79 | const SkSurfaceProps* surfaceProps, |
| 80 | SkBudgeted budgeted) { |
Robert Phillips | b97da53 | 2019-02-12 15:24:12 -0500 | [diff] [blame] | 81 | return fContext->makeDeferredRenderTargetContext(format, fit, width, height, config, |
| 82 | std::move(colorSpace), sampleCnt, mipMapped, |
| 83 | origin, surfaceProps, budgeted); |
| 84 | } |
| 85 | |
Robert Phillips | 6f0e02f | 2019-02-13 11:02:28 -0500 | [diff] [blame] | 86 | sk_sp<GrRenderTargetContext> GrContextPriv::makeDeferredRenderTargetContextWithFallback( |
| 87 | const GrBackendFormat& format, |
| 88 | SkBackingFit fit, |
| 89 | int width, int height, |
| 90 | GrPixelConfig config, |
| 91 | sk_sp<SkColorSpace> colorSpace, |
| 92 | int sampleCnt, |
| 93 | GrMipMapped mipMapped, |
| 94 | GrSurfaceOrigin origin, |
| 95 | const SkSurfaceProps* surfaceProps, |
| 96 | SkBudgeted budgeted) { |
| 97 | return fContext->makeDeferredRenderTargetContextWithFallback(format, fit, width, height, config, |
| 98 | std::move(colorSpace), sampleCnt, |
| 99 | mipMapped, origin, surfaceProps, |
| 100 | budgeted); |
| 101 | } |
| 102 | |
Robert Phillips | dbaf317 | 2019-02-06 15:12:53 -0500 | [diff] [blame] | 103 | sk_sp<GrTextureContext> GrContextPriv::makeBackendTextureContext(const GrBackendTexture& tex, |
| 104 | GrSurfaceOrigin origin, |
| 105 | sk_sp<SkColorSpace> colorSpace) { |
Brian Salomon | f9a1fdf | 2019-05-09 10:30:12 -0400 | [diff] [blame] | 106 | ASSERT_SINGLE_OWNER |
Robert Phillips | dbaf317 | 2019-02-06 15:12:53 -0500 | [diff] [blame] | 107 | |
| 108 | sk_sp<GrSurfaceProxy> proxy = this->proxyProvider()->wrapBackendTexture( |
| 109 | tex, origin, kBorrow_GrWrapOwnership, GrWrapCacheable::kNo, kRW_GrIOType); |
| 110 | if (!proxy) { |
| 111 | return nullptr; |
| 112 | } |
| 113 | |
| 114 | return this->drawingManager()->makeTextureContext(std::move(proxy), std::move(colorSpace)); |
| 115 | } |
| 116 | |
| 117 | sk_sp<GrRenderTargetContext> GrContextPriv::makeBackendTextureRenderTargetContext( |
| 118 | const GrBackendTexture& tex, |
| 119 | GrSurfaceOrigin origin, |
| 120 | int sampleCnt, |
| 121 | sk_sp<SkColorSpace> colorSpace, |
| 122 | const SkSurfaceProps* props, |
| 123 | ReleaseProc releaseProc, |
| 124 | ReleaseContext releaseCtx) { |
Brian Salomon | f9a1fdf | 2019-05-09 10:30:12 -0400 | [diff] [blame] | 125 | ASSERT_SINGLE_OWNER |
Robert Phillips | dbaf317 | 2019-02-06 15:12:53 -0500 | [diff] [blame] | 126 | SkASSERT(sampleCnt > 0); |
| 127 | |
| 128 | sk_sp<GrTextureProxy> proxy(this->proxyProvider()->wrapRenderableBackendTexture( |
| 129 | tex, origin, sampleCnt, kBorrow_GrWrapOwnership, GrWrapCacheable::kNo, releaseProc, |
| 130 | releaseCtx)); |
| 131 | if (!proxy) { |
| 132 | return nullptr; |
| 133 | } |
| 134 | |
| 135 | return this->drawingManager()->makeRenderTargetContext(std::move(proxy), |
| 136 | std::move(colorSpace), props); |
| 137 | } |
| 138 | |
| 139 | sk_sp<GrRenderTargetContext> GrContextPriv::makeBackendRenderTargetRenderTargetContext( |
| 140 | const GrBackendRenderTarget& backendRT, |
| 141 | GrSurfaceOrigin origin, |
| 142 | sk_sp<SkColorSpace> colorSpace, |
| 143 | const SkSurfaceProps* surfaceProps, |
| 144 | ReleaseProc releaseProc, |
| 145 | ReleaseContext releaseCtx) { |
Brian Salomon | f9a1fdf | 2019-05-09 10:30:12 -0400 | [diff] [blame] | 146 | ASSERT_SINGLE_OWNER |
Robert Phillips | dbaf317 | 2019-02-06 15:12:53 -0500 | [diff] [blame] | 147 | |
| 148 | sk_sp<GrSurfaceProxy> proxy = this->proxyProvider()->wrapBackendRenderTarget( |
| 149 | backendRT, origin, releaseProc, releaseCtx); |
| 150 | if (!proxy) { |
| 151 | return nullptr; |
| 152 | } |
| 153 | |
| 154 | return this->drawingManager()->makeRenderTargetContext(std::move(proxy), |
| 155 | std::move(colorSpace), |
| 156 | surfaceProps); |
| 157 | } |
| 158 | |
| 159 | sk_sp<GrRenderTargetContext> GrContextPriv::makeBackendTextureAsRenderTargetRenderTargetContext( |
| 160 | const GrBackendTexture& tex, |
| 161 | GrSurfaceOrigin origin, |
| 162 | int sampleCnt, |
| 163 | sk_sp<SkColorSpace> colorSpace, |
| 164 | const SkSurfaceProps* props) { |
Brian Salomon | f9a1fdf | 2019-05-09 10:30:12 -0400 | [diff] [blame] | 165 | ASSERT_SINGLE_OWNER |
Robert Phillips | dbaf317 | 2019-02-06 15:12:53 -0500 | [diff] [blame] | 166 | SkASSERT(sampleCnt > 0); |
| 167 | sk_sp<GrSurfaceProxy> proxy( |
| 168 | this->proxyProvider()->wrapBackendTextureAsRenderTarget(tex, origin, sampleCnt)); |
| 169 | if (!proxy) { |
| 170 | return nullptr; |
| 171 | } |
| 172 | |
| 173 | return this->drawingManager()->makeRenderTargetContext(std::move(proxy), |
| 174 | std::move(colorSpace), |
| 175 | props); |
| 176 | } |
| 177 | |
| 178 | sk_sp<GrRenderTargetContext> GrContextPriv::makeVulkanSecondaryCBRenderTargetContext( |
| 179 | const SkImageInfo& imageInfo, const GrVkDrawableInfo& vkInfo, const SkSurfaceProps* props) { |
Brian Salomon | f9a1fdf | 2019-05-09 10:30:12 -0400 | [diff] [blame] | 180 | ASSERT_SINGLE_OWNER |
Robert Phillips | dbaf317 | 2019-02-06 15:12:53 -0500 | [diff] [blame] | 181 | sk_sp<GrSurfaceProxy> proxy( |
| 182 | this->proxyProvider()->wrapVulkanSecondaryCBAsRenderTarget(imageInfo, vkInfo)); |
| 183 | if (!proxy) { |
| 184 | return nullptr; |
| 185 | } |
| 186 | |
| 187 | return this->drawingManager()->makeRenderTargetContext(std::move(proxy), |
| 188 | imageInfo.refColorSpace(), |
| 189 | props); |
| 190 | } |
| 191 | |
Brian Salomon | f9a1fdf | 2019-05-09 10:30:12 -0400 | [diff] [blame] | 192 | GrSemaphoresSubmitted GrContextPriv::flushSurfaces(GrSurfaceProxy* proxies[], int numProxies, |
| 193 | const GrFlushInfo& info) { |
| 194 | ASSERT_SINGLE_OWNER |
| 195 | RETURN_VALUE_IF_ABANDONED(GrSemaphoresSubmitted::kNo) |
| 196 | GR_CREATE_TRACE_MARKER_CONTEXT("GrContextPriv", "flushSurfaces", fContext); |
| 197 | SkASSERT(numProxies >= 0); |
| 198 | SkASSERT(!numProxies || proxies); |
| 199 | for (int i = 0; i < numProxies; ++i) { |
| 200 | SkASSERT(proxies[i]); |
| 201 | ASSERT_OWNED_PROXY(proxies[i]); |
| 202 | } |
| 203 | return fContext->drawingManager()->flushSurfaces( |
| 204 | proxies, numProxies, SkSurface::BackendSurfaceAccess::kNoAccess, info); |
Robert Phillips | dbaf317 | 2019-02-06 15:12:53 -0500 | [diff] [blame] | 205 | } |
| 206 | |
Brian Salomon | 693bc2b | 2019-05-09 13:48:00 +0000 | [diff] [blame] | 207 | void GrContextPriv::flushSurface(GrSurfaceProxy* proxy) { |
Brian Salomon | f9a1fdf | 2019-05-09 10:30:12 -0400 | [diff] [blame] | 208 | this->flushSurfaces(proxy ? &proxy : nullptr, proxy ? 1 : 0, {}); |
Brian Salomon | 693bc2b | 2019-05-09 13:48:00 +0000 | [diff] [blame] | 209 | } |
Robert Phillips | dbaf317 | 2019-02-06 15:12:53 -0500 | [diff] [blame] | 210 | |
Robert Phillips | dbaf317 | 2019-02-06 15:12:53 -0500 | [diff] [blame] | 211 | void GrContextPriv::moveOpListsToDDL(SkDeferredDisplayList* ddl) { |
Robert Phillips | 292a6b2 | 2019-02-14 14:49:02 -0500 | [diff] [blame] | 212 | fContext->drawingManager()->moveOpListsToDDL(ddl); |
Robert Phillips | dbaf317 | 2019-02-06 15:12:53 -0500 | [diff] [blame] | 213 | } |
| 214 | |
| 215 | void GrContextPriv::copyOpListsFromDDL(const SkDeferredDisplayList* ddl, |
| 216 | GrRenderTargetProxy* newDest) { |
Robert Phillips | 6a6de56 | 2019-02-15 15:19:15 -0500 | [diff] [blame] | 217 | fContext->drawingManager()->copyOpListsFromDDL(ddl, newDest); |
Robert Phillips | dbaf317 | 2019-02-06 15:12:53 -0500 | [diff] [blame] | 218 | } |
| 219 | |
Robert Phillips | dbaf317 | 2019-02-06 15:12:53 -0500 | [diff] [blame] | 220 | ////////////////////////////////////////////////////////////////////////////// |
| 221 | #ifdef SK_ENABLE_DUMP_GPU |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 222 | #include "src/utils/SkJSONWriter.h" |
Robert Phillips | dbaf317 | 2019-02-06 15:12:53 -0500 | [diff] [blame] | 223 | SkString GrContextPriv::dump() const { |
| 224 | SkDynamicMemoryWStream stream; |
| 225 | SkJSONWriter writer(&stream, SkJSONWriter::Mode::kPretty); |
| 226 | writer.beginObject(); |
| 227 | |
| 228 | static const char* kBackendStr[] = { |
| 229 | "Metal", |
| 230 | "OpenGL", |
| 231 | "Vulkan", |
| 232 | "Mock", |
| 233 | }; |
| 234 | GR_STATIC_ASSERT(0 == (unsigned)GrBackendApi::kMetal); |
| 235 | GR_STATIC_ASSERT(1 == (unsigned)GrBackendApi::kOpenGL); |
| 236 | GR_STATIC_ASSERT(2 == (unsigned)GrBackendApi::kVulkan); |
| 237 | GR_STATIC_ASSERT(3 == (unsigned)GrBackendApi::kMock); |
| 238 | writer.appendString("backend", kBackendStr[(unsigned)fContext->backend()]); |
| 239 | |
| 240 | writer.appendName("caps"); |
| 241 | fContext->caps()->dumpJSON(&writer); |
| 242 | |
| 243 | writer.appendName("gpu"); |
| 244 | fContext->fGpu->dumpJSON(&writer); |
| 245 | |
| 246 | // Flush JSON to the memory stream |
| 247 | writer.endObject(); |
| 248 | writer.flush(); |
| 249 | |
| 250 | // Null terminate the JSON data in the memory stream |
| 251 | stream.write8(0); |
| 252 | |
| 253 | // Allocate a string big enough to hold all the data, then copy out of the stream |
| 254 | SkString result(stream.bytesWritten()); |
| 255 | stream.copyToAndReset(result.writable_str()); |
| 256 | return result; |
| 257 | } |
| 258 | #endif |
| 259 | |
| 260 | #if GR_TEST_UTILS |
| 261 | void GrContextPriv::resetGpuStats() const { |
| 262 | #if GR_GPU_STATS |
| 263 | fContext->fGpu->stats()->reset(); |
| 264 | #endif |
| 265 | } |
| 266 | |
| 267 | void GrContextPriv::dumpCacheStats(SkString* out) const { |
| 268 | #if GR_CACHE_STATS |
| 269 | fContext->fResourceCache->dumpStats(out); |
| 270 | #endif |
| 271 | } |
| 272 | |
| 273 | void GrContextPriv::dumpCacheStatsKeyValuePairs(SkTArray<SkString>* keys, |
| 274 | SkTArray<double>* values) const { |
| 275 | #if GR_CACHE_STATS |
| 276 | fContext->fResourceCache->dumpStatsKeyValuePairs(keys, values); |
| 277 | #endif |
| 278 | } |
| 279 | |
| 280 | void GrContextPriv::printCacheStats() const { |
| 281 | SkString out; |
| 282 | this->dumpCacheStats(&out); |
| 283 | SkDebugf("%s", out.c_str()); |
| 284 | } |
| 285 | |
| 286 | void GrContextPriv::dumpGpuStats(SkString* out) const { |
| 287 | #if GR_GPU_STATS |
| 288 | return fContext->fGpu->stats()->dump(out); |
| 289 | #endif |
| 290 | } |
| 291 | |
| 292 | void GrContextPriv::dumpGpuStatsKeyValuePairs(SkTArray<SkString>* keys, |
| 293 | SkTArray<double>* values) const { |
| 294 | #if GR_GPU_STATS |
| 295 | return fContext->fGpu->stats()->dumpKeyValuePairs(keys, values); |
| 296 | #endif |
| 297 | } |
| 298 | |
| 299 | void GrContextPriv::printGpuStats() const { |
| 300 | SkString out; |
| 301 | this->dumpGpuStats(&out); |
| 302 | SkDebugf("%s", out.c_str()); |
| 303 | } |
| 304 | |
| 305 | void GrContextPriv::testingOnly_setTextBlobCacheLimit(size_t bytes) { |
Robert Phillips | 2184fb7 | 2019-02-21 16:11:41 -0500 | [diff] [blame] | 306 | fContext->priv().getTextBlobCache()->setBudget(bytes); |
Robert Phillips | dbaf317 | 2019-02-06 15:12:53 -0500 | [diff] [blame] | 307 | } |
| 308 | |
| 309 | sk_sp<SkImage> GrContextPriv::testingOnly_getFontAtlasImage(GrMaskFormat format, unsigned int index) { |
| 310 | auto atlasManager = this->getAtlasManager(); |
| 311 | if (!atlasManager) { |
| 312 | return nullptr; |
| 313 | } |
| 314 | |
| 315 | unsigned int numActiveProxies; |
| 316 | const sk_sp<GrTextureProxy>* proxies = atlasManager->getProxies(format, &numActiveProxies); |
| 317 | if (index >= numActiveProxies || !proxies || !proxies[index]) { |
| 318 | return nullptr; |
| 319 | } |
| 320 | |
| 321 | SkASSERT(proxies[index]->priv().isExact()); |
| 322 | sk_sp<SkImage> image(new SkImage_Gpu(sk_ref_sp(fContext), kNeedNewImageUniqueID, |
| 323 | kPremul_SkAlphaType, proxies[index], nullptr)); |
| 324 | return image; |
| 325 | } |
| 326 | |
| 327 | void GrContextPriv::testingOnly_purgeAllUnlockedResources() { |
| 328 | fContext->fResourceCache->purgeAllUnlocked(); |
| 329 | } |
| 330 | |
| 331 | void GrContextPriv::testingOnly_flushAndRemoveOnFlushCallbackObject(GrOnFlushCallbackObject* cb) { |
| 332 | fContext->flush(); |
Robert Phillips | 292a6b2 | 2019-02-14 14:49:02 -0500 | [diff] [blame] | 333 | fContext->drawingManager()->testingOnly_removeOnFlushCallbackObject(cb); |
Robert Phillips | dbaf317 | 2019-02-06 15:12:53 -0500 | [diff] [blame] | 334 | } |
| 335 | #endif |
Greg Daniel | 6eb8c24 | 2019-06-05 10:22:24 -0400 | [diff] [blame] | 336 | |
| 337 | bool GrContextPriv::validPMUPMConversionExists() { |
| 338 | ASSERT_SINGLE_OWNER |
| 339 | if (!fContext->fDidTestPMConversions) { |
| 340 | fContext->fPMUPMConversionsRoundTrip = |
| 341 | GrConfigConversionEffect::TestForPreservingPMConversions(fContext); |
| 342 | fContext->fDidTestPMConversions = true; |
| 343 | } |
| 344 | |
| 345 | // The PM<->UPM tests fail or succeed together so we only need to check one. |
| 346 | return fContext->fPMUPMConversionsRoundTrip; |
| 347 | } |
| 348 | |
| 349 | std::unique_ptr<GrFragmentProcessor> GrContextPriv::createPMToUPMEffect( |
| 350 | std::unique_ptr<GrFragmentProcessor> fp) { |
| 351 | ASSERT_SINGLE_OWNER |
| 352 | // We should have already called this->priv().validPMUPMConversionExists() in this case |
| 353 | SkASSERT(fContext->fDidTestPMConversions); |
| 354 | // ...and it should have succeeded |
| 355 | SkASSERT(this->validPMUPMConversionExists()); |
| 356 | |
| 357 | return GrConfigConversionEffect::Make(std::move(fp), PMConversion::kToUnpremul); |
| 358 | } |
| 359 | |
| 360 | std::unique_ptr<GrFragmentProcessor> GrContextPriv::createUPMToPMEffect( |
| 361 | std::unique_ptr<GrFragmentProcessor> fp) { |
| 362 | ASSERT_SINGLE_OWNER |
| 363 | // We should have already called this->priv().validPMUPMConversionExists() in this case |
| 364 | SkASSERT(fContext->fDidTestPMConversions); |
| 365 | // ...and it should have succeeded |
| 366 | SkASSERT(this->validPMUPMConversionExists()); |
| 367 | |
| 368 | return GrConfigConversionEffect::Make(std::move(fp), PMConversion::kToPremul); |
| 369 | } |