Revert "Split GrContextThreadSafeProxy into its own files"
This reverts commit f8397f2b3f00ca17da3c028a287097b5d79cd315.
Reason for revert: Breaking Flutter build!
Original change's description:
> Split GrContextThreadSafeProxy into its own files
>
> This just shuffles stuff around.
>
> Change-Id: Ieab35f50945efe87512d7077cb994132f0e0b6ef
> Reviewed-on: https://skia-review.googlesource.com/c/186874
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Robert Phillips <robertphillips@google.com>
TBR=bsalomon@google.com,robertphillips@google.com
Change-Id: I236add95d8a0066037854b5532a7db131d93d603
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/187783
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 657b7da..d122a4d 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -169,6 +169,76 @@
//////////////////////////////////////////////////////////////////////////////
+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
@@ -1070,8 +1140,6 @@
return renderTargetContext;
}
-sk_sp<GrSkSLFPFactoryCache> GrContextPriv::getFPFactoryCache() { return fContext->fFPFactoryCache; }
-
std::unique_ptr<GrFragmentProcessor> GrContext::createPMToUPMEffect(
std::unique_ptr<GrFragmentProcessor> fp) {
ASSERT_SINGLE_OWNER