Add flag to force gpu trace markers to be used and printed out for debugging.
BUG=skia: Review URL: https://codereview.chromium.org/976413002
This commit is contained in:
parent
a0865b4620
commit
bdad9c34d8
@ -232,4 +232,12 @@ typedef unsigned __int64 uint64_t;
|
||||
#define GR_ALWAYS_ALLOCATE_ON_HEAP 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* GR_FORCE_GPU_TRACE_DEBUGGING will force gpu tracing/debug markers to be turned on. The trace
|
||||
* markers will be printed out instead of making the backend calls to push and pop them.
|
||||
*/
|
||||
#if !defined(GR_FORCE_GPU_TRACE_DEBUGGING)
|
||||
#define GR_FORCE_GPU_TRACE_DEBUGGING 0
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -80,7 +80,11 @@ public:
|
||||
bool pathRenderingSupport() const { return fPathRenderingSupport; }
|
||||
bool dstReadInShaderSupport() const { return fDstReadInShaderSupport; }
|
||||
bool discardRenderTargetSupport() const { return fDiscardRenderTargetSupport; }
|
||||
#if GR_FORCE_GPU_TRACE_DEBUGGING
|
||||
bool gpuTracingSupport() const { return true; }
|
||||
#else
|
||||
bool gpuTracingSupport() const { return fGpuTracingSupport; }
|
||||
#endif
|
||||
bool compressedTexSubImageSupport() const { return fCompressedTexSubImageSupport; }
|
||||
bool oversizedStencilSupport() const { return fOversizedStencilSupport; }
|
||||
|
||||
|
@ -85,6 +85,11 @@ private:
|
||||
INTERNAL_TRACE_EVENT_ADD_SCOPED(TRACE_DISABLED_BY_DEFAULT("skia.gpu"),name, \
|
||||
"id", name_counter, ##__VA_ARGS__);
|
||||
|
||||
#if GR_FORCE_GPU_TRACE_DEBUGGING
|
||||
#define GR_CREATE_GPU_TRACE_MARKER(name, name_counter, target) \
|
||||
GrGpuTraceMarkerGenerator SK_MACRO_APPEND_LINE(TMG)(target); \
|
||||
SK_MACRO_APPEND_LINE(TMG).initialize(name, &name_counter);
|
||||
#else
|
||||
#define GR_CREATE_GPU_TRACE_MARKER(name, name_counter, target) \
|
||||
GrGpuTraceMarkerGenerator SK_MACRO_APPEND_LINE(TMG)(target); \
|
||||
bool SK_MACRO_APPEND_LINE(gpuTracingEnabled); \
|
||||
@ -93,7 +98,7 @@ private:
|
||||
if (SK_MACRO_APPEND_LINE(gpuTracingEnabled)) { \
|
||||
SK_MACRO_APPEND_LINE(TMG).initialize(name, &name_counter); \
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#define GR_CREATE_TRACE_MARKER_CONTEXT(name, context) \
|
||||
INTERNAL_GR_CREATE_TRACE_MARKER_SCOPED_C(name, context)
|
||||
@ -114,6 +119,11 @@ private:
|
||||
INTERNAL_TRACE_EVENT_ADD_SCOPED(TRACE_DISABLED_BY_DEFAULT("skia.gpu"),name, \
|
||||
"id", name_counter, ##__VA_ARGS__);
|
||||
|
||||
#if GR_FORCE_GPU_TRACE_DEBUGGING
|
||||
#define GR_CREATE_GPU_TRACE_MARKER_C(name, name_counter, context) \
|
||||
GrGpuTraceMarkerGeneratorContext SK_MACRO_APPEND_LINE(TMG)(context); \
|
||||
SK_MACRO_APPEND_LINE(TMG).initialize(name, &name_counter);
|
||||
#else
|
||||
#define GR_CREATE_GPU_TRACE_MARKER_C(name, name_counter, context) \
|
||||
GrGpuTraceMarkerGeneratorContext SK_MACRO_APPEND_LINE(TMG)(context); \
|
||||
bool SK_MACRO_APPEND_LINE(gpuTracingEnabled); \
|
||||
@ -122,5 +132,6 @@ private:
|
||||
if (SK_MACRO_APPEND_LINE(gpuTracingEnabled)) { \
|
||||
SK_MACRO_APPEND_LINE(TMG).initialize(name, &name_counter); \
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -2778,13 +2778,21 @@ void GrGLGpu::didAddGpuTraceMarker() {
|
||||
if (this->caps()->gpuTracingSupport()) {
|
||||
const GrTraceMarkerSet& markerArray = this->getActiveTraceMarkers();
|
||||
SkString markerString = markerArray.toStringLast();
|
||||
#if GR_FORCE_GPU_TRACE_DEBUGGING
|
||||
SkDebugf("%s\n", markerString.c_str());
|
||||
#else
|
||||
GL_CALL(PushGroupMarker(0, markerString.c_str()));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void GrGLGpu::didRemoveGpuTraceMarker() {
|
||||
if (this->caps()->gpuTracingSupport()) {
|
||||
#if GR_FORCE_GPU_TRACE_DEBUGGING
|
||||
SkDebugf("Pop trace marker.\n");
|
||||
#else
|
||||
GL_CALL(PopGroupMarker());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user