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