Split GrContextThreadSafeProxy into its own files (take 2)
This just shuffles stuff around.
Change-Id: I90e24a73bf44dd3e88fc121a0528bf94e4fdead4
Reviewed-on: https://skia-review.googlesource.com/c/187786
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index d122a4d..657b7da 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -169,76 +169,6 @@
//////////////////////////////////////////////////////////////////////////////
-GrContextThreadSafeProxy::GrContextThreadSafeProxy(sk_sp<const GrCaps> caps, uint32_t uniqueID,
- GrBackendApi backend,
- const GrContextOptions& options,
- sk_sp<GrSkSLFPFactoryCache> cache)
- : fCaps(std::move(caps))
- , fContextUniqueID(uniqueID)
- , fBackend(backend)
- , fOptions(options)
- , fFPFactoryCache(std::move(cache)) {}
-
-GrContextThreadSafeProxy::~GrContextThreadSafeProxy() = default;
-
-sk_sp<GrContextThreadSafeProxy> GrContext::threadSafeProxy() {
- return fThreadSafeProxy;
-}
-
-SkSurfaceCharacterization GrContextThreadSafeProxy::createCharacterization(
- size_t cacheMaxResourceBytes,
- const SkImageInfo& ii, const GrBackendFormat& backendFormat,
- int sampleCnt, GrSurfaceOrigin origin,
- const SkSurfaceProps& surfaceProps,
- bool isMipMapped, bool willUseGLFBO0) {
- if (!backendFormat.isValid()) {
- return SkSurfaceCharacterization(); // return an invalid characterization
- }
-
- if (GrBackendApi::kOpenGL != backendFormat.backend() && willUseGLFBO0) {
- // The willUseGLFBO0 flags can only be used for a GL backend.
- return SkSurfaceCharacterization(); // return an invalid characterization
- }
-
- if (!fCaps->mipMapSupport()) {
- isMipMapped = false;
- }
-
- GrPixelConfig config = fCaps->getConfigFromBackendFormat(backendFormat, ii.colorType());
- if (config == kUnknown_GrPixelConfig) {
- return SkSurfaceCharacterization(); // return an invalid characterization
- }
-
- if (!SkSurface_Gpu::Valid(fCaps.get(), config, ii.colorSpace())) {
- return SkSurfaceCharacterization(); // return an invalid characterization
- }
-
- sampleCnt = fCaps->getRenderTargetSampleCount(sampleCnt, config);
- if (!sampleCnt) {
- return SkSurfaceCharacterization(); // return an invalid characterization
- }
-
- GrFSAAType FSAAType = GrFSAAType::kNone;
- if (sampleCnt > 1) {
- FSAAType = fCaps->usesMixedSamples() ? GrFSAAType::kMixedSamples : GrFSAAType::kUnifiedMSAA;
- }
-
- // This surface characterization factory assumes that the resulting characterization is
- // textureable.
- if (!fCaps->isConfigTexturable(config)) {
- return SkSurfaceCharacterization(); // return an invalid characterization
- }
-
- return SkSurfaceCharacterization(sk_ref_sp<GrContextThreadSafeProxy>(this),
- cacheMaxResourceBytes, ii,
- origin, config, FSAAType, sampleCnt,
- SkSurfaceCharacterization::Textureable(true),
- SkSurfaceCharacterization::MipMapped(isMipMapped),
- SkSurfaceCharacterization::UsesGLFBO0(willUseGLFBO0),
- SkSurfaceCharacterization::VulkanSecondaryCBCompatible(false),
- surfaceProps);
-}
-
void GrContext::abandonContext() {
ASSERT_SINGLE_OWNER
@@ -1140,6 +1070,8 @@
return renderTargetContext;
}
+sk_sp<GrSkSLFPFactoryCache> GrContextPriv::getFPFactoryCache() { return fContext->fFPFactoryCache; }
+
std::unique_ptr<GrFragmentProcessor> GrContext::createPMToUPMEffect(
std::unique_ptr<GrFragmentProcessor> fp) {
ASSERT_SINGLE_OWNER