Move GrContextOptions to GrContext_Base and make GrContextThreadSafeProxy be derived from GrContext_Base
The main thrust of this CL is to bring the GrContextThreadSafeProxy into the fold. Change-Id: I8f457d5b75c69f89beac3a0035b1c05ba5d3b931 Reviewed-on: https://skia-review.googlesource.com/c/188622 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
This commit is contained in:
parent
69da42f188
commit
c1541ae25f
@ -280,10 +280,10 @@ public:
|
||||
void storeVkPipelineCacheData();
|
||||
|
||||
protected:
|
||||
GrContext(GrBackendApi, int32_t id = SK_InvalidGenID);
|
||||
GrContext(GrBackendApi, const GrContextOptions& options, int32_t id = SK_InvalidGenID);
|
||||
|
||||
bool initCommon(const GrContextOptions&);
|
||||
virtual bool init(const GrContextOptions&) = 0; // must be called after the ctor!
|
||||
bool initCommon();
|
||||
virtual bool init() = 0; // must be called after the ctor!
|
||||
|
||||
virtual GrAtlasManager* onGetAtlasManager() = 0;
|
||||
|
||||
@ -308,8 +308,6 @@ private:
|
||||
GrStrikeCache* fGlyphCache;
|
||||
std::unique_ptr<GrTextBlobCache> fTextBlobCache;
|
||||
|
||||
bool fDisableGpuYUVConversion;
|
||||
bool fSharpenMipmappedTextures;
|
||||
bool fDidTestPMConversions;
|
||||
// true if the PM/UPM conversion succeeded; false otherwise
|
||||
bool fPMUPMConversionsRoundTrip;
|
||||
|
@ -10,6 +10,7 @@
|
||||
|
||||
#include "GrContextOptions.h"
|
||||
#include "SkRefCnt.h"
|
||||
#include "../private/GrContext_Base.h"
|
||||
|
||||
class GrBackendFormat;
|
||||
class GrCaps;
|
||||
@ -24,7 +25,7 @@ class SkSurfaceCharacterization;
|
||||
* Can be used to perform actions related to the generating GrContext in a thread safe manner. The
|
||||
* proxy does not access the 3D API (e.g. OpenGL) that backs the generating GrContext.
|
||||
*/
|
||||
class SK_API GrContextThreadSafeProxy : public SkRefCnt {
|
||||
class SK_API GrContextThreadSafeProxy : public GrContext_Base {
|
||||
public:
|
||||
~GrContextThreadSafeProxy() override;
|
||||
|
||||
@ -72,7 +73,7 @@ public:
|
||||
|
||||
bool operator==(const GrContextThreadSafeProxy& that) const {
|
||||
// Each GrContext should only ever have a single thread-safe proxy.
|
||||
SkASSERT((this == &that) == (fContextID == that.fContextID));
|
||||
SkASSERT((this == &that) == (this->contextID() == that.contextID()));
|
||||
return this == &that;
|
||||
}
|
||||
|
||||
@ -91,15 +92,12 @@ private:
|
||||
sk_sp<GrSkSLFPFactoryCache> cache);
|
||||
|
||||
sk_sp<const GrCaps> fCaps;
|
||||
const uint32_t fContextID;
|
||||
const GrBackendApi fBackend;
|
||||
const GrContextOptions fOptions;
|
||||
sk_sp<GrSkSLFPFactoryCache> fFPFactoryCache;
|
||||
|
||||
friend class GrDirectContext; // To construct this object
|
||||
friend class GrContextThreadSafeProxyPriv;
|
||||
|
||||
typedef SkRefCnt INHERITED;
|
||||
typedef GrContext_Base INHERITED;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -9,6 +9,7 @@
|
||||
#define GrContext_Base_DEFINED
|
||||
|
||||
#include "SkRefCnt.h"
|
||||
#include "GrContextOptions.h"
|
||||
#include "GrTypes.h"
|
||||
|
||||
class GrBaseContextPriv;
|
||||
@ -32,7 +33,7 @@ public:
|
||||
protected:
|
||||
friend class GrBaseContextPriv; // for hidden functions
|
||||
|
||||
GrContext_Base(GrBackendApi backend, uint32_t uniqueID);
|
||||
GrContext_Base(GrBackendApi backend, const GrContextOptions& options, uint32_t uniqueID);
|
||||
|
||||
/**
|
||||
* An identifier for this context. The id is used by all compatible contexts. For example,
|
||||
@ -43,14 +44,20 @@ protected:
|
||||
*/
|
||||
uint32_t contextID() const { return fContextID; }
|
||||
|
||||
/*
|
||||
* The options in effect for this context
|
||||
*/
|
||||
const GrContextOptions& options() const { return fOptions; }
|
||||
|
||||
GrContext_Base* asBaseContext() { return this; }
|
||||
virtual GrImageContext* asImageContext() { return nullptr; }
|
||||
virtual GrRecordingContext* asRecordingContext() { return nullptr; }
|
||||
virtual GrContext* asDirectContext() { return nullptr; }
|
||||
|
||||
private:
|
||||
const GrBackendApi fBackend;
|
||||
const uint32_t fContextID;
|
||||
const GrBackendApi fBackend;
|
||||
const GrContextOptions fOptions;
|
||||
const uint32_t fContextID;
|
||||
|
||||
typedef SkRefCnt INHERITED;
|
||||
};
|
||||
|
@ -23,7 +23,7 @@ public:
|
||||
protected:
|
||||
friend class GrImageContextPriv; // for hidden functions
|
||||
|
||||
GrImageContext(GrBackendApi backend, uint32_t uniqueID);
|
||||
GrImageContext(GrBackendApi, const GrContextOptions&, uint32_t uniqueID);
|
||||
|
||||
GrImageContext* asImageContext() override { return this; }
|
||||
|
||||
|
@ -23,7 +23,7 @@ public:
|
||||
protected:
|
||||
friend class GrRecordingContextPriv; // for hidden functions
|
||||
|
||||
GrRecordingContext(GrBackendApi backend, uint32_t uniqueID);
|
||||
GrRecordingContext(GrBackendApi, const GrContextOptions&, uint32_t uniqueID);
|
||||
|
||||
GrRecordingContext* asRecordingContext() override { return this; }
|
||||
|
||||
|
@ -18,6 +18,8 @@ public:
|
||||
// from GrContext_Base
|
||||
uint32_t contextID() const { return fContext->contextID(); }
|
||||
|
||||
const GrContextOptions& options() const { return fContext->options(); }
|
||||
|
||||
private:
|
||||
explicit GrBaseContextPriv(GrContext_Base* context) : fContext(context) {}
|
||||
GrBaseContextPriv(const GrBaseContextPriv&); // unimpl
|
||||
|
@ -59,15 +59,15 @@
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
GrContext::GrContext(GrBackendApi backend, int32_t id)
|
||||
: INHERITED(backend, id) {
|
||||
GrContext::GrContext(GrBackendApi backend, const GrContextOptions& options, int32_t id)
|
||||
: INHERITED(backend, options, id) {
|
||||
fResourceCache = nullptr;
|
||||
fResourceProvider = nullptr;
|
||||
fProxyProvider = nullptr;
|
||||
fGlyphCache = nullptr;
|
||||
}
|
||||
|
||||
bool GrContext::initCommon(const GrContextOptions& options) {
|
||||
bool GrContext::initCommon() {
|
||||
ASSERT_SINGLE_OWNER
|
||||
SkASSERT(fCaps); // needs to have been initialized by derived classes
|
||||
SkASSERT(fThreadSafeProxy); // needs to have been initialized by derived classes
|
||||
@ -76,7 +76,7 @@ bool GrContext::initCommon(const GrContextOptions& options) {
|
||||
fCaps = fGpu->refCaps();
|
||||
fResourceCache = new GrResourceCache(fCaps.get(), &fSingleOwner, this->contextID());
|
||||
fResourceProvider = new GrResourceProvider(fGpu.get(), fResourceCache, &fSingleOwner,
|
||||
options.fExplicitlyAllocateGPUResources);
|
||||
this->options().fExplicitlyAllocateGPUResources);
|
||||
fProxyProvider =
|
||||
new GrProxyProvider(fResourceProvider, fResourceCache, fCaps, &fSingleOwner);
|
||||
} else {
|
||||
@ -87,19 +87,17 @@ bool GrContext::initCommon(const GrContextOptions& options) {
|
||||
fResourceCache->setProxyProvider(fProxyProvider);
|
||||
}
|
||||
|
||||
fDisableGpuYUVConversion = options.fDisableGpuYUVConversion;
|
||||
fSharpenMipmappedTextures = options.fSharpenMipmappedTextures;
|
||||
fDidTestPMConversions = false;
|
||||
|
||||
GrPathRendererChain::Options prcOptions;
|
||||
prcOptions.fAllowPathMaskCaching = options.fAllowPathMaskCaching;
|
||||
prcOptions.fAllowPathMaskCaching = this->options().fAllowPathMaskCaching;
|
||||
#if GR_TEST_UTILS
|
||||
prcOptions.fGpuPathRenderers = options.fGpuPathRenderers;
|
||||
prcOptions.fGpuPathRenderers = this->options().fGpuPathRenderers;
|
||||
#endif
|
||||
if (options.fDisableCoverageCountingPaths) {
|
||||
if (this->options().fDisableCoverageCountingPaths) {
|
||||
prcOptions.fGpuPathRenderers &= ~GpuPathRenderers::kCoverageCounting;
|
||||
}
|
||||
if (options.fDisableDistanceFieldPaths) {
|
||||
if (this->options().fDisableDistanceFieldPaths) {
|
||||
prcOptions.fGpuPathRenderers &= ~GpuPathRenderers::kSmall;
|
||||
}
|
||||
|
||||
@ -112,11 +110,11 @@ bool GrContext::initCommon(const GrContextOptions& options) {
|
||||
}
|
||||
|
||||
GrTextContext::Options textContextOptions;
|
||||
textContextOptions.fMaxDistanceFieldFontSize = options.fGlyphsAsPathsFontSize;
|
||||
textContextOptions.fMinDistanceFieldFontSize = options.fMinDistanceFieldFontSize;
|
||||
textContextOptions.fMaxDistanceFieldFontSize = this->options().fGlyphsAsPathsFontSize;
|
||||
textContextOptions.fMinDistanceFieldFontSize = this->options().fMinDistanceFieldFontSize;
|
||||
textContextOptions.fDistanceFieldVerticesAlwaysHaveW = false;
|
||||
#if SK_SUPPORT_ATLAS_TEXT
|
||||
if (GrContextOptions::Enable::kYes == options.fDistanceFieldGlyphVerticesAlwaysHaveW) {
|
||||
if (GrContextOptions::Enable::kYes == this->options().fDistanceFieldGlyphVerticesAlwaysHaveW) {
|
||||
textContextOptions.fDistanceFieldVerticesAlwaysHaveW = true;
|
||||
}
|
||||
#endif
|
||||
@ -126,20 +124,20 @@ bool GrContext::initCommon(const GrContextOptions& options) {
|
||||
: false;
|
||||
fDrawingManager.reset(new GrDrawingManager(this, prcOptions, textContextOptions,
|
||||
&fSingleOwner, explicitlyAllocatingResources,
|
||||
options.fSortRenderTargets,
|
||||
options.fReduceOpListSplitting));
|
||||
this->options().fSortRenderTargets,
|
||||
this->options().fReduceOpListSplitting));
|
||||
|
||||
fGlyphCache = new GrStrikeCache(fCaps.get(), options.fGlyphCacheTextureMaximumBytes);
|
||||
fGlyphCache = new GrStrikeCache(fCaps.get(), this->options().fGlyphCacheTextureMaximumBytes);
|
||||
|
||||
fTextBlobCache.reset(new GrTextBlobCache(TextBlobCacheOverBudgetCB, this, this->contextID()));
|
||||
|
||||
// DDL TODO: we need to think through how the task group & persistent cache
|
||||
// get passed on to/shared between all the DDLRecorders created with this context.
|
||||
if (options.fExecutor) {
|
||||
fTaskGroup = skstd::make_unique<SkTaskGroup>(*options.fExecutor);
|
||||
if (this->options().fExecutor) {
|
||||
fTaskGroup = skstd::make_unique<SkTaskGroup>(*this->options().fExecutor);
|
||||
}
|
||||
|
||||
fPersistentCache = options.fPersistentCache;
|
||||
fPersistentCache = this->options().fPersistentCache;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -32,6 +32,8 @@ public:
|
||||
// from GrContext_Base
|
||||
uint32_t contextID() const { return fContext->contextID(); }
|
||||
|
||||
const GrContextOptions& options() const { return fContext->options(); }
|
||||
|
||||
// from GrImageContext
|
||||
|
||||
// from GrRecordingContext
|
||||
@ -88,9 +90,6 @@ public:
|
||||
sk_sp<GrRenderTargetContext> makeVulkanSecondaryCBRenderTargetContext(
|
||||
const SkImageInfo&, const GrVkDrawableInfo&, const SkSurfaceProps* = nullptr);
|
||||
|
||||
bool disableGpuYUVConversion() const { return fContext->fDisableGpuYUVConversion; }
|
||||
bool sharpenMipmappedTextures() const { return fContext->fSharpenMipmappedTextures; }
|
||||
|
||||
/**
|
||||
* Call to ensure all drawing to the context has been issued to the
|
||||
* underlying 3D API.
|
||||
|
@ -19,16 +19,14 @@ GrContextThreadSafeProxy::GrContextThreadSafeProxy(sk_sp<const GrCaps> caps, uin
|
||||
GrBackendApi backend,
|
||||
const GrContextOptions& options,
|
||||
sk_sp<GrSkSLFPFactoryCache> cache)
|
||||
: fCaps(std::move(caps))
|
||||
, fContextID(contextID)
|
||||
, fBackend(backend)
|
||||
, fOptions(options)
|
||||
: INHERITED(backend, options, contextID)
|
||||
, fCaps(std::move(caps))
|
||||
, fFPFactoryCache(std::move(cache)) {}
|
||||
|
||||
GrContextThreadSafeProxy::~GrContextThreadSafeProxy() = default;
|
||||
|
||||
bool GrContextThreadSafeProxy::matches(GrContext_Base* context) const {
|
||||
return context->priv().contextID() == fContextID;
|
||||
return context->priv().contextID() == this->contextID();
|
||||
}
|
||||
|
||||
SkSurfaceCharacterization GrContextThreadSafeProxy::createCharacterization(
|
||||
|
@ -17,12 +17,15 @@
|
||||
*/
|
||||
class GrContextThreadSafeProxyPriv {
|
||||
public:
|
||||
const GrContextOptions& contextOptions() { return fProxy->fOptions; }
|
||||
// from GrContext_Base
|
||||
uint32_t contextID() const { return fProxy->contextID(); }
|
||||
|
||||
const GrContextOptions& options() const { return fProxy->options(); }
|
||||
|
||||
//
|
||||
const GrCaps* caps() const { return fProxy->fCaps.get(); }
|
||||
sk_sp<const GrCaps> refCaps() const { return fProxy->fCaps; }
|
||||
uint32_t contextID() const { return fProxy->fContextID; }
|
||||
GrBackendApi backend() const { return fProxy->fBackend; }
|
||||
|
||||
sk_sp<GrSkSLFPFactoryCache> fpFactoryCache() const;
|
||||
|
||||
private:
|
||||
|
@ -17,12 +17,13 @@ static int32_t next_id() {
|
||||
}
|
||||
|
||||
GrContext_Base::GrContext_Base(GrBackendApi backend,
|
||||
const GrContextOptions& options,
|
||||
uint32_t contextID)
|
||||
: fBackend(backend)
|
||||
, fOptions(options)
|
||||
, fContextID(SK_InvalidGenID == contextID ? next_id() : contextID) {
|
||||
}
|
||||
|
||||
GrContext_Base::~GrContext_Base() {
|
||||
}
|
||||
GrContext_Base::~GrContext_Base() { }
|
||||
|
||||
|
||||
|
@ -18,16 +18,14 @@
|
||||
class SK_API GrDDLContext : public GrContext {
|
||||
public:
|
||||
GrDDLContext(sk_sp<GrContextThreadSafeProxy> proxy)
|
||||
: INHERITED(proxy->priv().backend(), proxy->priv().contextID()) {
|
||||
: INHERITED(proxy->backend(), proxy->priv().options(), proxy->priv().contextID()) {
|
||||
fCaps = proxy->priv().refCaps();
|
||||
fFPFactoryCache = proxy->priv().fpFactoryCache();
|
||||
SkASSERT(fFPFactoryCache);
|
||||
fThreadSafeProxy = std::move(proxy);
|
||||
}
|
||||
|
||||
~GrDDLContext() override {
|
||||
// The GrDDLContext doesn't actually own the fRestrictedAtlasManager so don't delete it
|
||||
}
|
||||
~GrDDLContext() override { }
|
||||
|
||||
void abandonContext() override {
|
||||
SkASSERT(0); // abandoning in a DDL Recorder doesn't make a whole lot of sense
|
||||
@ -45,11 +43,11 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
bool init(const GrContextOptions& options) override {
|
||||
bool init() override {
|
||||
SkASSERT(fCaps); // should've been set in ctor
|
||||
SkASSERT(fThreadSafeProxy); // should've been set in the ctor
|
||||
|
||||
if (!INHERITED::initCommon(options)) {
|
||||
if (!INHERITED::initCommon()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -70,7 +68,7 @@ sk_sp<GrContext> GrContextPriv::MakeDDL(const sk_sp<GrContextThreadSafeProxy>& p
|
||||
|
||||
// Note: we aren't creating a Gpu here. This causes the resource provider & cache to
|
||||
// also not be created
|
||||
if (!context->init(proxy->priv().contextOptions())) {
|
||||
if (!context->init()) {
|
||||
return nullptr;
|
||||
}
|
||||
return context;
|
||||
|
@ -25,8 +25,8 @@
|
||||
|
||||
class SK_API GrDirectContext : public GrContext {
|
||||
public:
|
||||
GrDirectContext(GrBackendApi backend)
|
||||
: INHERITED(backend)
|
||||
GrDirectContext(GrBackendApi backend, const GrContextOptions& options)
|
||||
: INHERITED(backend, options)
|
||||
, fAtlasManager(nullptr) {
|
||||
}
|
||||
|
||||
@ -58,21 +58,21 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
bool init(const GrContextOptions& options) override {
|
||||
bool init() override {
|
||||
SkASSERT(fCaps); // should've been set in ctor
|
||||
SkASSERT(!fThreadSafeProxy);
|
||||
SkASSERT(!fFPFactoryCache);
|
||||
fFPFactoryCache.reset(new GrSkSLFPFactoryCache());
|
||||
fThreadSafeProxy.reset(new GrContextThreadSafeProxy(fCaps, this->contextID(),
|
||||
this->backend(),
|
||||
options, fFPFactoryCache));
|
||||
this->options(), fFPFactoryCache));
|
||||
|
||||
if (!INHERITED::initCommon(options)) {
|
||||
if (!INHERITED::initCommon()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
GrDrawOpAtlas::AllowMultitexturing allowMultitexturing;
|
||||
if (GrContextOptions::Enable::kNo == options.fAllowMultipleGlyphCacheTextures ||
|
||||
if (GrContextOptions::Enable::kNo == this->options().fAllowMultipleGlyphCacheTextures ||
|
||||
// multitexturing supported only if range can represent the index + texcoords fully
|
||||
!(fCaps->shaderCaps()->floatIs32Bits() || fCaps->shaderCaps()->integerSupport())) {
|
||||
allowMultitexturing = GrDrawOpAtlas::AllowMultitexturing::kNo;
|
||||
@ -84,7 +84,7 @@ protected:
|
||||
GrProxyProvider* proxyProvider = this->contextPriv().proxyProvider();
|
||||
|
||||
fAtlasManager = new GrAtlasManager(proxyProvider, glyphCache,
|
||||
options.fGlyphCacheTextureMaximumBytes,
|
||||
this->options().fGlyphCacheTextureMaximumBytes,
|
||||
allowMultitexturing);
|
||||
this->contextPriv().addOnFlushCallbackObject(fAtlasManager);
|
||||
|
||||
@ -115,7 +115,7 @@ sk_sp<GrContext> GrContext::MakeGL() {
|
||||
|
||||
sk_sp<GrContext> GrContext::MakeGL(sk_sp<const GrGLInterface> interface,
|
||||
const GrContextOptions& options) {
|
||||
sk_sp<GrContext> context(new GrDirectContext(GrBackendApi::kOpenGL));
|
||||
sk_sp<GrContext> context(new GrDirectContext(GrBackendApi::kOpenGL, options));
|
||||
|
||||
context->fGpu = GrGLGpu::Make(std::move(interface), options, context.get());
|
||||
if (!context->fGpu) {
|
||||
@ -123,7 +123,7 @@ sk_sp<GrContext> GrContext::MakeGL(sk_sp<const GrGLInterface> interface,
|
||||
}
|
||||
|
||||
context->fCaps = context->fGpu->refCaps();
|
||||
if (!context->init(options)) {
|
||||
if (!context->init()) {
|
||||
return nullptr;
|
||||
}
|
||||
return context;
|
||||
@ -136,7 +136,7 @@ sk_sp<GrContext> GrContext::MakeMock(const GrMockOptions* mockOptions) {
|
||||
|
||||
sk_sp<GrContext> GrContext::MakeMock(const GrMockOptions* mockOptions,
|
||||
const GrContextOptions& options) {
|
||||
sk_sp<GrContext> context(new GrDirectContext(GrBackendApi::kMock));
|
||||
sk_sp<GrContext> context(new GrDirectContext(GrBackendApi::kMock, options));
|
||||
|
||||
context->fGpu = GrMockGpu::Make(mockOptions, options, context.get());
|
||||
if (!context->fGpu) {
|
||||
@ -144,7 +144,7 @@ sk_sp<GrContext> GrContext::MakeMock(const GrMockOptions* mockOptions,
|
||||
}
|
||||
|
||||
context->fCaps = context->fGpu->refCaps();
|
||||
if (!context->init(options)) {
|
||||
if (!context->init()) {
|
||||
return nullptr;
|
||||
}
|
||||
return context;
|
||||
@ -163,7 +163,7 @@ sk_sp<GrContext> GrContext::MakeVulkan(const GrVkBackendContext& backendContext,
|
||||
const GrContextOptions& options) {
|
||||
#ifdef SK_VULKAN
|
||||
GrContextOptions defaultOptions;
|
||||
sk_sp<GrContext> context(new GrDirectContext(GrBackendApi::kVulkan));
|
||||
sk_sp<GrContext> context(new GrDirectContext(GrBackendApi::kVulkan, options));
|
||||
|
||||
context->fGpu = GrVkGpu::Make(backendContext, options, context.get());
|
||||
if (!context->fGpu) {
|
||||
@ -171,7 +171,7 @@ sk_sp<GrContext> GrContext::MakeVulkan(const GrVkBackendContext& backendContext,
|
||||
}
|
||||
|
||||
context->fCaps = context->fGpu->refCaps();
|
||||
if (!context->init(options)) {
|
||||
if (!context->init()) {
|
||||
return nullptr;
|
||||
}
|
||||
return context;
|
||||
@ -187,7 +187,7 @@ sk_sp<GrContext> GrContext::MakeMetal(void* device, void* queue) {
|
||||
}
|
||||
|
||||
sk_sp<GrContext> GrContext::MakeMetal(void* device, void* queue, const GrContextOptions& options) {
|
||||
sk_sp<GrContext> context(new GrDirectContext(GrBackendApi::kMetal));
|
||||
sk_sp<GrContext> context(new GrDirectContext(GrBackendApi::kMetal, options));
|
||||
|
||||
context->fGpu = GrMtlTrampoline::MakeGpu(context.get(), options, device, queue);
|
||||
if (!context->fGpu) {
|
||||
@ -195,7 +195,7 @@ sk_sp<GrContext> GrContext::MakeMetal(void* device, void* queue, const GrContext
|
||||
}
|
||||
|
||||
context->fCaps = context->fGpu->refCaps();
|
||||
if (!context->init(options)) {
|
||||
if (!context->init()) {
|
||||
return nullptr;
|
||||
}
|
||||
return context;
|
||||
|
@ -7,8 +7,10 @@
|
||||
|
||||
#include "GrImageContext.h"
|
||||
|
||||
GrImageContext::GrImageContext(GrBackendApi backend, uint32_t uniqueID)
|
||||
: INHERITED(backend, uniqueID) {
|
||||
GrImageContext::GrImageContext(GrBackendApi backend,
|
||||
const GrContextOptions& options,
|
||||
uint32_t uniqueID)
|
||||
: INHERITED(backend, options, uniqueID) {
|
||||
}
|
||||
|
||||
GrImageContext::~GrImageContext() {}
|
||||
|
@ -18,6 +18,8 @@ public:
|
||||
// from GrContext_Base
|
||||
uint32_t contextID() const { return fContext->contextID(); }
|
||||
|
||||
const GrContextOptions& options() const { return fContext->options(); }
|
||||
|
||||
// from GrImageContext
|
||||
|
||||
private:
|
||||
|
@ -7,8 +7,10 @@
|
||||
|
||||
#include "GrRecordingContext.h"
|
||||
|
||||
GrRecordingContext::GrRecordingContext(GrBackendApi backend, uint32_t uniqueID)
|
||||
: INHERITED(backend, uniqueID) {
|
||||
GrRecordingContext::GrRecordingContext(GrBackendApi backend,
|
||||
const GrContextOptions& options,
|
||||
uint32_t uniqueID)
|
||||
: INHERITED(backend, options, uniqueID) {
|
||||
}
|
||||
|
||||
GrRecordingContext::~GrRecordingContext() { }
|
||||
|
@ -18,6 +18,8 @@ public:
|
||||
// from GrContext_Base
|
||||
uint32_t contextID() const { return fContext->contextID(); }
|
||||
|
||||
const GrContextOptions& options() const { return fContext->options(); }
|
||||
|
||||
// from GrImageContext
|
||||
|
||||
// from GrRecordingContext
|
||||
|
@ -769,8 +769,8 @@ bool SkGpuDevice::shouldTileImage(const SkImage* image, const SkRect* srcRectPtr
|
||||
GrSamplerState samplerState;
|
||||
bool doBicubic;
|
||||
GrSamplerState::Filter textureFilterMode = GrSkFilterQualityToGrFilterMode(
|
||||
quality, viewMatrix, srcToDstRect, fContext->contextPriv().sharpenMipmappedTextures(),
|
||||
&doBicubic);
|
||||
quality, viewMatrix, srcToDstRect,
|
||||
fContext->contextPriv().options().fSharpenMipmappedTextures, &doBicubic);
|
||||
|
||||
int tileFilterPad;
|
||||
if (doBicubic) {
|
||||
@ -821,7 +821,7 @@ void SkGpuDevice::drawBitmap(const SkBitmap& bitmap,
|
||||
bool doBicubic;
|
||||
GrSamplerState::Filter textureFilterMode = GrSkFilterQualityToGrFilterMode(
|
||||
paint.getFilterQuality(), viewMatrix, SkMatrix::I(),
|
||||
fContext->contextPriv().sharpenMipmappedTextures(), &doBicubic);
|
||||
fContext->contextPriv().options().fSharpenMipmappedTextures, &doBicubic);
|
||||
|
||||
int tileFilterPad;
|
||||
|
||||
@ -1180,7 +1180,7 @@ void SkGpuDevice::drawBitmapRect(const SkBitmap& bitmap,
|
||||
bool doBicubic;
|
||||
GrSamplerState::Filter textureFilterMode = GrSkFilterQualityToGrFilterMode(
|
||||
paint.getFilterQuality(), this->ctm(), srcToDstMatrix,
|
||||
fContext->contextPriv().sharpenMipmappedTextures(), &doBicubic);
|
||||
fContext->contextPriv().options().fSharpenMipmappedTextures, &doBicubic);
|
||||
|
||||
int tileFilterPad;
|
||||
|
||||
|
@ -251,7 +251,7 @@ void SkGpuDevice::drawTextureProducerImpl(GrTextureProducer* producer,
|
||||
bool doBicubic;
|
||||
GrSamplerState::Filter fm = GrSkFilterQualityToGrFilterMode(
|
||||
paint.getFilterQuality(), viewMatrix, srcToDstMatrix,
|
||||
fContext->contextPriv().sharpenMipmappedTextures(), &doBicubic);
|
||||
fContext->contextPriv().options().fSharpenMipmappedTextures, &doBicubic);
|
||||
const GrSamplerState::Filter* filterMode = doBicubic ? nullptr : &fm;
|
||||
|
||||
GrTextureProducer::FilterConstraint constraintMode;
|
||||
|
@ -231,7 +231,8 @@ GrGLProgram* GrGLProgramBuilder::finalize() {
|
||||
SkSL::Program::Settings settings;
|
||||
settings.fCaps = this->gpu()->glCaps().shaderCaps();
|
||||
settings.fFlipY = this->origin() != kTopLeft_GrSurfaceOrigin;
|
||||
settings.fSharpenTextures = this->gpu()->getContext()->contextPriv().sharpenMipmappedTextures();
|
||||
settings.fSharpenTextures =
|
||||
this->gpu()->getContext()->contextPriv().options().fSharpenMipmappedTextures;
|
||||
settings.fFragColorIsInOut = this->fragColorIsInOut();
|
||||
|
||||
SkSL::Program::Inputs inputs;
|
||||
|
@ -319,7 +319,8 @@ GrMtlPipelineState* GrMtlPipelineStateBuilder::finalize(const GrPrimitiveProcess
|
||||
SkSL::Program::Settings settings;
|
||||
settings.fCaps = this->caps()->shaderCaps();
|
||||
settings.fFlipY = this->origin() != kTopLeft_GrSurfaceOrigin;
|
||||
settings.fSharpenTextures = fGpu->getContext()->contextPriv().sharpenMipmappedTextures();
|
||||
settings.fSharpenTextures =
|
||||
fGpu->getContext()->contextPriv().options().fSharpenMipmappedTextures;
|
||||
SkASSERT(!this->fragColorIsInOut());
|
||||
|
||||
id<MTLLibrary> vertexLibrary = nil;
|
||||
|
@ -276,7 +276,8 @@ GrVkPipelineState* GrVkPipelineStateBuilder::finalize(const GrStencilSettings& s
|
||||
SkSL::Program::Settings settings;
|
||||
settings.fCaps = this->caps()->shaderCaps();
|
||||
settings.fFlipY = this->origin() != kTopLeft_GrSurfaceOrigin;
|
||||
settings.fSharpenTextures = this->gpu()->getContext()->contextPriv().sharpenMipmappedTextures();
|
||||
settings.fSharpenTextures =
|
||||
this->gpu()->getContext()->contextPriv().options().fSharpenMipmappedTextures;
|
||||
SkASSERT(!this->fragColorIsInOut());
|
||||
|
||||
sk_sp<SkData> cached;
|
||||
|
@ -425,7 +425,7 @@ sk_sp<GrTextureProxy> SkImage_Lazy::lockTextureProxy(
|
||||
|
||||
// 3. Ask the generator to return YUV planes, which the GPU can convert. If we will be mipping
|
||||
// the texture we fall through here and have the CPU generate the mip maps for us.
|
||||
if (!proxy && !willBeMipped && !ctx->contextPriv().disableGpuYUVConversion()) {
|
||||
if (!proxy && !willBeMipped && !ctx->contextPriv().options().fDisableGpuYUVConversion) {
|
||||
const GrSurfaceDesc desc = GrImageInfoToSurfaceDesc(fInfo);
|
||||
|
||||
SkColorType colorType = fInfo.colorType();
|
||||
|
@ -214,7 +214,7 @@ std::unique_ptr<GrFragmentProcessor> SkImageShader::asFragmentProcessor(
|
||||
bool doBicubic;
|
||||
GrSamplerState::Filter textureFilterMode = GrSkFilterQualityToGrFilterMode(
|
||||
args.fFilterQuality, *args.fViewMatrix, *lm,
|
||||
args.fContext->contextPriv().sharpenMipmappedTextures(), &doBicubic);
|
||||
args.fContext->contextPriv().options().fSharpenMipmappedTextures, &doBicubic);
|
||||
GrSamplerState samplerState(wrapModes, textureFilterMode);
|
||||
SkScalar scaleAdjust[2] = { 1.0f, 1.0f };
|
||||
sk_sp<GrTextureProxy> proxy(as_IB(fImage)->asTextureProxyRef(args.fContext, samplerState,
|
||||
|
Loading…
Reference in New Issue
Block a user