Add plumbing for access to the flush-time GrSmallPathAtlasMgr
This isn't connected to anything yet and parallels what is done for the text GrAtlasManager. The rough pattern is that the GrContext hierarchy implements creating the atlas but it is only exposed/made available via the flush state (which derives from GrDrawMeshOp::Target). TBR=bsalomon@google.com Bug: 1108408 Change-Id: Iad7b5648877dbd20840e8d47c1d24131098ded94 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/309128 Reviewed-by: Robert Phillips <robertphillips@google.com> Reviewed-by: Jim Van Verth <jvanverth@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
This commit is contained in:
parent
cf0d08e149
commit
5edf510941
@ -54,6 +54,7 @@ public:
|
||||
GrResourceProvider* resourceProvider() const override {
|
||||
return fMockContext->priv().resourceProvider();
|
||||
}
|
||||
GrSmallPathAtlasMgr* smallPathAtlasManager() const override { return nullptr; }
|
||||
void resetAllocator() { fAllocator.reset(); }
|
||||
SkArenaAlloc* allocator() override { return &fAllocator; }
|
||||
void putBackVertices(int vertices, size_t vertexStride) override { /* no-op */ }
|
||||
|
@ -33,6 +33,7 @@ class GrPath;
|
||||
class GrRenderTargetContext;
|
||||
class GrResourceCache;
|
||||
class GrResourceProvider;
|
||||
class GrSmallPathAtlasMgr;
|
||||
class GrStrikeCache;
|
||||
class GrSurfaceProxy;
|
||||
class GrSwizzle;
|
||||
@ -755,6 +756,7 @@ protected:
|
||||
bool init() override;
|
||||
|
||||
virtual GrAtlasManager* onGetAtlasManager() = 0;
|
||||
virtual GrSmallPathAtlasMgr* onGetSmallPathAtlasMgr() = 0;
|
||||
|
||||
private:
|
||||
friend class GrDirectContext; // for access to fGpu
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "include/gpu/GrContext.h"
|
||||
|
||||
class GrAtlasManager;
|
||||
class GrSmallPathAtlasMgr;
|
||||
|
||||
class SK_API GrDirectContext : public GrContext {
|
||||
public:
|
||||
@ -80,12 +81,15 @@ protected:
|
||||
bool init() override;
|
||||
|
||||
GrAtlasManager* onGetAtlasManager() override { return fAtlasManager.get(); }
|
||||
GrSmallPathAtlasMgr* onGetSmallPathAtlasMgr() override;
|
||||
|
||||
GrDirectContext* asDirectContext() override { return this; }
|
||||
|
||||
private:
|
||||
std::unique_ptr<GrAtlasManager> fAtlasManager;
|
||||
|
||||
// The small path renderer atlas will be stored here
|
||||
|
||||
typedef GrContext INHERITED;
|
||||
};
|
||||
|
||||
|
@ -112,6 +112,11 @@ public:
|
||||
return fContext->onGetAtlasManager();
|
||||
}
|
||||
|
||||
// This accessor should only ever be called by the GrOpFlushState.
|
||||
GrSmallPathAtlasMgr* getSmallPathAtlasMgr() {
|
||||
return fContext->onGetSmallPathAtlasMgr();
|
||||
}
|
||||
|
||||
void copyRenderTasksFromDDL(sk_sp<const SkDeferredDisplayList>, GrRenderTargetProxy* newDest);
|
||||
|
||||
bool compile(const GrProgramDesc&, const GrProgramInfo&);
|
||||
|
@ -63,6 +63,11 @@ private:
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
GrSmallPathAtlasMgr* onGetSmallPathAtlasMgr() override {
|
||||
SkASSERT(0); // DDL recorders should never invoke this
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Add to the set of unique program infos required by this DDL
|
||||
void recordProgramInfo(const GrProgramInfo* programInfo) final {
|
||||
if (!programInfo) {
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "src/gpu/effects/GrSkSLFP.h"
|
||||
#include "src/gpu/gl/GrGLGpu.h"
|
||||
#include "src/gpu/mock/GrMockGpu.h"
|
||||
#include "src/gpu/ops/GrSmallPathAtlasMgr.h"
|
||||
#include "src/gpu/text/GrAtlasManager.h"
|
||||
#include "src/gpu/text/GrStrikeCache.h"
|
||||
#ifdef SK_METAL
|
||||
@ -113,6 +114,11 @@ bool GrDirectContext::init() {
|
||||
return true;
|
||||
}
|
||||
|
||||
GrSmallPathAtlasMgr* GrDirectContext::onGetSmallPathAtlasMgr() {
|
||||
// The small path renderer atlas will be created here
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#ifdef SK_GL
|
||||
/*************************************************************************************************/
|
||||
#ifndef SK_DISABLE_LEGACY_CONTEXT_FACTORIES
|
||||
|
@ -206,6 +206,10 @@ GrAtlasManager* GrOpFlushState::atlasManager() const {
|
||||
return fGpu->getContext()->priv().getAtlasManager();
|
||||
}
|
||||
|
||||
GrSmallPathAtlasMgr* GrOpFlushState::smallPathAtlasManager() const {
|
||||
return fGpu->getContext()->priv().getSmallPathAtlasMgr();
|
||||
}
|
||||
|
||||
void GrOpFlushState::drawMesh(const GrSimpleMesh& mesh) {
|
||||
SkASSERT(mesh.fIsInitialized);
|
||||
if (!mesh.fIndexBuffer) {
|
||||
|
@ -157,9 +157,10 @@ public:
|
||||
|
||||
GrStrikeCache* strikeCache() const final;
|
||||
|
||||
// At this point we know we're flushing so full access to the GrAtlasManager is required (and
|
||||
// permissible).
|
||||
// At this point we know we're flushing so full access to the GrAtlasManager and
|
||||
// GrSmallPathAtlasMgr is required (and permissible).
|
||||
GrAtlasManager* atlasManager() const final;
|
||||
GrSmallPathAtlasMgr* smallPathAtlasManager() const final;
|
||||
|
||||
/** GrMeshDrawOp::Target override. */
|
||||
SkArenaAlloc* allocator() override { return &fArena; }
|
||||
|
@ -19,6 +19,7 @@ class GrAtlasManager;
|
||||
class GrCaps;
|
||||
class GrStrikeCache;
|
||||
class GrOpFlushState;
|
||||
class GrSmallPathAtlasMgr;
|
||||
|
||||
/**
|
||||
* Base class for mesh-drawing GrDrawOps.
|
||||
@ -222,6 +223,7 @@ public:
|
||||
|
||||
virtual GrStrikeCache* strikeCache() const = 0;
|
||||
virtual GrAtlasManager* atlasManager() const = 0;
|
||||
virtual GrSmallPathAtlasMgr* smallPathAtlasManager() const = 0;
|
||||
|
||||
// This should be called during onPrepare of a GrOp. The caller should add any proxies to the
|
||||
// array it will use that it did not access during a call to visitProxies. This is usually the
|
||||
|
Loading…
Reference in New Issue
Block a user