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

View File

@ -105,12 +105,6 @@ private:
const SkIRect& srcRect, const SkIRect& srcRect,
const SkIPoint& dstPoint) override; 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; } bool isIssued(uint32_t drawID) override { return drawID != fDrawID; }
StateForPathDraw* SK_WARN_UNUSED_RESULT createStateForPathDraw( StateForPathDraw* SK_WARN_UNUSED_RESULT createStateForPathDraw(
@ -130,7 +124,6 @@ private:
static const int kPipelineBufferHighWaterMark = 100; static const int kPipelineBufferHighWaterMark = 100;
SkAutoTDelete<GrCommandBuilder> fCommands; SkAutoTDelete<GrCommandBuilder> fCommands;
SkTArray<GrTraceMarkerSet, false> fGpuCmdMarkers;
SkChunkAlloc fPathIndexBuffer; SkChunkAlloc fPathIndexBuffer;
SkChunkAlloc fPathTransformBuffer; SkChunkAlloc fPathTransformBuffer;
SkChunkAlloc fPipelineBuffer; SkChunkAlloc fPipelineBuffer;

View File

@ -40,18 +40,7 @@ void GrTargetCommands::flush(GrBufferedDrawTarget* bufferedDrawTarget) {
CmdBuffer::Iter iter(fCmdBuffer); CmdBuffer::Iter iter(fCmdBuffer);
while (iter.next()) { 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); iter->execute(gpu);
if (iter->isTraced()) {
gpu->removeGpuTraceMarker(&newMarker);
}
} }
fBatchTarget.postFlush(); fBatchTarget.postFlush();

View File

@ -46,22 +46,17 @@ public:
}; };
Cmd(CmdType type) Cmd(CmdType type)
: fMarkerID(-1) : fType(type)
, fType(type)
#if GR_BATCH_SPEW #if GR_BATCH_SPEW
, fUniqueID(GenID(&gUniqueID)) , fUniqueID(GenID(&gUniqueID))
#endif #endif
{} {}
virtual ~Cmd() {} virtual ~Cmd() {}
virtual void execute(GrGpu*) = 0; virtual void execute(GrGpu*) = 0;
CmdType type() const { return fType; } 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;} ) GrBATCH_SPEW(uint32_t uniqueID() const { return fUniqueID;} )
private: private:
@ -73,7 +68,6 @@ public:
} }
return id; return id;
} }
int fMarkerID;
CmdType fType; CmdType fType;
GrBATCH_SPEW(uint32_t fUniqueID); GrBATCH_SPEW(uint32_t fUniqueID);
GrBATCH_SPEW(static int32_t gUniqueID;) GrBATCH_SPEW(static int32_t gUniqueID;)