Revert of Stop closing batch prematurely (patchset #4 id:60001 of https://codereview.chromium.org/1092403002/)
Reason for revert:
really does break windows bots
Original issue's description:
> In this CL we stop closing batches prematurely, and only close immediately before a flush.
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/db3ce12c810ead7b76faa784e7293197aca0d9f1
>
> Committed: https://skia.googlesource.com/skia/+/9e830ead85e544924344b01436c44cfb09fcf177
TBR=bsalomon@google.com,robertphillips@google.com,joshualitt@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:
Review URL: https://codereview.chromium.org/1105203002
diff --git a/src/gpu/GrTargetCommands.cpp b/src/gpu/GrTargetCommands.cpp
index 6a3f1f4..9b968dc 100644
--- a/src/gpu/GrTargetCommands.cpp
+++ b/src/gpu/GrTargetCommands.cpp
@@ -82,11 +82,8 @@
const GrGeometryProcessor* gp,
const GrDrawTarget::DrawInfo& info,
const GrDrawTarget::PipelineInfo& pipelineInfo) {
-#ifdef USE_BITMAP_TEXTBLOBS
- SkFAIL("Non-batch no longer supported\n");
-#endif
SkASSERT(info.vertexBuffer() && (!info.isIndexed() || info.indexBuffer()));
- CLOSE_BATCH
+ this->closeBatch();
if (!this->setupPipelineAndShouldDraw(iodb, gp, pipelineInfo)) {
return NULL;
@@ -124,7 +121,7 @@
SkASSERT(&fCmdBuffer.back() == fDrawBatch);
if (!fDrawBatch->fBatch->combineIfPossible(batch)) {
- CLOSE_BATCH
+ this->closeBatch();
fDrawBatch = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, DrawBatch, (batch, &fBatchTarget));
}
@@ -138,7 +135,7 @@
const GrPath* path,
const GrScissorState& scissorState,
const GrStencilSettings& stencilSettings) {
- CLOSE_BATCH
+ this->closeBatch();
StencilPath* sp = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, StencilPath,
(path, pipelineBuilder.getRenderTarget()));
@@ -156,7 +153,7 @@
const GrPath* path,
const GrStencilSettings& stencilSettings,
const GrDrawTarget::PipelineInfo& pipelineInfo) {
- CLOSE_BATCH
+ this->closeBatch();
// TODO: Only compare the subset of GrPipelineBuilder relevant to path covering?
if (!this->setupPipelineAndShouldDraw(iodb, pathProc, pipelineInfo)) {
@@ -181,7 +178,7 @@
SkASSERT(pathRange);
SkASSERT(indexValues);
SkASSERT(transformValues);
- CLOSE_BATCH
+ this->closeBatch();
if (!this->setupPipelineAndShouldDraw(iodb, pathProc, pipelineInfo)) {
return NULL;
@@ -237,7 +234,7 @@
bool canIgnoreRect,
GrRenderTarget* renderTarget) {
SkASSERT(renderTarget);
- CLOSE_BATCH
+ this->closeBatch();
SkIRect r;
if (NULL == rect) {
@@ -260,7 +257,7 @@
bool insideClip,
GrRenderTarget* renderTarget) {
SkASSERT(renderTarget);
- CLOSE_BATCH
+ this->closeBatch();
ClearStencilClip* clr = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, ClearStencilClip, (renderTarget));
clr->fRect = rect;
@@ -271,7 +268,7 @@
GrTargetCommands::Cmd* GrTargetCommands::recordDiscard(GrInOrderDrawBuffer* iodb,
GrRenderTarget* renderTarget) {
SkASSERT(renderTarget);
- CLOSE_BATCH
+ this->closeBatch();
Clear* clr = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, Clear, (renderTarget));
clr->fColor = GrColor_ILLEGAL;
@@ -290,38 +287,19 @@
}
// TODO this is temporary while batch is being rolled out
- CLOSE_BATCH
+ this->closeBatch();
+ iodb->getVertexAllocPool()->unmap();
+ iodb->getIndexAllocPool()->unmap();
+ fBatchTarget.preFlush();
// Updated every time we find a set state cmd to reflect the current state in the playback
// stream.
SetState* currentState = NULL;
- GrGpu* gpu = iodb->getGpu();
-
-#ifdef USE_BITMAP_TEXTBLOBS
- // Loop over all batches and generate geometry
- CmdBuffer::Iter genIter(fCmdBuffer);
- while (genIter.next()) {
- if (Cmd::kDrawBatch_CmdType == genIter->type()) {
- DrawBatch* db = reinterpret_cast<DrawBatch*>(genIter.get());
- fBatchTarget.resetNumberOfDraws();
- db->execute(NULL, currentState);
- db->fBatch->setNumberOfDraws(fBatchTarget.numberOfDraws());
- } else if (Cmd::kSetState_CmdType == genIter->type()) {
- SetState* ss = reinterpret_cast<SetState*>(genIter.get());
-
- ss->execute(gpu, currentState);
- currentState = ss;
- }
- }
-#endif
-
- iodb->getVertexAllocPool()->unmap();
- iodb->getIndexAllocPool()->unmap();
- fBatchTarget.preFlush();
-
CmdBuffer::Iter iter(fCmdBuffer);
+ GrGpu* gpu = iodb->getGpu();
+
while (iter.next()) {
GrGpuTraceMarker newMarker("", -1);
SkString traceString;
@@ -343,12 +321,10 @@
}
if (Cmd::kSetState_CmdType == iter->type()) {
-#ifndef USE_BITMAP_TEXTBLOBS
SetState* ss = reinterpret_cast<SetState*>(iter.get());
ss->execute(gpu, currentState);
currentState = ss;
-#endif
} else {
iter->execute(gpu, currentState);
}
@@ -432,7 +408,7 @@
const SkIRect& srcRect,
const SkIPoint& dstPoint) {
if (iodb->getGpu()->canCopySurface(dst, src, srcRect, dstPoint)) {
- CLOSE_BATCH
+ this->closeBatch();
CopySurface* cs = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, CopySurface, (dst, src));
cs->fSrcRect = srcRect;
cs->fDstPoint = dstPoint;
@@ -485,7 +461,7 @@
fPrevState->getPipeline()->isEqual(*ss->getPipeline())) {
fCmdBuffer.pop_back();
} else {
- CLOSE_BATCH
+ this->closeBatch();
fPrevState = ss;
iodb->recordTraceMarkersIfNecessary(ss);
}