aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu
diff options
context:
space:
mode:
authorGravatar joshualitt <joshualitt@google.com>2015-04-27 11:19:33 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-04-27 11:19:33 -0700
commit8a0a16d0a5e684e22cc3464642bc03bf341149a8 (patch)
tree2c05c7d407dd6a79b2930d5bdbe82347c0ae91aa /src/gpu
parentabf6c5cf95e921fae59efb487480e5b5081cf0ec (diff)
Revert of Stop closing batch prematurely (patchset #4 id:60001 of https://codereview.chromium.org/1092403002/)
Reason for revert: breaking 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 TBR=bsalomon@google.com,robertphillips@google.com,joshualitt@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Review URL: https://codereview.chromium.org/1109773003
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/GrInOrderDrawBuffer.cpp2
-rw-r--r--src/gpu/GrTargetCommands.cpp56
-rw-r--r--src/gpu/GrTargetCommands.h9
3 files changed, 16 insertions, 51 deletions
diff --git a/src/gpu/GrInOrderDrawBuffer.cpp b/src/gpu/GrInOrderDrawBuffer.cpp
index aaf3fd3f0e..8289f006d4 100644
--- a/src/gpu/GrInOrderDrawBuffer.cpp
+++ b/src/gpu/GrInOrderDrawBuffer.cpp
@@ -411,9 +411,7 @@ void GrInOrderDrawBuffer::recordTraceMarkersIfNecessary(GrTargetCommands::Cmd* c
void GrInOrderDrawBuffer::willReserveVertexAndIndexSpace(int vertexCount,
size_t vertexStride,
int indexCount) {
-#ifndef USE_BITMAP_TEXTBLOBS
fCommands.closeBatch();
-#endif
this->INHERITED::willReserveVertexAndIndexSpace(vertexCount, vertexStride, indexCount);
}
diff --git a/src/gpu/GrTargetCommands.cpp b/src/gpu/GrTargetCommands.cpp
index 6a3f1f4475..9b968dc9e7 100644
--- a/src/gpu/GrTargetCommands.cpp
+++ b/src/gpu/GrTargetCommands.cpp
@@ -82,11 +82,8 @@ GrTargetCommands::Cmd* GrTargetCommands::recordDraw(
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 @@ GrTargetCommands::Cmd* GrTargetCommands::recordDrawBatch(
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 @@ GrTargetCommands::Cmd* GrTargetCommands::recordStencilPath(
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 @@ GrTargetCommands::Cmd* GrTargetCommands::recordDrawPath(
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 @@ GrTargetCommands::Cmd* GrTargetCommands::recordDrawPaths(
SkASSERT(pathRange);
SkASSERT(indexValues);
SkASSERT(transformValues);
- CLOSE_BATCH
+ this->closeBatch();
if (!this->setupPipelineAndShouldDraw(iodb, pathProc, pipelineInfo)) {
return NULL;
@@ -237,7 +234,7 @@ GrTargetCommands::Cmd* GrTargetCommands::recordClear(GrInOrderDrawBuffer* iodb,
bool canIgnoreRect,
GrRenderTarget* renderTarget) {
SkASSERT(renderTarget);
- CLOSE_BATCH
+ this->closeBatch();
SkIRect r;
if (NULL == rect) {
@@ -260,7 +257,7 @@ GrTargetCommands::Cmd* GrTargetCommands::recordClearStencilClip(GrInOrderDrawBuf
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::recordClearStencilClip(GrInOrderDrawBuf
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 @@ void GrTargetCommands::flush(GrInOrderDrawBuffer* iodb) {
}
// 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 @@ void GrTargetCommands::flush(GrInOrderDrawBuffer* iodb) {
}
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 @@ GrTargetCommands::Cmd* GrTargetCommands::recordCopySurface(GrInOrderDrawBuffer*
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 @@ bool GrTargetCommands::setupPipelineAndShouldDraw(GrInOrderDrawBuffer* iodb,
fPrevState->getPipeline()->isEqual(*ss->getPipeline())) {
fCmdBuffer.pop_back();
} else {
- CLOSE_BATCH
+ this->closeBatch();
fPrevState = ss;
iodb->recordTraceMarkersIfNecessary(ss);
}
diff --git a/src/gpu/GrTargetCommands.h b/src/gpu/GrTargetCommands.h
index 696fcec5bb..4b3dd574e3 100644
--- a/src/gpu/GrTargetCommands.h
+++ b/src/gpu/GrTargetCommands.h
@@ -19,15 +19,6 @@
#include "SkRect.h"
#include "SkTypes.h"
-// This is just to get a flag
-// TODO remove this when batch is everywhere
-#include "GrTextContext.h"
-#ifdef USE_BITMAP_TEXTBLOBS
-#define CLOSE_BATCH
-#else
-#define CLOSE_BATCH this->closeBatch();
-#endif
-
class GrInOrderDrawBuffer;
class GrVertexBufferAllocPool;
class GrIndexBufferAllocPool;