Pull creation of GrPipeline explicitly into the Ops' onExecute methods
This is a first step towards pulling the creation of the GrProgramInfos explicitly into the Ops' onExecute methods. We need this behavior so programInfo creation can be moved forward to onPrePrepare. For now, pipeline creation is a static member on GrSimpleMeshDrawOpHelper so GrPipeline creation can be bottle-neckedOps for Ops that don't use the helper. In some future world CreatePipeline could become non-static to reduce some of the duplicate code. Bug: skia:9455 Change-Id: I2d35dd223db824e84616f5df0f1dca34c1b6e412 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/258003 Reviewed-by: Michael Ludwig <michaelludwig@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
This commit is contained in:
parent
a746fc19ce
commit
3968fcbc3a
@ -23,6 +23,7 @@
|
|||||||
#include "src/gpu/glsl/GrGLSLVarying.h"
|
#include "src/gpu/glsl/GrGLSLVarying.h"
|
||||||
#include "src/gpu/glsl/GrGLSLVertexGeoBuilder.h"
|
#include "src/gpu/glsl/GrGLSLVertexGeoBuilder.h"
|
||||||
#include "src/gpu/ops/GrMeshDrawOp.h"
|
#include "src/gpu/ops/GrMeshDrawOp.h"
|
||||||
|
#include "src/gpu/ops/GrSimpleMeshDrawOpHelper.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
@ -235,8 +236,11 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) override {
|
void onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) override {
|
||||||
flushState->executeDrawsAndUploadsForMeshDrawOp(
|
auto pipeline = GrSimpleMeshDrawOpHelper::CreatePipeline(flushState,
|
||||||
this, chainBounds, GrProcessorSet::MakeEmptySet());
|
GrProcessorSet::MakeEmptySet(),
|
||||||
|
GrPipeline::InputFlags::kNone);
|
||||||
|
|
||||||
|
flushState->executeDrawsAndUploadsForMeshDrawOp(this, chainBounds, pipeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
Mode fMode;
|
Mode fMode;
|
||||||
|
@ -46,6 +46,7 @@
|
|||||||
#include "src/gpu/ops/GrDrawOp.h"
|
#include "src/gpu/ops/GrDrawOp.h"
|
||||||
#include "src/gpu/ops/GrMeshDrawOp.h"
|
#include "src/gpu/ops/GrMeshDrawOp.h"
|
||||||
#include "src/gpu/ops/GrOp.h"
|
#include "src/gpu/ops/GrOp.h"
|
||||||
|
#include "src/gpu/ops/GrSimpleMeshDrawOpHelper.h"
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
@ -81,8 +82,11 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) override {
|
void onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) override {
|
||||||
flushState->executeDrawsAndUploadsForMeshDrawOp(
|
auto pipeline = GrSimpleMeshDrawOpHelper::CreatePipeline(flushState,
|
||||||
this, chainBounds, std::move(fProcessorSet));
|
std::move(fProcessorSet),
|
||||||
|
GrPipeline::InputFlags::kNone);
|
||||||
|
|
||||||
|
flushState->executeDrawsAndUploadsForMeshDrawOp(this, chainBounds, pipeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
GrClipEdgeType edgeType() const { return fEdgeType; }
|
GrClipEdgeType edgeType() const { return fEdgeType; }
|
||||||
|
@ -32,20 +32,9 @@ const GrCaps& GrOpFlushState::caps() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GrOpFlushState::executeDrawsAndUploadsForMeshDrawOp(
|
void GrOpFlushState::executeDrawsAndUploadsForMeshDrawOp(
|
||||||
const GrOp* op, const SkRect& chainBounds, GrProcessorSet&& processorSet,
|
const GrOp* op, const SkRect& chainBounds, const GrPipeline* pipeline) {
|
||||||
GrPipeline::InputFlags pipelineFlags, const GrUserStencilSettings* stencilSettings) {
|
|
||||||
SkASSERT(this->opsRenderPass());
|
SkASSERT(this->opsRenderPass());
|
||||||
|
|
||||||
GrPipeline::InitArgs pipelineArgs;
|
|
||||||
pipelineArgs.fInputFlags = pipelineFlags;
|
|
||||||
pipelineArgs.fDstProxyView = this->dstProxyView();
|
|
||||||
pipelineArgs.fCaps = &this->caps();
|
|
||||||
pipelineArgs.fUserStencil = stencilSettings;
|
|
||||||
pipelineArgs.fOutputSwizzle = this->drawOpArgs().outputSwizzle();
|
|
||||||
auto pipeline = this->allocator()->make<GrPipeline>(pipelineArgs,
|
|
||||||
std::move(processorSet),
|
|
||||||
this->detachAppliedClip());
|
|
||||||
|
|
||||||
while (fCurrDraw != fDraws.end() && fCurrDraw->fOp == op) {
|
while (fCurrDraw != fDraws.end() && fCurrDraw->fOp == op) {
|
||||||
GrDeferredUploadToken drawToken = fTokenTracker->nextTokenToFlush();
|
GrDeferredUploadToken drawToken = fTokenTracker->nextTokenToFlush();
|
||||||
while (fCurrUpload != fInlineUploads.end() &&
|
while (fCurrUpload != fInlineUploads.end() &&
|
||||||
|
@ -44,10 +44,8 @@ public:
|
|||||||
void doUpload(GrDeferredTextureUploadFn&, bool shouldPrepareSurfaceForSampling = false);
|
void doUpload(GrDeferredTextureUploadFn&, bool shouldPrepareSurfaceForSampling = false);
|
||||||
|
|
||||||
/** Called as ops are executed. Must be called in the same order as the ops were prepared. */
|
/** Called as ops are executed. Must be called in the same order as the ops were prepared. */
|
||||||
void executeDrawsAndUploadsForMeshDrawOp(
|
void executeDrawsAndUploadsForMeshDrawOp(const GrOp* op, const SkRect& chainBounds,
|
||||||
const GrOp* op, const SkRect& chainBounds, GrProcessorSet&&,
|
const GrPipeline*);
|
||||||
GrPipeline::InputFlags = GrPipeline::InputFlags::kNone,
|
|
||||||
const GrUserStencilSettings* = &GrUserStencilSettings::kUnused);
|
|
||||||
|
|
||||||
GrOpsRenderPass* opsRenderPass() { return fOpsRenderPass; }
|
GrOpsRenderPass* opsRenderPass() { return fOpsRenderPass; }
|
||||||
void setOpsRenderPass(GrOpsRenderPass* renderPass) { fOpsRenderPass = renderPass; }
|
void setOpsRenderPass(GrOpsRenderPass* renderPass) { fOpsRenderPass = renderPass; }
|
||||||
|
@ -119,10 +119,9 @@ static constexpr GrUserStencilSettings kResolveStencilCoverageAndReset(
|
|||||||
void GrStencilAtlasOp::onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) {
|
void GrStencilAtlasOp::onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) {
|
||||||
SkIRect drawBoundsRect = SkIRect::MakeWH(fDrawBounds.width(), fDrawBounds.height());
|
SkIRect drawBoundsRect = SkIRect::MakeWH(fDrawBounds.width(), fDrawBounds.height());
|
||||||
|
|
||||||
GrPipeline pipeline(
|
GrPipeline pipeline(GrScissorTest::kEnabled, GrDisableColorXPFactory::MakeXferProcessor(),
|
||||||
GrScissorTest::kEnabled, GrDisableColorXPFactory::MakeXferProcessor(),
|
flushState->drawOpArgs().outputSwizzle(),
|
||||||
flushState->drawOpArgs().outputSwizzle(), GrPipeline::InputFlags::kHWAntialias,
|
GrPipeline::InputFlags::kHWAntialias, &kIncrDecrStencil);
|
||||||
&kIncrDecrStencil);
|
|
||||||
|
|
||||||
GrSampleMaskProcessor sampleMaskProc;
|
GrSampleMaskProcessor sampleMaskProc;
|
||||||
|
|
||||||
|
@ -821,7 +821,12 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) override {
|
void onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) override {
|
||||||
fHelper.executeDrawsAndUploads(this, flushState, chainBounds);
|
auto pipeline = GrSimpleMeshDrawOpHelper::CreatePipeline(flushState,
|
||||||
|
fHelper.detachProcessorSet(),
|
||||||
|
fHelper.pipelineFlags(),
|
||||||
|
fHelper.stencilSettings());
|
||||||
|
|
||||||
|
flushState->executeDrawsAndUploadsForMeshDrawOp(this, chainBounds, pipeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
CombineResult onCombineIfPossible(GrOp* t, const GrCaps& caps) override {
|
CombineResult onCombineIfPossible(GrOp* t, const GrCaps& caps) override {
|
||||||
|
@ -1105,7 +1105,12 @@ void AAHairlineOp::onPrepareDraws(Target* target) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AAHairlineOp::onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) {
|
void AAHairlineOp::onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) {
|
||||||
fHelper.executeDrawsAndUploads(this, flushState, chainBounds);
|
auto pipeline = GrSimpleMeshDrawOpHelper::CreatePipeline(flushState,
|
||||||
|
fHelper.detachProcessorSet(),
|
||||||
|
fHelper.pipelineFlags(),
|
||||||
|
fHelper.stencilSettings());
|
||||||
|
|
||||||
|
flushState->executeDrawsAndUploadsForMeshDrawOp(this, chainBounds, pipeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GrAAHairLinePathRenderer::onDrawPath(const DrawPathArgs& args) {
|
bool GrAAHairLinePathRenderer::onDrawPath(const DrawPathArgs& args) {
|
||||||
|
@ -304,7 +304,12 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) override {
|
void onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) override {
|
||||||
fHelper.executeDrawsAndUploads(this, flushState, chainBounds);
|
auto pipeline = GrSimpleMeshDrawOpHelper::CreatePipeline(flushState,
|
||||||
|
fHelper.detachProcessorSet(),
|
||||||
|
fHelper.pipelineFlags(),
|
||||||
|
fHelper.stencilSettings());
|
||||||
|
|
||||||
|
flushState->executeDrawsAndUploadsForMeshDrawOp(this, chainBounds, pipeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
CombineResult onCombineIfPossible(GrOp* t, const GrCaps& caps) override {
|
CombineResult onCombineIfPossible(GrOp* t, const GrCaps& caps) override {
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#include "src/gpu/GrResourceProvider.h"
|
#include "src/gpu/GrResourceProvider.h"
|
||||||
#include "src/gpu/effects/GrBitmapTextGeoProc.h"
|
#include "src/gpu/effects/GrBitmapTextGeoProc.h"
|
||||||
#include "src/gpu/effects/GrDistanceFieldGeoProc.h"
|
#include "src/gpu/effects/GrDistanceFieldGeoProc.h"
|
||||||
|
#include "src/gpu/ops/GrSimpleMeshDrawOpHelper.h"
|
||||||
#include "src/gpu/text/GrAtlasManager.h"
|
#include "src/gpu/text/GrAtlasManager.h"
|
||||||
#include "src/gpu/text/GrStrikeCache.h"
|
#include "src/gpu/text/GrStrikeCache.h"
|
||||||
|
|
||||||
@ -393,8 +394,11 @@ void GrAtlasTextOp::onPrepareDraws(Target* target) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GrAtlasTextOp::onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) {
|
void GrAtlasTextOp::onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) {
|
||||||
flushState->executeDrawsAndUploadsForMeshDrawOp(
|
auto pipeline = GrSimpleMeshDrawOpHelper::CreatePipeline(flushState,
|
||||||
this, chainBounds, std::move(fProcessors), GrPipeline::InputFlags::kNone);
|
std::move(fProcessors),
|
||||||
|
GrPipeline::InputFlags::kNone);
|
||||||
|
|
||||||
|
flushState->executeDrawsAndUploadsForMeshDrawOp(this, chainBounds, pipeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GrAtlasTextOp::flush(GrMeshDrawOp::Target* target, FlushInfo* flushInfo) const {
|
void GrAtlasTextOp::flush(GrMeshDrawOp::Target* target, FlushInfo* flushInfo) const {
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#include "src/gpu/glsl/GrGLSLVertexGeoBuilder.h"
|
#include "src/gpu/glsl/GrGLSLVertexGeoBuilder.h"
|
||||||
#include "src/gpu/ops/GrDashOp.h"
|
#include "src/gpu/ops/GrDashOp.h"
|
||||||
#include "src/gpu/ops/GrMeshDrawOp.h"
|
#include "src/gpu/ops/GrMeshDrawOp.h"
|
||||||
|
#include "src/gpu/ops/GrSimpleMeshDrawOpHelper.h"
|
||||||
|
|
||||||
using AAMode = GrDashOp::AAMode;
|
using AAMode = GrDashOp::AAMode;
|
||||||
|
|
||||||
@ -632,8 +633,13 @@ private:
|
|||||||
if (AAMode::kCoverageWithMSAA == fAAMode) {
|
if (AAMode::kCoverageWithMSAA == fAAMode) {
|
||||||
pipelineFlags |= GrPipeline::InputFlags::kHWAntialias;
|
pipelineFlags |= GrPipeline::InputFlags::kHWAntialias;
|
||||||
}
|
}
|
||||||
flushState->executeDrawsAndUploadsForMeshDrawOp(
|
|
||||||
this, chainBounds, std::move(fProcessorSet), pipelineFlags, fStencilSettings);
|
auto pipeline = GrSimpleMeshDrawOpHelper::CreatePipeline(flushState,
|
||||||
|
std::move(fProcessorSet),
|
||||||
|
pipelineFlags,
|
||||||
|
fStencilSettings);
|
||||||
|
|
||||||
|
flushState->executeDrawsAndUploadsForMeshDrawOp(this, chainBounds, pipeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
CombineResult onCombineIfPossible(GrOp* t, const GrCaps& caps) override {
|
CombineResult onCombineIfPossible(GrOp* t, const GrCaps& caps) override {
|
||||||
|
@ -442,7 +442,12 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) override {
|
void onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) override {
|
||||||
fHelper.executeDrawsAndUploads(this, flushState, chainBounds);
|
auto pipeline = GrSimpleMeshDrawOpHelper::CreatePipeline(flushState,
|
||||||
|
fHelper.detachProcessorSet(),
|
||||||
|
fHelper.pipelineFlags(),
|
||||||
|
fHelper.stencilSettings());
|
||||||
|
|
||||||
|
flushState->executeDrawsAndUploadsForMeshDrawOp(this, chainBounds, pipeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
CombineResult onCombineIfPossible(GrOp* t, const GrCaps& caps) override {
|
CombineResult onCombineIfPossible(GrOp* t, const GrCaps& caps) override {
|
||||||
|
@ -214,7 +214,11 @@ void DrawAtlasOp::onPrepareDraws(Target* target) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DrawAtlasOp::onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) {
|
void DrawAtlasOp::onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) {
|
||||||
fHelper.executeDrawsAndUploads(this, flushState, chainBounds);
|
auto pipeline = GrSimpleMeshDrawOpHelper::CreatePipeline(flushState,
|
||||||
|
fHelper.detachProcessorSet(),
|
||||||
|
fHelper.pipelineFlags());
|
||||||
|
|
||||||
|
flushState->executeDrawsAndUploadsForMeshDrawOp(this, chainBounds, pipeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
GrOp::CombineResult DrawAtlasOp::onCombineIfPossible(GrOp* t, const GrCaps& caps) {
|
GrOp::CombineResult DrawAtlasOp::onCombineIfPossible(GrOp* t, const GrCaps& caps) {
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
#include "src/gpu/GrRenderTargetContext.h"
|
#include "src/gpu/GrRenderTargetContext.h"
|
||||||
#include "src/gpu/GrRenderTargetPriv.h"
|
#include "src/gpu/GrRenderTargetPriv.h"
|
||||||
#include "src/gpu/ops/GrDrawPathOp.h"
|
#include "src/gpu/ops/GrDrawPathOp.h"
|
||||||
|
#include "src/gpu/ops/GrSimpleMeshDrawOpHelper.h"
|
||||||
|
|
||||||
static constexpr GrUserStencilSettings kCoverPass{
|
static constexpr GrUserStencilSettings kCoverPass{
|
||||||
GrUserStencilSettings::StaticInit<
|
GrUserStencilSettings::StaticInit<
|
||||||
@ -43,18 +44,6 @@ SkString GrDrawPathOp::dumpInfo() const {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
GrPipeline::InitArgs GrDrawPathOpBase::pipelineInitArgs(const GrOpFlushState& state) {
|
|
||||||
GrPipeline::InitArgs args;
|
|
||||||
if (fDoAA) {
|
|
||||||
args.fInputFlags |= GrPipeline::InputFlags::kHWAntialias;
|
|
||||||
}
|
|
||||||
args.fUserStencil = &kCoverPass;
|
|
||||||
args.fCaps = &state.caps();
|
|
||||||
args.fDstProxyView = state.drawOpArgs().dstProxyView();
|
|
||||||
args.fOutputSwizzle = state.drawOpArgs().outputSwizzle();
|
|
||||||
return args;
|
|
||||||
}
|
|
||||||
|
|
||||||
const GrProcessorSet::Analysis& GrDrawPathOpBase::doProcessorAnalysis(
|
const GrProcessorSet::Analysis& GrDrawPathOpBase::doProcessorAnalysis(
|
||||||
const GrCaps& caps, const GrAppliedClip* clip, bool hasMixedSampledCoverage,
|
const GrCaps& caps, const GrAppliedClip* clip, bool hasMixedSampledCoverage,
|
||||||
GrClampType clampType) {
|
GrClampType clampType) {
|
||||||
@ -87,34 +76,42 @@ std::unique_ptr<GrDrawOp> GrDrawPathOp::Make(GrRecordingContext* context,
|
|||||||
return pool->allocate<GrDrawPathOp>(viewMatrix, std::move(paint), aa, std::move(path));
|
return pool->allocate<GrDrawPathOp>(viewMatrix, std::move(paint), aa, std::move(path));
|
||||||
}
|
}
|
||||||
|
|
||||||
void GrDrawPathOp::onExecute(GrOpFlushState* state, const SkRect& chainBounds) {
|
void GrDrawPathOp::onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) {
|
||||||
GrAppliedClip appliedClip = state->detachAppliedClip();
|
|
||||||
|
|
||||||
GrPipeline::FixedDynamicState* fixedDynamicState = nullptr, storage;
|
GrPipeline::FixedDynamicState* fixedDynamicState = nullptr, storage;
|
||||||
|
|
||||||
if (appliedClip.scissorState().enabled()) {
|
const GrAppliedClip* appliedClip = flushState->appliedClip();
|
||||||
storage.fScissorRect = appliedClip.scissorState().rect();
|
if (appliedClip && appliedClip->scissorState().enabled()) {
|
||||||
|
storage.fScissorRect = appliedClip->scissorState().rect();
|
||||||
fixedDynamicState = &storage;
|
fixedDynamicState = &storage;
|
||||||
}
|
}
|
||||||
|
|
||||||
GrPipeline pipeline(this->pipelineInitArgs(*state), this->detachProcessors(),
|
GrPipeline::InputFlags pipelineFlags = GrPipeline::InputFlags::kNone;
|
||||||
std::move(appliedClip));
|
if (this->doAA()) {
|
||||||
|
pipelineFlags |= GrPipeline::InputFlags::kHWAntialias;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto pipeline = GrSimpleMeshDrawOpHelper::CreatePipeline(flushState,
|
||||||
|
this->detachProcessorSet(),
|
||||||
|
pipelineFlags,
|
||||||
|
&kCoverPass);
|
||||||
|
|
||||||
sk_sp<GrPathProcessor> pathProc(GrPathProcessor::Create(this->color(), this->viewMatrix()));
|
sk_sp<GrPathProcessor> pathProc(GrPathProcessor::Create(this->color(), this->viewMatrix()));
|
||||||
|
|
||||||
GrProgramInfo programInfo(state->proxy()->numSamples(),
|
GrRenderTargetProxy* proxy = flushState->proxy();
|
||||||
state->proxy()->numStencilSamples(),
|
GrProgramInfo programInfo(proxy->numSamples(),
|
||||||
state->proxy()->backendFormat(),
|
proxy->numStencilSamples(),
|
||||||
state->view()->origin(),
|
proxy->backendFormat(),
|
||||||
&pipeline,
|
flushState->view()->origin(),
|
||||||
|
pipeline,
|
||||||
pathProc.get(),
|
pathProc.get(),
|
||||||
fixedDynamicState,
|
fixedDynamicState,
|
||||||
nullptr, 0,
|
nullptr, 0,
|
||||||
GrPrimitiveType::kPath);
|
GrPrimitiveType::kPath);
|
||||||
|
|
||||||
GrStencilSettings stencil;
|
GrStencilSettings stencil;
|
||||||
init_stencil_pass_settings(*state, this->fillType(), &stencil);
|
init_stencil_pass_settings(*flushState, this->fillType(), &stencil);
|
||||||
state->gpu()->pathRendering()->drawPath(state->drawOpArgs().proxy()->peekRenderTarget(),
|
flushState->gpu()->pathRendering()->drawPath(proxy->peekRenderTarget(),
|
||||||
programInfo, stencil, fPath.get());
|
programInfo, stencil, fPath.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -43,9 +43,9 @@ protected:
|
|||||||
const SkMatrix& viewMatrix() const { return fViewMatrix; }
|
const SkMatrix& viewMatrix() const { return fViewMatrix; }
|
||||||
const SkPMColor4f& color() const { return fInputColor; }
|
const SkPMColor4f& color() const { return fInputColor; }
|
||||||
GrPathRendering::FillType fillType() const { return fFillType; }
|
GrPathRendering::FillType fillType() const { return fFillType; }
|
||||||
|
bool doAA() const { return fDoAA; }
|
||||||
const GrProcessorSet& processors() const { return fProcessorSet; }
|
const GrProcessorSet& processors() const { return fProcessorSet; }
|
||||||
GrProcessorSet detachProcessors() { return std::move(fProcessorSet); }
|
GrProcessorSet detachProcessorSet() { return std::move(fProcessorSet); }
|
||||||
inline GrPipeline::InitArgs pipelineInitArgs(const GrOpFlushState&);
|
|
||||||
const GrProcessorSet::Analysis& doProcessorAnalysis(
|
const GrProcessorSet::Analysis& doProcessorAnalysis(
|
||||||
const GrCaps&, const GrAppliedClip*, bool hasMixedSampledCoverage, GrClampType);
|
const GrCaps&, const GrAppliedClip*, bool hasMixedSampledCoverage, GrClampType);
|
||||||
const GrProcessorSet::Analysis& processorAnalysis() const {
|
const GrProcessorSet::Analysis& processorAnalysis() const {
|
||||||
|
@ -512,7 +512,11 @@ void DrawVerticesOp::drawVertices(Target* target,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DrawVerticesOp::onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) {
|
void DrawVerticesOp::onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) {
|
||||||
fHelper.executeDrawsAndUploads(this, flushState, chainBounds);
|
auto pipeline = GrSimpleMeshDrawOpHelper::CreatePipeline(flushState,
|
||||||
|
fHelper.detachProcessorSet(),
|
||||||
|
fHelper.pipelineFlags());
|
||||||
|
|
||||||
|
flushState->executeDrawsAndUploadsForMeshDrawOp(this, chainBounds, pipeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
GrOp::CombineResult DrawVerticesOp::onCombineIfPossible(GrOp* t, const GrCaps& caps) {
|
GrOp::CombineResult DrawVerticesOp::onCombineIfPossible(GrOp* t, const GrCaps& caps) {
|
||||||
|
@ -281,7 +281,12 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) override {
|
void onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) override {
|
||||||
fHelper.executeDrawsAndUploads(this, flushState, chainBounds);
|
auto pipeline = GrSimpleMeshDrawOpHelper::CreatePipeline(flushState,
|
||||||
|
fHelper.detachProcessorSet(),
|
||||||
|
fHelper.pipelineFlags(),
|
||||||
|
fHelper.stencilSettings());
|
||||||
|
|
||||||
|
flushState->executeDrawsAndUploadsForMeshDrawOp(this, chainBounds, pipeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
CombineResult onCombineIfPossible(GrOp* t, const GrCaps& caps) override {
|
CombineResult onCombineIfPossible(GrOp* t, const GrCaps& caps) override {
|
||||||
|
@ -290,7 +290,11 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) override {
|
void onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) override {
|
||||||
fHelper.executeDrawsAndUploads(this, flushState, chainBounds);
|
auto pipeline = GrSimpleMeshDrawOpHelper::CreatePipeline(flushState,
|
||||||
|
fHelper.detachProcessorSet(),
|
||||||
|
fHelper.pipelineFlags());
|
||||||
|
|
||||||
|
flushState->executeDrawsAndUploadsForMeshDrawOp(this, chainBounds, pipeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
CombineResult onCombineIfPossible(GrOp* t, const GrCaps& caps) override {
|
CombineResult onCombineIfPossible(GrOp* t, const GrCaps& caps) override {
|
||||||
|
@ -1399,7 +1399,11 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) override {
|
void onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) override {
|
||||||
fHelper.executeDrawsAndUploads(this, flushState, chainBounds);
|
auto pipeline = GrSimpleMeshDrawOpHelper::CreatePipeline(flushState,
|
||||||
|
fHelper.detachProcessorSet(),
|
||||||
|
fHelper.pipelineFlags());
|
||||||
|
|
||||||
|
flushState->executeDrawsAndUploadsForMeshDrawOp(this, chainBounds, pipeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
CombineResult onCombineIfPossible(GrOp* t, const GrCaps& caps) override {
|
CombineResult onCombineIfPossible(GrOp* t, const GrCaps& caps) override {
|
||||||
@ -1690,7 +1694,11 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) override {
|
void onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) override {
|
||||||
fHelper.executeDrawsAndUploads(this, flushState, chainBounds);
|
auto pipeline = GrSimpleMeshDrawOpHelper::CreatePipeline(flushState,
|
||||||
|
fHelper.detachProcessorSet(),
|
||||||
|
fHelper.pipelineFlags());
|
||||||
|
|
||||||
|
flushState->executeDrawsAndUploadsForMeshDrawOp(this, chainBounds, pipeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
CombineResult onCombineIfPossible(GrOp* t, const GrCaps& caps) override {
|
CombineResult onCombineIfPossible(GrOp* t, const GrCaps& caps) override {
|
||||||
@ -1945,7 +1953,11 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) override {
|
void onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) override {
|
||||||
fHelper.executeDrawsAndUploads(this, flushState, chainBounds);
|
auto pipeline = GrSimpleMeshDrawOpHelper::CreatePipeline(flushState,
|
||||||
|
fHelper.detachProcessorSet(),
|
||||||
|
fHelper.pipelineFlags());
|
||||||
|
|
||||||
|
flushState->executeDrawsAndUploadsForMeshDrawOp(this, chainBounds, pipeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
CombineResult onCombineIfPossible(GrOp* t, const GrCaps& caps) override {
|
CombineResult onCombineIfPossible(GrOp* t, const GrCaps& caps) override {
|
||||||
@ -2182,7 +2194,11 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) override {
|
void onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) override {
|
||||||
fHelper.executeDrawsAndUploads(this, flushState, chainBounds);
|
auto pipeline = GrSimpleMeshDrawOpHelper::CreatePipeline(flushState,
|
||||||
|
fHelper.detachProcessorSet(),
|
||||||
|
fHelper.pipelineFlags());
|
||||||
|
|
||||||
|
flushState->executeDrawsAndUploadsForMeshDrawOp(this, chainBounds, pipeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
CombineResult onCombineIfPossible(GrOp* t, const GrCaps& caps) override {
|
CombineResult onCombineIfPossible(GrOp* t, const GrCaps& caps) override {
|
||||||
@ -2613,7 +2629,11 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) override {
|
void onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) override {
|
||||||
fHelper.executeDrawsAndUploads(this, flushState, chainBounds);
|
auto pipeline = GrSimpleMeshDrawOpHelper::CreatePipeline(flushState,
|
||||||
|
fHelper.detachProcessorSet(),
|
||||||
|
fHelper.pipelineFlags());
|
||||||
|
|
||||||
|
flushState->executeDrawsAndUploadsForMeshDrawOp(this, chainBounds, pipeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
CombineResult onCombineIfPossible(GrOp* t, const GrCaps& caps) override {
|
CombineResult onCombineIfPossible(GrOp* t, const GrCaps& caps) override {
|
||||||
@ -2895,7 +2915,11 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) override {
|
void onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) override {
|
||||||
fHelper.executeDrawsAndUploads(this, flushState, chainBounds);
|
auto pipeline = GrSimpleMeshDrawOpHelper::CreatePipeline(flushState,
|
||||||
|
fHelper.detachProcessorSet(),
|
||||||
|
fHelper.pipelineFlags());
|
||||||
|
|
||||||
|
flushState->executeDrawsAndUploadsForMeshDrawOp(this, chainBounds, pipeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
CombineResult onCombineIfPossible(GrOp* t, const GrCaps& caps) override {
|
CombineResult onCombineIfPossible(GrOp* t, const GrCaps& caps) override {
|
||||||
|
@ -133,7 +133,12 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) override {
|
void onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) override {
|
||||||
fHelper.executeDrawsAndUploads(this, flushState, chainBounds);
|
auto pipeline = GrSimpleMeshDrawOpHelper::CreatePipeline(flushState,
|
||||||
|
fHelper.detachProcessorSet(),
|
||||||
|
fHelper.pipelineFlags(),
|
||||||
|
fHelper.stencilSettings());
|
||||||
|
|
||||||
|
flushState->executeDrawsAndUploadsForMeshDrawOp(this, chainBounds, pipeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
CombineResult onCombineIfPossible(GrOp* t, const GrCaps& caps) override {
|
CombineResult onCombineIfPossible(GrOp* t, const GrCaps& caps) override {
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
#include "src/gpu/GrProxyProvider.h"
|
#include "src/gpu/GrProxyProvider.h"
|
||||||
#include "src/gpu/GrRecordingContextPriv.h"
|
#include "src/gpu/GrRecordingContextPriv.h"
|
||||||
#include "src/gpu/effects/GrShadowGeoProc.h"
|
#include "src/gpu/effects/GrShadowGeoProc.h"
|
||||||
|
#include "src/gpu/ops/GrSimpleMeshDrawOpHelper.h"
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// Circle Data
|
// Circle Data
|
||||||
@ -602,8 +603,11 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) override {
|
void onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) override {
|
||||||
flushState->executeDrawsAndUploadsForMeshDrawOp(
|
auto pipeline = GrSimpleMeshDrawOpHelper::CreatePipeline(flushState,
|
||||||
this, chainBounds, GrProcessorSet::MakeEmptySet());
|
GrProcessorSet::MakeEmptySet(),
|
||||||
|
GrPipeline::InputFlags::kNone);
|
||||||
|
|
||||||
|
flushState->executeDrawsAndUploadsForMeshDrawOp(this, chainBounds, pipeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
CombineResult onCombineIfPossible(GrOp* t, const GrCaps& caps) override {
|
CombineResult onCombineIfPossible(GrOp* t, const GrCaps& caps) override {
|
||||||
|
@ -106,15 +106,22 @@ GrProcessorSet::Analysis GrSimpleMeshDrawOpHelper::finalizeProcessors(
|
|||||||
return analysis;
|
return analysis;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GrSimpleMeshDrawOpHelper::executeDrawsAndUploads(
|
const GrPipeline* GrSimpleMeshDrawOpHelper::CreatePipeline(
|
||||||
const GrOp* op, GrOpFlushState* flushState, const SkRect& chainBounds) {
|
GrOpFlushState* flushState,
|
||||||
if (fProcessors) {
|
GrProcessorSet&& processorSet,
|
||||||
flushState->executeDrawsAndUploadsForMeshDrawOp(
|
GrPipeline::InputFlags pipelineFlags,
|
||||||
op, chainBounds, std::move(*fProcessors), fPipelineFlags);
|
const GrUserStencilSettings* stencilSettings) {
|
||||||
} else {
|
GrPipeline::InitArgs pipelineArgs;
|
||||||
flushState->executeDrawsAndUploadsForMeshDrawOp(
|
|
||||||
op, chainBounds, GrProcessorSet::MakeEmptySet(), fPipelineFlags);
|
pipelineArgs.fInputFlags = pipelineFlags;
|
||||||
}
|
pipelineArgs.fDstProxyView = flushState->dstProxyView();
|
||||||
|
pipelineArgs.fCaps = &flushState->caps();
|
||||||
|
pipelineArgs.fUserStencil = stencilSettings;
|
||||||
|
pipelineArgs.fOutputSwizzle = flushState->view()->swizzle();
|
||||||
|
|
||||||
|
return flushState->allocator()->make<GrPipeline>(pipelineArgs,
|
||||||
|
std::move(processorSet),
|
||||||
|
flushState->detachAppliedClip());
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SK_DEBUG
|
#ifdef SK_DEBUG
|
||||||
@ -186,17 +193,6 @@ bool GrSimpleMeshDrawOpHelperWithStencil::isCompatible(
|
|||||||
fStencilSettings == that.fStencilSettings;
|
fStencilSettings == that.fStencilSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GrSimpleMeshDrawOpHelperWithStencil::executeDrawsAndUploads(
|
|
||||||
const GrOp* op, GrOpFlushState* flushState, const SkRect& chainBounds) {
|
|
||||||
if (fProcessors) {
|
|
||||||
flushState->executeDrawsAndUploadsForMeshDrawOp(
|
|
||||||
op, chainBounds, std::move(*fProcessors), fPipelineFlags, fStencilSettings);
|
|
||||||
} else {
|
|
||||||
flushState->executeDrawsAndUploadsForMeshDrawOp(
|
|
||||||
op, chainBounds, GrProcessorSet::MakeEmptySet(), fPipelineFlags, fStencilSettings);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef SK_DEBUG
|
#ifdef SK_DEBUG
|
||||||
SkString GrSimpleMeshDrawOpHelperWithStencil::dumpInfo() const {
|
SkString GrSimpleMeshDrawOpHelperWithStencil::dumpInfo() const {
|
||||||
SkString result = INHERITED::dumpInfo();
|
SkString result = INHERITED::dumpInfo();
|
||||||
|
@ -122,11 +122,19 @@ public:
|
|||||||
fAAType = static_cast<unsigned>(aaType);
|
fAAType = static_cast<unsigned>(aaType);
|
||||||
}
|
}
|
||||||
|
|
||||||
void executeDrawsAndUploads(const GrOp*, GrOpFlushState*, const SkRect& chainBounds);
|
static const GrPipeline* CreatePipeline(
|
||||||
|
GrOpFlushState*,
|
||||||
|
GrProcessorSet&&,
|
||||||
|
GrPipeline::InputFlags fPipelineFlags,
|
||||||
|
const GrUserStencilSettings* = &GrUserStencilSettings::kUnused);
|
||||||
|
|
||||||
|
GrProcessorSet detachProcessorSet() {
|
||||||
|
return fProcessors ? std::move(*fProcessors) : GrProcessorSet::MakeEmptySet();
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
|
||||||
GrPipeline::InputFlags pipelineFlags() const { return fPipelineFlags; }
|
GrPipeline::InputFlags pipelineFlags() const { return fPipelineFlags; }
|
||||||
|
|
||||||
|
protected:
|
||||||
GrProcessorSet::Analysis finalizeProcessors(
|
GrProcessorSet::Analysis finalizeProcessors(
|
||||||
const GrCaps& caps, const GrAppliedClip*, const GrUserStencilSettings*,
|
const GrCaps& caps, const GrAppliedClip*, const GrUserStencilSettings*,
|
||||||
bool hasMixedSampledCoverage, GrClampType, GrProcessorAnalysisCoverage geometryCoverage,
|
bool hasMixedSampledCoverage, GrClampType, GrProcessorAnalysisCoverage geometryCoverage,
|
||||||
@ -185,17 +193,19 @@ public:
|
|||||||
using GrSimpleMeshDrawOpHelper::isTrivial;
|
using GrSimpleMeshDrawOpHelper::isTrivial;
|
||||||
using GrSimpleMeshDrawOpHelper::usesLocalCoords;
|
using GrSimpleMeshDrawOpHelper::usesLocalCoords;
|
||||||
using GrSimpleMeshDrawOpHelper::compatibleWithCoverageAsAlpha;
|
using GrSimpleMeshDrawOpHelper::compatibleWithCoverageAsAlpha;
|
||||||
|
using GrSimpleMeshDrawOpHelper::detachProcessorSet;
|
||||||
|
using GrSimpleMeshDrawOpHelper::pipelineFlags;
|
||||||
|
|
||||||
bool isCompatible(const GrSimpleMeshDrawOpHelperWithStencil& that, const GrCaps&,
|
bool isCompatible(const GrSimpleMeshDrawOpHelperWithStencil& that, const GrCaps&,
|
||||||
const SkRect& thisBounds, const SkRect& thatBounds,
|
const SkRect& thisBounds, const SkRect& thatBounds,
|
||||||
bool ignoreAAType = false) const;
|
bool ignoreAAType = false) const;
|
||||||
|
|
||||||
void executeDrawsAndUploads(const GrOp*, GrOpFlushState*, const SkRect& chainBounds);
|
|
||||||
|
|
||||||
#ifdef SK_DEBUG
|
#ifdef SK_DEBUG
|
||||||
SkString dumpInfo() const;
|
SkString dumpInfo() const;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
const GrUserStencilSettings* stencilSettings() const { return fStencilSettings; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const GrUserStencilSettings* fStencilSettings;
|
const GrUserStencilSettings* fStencilSettings;
|
||||||
typedef GrSimpleMeshDrawOpHelper INHERITED;
|
typedef GrSimpleMeshDrawOpHelper INHERITED;
|
||||||
|
@ -812,7 +812,12 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) override {
|
void onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) override {
|
||||||
fHelper.executeDrawsAndUploads(this, flushState, chainBounds);
|
auto pipeline = GrSimpleMeshDrawOpHelper::CreatePipeline(flushState,
|
||||||
|
fHelper.detachProcessorSet(),
|
||||||
|
fHelper.pipelineFlags(),
|
||||||
|
fHelper.stencilSettings());
|
||||||
|
|
||||||
|
flushState->executeDrawsAndUploadsForMeshDrawOp(this, chainBounds, pipeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
const SkPMColor4f& color() const { return fShapes[0].fColor; }
|
const SkPMColor4f& color() const { return fShapes[0].fColor; }
|
||||||
|
@ -228,7 +228,11 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) override {
|
void onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) override {
|
||||||
fHelper.executeDrawsAndUploads(this, flushState, chainBounds);
|
auto pipeline = GrSimpleMeshDrawOpHelper::CreatePipeline(flushState,
|
||||||
|
fHelper.detachProcessorSet(),
|
||||||
|
fHelper.pipelineFlags());
|
||||||
|
|
||||||
|
flushState->executeDrawsAndUploadsForMeshDrawOp(this, chainBounds, pipeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: override onCombineIfPossible
|
// TODO: override onCombineIfPossible
|
||||||
@ -520,7 +524,11 @@ void AAStrokeRectOp::onPrepareDraws(Target* target) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AAStrokeRectOp::onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) {
|
void AAStrokeRectOp::onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) {
|
||||||
fHelper.executeDrawsAndUploads(this, flushState, chainBounds);
|
auto pipeline = GrSimpleMeshDrawOpHelper::CreatePipeline(flushState,
|
||||||
|
fHelper.detachProcessorSet(),
|
||||||
|
fHelper.pipelineFlags());
|
||||||
|
|
||||||
|
flushState->executeDrawsAndUploadsForMeshDrawOp(this, chainBounds, pipeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
sk_sp<const GrGpuBuffer> AAStrokeRectOp::GetIndexBuffer(GrResourceProvider* resourceProvider,
|
sk_sp<const GrGpuBuffer> AAStrokeRectOp::GetIndexBuffer(GrResourceProvider* resourceProvider,
|
||||||
|
@ -382,7 +382,12 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) override {
|
void onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) override {
|
||||||
fHelper.executeDrawsAndUploads(this, flushState, chainBounds);
|
auto pipeline = GrSimpleMeshDrawOpHelper::CreatePipeline(flushState,
|
||||||
|
fHelper.detachProcessorSet(),
|
||||||
|
fHelper.pipelineFlags(),
|
||||||
|
fHelper.stencilSettings());
|
||||||
|
|
||||||
|
flushState->executeDrawsAndUploadsForMeshDrawOp(this, chainBounds, pipeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
Helper fHelper;
|
Helper fHelper;
|
||||||
|
@ -39,6 +39,7 @@
|
|||||||
#include "src/gpu/ops/GrFillRectOp.h"
|
#include "src/gpu/ops/GrFillRectOp.h"
|
||||||
#include "src/gpu/ops/GrMeshDrawOp.h"
|
#include "src/gpu/ops/GrMeshDrawOp.h"
|
||||||
#include "src/gpu/ops/GrQuadPerEdgeAA.h"
|
#include "src/gpu/ops/GrQuadPerEdgeAA.h"
|
||||||
|
#include "src/gpu/ops/GrSimpleMeshDrawOpHelper.h"
|
||||||
#include "src/gpu/ops/GrTextureOp.h"
|
#include "src/gpu/ops/GrTextureOp.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@ -883,8 +884,12 @@ private:
|
|||||||
auto pipelineFlags = (GrAAType::kMSAA == fMetadata.aaType())
|
auto pipelineFlags = (GrAAType::kMSAA == fMetadata.aaType())
|
||||||
? GrPipeline::InputFlags::kHWAntialias
|
? GrPipeline::InputFlags::kHWAntialias
|
||||||
: GrPipeline::InputFlags::kNone;
|
: GrPipeline::InputFlags::kNone;
|
||||||
flushState->executeDrawsAndUploadsForMeshDrawOp(
|
|
||||||
this, chainBounds, GrProcessorSet::MakeEmptySet(), pipelineFlags);
|
auto pipeline = GrSimpleMeshDrawOpHelper::CreatePipeline(flushState,
|
||||||
|
GrProcessorSet::MakeEmptySet(),
|
||||||
|
pipelineFlags);
|
||||||
|
|
||||||
|
flushState->executeDrawsAndUploadsForMeshDrawOp(this, chainBounds, pipeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
CombineResult onCombineIfPossible(GrOp* t, const GrCaps& caps) override {
|
CombineResult onCombineIfPossible(GrOp* t, const GrCaps& caps) override {
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
#include "src/gpu/glsl/GrGLSLGeometryProcessor.h"
|
#include "src/gpu/glsl/GrGLSLGeometryProcessor.h"
|
||||||
#include "src/gpu/glsl/GrGLSLVarying.h"
|
#include "src/gpu/glsl/GrGLSLVarying.h"
|
||||||
#include "src/gpu/glsl/GrGLSLVertexGeoBuilder.h"
|
#include "src/gpu/glsl/GrGLSLVertexGeoBuilder.h"
|
||||||
|
#include "src/gpu/ops/GrSimpleMeshDrawOpHelper.h"
|
||||||
|
|
||||||
GR_DECLARE_STATIC_UNIQUE_KEY(gIndexBufferKey);
|
GR_DECLARE_STATIC_UNIQUE_KEY(gIndexBufferKey);
|
||||||
|
|
||||||
@ -417,7 +418,22 @@ sk_sp<const GrBuffer> DrawMeshHelper::getIndexBuffer() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DrawMeshHelper::drawMesh(const GrMesh& mesh, GrPrimitiveType primitiveType) {
|
void DrawMeshHelper::drawMesh(const GrMesh& mesh, GrPrimitiveType primitiveType) {
|
||||||
GrPipeline pipeline(GrScissorTest::kDisabled, SkBlendMode::kSrc, GrSwizzle::RGBA());
|
GrProcessorSet processorSet(SkBlendMode::kSrc);
|
||||||
|
|
||||||
|
// TODO: add a GrProcessorSet testing helper to make this easier
|
||||||
|
SkPMColor4f overrideColor;
|
||||||
|
processorSet.finalize(GrProcessorAnalysisColor(),
|
||||||
|
GrProcessorAnalysisCoverage::kNone,
|
||||||
|
fState->appliedClip(),
|
||||||
|
nullptr,
|
||||||
|
false,
|
||||||
|
fState->caps(),
|
||||||
|
GrClampType::kAuto,
|
||||||
|
&overrideColor);
|
||||||
|
|
||||||
|
auto pipeline = GrSimpleMeshDrawOpHelper::CreatePipeline(fState,
|
||||||
|
std::move(processorSet),
|
||||||
|
GrPipeline::InputFlags::kNone);
|
||||||
|
|
||||||
GrGeometryProcessor* mtp = GrMeshTestProcessor::Make(fState->allocator(),
|
GrGeometryProcessor* mtp = GrMeshTestProcessor::Make(fState->allocator(),
|
||||||
mesh.isInstanced(), mesh.hasVertexData());
|
mesh.isInstanced(), mesh.hasVertexData());
|
||||||
@ -426,7 +442,7 @@ void DrawMeshHelper::drawMesh(const GrMesh& mesh, GrPrimitiveType primitiveType)
|
|||||||
fState->proxy()->numStencilSamples(),
|
fState->proxy()->numStencilSamples(),
|
||||||
fState->proxy()->backendFormat(),
|
fState->proxy()->backendFormat(),
|
||||||
fState->view()->origin(),
|
fState->view()->origin(),
|
||||||
&pipeline,
|
pipeline,
|
||||||
mtp,
|
mtp,
|
||||||
nullptr, nullptr, 0, primitiveType);
|
nullptr, nullptr, 0, primitiveType);
|
||||||
|
|
||||||
|
@ -166,7 +166,11 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) override {
|
void onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) override {
|
||||||
fHelper.executeDrawsAndUploads(this, flushState, chainBounds);
|
auto pipeline = GrSimpleMeshDrawOpHelper::CreatePipeline(flushState,
|
||||||
|
fHelper.detachProcessorSet(),
|
||||||
|
fHelper.pipelineFlags());
|
||||||
|
|
||||||
|
flushState->executeDrawsAndUploadsForMeshDrawOp(this, chainBounds, pipeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
Helper fHelper;
|
Helper fHelper;
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
#include "src/gpu/glsl/GrGLSLGeometryProcessor.h"
|
#include "src/gpu/glsl/GrGLSLGeometryProcessor.h"
|
||||||
#include "src/gpu/glsl/GrGLSLVarying.h"
|
#include "src/gpu/glsl/GrGLSLVarying.h"
|
||||||
#include "src/gpu/ops/GrMeshDrawOp.h"
|
#include "src/gpu/ops/GrMeshDrawOp.h"
|
||||||
|
#include "src/gpu/ops/GrSimpleMeshDrawOpHelper.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
class Op : public GrMeshDrawOp {
|
class Op : public GrMeshDrawOp {
|
||||||
@ -124,8 +125,11 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) override {
|
void onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) override {
|
||||||
flushState->executeDrawsAndUploadsForMeshDrawOp(
|
auto pipeline = GrSimpleMeshDrawOpHelper::CreatePipeline(flushState,
|
||||||
this, chainBounds, GrProcessorSet::MakeEmptySet());
|
GrProcessorSet::MakeEmptySet(),
|
||||||
|
GrPipeline::InputFlags::kNone);
|
||||||
|
|
||||||
|
flushState->executeDrawsAndUploadsForMeshDrawOp(this, chainBounds, pipeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
int fNumAttribs;
|
int fNumAttribs;
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#include "src/gpu/glsl/GrGLSLGeometryProcessor.h"
|
#include "src/gpu/glsl/GrGLSLGeometryProcessor.h"
|
||||||
#include "src/gpu/glsl/GrGLSLVarying.h"
|
#include "src/gpu/glsl/GrGLSLVarying.h"
|
||||||
#include "src/gpu/glsl/GrGLSLVertexGeoBuilder.h"
|
#include "src/gpu/glsl/GrGLSLVertexGeoBuilder.h"
|
||||||
|
#include "src/gpu/ops/GrSimpleMeshDrawOpHelper.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
@ -160,7 +161,11 @@ void TestRectOp::onPrepareDraws(Target* target) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void TestRectOp::onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) {
|
void TestRectOp::onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) {
|
||||||
flushState->executeDrawsAndUploadsForMeshDrawOp(this, chainBounds, std::move(fProcessorSet));
|
auto pipeline = GrSimpleMeshDrawOpHelper::CreatePipeline(flushState,
|
||||||
|
std::move(fProcessorSet),
|
||||||
|
GrPipeline::InputFlags::kNone);
|
||||||
|
|
||||||
|
flushState->executeDrawsAndUploadsForMeshDrawOp(this, chainBounds, pipeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // anonymous namespace
|
} // anonymous namespace
|
||||||
|
Loading…
Reference in New Issue
Block a user