Remove trace marker support from GrBufferedDrawTarget

Review URL: https://codereview.chromium.org/1284983002
This commit is contained in:
bsalomon 2015-08-12 08:11:22 -07:00 committed by Commit bot
parent d0375bc460
commit 69a9689ace
4 changed files with 14 additions and 69 deletions

View File

@ -27,11 +27,8 @@ GrBufferedDrawTarget::~GrBufferedDrawTarget() {
}
void GrBufferedDrawTarget::onDrawBatch(GrBatch* batch) {
this->recordTraceMarkersIfNecessary(
fCommands->recordXferBarrierIfNecessary(*batch->pipeline(), *this->caps()));
GrTargetCommands::Cmd* cmd = fCommands->recordDrawBatch(batch);
this->recordTraceMarkersIfNecessary(cmd);
fCommands->recordXferBarrierIfNecessary(*batch->pipeline(), *this->caps());
fCommands->recordDrawBatch(batch);
}
void GrBufferedDrawTarget::onStencilPath(const GrPipelineBuilder& pipelineBuilder,
@ -39,10 +36,7 @@ void GrBufferedDrawTarget::onStencilPath(const GrPipelineBuilder& pipelineBuilde
const GrPath* path,
const GrScissorState& scissorState,
const GrStencilSettings& stencilSettings) {
GrTargetCommands::Cmd* cmd = fCommands->recordStencilPath(pipelineBuilder,
pathProc, path, scissorState,
stencilSettings);
this->recordTraceMarkersIfNecessary(cmd);
fCommands->recordStencilPath(pipelineBuilder, pathProc, path, scissorState, stencilSettings);
}
void GrBufferedDrawTarget::onDrawPath(const GrPathProcessor* pathProc,
@ -54,8 +48,7 @@ void GrBufferedDrawTarget::onDrawPath(const GrPathProcessor* pathProc,
if (!state) {
return;
}
GrTargetCommands::Cmd* cmd = fCommands->recordDrawPath(state, pathProc, path, stencilSettings);
this->recordTraceMarkersIfNecessary(cmd);
fCommands->recordDrawPath(state, pathProc, path, stencilSettings);
}
void GrBufferedDrawTarget::onDrawPaths(const GrPathProcessor* pathProc,
@ -72,40 +65,33 @@ void GrBufferedDrawTarget::onDrawPaths(const GrPathProcessor* pathProc,
if (!state) {
return;
}
GrTargetCommands::Cmd* cmd = fCommands->recordDrawPaths(state, this, pathProc, pathRange,
indices, indexType, transformValues,
transformType, count,
stencilSettings, pipelineInfo);
this->recordTraceMarkersIfNecessary(cmd);
fCommands->recordDrawPaths(state, this, pathProc, pathRange, indices, indexType,
transformValues, transformType, count, stencilSettings,
pipelineInfo);
}
void GrBufferedDrawTarget::onClear(const SkIRect& rect, GrColor color,
GrRenderTarget* renderTarget) {
GrTargetCommands::Cmd* cmd = fCommands->recordClear(rect, color, renderTarget);
this->recordTraceMarkersIfNecessary(cmd);
fCommands->recordClear(rect, color, renderTarget);
}
void GrBufferedDrawTarget::clearStencilClip(const SkIRect& rect,
bool insideClip,
GrRenderTarget* renderTarget) {
GrTargetCommands::Cmd* cmd = fCommands->recordClearStencilClip(rect, insideClip, renderTarget);
this->recordTraceMarkersIfNecessary(cmd);
fCommands->recordClearStencilClip(rect, insideClip, renderTarget);
}
void GrBufferedDrawTarget::discard(GrRenderTarget* renderTarget) {
if (!this->caps()->discardRenderTargetSupport()) {
return;
}
GrTargetCommands::Cmd* cmd = fCommands->recordDiscard(renderTarget);
this->recordTraceMarkersIfNecessary(cmd);
fCommands->recordDiscard(renderTarget);
}
void GrBufferedDrawTarget::onReset() {
fCommands->reset();
fPathIndexBuffer.rewind();
fPathTransformBuffer.rewind();
fGpuCmdMarkers.reset();
fPrevState.reset(NULL);
// Note, fPrevState points into fPipelineBuffer's allocation, so we have to reset first.
@ -126,23 +112,7 @@ void GrBufferedDrawTarget::onCopySurface(GrSurface* dst,
GrSurface* src,
const SkIRect& srcRect,
const SkIPoint& dstPoint) {
GrTargetCommands::Cmd* cmd = fCommands->recordCopySurface(dst, src, srcRect, dstPoint);
this->recordTraceMarkersIfNecessary(cmd);
}
void GrBufferedDrawTarget::recordTraceMarkersIfNecessary(GrTargetCommands::Cmd* cmd) {
if (!cmd) {
return;
}
const GrTraceMarkerSet& activeTraceMarkers = this->getActiveTraceMarkers();
if (activeTraceMarkers.count() > 0) {
if (cmd->isTraced()) {
fGpuCmdMarkers[cmd->markerID()].addSet(activeTraceMarkers);
} else {
cmd->setMarkerID(fGpuCmdMarkers.count());
fGpuCmdMarkers.push_back(activeTraceMarkers);
}
}
fCommands->recordCopySurface(dst, src, srcRect, dstPoint);
}
GrTargetCommands::StateForPathDraw*
@ -167,7 +137,6 @@ GrBufferedDrawTarget::createStateForPathDraw(const GrPrimitiveProcessor* primPro
fPrevState.reset(state);
}
this->recordTraceMarkersIfNecessary(
fCommands->recordXferBarrierIfNecessary(*fPrevState->getPipeline(), *this->caps()));
fCommands->recordXferBarrierIfNecessary(*fPrevState->getPipeline(), *this->caps());
return fPrevState;
}

View File

@ -105,12 +105,6 @@ private:
const SkIRect& srcRect,
const SkIPoint& dstPoint) override;
// Records any trace markers for a command
void recordTraceMarkersIfNecessary(GrTargetCommands::Cmd*);
SkString getCmdString(int index) const {
SkASSERT(index < fGpuCmdMarkers.count());
return fGpuCmdMarkers[index].toString();
}
bool isIssued(uint32_t drawID) override { return drawID != fDrawID; }
StateForPathDraw* SK_WARN_UNUSED_RESULT createStateForPathDraw(
@ -130,7 +124,6 @@ private:
static const int kPipelineBufferHighWaterMark = 100;
SkAutoTDelete<GrCommandBuilder> fCommands;
SkTArray<GrTraceMarkerSet, false> fGpuCmdMarkers;
SkChunkAlloc fPathIndexBuffer;
SkChunkAlloc fPathTransformBuffer;
SkChunkAlloc fPipelineBuffer;

View File

@ -40,18 +40,7 @@ void GrTargetCommands::flush(GrBufferedDrawTarget* bufferedDrawTarget) {
CmdBuffer::Iter iter(fCmdBuffer);
while (iter.next()) {
GrGpuTraceMarker newMarker("", -1);
SkString traceString;
if (iter->isTraced()) {
traceString = bufferedDrawTarget->getCmdString(iter->markerID());
newMarker.fMarker = traceString.c_str();
gpu->addGpuTraceMarker(&newMarker);
}
iter->execute(gpu);
if (iter->isTraced()) {
gpu->removeGpuTraceMarker(&newMarker);
}
}
fBatchTarget.postFlush();

View File

@ -46,22 +46,17 @@ public:
};
Cmd(CmdType type)
: fMarkerID(-1)
, fType(type)
: fType(type)
#if GR_BATCH_SPEW
, fUniqueID(GenID(&gUniqueID))
#endif
{}
{}
virtual ~Cmd() {}
virtual void execute(GrGpu*) = 0;
CmdType type() const { return fType; }
// trace markers
bool isTraced() const { return -1 != fMarkerID; }
void setMarkerID(int markerID) { SkASSERT(-1 == fMarkerID); fMarkerID = markerID; }
int markerID() const { return fMarkerID; }
GrBATCH_SPEW(uint32_t uniqueID() const { return fUniqueID;} )
private:
@ -73,7 +68,6 @@ public:
}
return id;
}
int fMarkerID;
CmdType fType;
GrBATCH_SPEW(uint32_t fUniqueID);
GrBATCH_SPEW(static int32_t gUniqueID;)