Remove FixedDynamicState from GrProgramInfo and GrPipeline

Everybody uses explicit binding now.

Change-Id: Idb6f64104eddd31d28dd2ba19f9743520a4e5170
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/277541
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
This commit is contained in:
Chris Dalton 2020-03-17 14:29:06 -06:00 committed by Skia Commit-Bot
parent 1c3bea4593
commit 304e14d883
27 changed files with 60 additions and 196 deletions

View File

@ -310,8 +310,6 @@ private:
void onExecute(GrOpFlushState* state, const SkRect& chainBounds) override {
GrPipeline pipeline(GrScissorTest::kDisabled, SkBlendMode::kSrc,
state->drawOpArgs().outputSwizzle());
GrPipeline::FixedDynamicState fixedDynamicState;
int tessellationPatchVertexCount;
std::unique_ptr<GrGeometryProcessor> shader;
if (fTriPositions) {
@ -329,8 +327,8 @@ private:
GrProgramInfo programInfo(state->proxy()->numSamples(), state->proxy()->numStencilSamples(),
state->proxy()->backendFormat(), state->outputView()->origin(),
&pipeline, shader.get(), &fixedDynamicState,
GrPrimitiveType::kPatches, tessellationPatchVertexCount);
&pipeline, shader.get(), GrPrimitiveType::kPatches,
tessellationPatchVertexCount);
state->bindPipeline(programInfo, SkRect::MakeIWH(kWidth, kHeight));
state->bindBuffers(nullptr, nullptr, fVertexBuffer.get());

View File

@ -49,17 +49,11 @@ void GrOpFlushState::executeDrawsAndUploadsForMeshDrawOp(
this->outputView()->origin(),
pipeline,
fCurrDraw->fGeometryProcessor,
fCurrDraw->fFixedDynamicState,
fCurrDraw->fPrimitiveType);
fOpsRenderPass->bindPipeline(programInfo, chainBounds);
if (programInfo.hasFixedScissor()) {
fOpsRenderPass->setScissorRect(programInfo.fixedScissor());
}
auto primProcTextures = (programInfo.hasFixedPrimProcTextures()) ?
programInfo.fixedPrimProcTextures() : nullptr;
fOpsRenderPass->bindTextures(programInfo.primProc(), primProcTextures,
programInfo.pipeline());
this->bindPipelineAndScissorClip(programInfo, chainBounds);
this->bindTextures(programInfo.primProc(), fCurrDraw->fPrimProcProxies,
programInfo.pipeline());
for (int i = 0; i < fCurrDraw->fMeshCnt; ++i) {
this->drawMesh(fCurrDraw->fMeshes[i]);
}
@ -141,20 +135,19 @@ void GrOpFlushState::recordDraw(
const GrGeometryProcessor* gp,
const GrSimpleMesh meshes[],
int meshCnt,
const GrPipeline::FixedDynamicState* fixedDynamicState,
const GrSurfaceProxy* const primProcProxies[],
GrPrimitiveType primitiveType) {
SkASSERT(fOpArgs);
SkDEBUGCODE(fOpArgs->validate());
bool firstDraw = fDraws.begin() == fDraws.end();
auto& draw = fDraws.append(&fArena);
GrDeferredUploadToken token = fTokenTracker->issueDrawToken();
if (fixedDynamicState && fixedDynamicState->fPrimitiveProcessorTextures) {
for (int i = 0; i < gp->numTextureSamplers(); ++i) {
fixedDynamicState->fPrimitiveProcessorTextures[i]->ref();
}
for (int i = 0; i < gp->numTextureSamplers(); ++i) {
SkASSERT(primProcProxies && primProcProxies[i]);
primProcProxies[i]->ref();
}
draw.fGeometryProcessor = gp;
draw.fFixedDynamicState = fixedDynamicState;
draw.fPrimProcProxies = primProcProxies;
draw.fMeshes = meshes;
draw.fMeshCnt = meshCnt;
draw.fOp = fOpArgs->op();
@ -230,9 +223,8 @@ void GrOpFlushState::drawMesh(const GrSimpleMesh& mesh) {
//////////////////////////////////////////////////////////////////////////////
GrOpFlushState::Draw::~Draw() {
if (fFixedDynamicState && fFixedDynamicState->fPrimitiveProcessorTextures) {
for (int i = 0; i < fGeometryProcessor->numTextureSamplers(); ++i) {
fFixedDynamicState->fPrimitiveProcessorTextures[i]->unref();
}
for (int i = 0; i < fGeometryProcessor->numTextureSamplers(); ++i) {
SkASSERT(fPrimProcProxies && fPrimProcProxies[i]);
fPrimProcProxies[i]->unref();
}
}

View File

@ -119,7 +119,7 @@ public:
void recordDraw(const GrGeometryProcessor*,
const GrSimpleMesh[],
int meshCnt,
const GrPipeline::FixedDynamicState*,
const GrSurfaceProxy* const primProcProxies[],
GrPrimitiveType) final;
void* makeVertexSpace(size_t vertexSize, int vertexCount, sk_sp<const GrBuffer>*,
int* startVertex) final;
@ -237,7 +237,8 @@ private:
// the stack (for CCPR). In either case this object does not need to manage its
// lifetime.
const GrGeometryProcessor* fGeometryProcessor = nullptr;
const GrPipeline::FixedDynamicState* fFixedDynamicState = nullptr;
// Must have GrPrimitiveProcessor::numTextureSamplers() entries. Can be null if no samplers.
const GrSurfaceProxy* const* fPrimProcProxies = nullptr;
const GrSimpleMesh* fMeshes = nullptr;
const GrOp* fOp = nullptr;
int fMeshCnt = 0;

View File

@ -61,5 +61,5 @@ void GrPathRendering::drawPath(GrRenderTarget* renderTarget,
*fGpu->caps())) {
fGpu->xferBarrier(renderTarget, barrierType);
}
this->onDrawPath(renderTarget, programInfo, stencilPassSettings, path);
this->onDrawPath(stencilPassSettings, path);
}

View File

@ -124,10 +124,7 @@ protected:
GrPathRendering(GrGpu* gpu) : fGpu(gpu) { }
virtual void onStencilPath(const StencilPathArgs&, const GrPath*) = 0;
virtual void onDrawPath(GrRenderTarget*,
const GrProgramInfo&,
const GrStencilSettings&,
const GrPath*) = 0;
virtual void onDrawPath(const GrStencilSettings&, const GrPath*) = 0;
GrGpu* fGpu;
private:

View File

@ -42,10 +42,7 @@ void GrGLPathRendering::setProjectionMatrix(const SkMatrix&, const SkISize&, GrS
sk_sp<GrPath> GrGLPathRendering::createPath(const SkPath&, const GrStyle&) { return nullptr; }
void GrGLPathRendering::onDrawPath(GrRenderTarget*,
const GrProgramInfo&,
const GrStencilSettings&,
const GrPath*) {}
void GrGLPathRendering::onDrawPath(const GrStencilSettings&, const GrPath*) {}
void GrGLPathRendering::onStencilPath(const StencilPathArgs&, const GrPath*) {}

View File

@ -74,19 +74,6 @@ public:
GrSwizzle fOutputSwizzle;
};
/**
* Some state can be changed between GrMeshes without changing GrPipelines. This is generally
* less expensive then using multiple pipelines. Such state is called "dynamic state".
* Use this to specify state that does not vary between GrMeshes.
**/
struct FixedDynamicState {
explicit FixedDynamicState(const SkIRect& scissorRect) : fScissorRect(scissorRect) {}
FixedDynamicState() = default;
SkIRect fScissorRect = SkIRect::MakeEmpty();
// Must have GrPrimitiveProcessor::numTextureSamplers() entries. Can be null if no samplers.
GrSurfaceProxy** fPrimitiveProcessorTextures = nullptr;
};
/**
* Creates a simple pipeline with default settings and no processors. The provided blend mode
* must be "Porter Duff" (<= kLastCoeffMode). If using GrScissorTest::kEnabled, the caller must

View File

@ -28,53 +28,27 @@ void GrProgramInfo::validate(bool flushTime) const {
if (flushTime) {
SkASSERT(fPipeline->allProxiesInstantiated());
}
if (this->hasFixedPrimProcTextures()) {
SkASSERT(fPrimProc->numTextureSamplers());
}
if (!fPipeline->isScissorTestEnabled()) {
SkASSERT(!this->hasFixedScissor());
}
}
void GrProgramInfo::checkAllInstantiated() const {
if (this->hasFixedPrimProcTextures()) {
auto fixedPrimProcTextures = this->fixedPrimProcTextures();
for (int s = 0; s < this->primProc().numTextureSamplers(); ++s) {
SkASSERT(fixedPrimProcTextures[s]->isInstantiated());
}
}
for (auto [sampler, fp] : GrFragmentProcessor::PipelineTextureSamplerRange(this->pipeline())) {
SkASSERT(sampler.proxy()->isInstantiated());
}
}
void GrProgramInfo::checkMSAAAndMIPSAreResolved() const {
auto assertResolved = [](GrTexture* tex, GrSamplerState sampler) {
for (auto [sampler, fp] : GrFragmentProcessor::PipelineTextureSamplerRange(this->pipeline())) {
GrTexture* tex = sampler.peekTexture();
SkASSERT(tex);
// Ensure mipmaps were all resolved ahead of time by the DAG.
if (GrSamplerState::Filter::kMipMap == sampler.filter() &&
if (GrSamplerState::Filter::kMipMap == sampler.samplerState().filter() &&
(tex->width() != 1 || tex->height() != 1)) {
// There are some cases where we might be given a non-mipmapped texture with a mipmap
// filter. See skbug.com/7094.
SkASSERT(tex->texturePriv().mipMapped() != GrMipMapped::kYes ||
!tex->texturePriv().mipMapsAreDirty());
}
};
if (this->hasFixedPrimProcTextures()) {
auto fixedPrimProcTextures = this->fixedPrimProcTextures();
for (int s = 0; s < this->primProc().numTextureSamplers(); ++s) {
auto* tex = fixedPrimProcTextures[s]->peekTexture();
assertResolved(tex, this->primProc().textureSampler(s).samplerState());
}
}
for (auto [sampler, fp] : GrFragmentProcessor::PipelineTextureSamplerRange(this->pipeline())) {
assertResolved(sampler.peekTexture(), sampler.samplerState());
}
}

View File

@ -22,7 +22,6 @@ public:
GrSurfaceOrigin origin,
const GrPipeline* pipeline,
const GrPrimitiveProcessor* primProc,
const GrPipeline::FixedDynamicState* fixedDynamicState,
GrPrimitiveType primitiveType,
uint8_t tessellationPatchVertexCount = 0)
: fNumRasterSamples(pipeline->isStencilEnabled() ? numStencilSamples : numSamples)
@ -31,7 +30,6 @@ public:
, fOrigin(origin)
, fPipeline(pipeline)
, fPrimProc(primProc)
, fFixedDynamicState(fixedDynamicState)
, fPrimitiveType(primitiveType)
, fTessellationPatchVertexCount(tessellationPatchVertexCount) {
SkASSERT(fNumRasterSamples > 0);
@ -55,25 +53,6 @@ public:
GrSurfaceOrigin origin() const { return fOrigin; }
const GrPipeline& pipeline() const { return *fPipeline; }
const GrPrimitiveProcessor& primProc() const { return *fPrimProc; }
const GrPipeline::FixedDynamicState* fixedDynamicState() const { return fFixedDynamicState; }
bool hasFixedScissor() const { return fPipeline->isScissorTestEnabled() && fFixedDynamicState; }
const SkIRect& fixedScissor() const {
SkASSERT(this->hasFixedScissor());
return fFixedDynamicState->fScissorRect;
}
bool hasFixedPrimProcTextures() const {
return fFixedDynamicState && fFixedDynamicState->fPrimitiveProcessorTextures;
}
const GrSurfaceProxy* const* fixedPrimProcTextures() const {
SkASSERT(this->hasFixedPrimProcTextures());
return fFixedDynamicState->fPrimitiveProcessorTextures;
}
GrPrimitiveType primitiveType() const { return fPrimitiveType; }
uint8_t tessellationPatchVertexCount() const {
@ -111,7 +90,6 @@ private:
const GrSurfaceOrigin fOrigin;
const GrPipeline* fPipeline;
const GrPrimitiveProcessor* fPrimProc;
const GrPipeline::FixedDynamicState* fFixedDynamicState;
GrProcessor::CustomFeatures fRequestedFeatures;
GrPrimitiveType fPrimitiveType;
uint8_t fTessellationPatchVertexCount; // GrPrimType::kPatches.

View File

@ -200,7 +200,7 @@ void GrCCCoverageProcessor::bindPipeline(GrOpFlushState* flushState, const GrPip
GrProgramInfo programInfo(flushState->proxy()->numSamples(),
flushState->proxy()->numStencilSamples(),
flushState->proxy()->backendFormat(),
flushState->outputView()->origin(), &pipeline, this, nullptr,
flushState->outputView()->origin(), &pipeline, this,
this->primType());
flushState->bindPipeline(programInfo, drawBounds);
}

View File

@ -138,7 +138,7 @@ void GrCCPathProcessor::drawPaths(GrOpFlushState* flushState, const GrPipeline&
GrRenderTargetProxy* rtProxy = flushState->proxy();
GrProgramInfo programInfo(rtProxy->numSamples(), rtProxy->numStencilSamples(),
rtProxy->backendFormat(), flushState->outputView()->origin(),
&pipeline, this, nullptr, primitiveType);
&pipeline, this, primitiveType);
flushState->bindPipelineAndScissorClip(programInfo, bounds);
flushState->bindTextures(*this, atlasProxy, pipeline);

View File

@ -738,7 +738,7 @@ void GrCCStroker::drawLog2Strokes(int numSegmentsLog2, GrOpFlushState* flushStat
GrProgramInfo programInfo(flushState->proxy()->numSamples(),
flushState->proxy()->numStencilSamples(),
flushState->proxy()->backendFormat(),
flushState->outputView()->origin(), &pipeline, &processor, nullptr,
flushState->outputView()->origin(), &pipeline, &processor,
GrPrimitiveType::kTriangleStrip);
flushState->bindPipeline(programInfo, SkRect::Make(drawBounds));

View File

@ -152,7 +152,7 @@ void GrStencilAtlasOp::onExecute(GrOpFlushState* flushState, const SkRect& chain
flushState->proxy()->numStencilSamples(),
flushState->proxy()->backendFormat(),
flushState->outputView()->origin(), &resolvePipeline, &primProc,
nullptr, GrPrimitiveType::kTriangleStrip);
GrPrimitiveType::kTriangleStrip);
flushState->bindPipeline(programInfo, SkRect::Make(drawBoundsRect));
flushState->setScissorRect(drawBoundsRect);

View File

@ -109,20 +109,8 @@ void GrGLPathRendering::onStencilPath(const StencilPathArgs& args, const GrPath*
}
}
void GrGLPathRendering::onDrawPath(GrRenderTarget* renderTarget,
const GrProgramInfo& programInfo,
const GrStencilSettings& stencilPassSettings,
void GrGLPathRendering::onDrawPath(const GrStencilSettings& stencilPassSettings,
const GrPath* path) {
if (!this->gpu()->flushGLState(renderTarget, programInfo)) {
return;
}
if (programInfo.hasFixedScissor()) {
this->gpu()->flushScissorRect(programInfo.fixedScissor(), renderTarget->width(),
renderTarget->height(), programInfo.origin());
}
this->gpu()->currentProgram()->bindTextures(programInfo.primProc(), nullptr,
programInfo.pipeline());
const GrGLPath* glPath = static_cast<const GrGLPath*>(path);
this->flushPathStencilSettings(stencilPassSettings);

View File

@ -65,8 +65,7 @@ public:
protected:
void onStencilPath(const StencilPathArgs&, const GrPath*) override;
void onDrawPath(GrRenderTarget*, const GrProgramInfo&, const GrStencilSettings&,
const GrPath*) override;
void onDrawPath(const GrStencilSettings&, const GrPath*) override;
private:
/**

View File

@ -305,16 +305,16 @@ void GrAtlasTextOp::onPrepareDraws(Target* target) {
static_assert(GrDistanceFieldA8TextGeoProc::kMaxTextures == kMaxTextures);
static_assert(GrDistanceFieldLCDTextGeoProc::kMaxTextures == kMaxTextures);
auto fixedDynamicState = target->makeFixedDynamicState(kMaxTextures);
auto primProcProxies = target->allocPrimProcProxyPtrs(kMaxTextures);
for (unsigned i = 0; i < numActiveViews; ++i) {
fixedDynamicState->fPrimitiveProcessorTextures[i] = views[i].proxy();
primProcProxies[i] = views[i].proxy();
// This op does not know its atlas proxies when it is added to a GrOpsTasks, so the proxies
// don't get added during the visitProxies call. Thus we add them here.
target->sampledProxyArray()->push_back(views[i].proxy());
}
FlushInfo flushInfo;
flushInfo.fFixedDynamicState = fixedDynamicState;
flushInfo.fPrimProcProxies = primProcProxies;
bool vmPerspective = fGeoData[0].fDrawMatrix.hasPerspective();
if (this->usesDistanceFields()) {
@ -487,13 +487,13 @@ void GrAtlasTextOp::createDrawForGeneratedGlyphs(
// During preparation the number of atlas pages has increased.
// Update the proxies used in the GP to match.
for (unsigned i = gp->numTextureSamplers(); i < numActiveViews; ++i) {
flushInfo->fFixedDynamicState->fPrimitiveProcessorTextures[i] = views[i].proxy();
flushInfo->fPrimProcProxies[i] = views[i].proxy();
// This op does not know its atlas proxies when it is added to a GrOpsTasks, so the
// proxies don't get added during the visitProxies call. Thus we add them here.
target->sampledProxyArray()->push_back(views[i].proxy());
// These will get unreffed when the previously recorded draws destruct.
for (int d = 0; d < flushInfo->fNumDraws; ++d) {
flushInfo->fFixedDynamicState->fPrimitiveProcessorTextures[i]->ref();
flushInfo->fPrimProcProxies[i]->ref();
}
}
if (this->usesDistanceFields()) {
@ -515,7 +515,7 @@ void GrAtlasTextOp::createDrawForGeneratedGlyphs(
mesh->setIndexedPatterned(flushInfo->fIndexBuffer, kIndicesPerGlyph, flushInfo->fGlyphsToFlush,
maxGlyphsPerDraw, flushInfo->fVertexBuffer, kVerticesPerGlyph,
flushInfo->fVertexOffset);
target->recordDraw(flushInfo->fGeometryProcessor, mesh, 1, flushInfo->fFixedDynamicState,
target->recordDraw(flushInfo->fGeometryProcessor, mesh, 1, flushInfo->fPrimProcProxies,
GrPrimitiveType::kTriangles);
flushInfo->fVertexOffset += kVerticesPerGlyph * flushInfo->fGlyphsToFlush;
flushInfo->fGlyphsToFlush = 0;

View File

@ -105,7 +105,7 @@ private:
sk_sp<const GrBuffer> fVertexBuffer;
sk_sp<const GrBuffer> fIndexBuffer;
GrGeometryProcessor* fGeometryProcessor;
GrPipeline::FixedDynamicState* fFixedDynamicState;
const GrSurfaceProxy** fPrimProcProxies;
int fGlyphsToFlush = 0;
int fVertexOffset = 0;
int fNumDraws = 0;

View File

@ -77,14 +77,6 @@ std::unique_ptr<GrDrawOp> GrDrawPathOp::Make(GrRecordingContext* context,
}
void GrDrawPathOp::onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) {
GrPipeline::FixedDynamicState* fixedDynamicState = nullptr, storage;
const GrAppliedClip* appliedClip = flushState->appliedClip();
if (appliedClip && appliedClip->scissorState().enabled()) {
storage.fScissorRect = appliedClip->scissorState().rect();
fixedDynamicState = &storage;
}
GrPipeline::InputFlags pipelineFlags = GrPipeline::InputFlags::kNone;
if (this->doAA()) {
pipelineFlags |= GrPipeline::InputFlags::kHWAntialias;
@ -104,9 +96,11 @@ void GrDrawPathOp::onExecute(GrOpFlushState* flushState, const SkRect& chainBoun
flushState->outputView()->origin(),
pipeline,
pathProc.get(),
fixedDynamicState,
GrPrimitiveType::kPath);
flushState->bindPipelineAndScissorClip(programInfo, this->bounds());
flushState->bindTextures(programInfo.primProc(), nullptr, programInfo.pipeline());
GrStencilSettings stencil;
init_stencil_pass_settings(*flushState, this->fillType(), &stencil);
flushState->gpu()->pathRendering()->drawPath(proxy->peekRenderTarget(),

View File

@ -85,8 +85,8 @@ void GrMeshDrawOp::PatternHelper::recordDraw(Target* target, const GrGeometryPro
void GrMeshDrawOp::PatternHelper::recordDraw(
Target* target,
const GrGeometryProcessor* gp,
const GrPipeline::FixedDynamicState* fixedDynamicState) const {
target->recordDraw(gp, fMesh, 1, fixedDynamicState, fPrimitiveType);
const GrSurfaceProxy* const primProcProxies[]) const {
target->recordDraw(gp, fMesh, 1, primProcProxies, fPrimitiveType);
}
//////////////////////////////////////////////////////////////////////////////
@ -102,26 +102,3 @@ GrMeshDrawOp::QuadHelper::QuadHelper(Target* target, size_t vertexStride, int qu
GrResourceProvider::NumIndicesPerNonAAQuad(), quadsToDraw,
GrResourceProvider::MaxNumNonAAQuads());
}
//////////////////////////////////////////////////////////////////////////////
GrPipeline::FixedDynamicState* GrMeshDrawOp::Target::MakeFixedDynamicState(
SkArenaAlloc* arena, const GrAppliedClip* clip, int numPrimProcTextures) {
bool haveScissor = clip && clip->scissorState().enabled();
if (haveScissor || numPrimProcTextures) {
auto result = arena->make<GrPipeline::FixedDynamicState>();
if (haveScissor) {
result->fScissorRect = clip->scissorState().rect();
}
if (numPrimProcTextures) {
result->fPrimitiveProcessorTextures = arena->makeArrayDefault<GrSurfaceProxy*>(
numPrimProcTextures);
}
return result;
}
return nullptr;
}

View File

@ -57,7 +57,7 @@ protected:
/** Called to issue draws to the GrMeshDrawOp::Target.*/
void recordDraw(Target*, const GrGeometryProcessor*) const;
void recordDraw(Target*, const GrGeometryProcessor*,
const GrPipeline::FixedDynamicState*) const;
const GrSurfaceProxy* const primProcProxies[]) const;
void* vertices() const { return fVertices; }
GrSimpleMesh* mesh() { return fMesh; }
@ -130,24 +130,23 @@ class GrMeshDrawOp::Target {
public:
virtual ~Target() {}
/** Adds a draw of a mesh. */
/** Adds a draw of a mesh. 'primProcProxies' must have
* GrPrimitiveProcessor::numTextureSamplers() entries. Can be null if no samplers.
*/
virtual void recordDraw(const GrGeometryProcessor*,
const GrSimpleMesh[],
int meshCnt,
const GrPipeline::FixedDynamicState*,
const GrSurfaceProxy* const primProcProxies[],
GrPrimitiveType) = 0;
/**
* Helper for drawing GrSimpleMesh(es) with zero primProc textures and no dynamic state besides
* the scissor clip.
* Helper for drawing GrSimpleMesh(es) with zero primProc textures.
*/
void recordDraw(const GrGeometryProcessor* gp,
const GrSimpleMesh meshes[],
int meshCnt,
GrPrimitiveType primitiveType) {
static constexpr int kZeroPrimProcTextures = 0;
auto fixedDynamicState = this->makeFixedDynamicState(kZeroPrimProcTextures);
this->recordDraw(gp, meshes, meshCnt, fixedDynamicState, primitiveType);
this->recordDraw(gp, meshes, meshCnt, nullptr, primitiveType);
}
/**
@ -191,15 +190,8 @@ public:
GrSimpleMesh* allocMesh() { return this->allocator()->make<GrSimpleMesh>(); }
GrSimpleMesh* allocMeshes(int n) { return this->allocator()->makeArray<GrSimpleMesh>(n); }
static GrPipeline::FixedDynamicState* MakeFixedDynamicState(SkArenaAlloc*,
const GrAppliedClip* clip,
int numPrimitiveProcessorTextures);
GrPipeline::FixedDynamicState* makeFixedDynamicState(int numPrimitiveProcessorTextures) {
return MakeFixedDynamicState(this->allocator(), this->appliedClip(),
numPrimitiveProcessorTextures);
const GrSurfaceProxy** allocPrimProcProxyPtrs(int n) {
return this->allocator()->makeArray<const GrSurfaceProxy*>(n);
}
virtual GrRenderTargetProxy* proxy() const = 0;

View File

@ -164,14 +164,7 @@ GrProgramInfo* GrSimpleMeshDrawOpHelper::CreateProgramInfo(
GrProcessorSet&& processorSet,
GrPrimitiveType primitiveType,
GrPipeline::InputFlags pipelineFlags,
const GrUserStencilSettings* stencilSettings,
GrPipeline::FixedDynamicState* fixedDynamicState) {
if (!fixedDynamicState) {
static constexpr int kZeroPrimProcTextures = 0;
fixedDynamicState = GrMeshDrawOp::Target::MakeFixedDynamicState(arena, &appliedClip,
kZeroPrimProcTextures);
}
const GrUserStencilSettings* stencilSettings) {
auto pipeline = CreatePipeline(caps,
arena,
outputView,
@ -189,7 +182,6 @@ GrProgramInfo* GrSimpleMeshDrawOpHelper::CreateProgramInfo(
outputView->origin(),
pipeline,
geometryProcessor,
fixedDynamicState,
primitiveType);
return tmp;
}

View File

@ -154,8 +154,7 @@ public:
GrPipeline::InputFlags pipelineFlags
= GrPipeline::InputFlags::kNone,
const GrUserStencilSettings*
= &GrUserStencilSettings::kUnused,
GrPipeline::FixedDynamicState* = nullptr);
= &GrUserStencilSettings::kUnused);
GrProgramInfo* createProgramInfo(const GrCaps*,
SkArenaAlloc*,

View File

@ -306,7 +306,7 @@ private:
sk_sp<const GrBuffer> fVertexBuffer;
sk_sp<const GrBuffer> fIndexBuffer;
GrGeometryProcessor* fGeometryProcessor;
GrPipeline::FixedDynamicState* fFixedDynamicState;
const GrSurfaceProxy** fPrimProcProxies;
int fVertexOffset;
int fInstancesToFlush;
};
@ -338,13 +338,13 @@ private:
static_assert(GrBitmapTextGeoProc::kMaxTextures == kMaxTextures);
FlushInfo flushInfo;
flushInfo.fFixedDynamicState = target->makeFixedDynamicState(kMaxTextures);
flushInfo.fPrimProcProxies = target->allocPrimProcProxyPtrs(kMaxTextures);
int numActiveProxies = fAtlas->numActivePages();
const auto views = fAtlas->getViews();
for (int i = 0; i < numActiveProxies; ++i) {
// This op does not know its atlas proxies when it is added to a GrOpsTasks, so the
// proxies don't get added during the visitProxies call. Thus we add them here.
flushInfo.fFixedDynamicState->fPrimitiveProcessorTextures[i] = views[i].proxy();
flushInfo.fPrimProcProxies[i] = views[i].proxy();
target->sampledProxyArray()->push_back(views[i].proxy());
}
@ -798,7 +798,7 @@ private:
const auto views = fAtlas->getViews();
if (gp->numTextureSamplers() != numAtlasTextures) {
for (int i = gp->numTextureSamplers(); i < numAtlasTextures; ++i) {
flushInfo->fFixedDynamicState->fPrimitiveProcessorTextures[i] = views[i].proxy();
flushInfo->fPrimProcProxies[i] = views[i].proxy();
// This op does not know its atlas proxies when it is added to a GrOpsTasks, so the
// proxies don't get added during the visitProxies call. Thus we add them here.
target->sampledProxyArray()->push_back(views[i].proxy());
@ -825,8 +825,8 @@ private:
flushInfo->fVertexBuffer,
GrResourceProvider::NumVertsPerNonAAQuad(),
flushInfo->fVertexOffset);
target->recordDraw(flushInfo->fGeometryProcessor, mesh, 1,
flushInfo->fFixedDynamicState, GrPrimitiveType::kTriangles);
target->recordDraw(flushInfo->fGeometryProcessor, mesh, 1, flushInfo->fPrimProcProxies,
GrPrimitiveType::kTriangles);
flushInfo->fVertexOffset += GrResourceProvider::NumVertsPerNonAAQuad() *
flushInfo->fInstancesToFlush;
flushInfo->fInstancesToFlush = 0;

View File

@ -173,7 +173,7 @@ void GrDrawAtlasPathOp::onExecute(GrOpFlushState* state, const SkRect& chainBoun
GrProgramInfo programInfo(state->proxy()->numSamples(), state->proxy()->numStencilSamples(),
state->proxy()->backendFormat(), state->outputView()->origin(),
&pipeline, &shader, nullptr, GrPrimitiveType::kTriangleStrip);
&pipeline, &shader, GrPrimitiveType::kTriangleStrip);
state->bindPipelineAndScissorClip(programInfo, this->bounds());
state->bindTextures(shader, *fAtlasProxy, pipeline);

View File

@ -40,7 +40,7 @@ public:
ProgramInfo(const GrRenderTargetProxy* proxy, GrSurfaceOrigin origin,
const GrPipeline* pipeline, const GrPathShader* shader)
: GrProgramInfo(proxy->numSamples(), proxy->numStencilSamples(),
proxy->backendFormat(), origin, pipeline, shader, nullptr,
proxy->backendFormat(), origin, pipeline, shader,
shader->fPrimitiveType, shader->fTessellationPatchVertexCount) {
}
};

View File

@ -461,7 +461,7 @@ GrOpsRenderPass* DrawMeshHelper::bindPipeline(GrPrimitiveType primitiveType, boo
GrProgramInfo programInfo(fState->proxy()->numSamples(), fState->proxy()->numStencilSamples(),
fState->proxy()->backendFormat(), fState->outputView()->origin(),
pipeline, mtp, nullptr, primitiveType);
pipeline, mtp, primitiveType);
fState->opsRenderPass()->bindPipeline(programInfo, SkRect::MakeIWH(kImageWidth, kImageHeight));
return fState->opsRenderPass();

View File

@ -163,7 +163,6 @@ private:
flushState->outputView()->origin(),
&pipeline,
geomProc,
nullptr,
GrPrimitiveType::kTriangleStrip);
flushState->bindPipeline(programInfo, SkRect::MakeIWH(kScreenSize, kScreenSize));