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/GrInOrderDrawBuffer.cpp

Issue 1119353002: Revert of Move state management to GrInOrderDrawBuffer (Closed) Base URL: https://skia.googlesource.com/skia.git@batchownsbounds
Patch Set: Created 5 years, 8 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/GrInOrderDrawBuffer.h ('k') | src/gpu/GrTargetCommands.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrInOrderDrawBuffer.cpp
diff --git a/src/gpu/GrInOrderDrawBuffer.cpp b/src/gpu/GrInOrderDrawBuffer.cpp
index 76e085dffa2809a6194e150683832565c875a2cc..e298be6c8bffb575798ae14250512495626e0fe5 100644
--- a/src/gpu/GrInOrderDrawBuffer.cpp
+++ b/src/gpu/GrInOrderDrawBuffer.cpp
@@ -17,7 +17,6 @@
, fCommands(context->getGpu(), vertexPool, indexPool)
, fPathIndexBuffer(kPathIdxBufferMinReserve * sizeof(char)/4)
, fPathTransformBuffer(kPathXformBufferMinReserve * sizeof(float)/4)
- , fPipelineBuffer(kPipelineBufferMinReserve)
, fDrawID(0) {
SkASSERT(vertexPool);
@@ -301,12 +300,7 @@
void GrInOrderDrawBuffer::onDrawBatch(GrBatch* batch,
const PipelineInfo& pipelineInfo) {
- State* state = this->setupPipelineAndShouldDraw(batch, pipelineInfo);
- if (!state) {
- return;
- }
-
- GrTargetCommands::Cmd* cmd = fCommands.recordDrawBatch(state, batch);
+ GrTargetCommands::Cmd* cmd = fCommands.recordDrawBatch(this, batch, pipelineInfo);
this->recordTraceMarkersIfNecessary(cmd);
}
@@ -315,7 +309,7 @@
const GrPath* path,
const GrScissorState& scissorState,
const GrStencilSettings& stencilSettings) {
- GrTargetCommands::Cmd* cmd = fCommands.recordStencilPath(pipelineBuilder,
+ GrTargetCommands::Cmd* cmd = fCommands.recordStencilPath(this, pipelineBuilder,
pathProc, path, scissorState,
stencilSettings);
this->recordTraceMarkersIfNecessary(cmd);
@@ -325,11 +319,9 @@
const GrPath* path,
const GrStencilSettings& stencilSettings,
const PipelineInfo& pipelineInfo) {
- State* state = this->setupPipelineAndShouldDraw(pathProc, pipelineInfo);
- if (!state) {
- return;
- }
- GrTargetCommands::Cmd* cmd = fCommands.recordDrawPath(state, pathProc, path, stencilSettings);
+ GrTargetCommands::Cmd* cmd = fCommands.recordDrawPath(this, pathProc,
+ path, stencilSettings,
+ pipelineInfo);
this->recordTraceMarkersIfNecessary(cmd);
}
@@ -342,11 +334,7 @@
int count,
const GrStencilSettings& stencilSettings,
const PipelineInfo& pipelineInfo) {
- State* state = this->setupPipelineAndShouldDraw(pathProc, pipelineInfo);
- if (!state) {
- return;
- }
- GrTargetCommands::Cmd* cmd = fCommands.recordDrawPaths(state, this, pathProc, pathRange,
+ GrTargetCommands::Cmd* cmd = fCommands.recordDrawPaths(this, pathProc, pathRange,
indices, indexType, transformValues,
transformType, count,
stencilSettings, pipelineInfo);
@@ -355,14 +343,16 @@
void GrInOrderDrawBuffer::onClear(const SkIRect* rect, GrColor color,
bool canIgnoreRect, GrRenderTarget* renderTarget) {
- GrTargetCommands::Cmd* cmd = fCommands.recordClear(rect, color, canIgnoreRect, renderTarget);
+ GrTargetCommands::Cmd* cmd = fCommands.recordClear(this, rect, color,
+ canIgnoreRect, renderTarget);
this->recordTraceMarkersIfNecessary(cmd);
}
void GrInOrderDrawBuffer::clearStencilClip(const SkIRect& rect,
bool insideClip,
GrRenderTarget* renderTarget) {
- GrTargetCommands::Cmd* cmd = fCommands.recordClearStencilClip(rect, insideClip, renderTarget);
+ GrTargetCommands::Cmd* cmd = fCommands.recordClearStencilClip(this, rect,
+ insideClip, renderTarget);
this->recordTraceMarkersIfNecessary(cmd);
}
@@ -371,7 +361,7 @@
return;
}
- GrTargetCommands::Cmd* cmd = fCommands.recordDiscard(renderTarget);
+ GrTargetCommands::Cmd* cmd = fCommands.recordDiscard(this, renderTarget);
this->recordTraceMarkersIfNecessary(cmd);
}
@@ -380,15 +370,6 @@
fPathIndexBuffer.rewind();
fPathTransformBuffer.rewind();
fGpuCmdMarkers.reset();
-
- fPrevState.reset(NULL);
- // Note, fPrevState points into fPipelineBuffer's allocation, so we have to reset first.
- // Furthermore, we have to reset fCommands before fPipelineBuffer too.
- if (fDrawID % kPipelineBufferHighWaterMark) {
- fPipelineBuffer.rewind();
- } else {
- fPipelineBuffer.reset();
- }
}
void GrInOrderDrawBuffer::onFlush() {
@@ -419,55 +400,3 @@
}
}
}
-
-GrTargetCommands::State*
-GrInOrderDrawBuffer::setupPipelineAndShouldDraw(const GrPrimitiveProcessor* primProc,
- const GrDrawTarget::PipelineInfo& pipelineInfo) {
- State* state = this->allocState();
- this->setupPipeline(pipelineInfo, state->pipelineLocation());
-
- if (state->getPipeline()->mustSkip()) {
- this->unallocState(state);
- return NULL;
- }
-
- state->fPrimitiveProcessor->initBatchTracker(&state->fBatchTracker,
- state->getPipeline()->getInitBatchTracker());
-
- if (fPrevState && fPrevState->fPrimitiveProcessor.get() &&
- fPrevState->fPrimitiveProcessor->canMakeEqual(fPrevState->fBatchTracker,
- *state->fPrimitiveProcessor,
- state->fBatchTracker) &&
- fPrevState->getPipeline()->isEqual(*state->getPipeline())) {
- this->unallocState(state);
- } else {
- fPrevState.reset(state);
- }
-
- fCommands.recordXferBarrierIfNecessary(*fPrevState->getPipeline(), this);
- return fPrevState;
-}
-
-GrTargetCommands::State*
-GrInOrderDrawBuffer::setupPipelineAndShouldDraw(GrBatch* batch,
- const GrDrawTarget::PipelineInfo& pipelineInfo) {
- State* state = this->allocState();
- this->setupPipeline(pipelineInfo, state->pipelineLocation());
-
- if (state->getPipeline()->mustSkip()) {
- this->unallocState(state);
- return NULL;
- }
-
- batch->initBatchTracker(state->getPipeline()->getInitBatchTracker());
-
- if (fPrevState && !fPrevState->fPrimitiveProcessor.get() &&
- fPrevState->getPipeline()->isEqual(*state->getPipeline())) {
- this->unallocState(state);
- } else {
- fPrevState.reset(state);
- }
-
- fCommands.recordXferBarrierIfNecessary(*fPrevState->getPipeline(), this);
- return fPrevState;
-}
« no previous file with comments | « src/gpu/GrInOrderDrawBuffer.h ('k') | src/gpu/GrTargetCommands.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698