aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2017-07-31 12:37:02 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-07-31 16:59:53 +0000
commit972b2f6041e0b591d9556fc874c24562733c50ce (patch)
treedd97768e34c2d2eba61d8e87d3f66cab07c82e6e /src
parentba937a43669f606ea32de9b88e119f0507870c15 (diff)
Initialize GrPipeline at construction.
Change-Id: I44bfa3553786ad197acdf807b15155e61d4e5952 Reviewed-on: https://skia-review.googlesource.com/28623 Commit-Queue: Brian Salomon <bsalomon@google.com> Reviewed-by: Greg Daniel <egdaniel@google.com> Reviewed-by: Chris Dalton <csmartdalton@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/gpu/GrPipeline.cpp2
-rw-r--r--src/gpu/GrPipeline.h10
-rw-r--r--src/gpu/ccpr/GrCoverageCountingPathRenderer.cpp3
-rw-r--r--src/gpu/instanced/InstancedOp.cpp3
-rw-r--r--src/gpu/ops/GrDrawPathOp.cpp11
-rw-r--r--src/gpu/ops/GrDrawPathOp.h2
6 files changed, 9 insertions, 22 deletions
diff --git a/src/gpu/GrPipeline.cpp b/src/gpu/GrPipeline.cpp
index 11da74a573..21400a9c95 100644
--- a/src/gpu/GrPipeline.cpp
+++ b/src/gpu/GrPipeline.cpp
@@ -17,7 +17,7 @@
#include "ops/GrOp.h"
-void GrPipeline::init(const InitArgs& args) {
+GrPipeline::GrPipeline(const InitArgs& args) {
SkASSERT(args.fProxy);
SkASSERT(kDefault_GrSurfaceOrigin != args.fProxy->origin());
SkASSERT(args.fProcessors);
diff --git a/src/gpu/GrPipeline.h b/src/gpu/GrPipeline.h
index b4423049fb..6ff6360adb 100644
--- a/src/gpu/GrPipeline.h
+++ b/src/gpu/GrPipeline.h
@@ -96,25 +96,17 @@ public:
};
/**
- * A Default constructed pipeline is unusable until init() is called.
- **/
- GrPipeline() = default;
-
- /**
* Creates a simple pipeline with default settings and no processors. The provided blend mode
* must be "Porter Duff" (<= kLastCoeffMode). If using ScissorState::kEnabled, the caller must
* specify a scissor rectangle through the DynamicState struct.
**/
GrPipeline(GrRenderTargetProxy*, ScissorState, SkBlendMode);
- GrPipeline(const InitArgs& args) { this->init(args); }
+ GrPipeline(const InitArgs& args);
GrPipeline(const GrPipeline&) = delete;
GrPipeline& operator=(const GrPipeline&) = delete;
- /** (Re)initializes a pipeline. After initialization the pipeline can be used. */
- void init(const InitArgs&);
-
/** True if the pipeline has been initialized. */
bool isInitialized() const { return SkToBool(fProxy.get()); }
diff --git a/src/gpu/ccpr/GrCoverageCountingPathRenderer.cpp b/src/gpu/ccpr/GrCoverageCountingPathRenderer.cpp
index 5a9afa19e3..78d8347709 100644
--- a/src/gpu/ccpr/GrCoverageCountingPathRenderer.cpp
+++ b/src/gpu/ccpr/GrCoverageCountingPathRenderer.cpp
@@ -292,7 +292,6 @@ void DrawPathsOp::onExecute(GrOpFlushState* flushState) {
return; // Setup failed.
}
- GrPipeline pipeline;
GrPipeline::InitArgs args;
args.fAppliedClip = flushState->drawOpArgs().fAppliedClip;
args.fCaps = &flushState->caps();
@@ -300,7 +299,7 @@ void DrawPathsOp::onExecute(GrOpFlushState* flushState) {
args.fFlags = fSRGBFlags;
args.fProxy = flushState->drawOpArgs().fProxy;
args.fDstProxy = flushState->drawOpArgs().fDstProxy;
- pipeline.init(args);
+ GrPipeline pipeline(args);
int baseInstance = fBaseInstance;
diff --git a/src/gpu/instanced/InstancedOp.cpp b/src/gpu/instanced/InstancedOp.cpp
index ab2b7583c8..229a144f07 100644
--- a/src/gpu/instanced/InstancedOp.cpp
+++ b/src/gpu/instanced/InstancedOp.cpp
@@ -225,7 +225,6 @@ void InstancedOp::onExecute(GrOpFlushState* state) {
state->gpu()->handleDirtyContext();
- GrPipeline pipeline;
GrPipeline::InitArgs args;
args.fAppliedClip = state->drawOpArgs().fAppliedClip;
args.fCaps = &state->caps();
@@ -240,7 +239,7 @@ void InstancedOp::onExecute(GrOpFlushState* state) {
}
args.fProxy = state->drawOpArgs().fProxy;
args.fDstProxy = state->drawOpArgs().fDstProxy;
- pipeline.init(args);
+ GrPipeline pipeline(args);
if (GrXferBarrierType barrierType = pipeline.xferBarrierType(*state->gpu()->caps())) {
state->gpu()->xferBarrier(pipeline.renderTarget(), barrierType);
diff --git a/src/gpu/ops/GrDrawPathOp.cpp b/src/gpu/ops/GrDrawPathOp.cpp
index 420a3a218e..fa7fc157d0 100644
--- a/src/gpu/ops/GrDrawPathOp.cpp
+++ b/src/gpu/ops/GrDrawPathOp.cpp
@@ -28,7 +28,7 @@ SkString GrDrawPathOp::dumpInfo() const {
return string;
}
-void GrDrawPathOpBase::initPipeline(const GrOpFlushState& state, GrPipeline* pipeline) {
+GrPipeline::InitArgs GrDrawPathOpBase::pipelineInitArgs(const GrOpFlushState& state) {
static constexpr GrUserStencilSettings kCoverPass{
GrUserStencilSettings::StaticInit<
0x0000,
@@ -50,8 +50,7 @@ void GrDrawPathOpBase::initPipeline(const GrOpFlushState& state, GrPipeline* pip
args.fCaps = &state.caps();
args.fResourceProvider = state.resourceProvider();
args.fDstProxy = state.drawOpArgs().fDstProxy;
-
- return pipeline->init(args);
+ return args;
}
//////////////////////////////////////////////////////////////////////////////
@@ -67,8 +66,7 @@ void init_stencil_pass_settings(const GrOpFlushState& flushState,
//////////////////////////////////////////////////////////////////////////////
void GrDrawPathOp::onExecute(GrOpFlushState* state) {
- GrPipeline pipeline;
- this->initPipeline(*state, &pipeline);
+ GrPipeline pipeline(this->pipelineInitArgs(*state));
sk_sp<GrPathProcessor> pathProc(GrPathProcessor::Create(this->color(), this->viewMatrix()));
GrStencilSettings stencil;
@@ -180,8 +178,7 @@ void GrDrawPathRangeOp::onExecute(GrOpFlushState* state) {
sk_sp<GrPathProcessor> pathProc(
GrPathProcessor::Create(this->color(), drawMatrix, localMatrix));
- GrPipeline pipeline;
- this->initPipeline(*state, &pipeline);
+ GrPipeline pipeline(this->pipelineInitArgs(*state));
GrStencilSettings stencil;
init_stencil_pass_settings(*state, this->fillType(), &stencil);
if (fDraws.count() == 1) {
diff --git a/src/gpu/ops/GrDrawPathOp.h b/src/gpu/ops/GrDrawPathOp.h
index ce9e6e048d..dcd8997f97 100644
--- a/src/gpu/ops/GrDrawPathOp.h
+++ b/src/gpu/ops/GrDrawPathOp.h
@@ -41,7 +41,7 @@ protected:
GrPathRendering::FillType fillType() const { return fFillType; }
const GrProcessorSet& processors() const { return fProcessorSet; }
uint32_t pipelineSRGBFlags() const { return fPipelineSRGBFlags; }
- void initPipeline(const GrOpFlushState&, GrPipeline*);
+ inline GrPipeline::InitArgs pipelineInitArgs(const GrOpFlushState&);
const GrProcessorSet::Analysis& doProcessorAnalysis(const GrCaps& caps,
const GrAppliedClip* clip) {
bool isMixedSamples = GrAAType::kMixedSamples == fAAType;