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

Unified Diff: src/gpu/GrImmediateDrawTarget.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/GrImmediateDrawTarget.h ('k') | src/gpu/GrInOrderCommandBuilder.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrImmediateDrawTarget.cpp
diff --git a/src/gpu/GrImmediateDrawTarget.cpp b/src/gpu/GrImmediateDrawTarget.cpp
index bf13e9441487a950057f658c5c0b72f68d391f85..8088eae4a02ee7bea2e62507ba9165d3dacbfed9 100644
--- a/src/gpu/GrImmediateDrawTarget.cpp
+++ b/src/gpu/GrImmediateDrawTarget.cpp
@@ -25,16 +25,13 @@ GrImmediateDrawTarget::~GrImmediateDrawTarget() {
this->reset();
}
-void GrImmediateDrawTarget::onDrawBatch(GrBatch* batch,
- const PipelineInfo& pipelineInfo) {
- GrPipelineOptimizations opts;
- SkAlignedSStorage<sizeof(GrPipeline)> pipelineStorage;
- bool shouldDraw = this->setupPipelineAndShouldDraw(pipelineStorage.get(), pipelineInfo, &opts);
- GrPipeline* pipeline = reinterpret_cast<GrPipeline*>(pipelineStorage.get());
-
- if (!shouldDraw) {
- pipeline->~GrPipeline();
- return;
+void GrImmediateDrawTarget::onDrawBatch(GrBatch* batch) {
+ const GrXferProcessor& xp = *batch->pipeline()->getXferProcessor();
+ GrRenderTarget* rt = batch->pipeline()->getRenderTarget();
+
+ GrXferBarrierType barrierType;
+ if (xp.willNeedXferBarrier(rt, *this->caps(), &barrierType)) {
+ this->getGpu()->xferBarrier(rt, barrierType);
}
fBatchTarget.resetNumberOfDraws();
@@ -45,8 +42,6 @@ void GrImmediateDrawTarget::onDrawBatch(GrBatch* batch,
fBatchTarget.preFlush();
fBatchTarget.flushNext(batch->numberOfDraws());
fBatchTarget.postFlush();
-
- pipeline->~GrPipeline();
}
void GrImmediateDrawTarget::onClear(const SkIRect& rect, GrColor color,
@@ -82,27 +77,3 @@ void GrImmediateDrawTarget::onReset() {
void GrImmediateDrawTarget::onFlush() {
++fDrawID;
}
-
-bool
-GrImmediateDrawTarget::setupPipelineAndShouldDraw(void* pipelineAddr,
- const GrDrawTarget::PipelineInfo& pipelineInfo,
- GrPipelineOptimizations* opts) {
- const GrPipeline* pipeline = this->setupPipeline(pipelineInfo, pipelineAddr, opts);
-
- if (pipeline->mustSkip()) {
- return false;
- }
-
- this->recordXferBarrierIfNecessary(pipeline);
- return true;
-}
-
-void GrImmediateDrawTarget::recordXferBarrierIfNecessary(const GrPipeline* pipeline) {
- const GrXferProcessor& xp = *pipeline->getXferProcessor();
- GrRenderTarget* rt = pipeline->getRenderTarget();
-
- GrXferBarrierType barrierType;
- if (xp.willNeedXferBarrier(rt, *this->caps(), &barrierType)) {
- this->getGpu()->xferBarrier(rt, barrierType);
- }
-}
« no previous file with comments | « src/gpu/GrImmediateDrawTarget.h ('k') | src/gpu/GrInOrderCommandBuilder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698