Move caps and FP factory cache to GrContext_Base
Both GrContext and GrContextThreadSafeProxy had their own copies. This centralizes ownership and standardizes how all the contexts get initialized. Change-Id: Ib2e418fbb53fcd6b0054789ef30a5fc4a3d80b20 Reviewed-on: https://skia-review.googlesource.com/c/189305 Commit-Queue: Robert Phillips <robertphillips@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
This commit is contained in:
parent
2d35a1c875
commit
bb60677d52
@ -79,7 +79,7 @@ public:
|
||||
static sk_sp<GrContext> MakeMock(const GrMockOptions*, const GrContextOptions&);
|
||||
static sk_sp<GrContext> MakeMock(const GrMockOptions*);
|
||||
|
||||
virtual ~GrContext();
|
||||
~GrContext() override;
|
||||
|
||||
sk_sp<GrContextThreadSafeProxy> threadSafeProxy();
|
||||
|
||||
@ -282,14 +282,11 @@ public:
|
||||
protected:
|
||||
GrContext(GrBackendApi, const GrContextOptions& options, int32_t id = SK_InvalidGenID);
|
||||
|
||||
bool initCommon();
|
||||
virtual bool init() = 0; // must be called after the ctor!
|
||||
bool init(sk_sp<const GrCaps>, sk_sp<GrSkSLFPFactoryCache>) override;
|
||||
|
||||
virtual GrAtlasManager* onGetAtlasManager() = 0;
|
||||
|
||||
sk_sp<const GrCaps> fCaps;
|
||||
sk_sp<GrContextThreadSafeProxy> fThreadSafeProxy;
|
||||
sk_sp<GrSkSLFPFactoryCache> fFPFactoryCache;
|
||||
|
||||
private:
|
||||
// fTaskGroup must appear before anything that uses it (e.g. fGpu), so that it is destroyed
|
||||
|
@ -14,8 +14,6 @@
|
||||
|
||||
class GrBackendFormat;
|
||||
class GrCaps;
|
||||
class GrContext;
|
||||
class GrContext_Base;
|
||||
class GrContextThreadSafeProxyPriv;
|
||||
class GrSkSLFPFactoryCache;
|
||||
struct SkImageInfo;
|
||||
@ -84,18 +82,12 @@ public:
|
||||
const GrContextThreadSafeProxyPriv priv() const;
|
||||
|
||||
private:
|
||||
friend class GrContextThreadSafeProxyPriv; // for ctor and hidden methods
|
||||
|
||||
// DDL TODO: need to add unit tests for backend & maybe options
|
||||
GrContextThreadSafeProxy(sk_sp<const GrCaps> caps,
|
||||
uint32_t uniqueID,
|
||||
GrBackendApi backend,
|
||||
const GrContextOptions& options,
|
||||
sk_sp<GrSkSLFPFactoryCache> cache);
|
||||
GrContextThreadSafeProxy(GrBackendApi, const GrContextOptions&, uint32_t contextID);
|
||||
|
||||
sk_sp<const GrCaps> fCaps;
|
||||
sk_sp<GrSkSLFPFactoryCache> fFPFactoryCache;
|
||||
|
||||
friend class GrDirectContext; // To construct this object
|
||||
friend class GrContextThreadSafeProxyPriv;
|
||||
bool init(sk_sp<const GrCaps>, sk_sp<GrSkSLFPFactoryCache>) override;
|
||||
|
||||
typedef GrContext_Base INHERITED;
|
||||
};
|
||||
|
@ -13,9 +13,11 @@
|
||||
#include "GrTypes.h"
|
||||
|
||||
class GrBaseContextPriv;
|
||||
class GrCaps;
|
||||
class GrContext;
|
||||
class GrImageContext;
|
||||
class GrRecordingContext;
|
||||
class GrSkSLFPFactoryCache;
|
||||
|
||||
class SK_API GrContext_Base : public SkRefCnt {
|
||||
public:
|
||||
@ -49,15 +51,24 @@ protected:
|
||||
*/
|
||||
const GrContextOptions& options() const { return fOptions; }
|
||||
|
||||
const GrCaps* caps() const;
|
||||
sk_sp<const GrCaps> refCaps() const;
|
||||
|
||||
sk_sp<GrSkSLFPFactoryCache> fpFactoryCache();
|
||||
|
||||
GrContext_Base* asBaseContext() { return this; }
|
||||
virtual GrImageContext* asImageContext() { return nullptr; }
|
||||
virtual GrRecordingContext* asRecordingContext() { return nullptr; }
|
||||
virtual GrContext* asDirectContext() { return nullptr; }
|
||||
|
||||
virtual bool init(sk_sp<const GrCaps>, sk_sp<GrSkSLFPFactoryCache>);
|
||||
|
||||
private:
|
||||
const GrBackendApi fBackend;
|
||||
const GrContextOptions fOptions;
|
||||
const uint32_t fContextID;
|
||||
sk_sp<const GrCaps> fCaps;
|
||||
sk_sp<GrSkSLFPFactoryCache> fFPFactoryCache;
|
||||
|
||||
typedef SkRefCnt INHERITED;
|
||||
};
|
||||
|
@ -20,6 +20,11 @@ public:
|
||||
|
||||
const GrContextOptions& options() const { return fContext->options(); }
|
||||
|
||||
const GrCaps* caps() const { return fContext->caps(); }
|
||||
sk_sp<const GrCaps> refCaps() const { return fContext->refCaps(); }
|
||||
|
||||
sk_sp<GrSkSLFPFactoryCache> fpFactoryCache() { return fContext->fpFactoryCache(); }
|
||||
|
||||
private:
|
||||
explicit GrBaseContextPriv(GrContext_Base* context) : fContext(context) {}
|
||||
GrBaseContextPriv(const GrBaseContextPriv&); // unimpl
|
||||
|
@ -67,20 +67,24 @@ GrContext::GrContext(GrBackendApi backend, const GrContextOptions& options, int3
|
||||
fGlyphCache = nullptr;
|
||||
}
|
||||
|
||||
bool GrContext::initCommon() {
|
||||
bool GrContext::init(sk_sp<const GrCaps> caps, sk_sp<GrSkSLFPFactoryCache> FPFactoryCache) {
|
||||
ASSERT_SINGLE_OWNER
|
||||
SkASSERT(fCaps); // needs to have been initialized by derived classes
|
||||
SkASSERT(fThreadSafeProxy); // needs to have been initialized by derived classes
|
||||
|
||||
if (!INHERITED::init(std::move(caps), std::move(FPFactoryCache))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
SkASSERT(this->caps());
|
||||
|
||||
if (fGpu) {
|
||||
fCaps = fGpu->refCaps();
|
||||
fResourceCache = new GrResourceCache(fCaps.get(), &fSingleOwner, this->contextID());
|
||||
fResourceCache = new GrResourceCache(this->caps(), &fSingleOwner, this->contextID());
|
||||
fResourceProvider = new GrResourceProvider(fGpu.get(), fResourceCache, &fSingleOwner,
|
||||
this->options().fExplicitlyAllocateGPUResources);
|
||||
fProxyProvider =
|
||||
new GrProxyProvider(fResourceProvider, fResourceCache, fCaps, &fSingleOwner);
|
||||
fProxyProvider = new GrProxyProvider(fResourceProvider, fResourceCache,
|
||||
this->refCaps(), &fSingleOwner);
|
||||
} else {
|
||||
fProxyProvider = new GrProxyProvider(this->contextID(), fCaps, &fSingleOwner);
|
||||
fProxyProvider = new GrProxyProvider(this->contextID(), this->refCaps(), &fSingleOwner);
|
||||
}
|
||||
|
||||
if (fResourceCache) {
|
||||
@ -127,7 +131,7 @@ bool GrContext::initCommon() {
|
||||
this->options().fSortRenderTargets,
|
||||
this->options().fReduceOpListSplitting));
|
||||
|
||||
fGlyphCache = new GrStrikeCache(fCaps.get(), this->options().fGlyphCacheTextureMaximumBytes);
|
||||
fGlyphCache = new GrStrikeCache(this->caps(), this->options().fGlyphCacheTextureMaximumBytes);
|
||||
|
||||
fTextBlobCache.reset(new GrTextBlobCache(TextBlobCacheOverBudgetCB, this, this->contextID()));
|
||||
|
||||
@ -268,18 +272,18 @@ size_t GrContext::getResourceCachePurgeableBytes() const {
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
int GrContext::maxTextureSize() const { return fCaps->maxTextureSize(); }
|
||||
int GrContext::maxTextureSize() const { return this->caps()->maxTextureSize(); }
|
||||
|
||||
int GrContext::maxRenderTargetSize() const { return fCaps->maxRenderTargetSize(); }
|
||||
int GrContext::maxRenderTargetSize() const { return this->caps()->maxRenderTargetSize(); }
|
||||
|
||||
bool GrContext::colorTypeSupportedAsImage(SkColorType colorType) const {
|
||||
GrPixelConfig config = SkColorType2GrPixelConfig(colorType);
|
||||
return fCaps->isConfigTexturable(config);
|
||||
return this->caps()->isConfigTexturable(config);
|
||||
}
|
||||
|
||||
int GrContext::maxSurfaceSampleCountForColorType(SkColorType colorType) const {
|
||||
GrPixelConfig config = SkColorType2GrPixelConfig(colorType);
|
||||
return fCaps->maxRenderTargetSampleCount(config);
|
||||
return this->caps()->maxRenderTargetSampleCount(config);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@ -1007,7 +1011,7 @@ sk_sp<GrRenderTargetContext> GrContextPriv::makeDeferredRenderTargetContextWithF
|
||||
if (!GrPixelConfigToColorType(config, &colorType)) {
|
||||
return nullptr;
|
||||
}
|
||||
localFormat = fContext->fCaps->getBackendFormatFromColorType(colorType);
|
||||
localFormat = fContext->caps()->getBackendFormatFromColorType(colorType);
|
||||
}
|
||||
|
||||
return this->makeDeferredRenderTargetContext(localFormat, fit, width, height, config,
|
||||
@ -1061,7 +1065,9 @@ sk_sp<GrRenderTargetContext> GrContextPriv::makeDeferredRenderTargetContext(
|
||||
return renderTargetContext;
|
||||
}
|
||||
|
||||
sk_sp<GrSkSLFPFactoryCache> GrContextPriv::getFPFactoryCache() { return fContext->fFPFactoryCache; }
|
||||
sk_sp<GrSkSLFPFactoryCache> GrContextPriv::fpFactoryCache() {
|
||||
return fContext->fpFactoryCache();
|
||||
}
|
||||
|
||||
std::unique_ptr<GrFragmentProcessor> GrContext::createPMToUPMEffect(
|
||||
std::unique_ptr<GrFragmentProcessor> fp) {
|
||||
@ -1097,7 +1103,7 @@ bool GrContext::validPMUPMConversionExists() {
|
||||
}
|
||||
|
||||
bool GrContext::supportsDistanceFieldText() const {
|
||||
return fCaps->shaderCaps()->supportsDistanceFieldText();
|
||||
return this->caps()->shaderCaps()->supportsDistanceFieldText();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@ -1147,7 +1153,7 @@ SkString GrContextPriv::dump() const {
|
||||
writer.appendString("backend", kBackendStr[(unsigned)fContext->backend()]);
|
||||
|
||||
writer.appendName("caps");
|
||||
fContext->fCaps->dumpJSON(&writer);
|
||||
fContext->caps()->dumpJSON(&writer);
|
||||
|
||||
writer.appendName("gpu");
|
||||
fContext->fGpu->dumpJSON(&writer);
|
||||
|
@ -34,6 +34,11 @@ public:
|
||||
|
||||
const GrContextOptions& options() const { return fContext->options(); }
|
||||
|
||||
const GrCaps* caps() const { return fContext->caps(); }
|
||||
sk_sp<const GrCaps> refCaps() const { return fContext->refCaps(); }
|
||||
|
||||
sk_sp<GrSkSLFPFactoryCache> fpFactoryCache();
|
||||
|
||||
// from GrImageContext
|
||||
|
||||
// from GrRecordingContext
|
||||
@ -43,8 +48,6 @@ public:
|
||||
*/
|
||||
static sk_sp<GrContext> MakeDDL(const sk_sp<GrContextThreadSafeProxy>&);
|
||||
|
||||
const GrCaps* caps() const { return fContext->fCaps.get(); }
|
||||
|
||||
sk_sp<GrOpMemoryPool> refOpMemoryPool();
|
||||
GrOpMemoryPool* opMemoryPool();
|
||||
|
||||
@ -284,8 +287,6 @@ public:
|
||||
|
||||
GrContextOptions::PersistentCache* getPersistentCache() { return fContext->fPersistentCache; }
|
||||
|
||||
sk_sp<GrSkSLFPFactoryCache> getFPFactoryCache();
|
||||
|
||||
/** This is only useful for debug purposes */
|
||||
SkDEBUGCODE(GrSingleOwner* debugSingleOwner() const { return &fContext->fSingleOwner; } )
|
||||
|
||||
|
@ -15,16 +15,19 @@
|
||||
#include "SkSurface_Gpu.h"
|
||||
#include "SkSurfaceCharacterization.h"
|
||||
|
||||
GrContextThreadSafeProxy::GrContextThreadSafeProxy(sk_sp<const GrCaps> caps, uint32_t contextID,
|
||||
GrBackendApi backend,
|
||||
GrContextThreadSafeProxy::GrContextThreadSafeProxy(GrBackendApi backend,
|
||||
const GrContextOptions& options,
|
||||
sk_sp<GrSkSLFPFactoryCache> cache)
|
||||
: INHERITED(backend, options, contextID)
|
||||
, fCaps(std::move(caps))
|
||||
, fFPFactoryCache(std::move(cache)) {}
|
||||
uint32_t contextID)
|
||||
: INHERITED(backend, options, contextID) {
|
||||
}
|
||||
|
||||
GrContextThreadSafeProxy::~GrContextThreadSafeProxy() = default;
|
||||
|
||||
bool GrContextThreadSafeProxy::init(sk_sp<const GrCaps> caps,
|
||||
sk_sp<GrSkSLFPFactoryCache> FPFactoryCache) {
|
||||
return INHERITED::init(std::move(caps), std::move(FPFactoryCache));
|
||||
}
|
||||
|
||||
bool GrContextThreadSafeProxy::matches(GrContext_Base* context) const {
|
||||
return context->priv().contextID() == this->contextID();
|
||||
}
|
||||
@ -44,34 +47,35 @@ SkSurfaceCharacterization GrContextThreadSafeProxy::createCharacterization(
|
||||
return SkSurfaceCharacterization(); // return an invalid characterization
|
||||
}
|
||||
|
||||
if (!fCaps->mipMapSupport()) {
|
||||
if (!this->caps()->mipMapSupport()) {
|
||||
isMipMapped = false;
|
||||
}
|
||||
|
||||
GrPixelConfig config = fCaps->getConfigFromBackendFormat(backendFormat, ii.colorType());
|
||||
GrPixelConfig config = this->caps()->getConfigFromBackendFormat(backendFormat, ii.colorType());
|
||||
if (config == kUnknown_GrPixelConfig) {
|
||||
return SkSurfaceCharacterization(); // return an invalid characterization
|
||||
}
|
||||
|
||||
if (!SkSurface_Gpu::Valid(fCaps.get(), config, ii.colorSpace())) {
|
||||
if (!SkSurface_Gpu::Valid(this->caps(), config, ii.colorSpace())) {
|
||||
return SkSurfaceCharacterization(); // return an invalid characterization
|
||||
}
|
||||
|
||||
sampleCnt = fCaps->getRenderTargetSampleCount(sampleCnt, config);
|
||||
sampleCnt = this->caps()->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;
|
||||
FSAAType = this->caps()->usesMixedSamples() ? GrFSAAType::kMixedSamples
|
||||
: GrFSAAType::kUnifiedMSAA;
|
||||
}
|
||||
|
||||
if (willUseGLFBO0 && isTextureable) {
|
||||
return SkSurfaceCharacterization(); // return an invalid characterization
|
||||
}
|
||||
|
||||
if (isTextureable && !fCaps->isConfigTexturable(config)) {
|
||||
if (isTextureable && !this->caps()->isConfigTexturable(config)) {
|
||||
// Skia doesn't agree that this is textureable.
|
||||
return SkSurfaceCharacterization(); // return an invalid characterization
|
||||
}
|
||||
@ -87,6 +91,22 @@ SkSurfaceCharacterization GrContextThreadSafeProxy::createCharacterization(
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
sk_sp<GrSkSLFPFactoryCache> GrContextThreadSafeProxyPriv::fpFactoryCache() const {
|
||||
return fProxy->fFPFactoryCache;
|
||||
sk_sp<GrSkSLFPFactoryCache> GrContextThreadSafeProxyPriv::fpFactoryCache() {
|
||||
return fProxy->fpFactoryCache();
|
||||
}
|
||||
|
||||
sk_sp<GrContextThreadSafeProxy> GrContextThreadSafeProxyPriv::Make(
|
||||
GrBackendApi backend,
|
||||
const GrContextOptions& options,
|
||||
uint32_t contextID,
|
||||
sk_sp<const GrCaps> caps,
|
||||
sk_sp<GrSkSLFPFactoryCache> cache) {
|
||||
sk_sp<GrContextThreadSafeProxy> proxy(new GrContextThreadSafeProxy(backend, options,
|
||||
contextID));
|
||||
|
||||
if (!proxy->init(std::move(caps), std::move(cache))) {
|
||||
return nullptr;
|
||||
}
|
||||
return proxy;
|
||||
}
|
||||
|
||||
|
@ -22,11 +22,17 @@ public:
|
||||
|
||||
const GrContextOptions& options() const { return fProxy->options(); }
|
||||
|
||||
//
|
||||
const GrCaps* caps() const { return fProxy->fCaps.get(); }
|
||||
sk_sp<const GrCaps> refCaps() const { return fProxy->fCaps; }
|
||||
const GrCaps* caps() const { return fProxy->caps(); }
|
||||
sk_sp<const GrCaps> refCaps() const { return fProxy->refCaps(); }
|
||||
|
||||
sk_sp<GrSkSLFPFactoryCache> fpFactoryCache() const;
|
||||
sk_sp<GrSkSLFPFactoryCache> fpFactoryCache();
|
||||
|
||||
// GrContextThreadSafeProxyPriv
|
||||
static sk_sp<GrContextThreadSafeProxy> Make(GrBackendApi,
|
||||
const GrContextOptions&,
|
||||
uint32_t contextID,
|
||||
sk_sp<const GrCaps>,
|
||||
sk_sp<GrSkSLFPFactoryCache>);
|
||||
|
||||
private:
|
||||
explicit GrContextThreadSafeProxyPriv(GrContextThreadSafeProxy* proxy) : fProxy(proxy) {}
|
||||
|
@ -7,6 +7,9 @@
|
||||
|
||||
#include "GrContext_Base.h"
|
||||
|
||||
#include "GrCaps.h"
|
||||
#include "GrSkSLFPFactoryCache.h"
|
||||
|
||||
static int32_t next_id() {
|
||||
static std::atomic<int32_t> nextID{1};
|
||||
int32_t id;
|
||||
@ -26,4 +29,16 @@ GrContext_Base::GrContext_Base(GrBackendApi backend,
|
||||
|
||||
GrContext_Base::~GrContext_Base() { }
|
||||
|
||||
const GrCaps* GrContext_Base::caps() const { return fCaps.get(); }
|
||||
sk_sp<const GrCaps> GrContext_Base::refCaps() const { return fCaps; }
|
||||
|
||||
sk_sp<GrSkSLFPFactoryCache> GrContext_Base::fpFactoryCache() { return fFPFactoryCache; }
|
||||
|
||||
bool GrContext_Base::init(sk_sp<const GrCaps> caps, sk_sp<GrSkSLFPFactoryCache> FPFactoryCache) {
|
||||
SkASSERT(caps && FPFactoryCache);
|
||||
|
||||
fCaps = caps;
|
||||
fFPFactoryCache = FPFactoryCache;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -19,9 +19,6 @@ class SK_API GrDDLContext : public GrContext {
|
||||
public:
|
||||
GrDDLContext(sk_sp<GrContextThreadSafeProxy> proxy)
|
||||
: INHERITED(proxy->backend(), proxy->priv().options(), proxy->priv().contextID()) {
|
||||
fCaps = proxy->priv().refCaps();
|
||||
fFPFactoryCache = proxy->priv().fpFactoryCache();
|
||||
SkASSERT(fFPFactoryCache);
|
||||
fThreadSafeProxy = std::move(proxy);
|
||||
}
|
||||
|
||||
@ -43,14 +40,16 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
bool init() override {
|
||||
SkASSERT(fCaps); // should've been set in ctor
|
||||
bool init(sk_sp<const GrCaps> caps, sk_sp<GrSkSLFPFactoryCache> FPFactoryCache) override {
|
||||
SkASSERT(caps && FPFactoryCache);
|
||||
SkASSERT(fThreadSafeProxy); // should've been set in the ctor
|
||||
|
||||
if (!INHERITED::initCommon()) {
|
||||
if (!INHERITED::init(std::move(caps), std::move(FPFactoryCache))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
SkASSERT(this->caps());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -66,9 +65,7 @@ private:
|
||||
sk_sp<GrContext> GrContextPriv::MakeDDL(const sk_sp<GrContextThreadSafeProxy>& proxy) {
|
||||
sk_sp<GrContext> context(new GrDDLContext(proxy));
|
||||
|
||||
// Note: we aren't creating a Gpu here. This causes the resource provider & cache to
|
||||
// also not be created
|
||||
if (!context->init()) {
|
||||
if (!context->init(proxy->priv().refCaps(), proxy->priv().fpFactoryCache())) {
|
||||
return nullptr;
|
||||
}
|
||||
return context;
|
||||
|
@ -10,6 +10,7 @@
|
||||
|
||||
#include "GrContextPriv.h"
|
||||
#include "GrContextThreadSafeProxy.h"
|
||||
#include "GrContextThreadSafeProxyPriv.h"
|
||||
#include "GrGpu.h"
|
||||
|
||||
#include "effects/GrSkSLFP.h"
|
||||
@ -58,23 +59,27 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
bool init() override {
|
||||
SkASSERT(fCaps); // should've been set in ctor
|
||||
bool init(sk_sp<const GrCaps> caps, sk_sp<GrSkSLFPFactoryCache> FPFactoryCache) override {
|
||||
SkASSERT(caps && !FPFactoryCache);
|
||||
SkASSERT(!fThreadSafeProxy);
|
||||
SkASSERT(!fFPFactoryCache);
|
||||
fFPFactoryCache.reset(new GrSkSLFPFactoryCache());
|
||||
fThreadSafeProxy.reset(new GrContextThreadSafeProxy(fCaps, this->contextID(),
|
||||
this->backend(),
|
||||
this->options(), fFPFactoryCache));
|
||||
|
||||
if (!INHERITED::initCommon()) {
|
||||
FPFactoryCache.reset(new GrSkSLFPFactoryCache());
|
||||
fThreadSafeProxy = GrContextThreadSafeProxyPriv::Make(this->backend(),
|
||||
this->options(),
|
||||
this->contextID(),
|
||||
caps, FPFactoryCache);
|
||||
|
||||
if (!INHERITED::init(std::move(caps), std::move(FPFactoryCache))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
SkASSERT(this->caps());
|
||||
|
||||
GrDrawOpAtlas::AllowMultitexturing allowMultitexturing;
|
||||
if (GrContextOptions::Enable::kNo == this->options().fAllowMultipleGlyphCacheTextures ||
|
||||
// multitexturing supported only if range can represent the index + texcoords fully
|
||||
!(fCaps->shaderCaps()->floatIs32Bits() || fCaps->shaderCaps()->integerSupport())) {
|
||||
!(this->caps()->shaderCaps()->floatIs32Bits() ||
|
||||
this->caps()->shaderCaps()->integerSupport())) {
|
||||
allowMultitexturing = GrDrawOpAtlas::AllowMultitexturing::kNo;
|
||||
} else {
|
||||
allowMultitexturing = GrDrawOpAtlas::AllowMultitexturing::kYes;
|
||||
@ -122,8 +127,7 @@ sk_sp<GrContext> GrContext::MakeGL(sk_sp<const GrGLInterface> interface,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
context->fCaps = context->fGpu->refCaps();
|
||||
if (!context->init()) {
|
||||
if (!context->init(context->fGpu->refCaps(), nullptr)) {
|
||||
return nullptr;
|
||||
}
|
||||
return context;
|
||||
@ -143,8 +147,7 @@ sk_sp<GrContext> GrContext::MakeMock(const GrMockOptions* mockOptions,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
context->fCaps = context->fGpu->refCaps();
|
||||
if (!context->init()) {
|
||||
if (!context->init(context->fGpu->refCaps(), nullptr)) {
|
||||
return nullptr;
|
||||
}
|
||||
return context;
|
||||
@ -170,8 +173,7 @@ sk_sp<GrContext> GrContext::MakeVulkan(const GrVkBackendContext& backendContext,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
context->fCaps = context->fGpu->refCaps();
|
||||
if (!context->init()) {
|
||||
if (!context->init(context->fGpu->refCaps(), nullptr)) {
|
||||
return nullptr;
|
||||
}
|
||||
return context;
|
||||
@ -194,8 +196,7 @@ sk_sp<GrContext> GrContext::MakeMetal(void* device, void* queue, const GrContext
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
context->fCaps = context->fGpu->refCaps();
|
||||
if (!context->init()) {
|
||||
if (!context->init(context->fGpu->refCaps(), nullptr)) {
|
||||
return nullptr;
|
||||
}
|
||||
return context;
|
||||
|
@ -20,6 +20,11 @@ public:
|
||||
|
||||
const GrContextOptions& options() const { return fContext->options(); }
|
||||
|
||||
const GrCaps* caps() const { return fContext->caps(); }
|
||||
sk_sp<const GrCaps> refCaps() const { return fContext->refCaps(); }
|
||||
|
||||
sk_sp<GrSkSLFPFactoryCache> fpFactoryCache() { return fContext->fpFactoryCache(); }
|
||||
|
||||
// from GrImageContext
|
||||
|
||||
private:
|
||||
|
@ -20,6 +20,11 @@ public:
|
||||
|
||||
const GrContextOptions& options() const { return fContext->options(); }
|
||||
|
||||
const GrCaps* caps() const { return fContext->caps(); }
|
||||
sk_sp<const GrCaps> refCaps() const { return fContext->refCaps(); }
|
||||
|
||||
sk_sp<GrSkSLFPFactoryCache> fpFactoryCache(); // { return fContext->getFPFactoryCache(); }
|
||||
|
||||
// from GrImageContext
|
||||
|
||||
// from GrRecordingContext
|
||||
|
@ -234,7 +234,7 @@ public:
|
||||
std::unique_ptr<GrSkSLFP> GrSkSLFP::Make(GrContext* context, int index, const char* name,
|
||||
const char* sksl, const void* inputs,
|
||||
size_t inputSize) {
|
||||
return std::unique_ptr<GrSkSLFP>(new GrSkSLFP(context->priv().getFPFactoryCache(),
|
||||
return std::unique_ptr<GrSkSLFP>(new GrSkSLFP(context->priv().fpFactoryCache(),
|
||||
context->priv().caps()->shaderCaps(),
|
||||
index, name, sksl, inputs, inputSize));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user