Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Unified Diff: src/gpu/GrBufferedDrawTarget.cpp

Issue 1278643006: Make GrBatch carry its own GrPipeline (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: more Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrBufferedDrawTarget.h ('k') | src/gpu/GrCommandBuilder.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrBufferedDrawTarget.cpp
diff --git a/src/gpu/GrBufferedDrawTarget.cpp b/src/gpu/GrBufferedDrawTarget.cpp
index 32111f5326aaf9ec3867dbadfa3aa43cce07db35..9ba6d826326ed46c979723601fd9559c50c1d642 100644
--- a/src/gpu/GrBufferedDrawTarget.cpp
+++ b/src/gpu/GrBufferedDrawTarget.cpp
@@ -26,15 +26,11 @@ GrBufferedDrawTarget::~GrBufferedDrawTarget() {
this->reset();
}
-void GrBufferedDrawTarget::onDrawBatch(GrBatch* batch,
- const PipelineInfo& pipelineInfo) {
- GrPipelineOptimizations opts;
- State* state = this->setupPipelineAndShouldDraw(batch, pipelineInfo, &opts);
- if (!state) {
- return;
- }
+void GrBufferedDrawTarget::onDrawBatch(GrBatch* batch) {
+ this->recordTraceMarkersIfNecessary(
+ fCommands->recordXferBarrierIfNecessary(*batch->pipeline(), *this->caps()));
- GrTargetCommands::Cmd* cmd = fCommands->recordDrawBatch(state, opts, batch);
+ GrTargetCommands::Cmd* cmd = fCommands->recordDrawBatch(batch);
this->recordTraceMarkersIfNecessary(cmd);
}
@@ -54,7 +50,7 @@ void GrBufferedDrawTarget::onDrawPath(const GrPathProcessor* pathProc,
const GrStencilSettings& stencilSettings,
const PipelineInfo& pipelineInfo) {
GrPipelineOptimizations opts;
- State* state = this->setupPipelineAndShouldDraw(pathProc, pipelineInfo, &opts);
+ StateForPathDraw* state = this->createStateForPathDraw(pathProc, pipelineInfo, &opts);
if (!state) {
return;
}
@@ -72,7 +68,7 @@ void GrBufferedDrawTarget::onDrawPaths(const GrPathProcessor* pathProc,
const GrStencilSettings& stencilSettings,
const PipelineInfo& pipelineInfo) {
GrPipelineOptimizations opts;
- State* state = this->setupPipelineAndShouldDraw(pathProc, pipelineInfo, &opts);
+ StateForPathDraw* state = this->createStateForPathDraw(pathProc, pipelineInfo, &opts);
if (!state) {
return;
}
@@ -149,14 +145,12 @@ void GrBufferedDrawTarget::recordTraceMarkersIfNecessary(GrTargetCommands::Cmd*
}
}
-GrTargetCommands::State*
-GrBufferedDrawTarget::setupPipelineAndShouldDraw(const GrPrimitiveProcessor* primProc,
- const GrDrawTarget::PipelineInfo& pipelineInfo,
- GrPipelineOptimizations* opts) {
- State* state = this->allocState(primProc);
- this->setupPipeline(pipelineInfo, state->pipelineLocation(), opts);
-
- if (state->getPipeline()->mustSkip()) {
+GrTargetCommands::StateForPathDraw*
+GrBufferedDrawTarget::createStateForPathDraw(const GrPrimitiveProcessor* primProc,
+ const GrDrawTarget::PipelineInfo& pipelineInfo,
+ GrPipelineOptimizations* opts) {
+ StateForPathDraw* state = this->allocState(primProc);
+ if (!GrPipeline::CreateAt(state->pipelineLocation(), pipelineInfo.pipelineCreateArgs(), opts)) {
this->unallocState(state);
return NULL;
}
@@ -177,27 +171,3 @@ GrBufferedDrawTarget::setupPipelineAndShouldDraw(const GrPrimitiveProcessor* pri
fCommands->recordXferBarrierIfNecessary(*fPrevState->getPipeline(), *this->caps()));
return fPrevState;
}
-
-GrTargetCommands::State*
-GrBufferedDrawTarget::setupPipelineAndShouldDraw(GrBatch* batch,
- const GrDrawTarget::PipelineInfo& pipelineInfo,
- GrPipelineOptimizations* opts) {
- State* state = this->allocState();
- this->setupPipeline(pipelineInfo, state->pipelineLocation(), opts);
-
- if (state->getPipeline()->mustSkip()) {
- this->unallocState(state);
- return NULL;
- }
-
- if (fPrevState && !fPrevState->fPrimitiveProcessor.get() &&
- fPrevState->getPipeline()->isEqual(*state->getPipeline())) {
- this->unallocState(state);
- } else {
- fPrevState.reset(state);
- }
-
- this->recordTraceMarkersIfNecessary(
- fCommands->recordXferBarrierIfNecessary(*fPrevState->getPipeline(), *this->caps()));
- return fPrevState;
-}
« no previous file with comments | « src/gpu/GrBufferedDrawTarget.h ('k') | src/gpu/GrCommandBuilder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698