diff options
author | chai <chaifix@163.com> | 2019-08-14 22:50:43 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2019-08-14 22:50:43 +0800 |
commit | 15740faf9fe9fe4be08965098bbf2947e096aeeb (patch) | |
tree | a730ec236656cc8cab5b13f088adfaed6bb218fb /Runtime/GfxDevice/d3d11/D3D11Debug.h |
Diffstat (limited to 'Runtime/GfxDevice/d3d11/D3D11Debug.h')
-rw-r--r-- | Runtime/GfxDevice/d3d11/D3D11Debug.h | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/Runtime/GfxDevice/d3d11/D3D11Debug.h b/Runtime/GfxDevice/d3d11/D3D11Debug.h new file mode 100644 index 0000000..1f57adf --- /dev/null +++ b/Runtime/GfxDevice/d3d11/D3D11Debug.h @@ -0,0 +1,54 @@ +#pragma once + +#define ENABLE_DX11_DEBUGGING (!UNITY_RELEASE && UNITY_METRO) && 0 + +#if ENABLE_DX11_DEBUGGING + + enum DbgFrameDebugType + { + kFrameDebugOutputNone, + kFrameDebugOutputDX11Commands, + kFrameDebugOutputDX11CommandsWithStepping + }; + + void DbgDX11DisableLogging(); + void DbgDX11EnableLogging(); + void DbgDX11LogOutput(const char* format,...); + void DbgDX11IncreaseIndentation(); + void DbgDX11DecreaseIndentation(); + void DbgDX11MarkDrawing(UInt32 triCount, UInt32 vertexCount); + void DbgDX11MarkFrameBegin(); + void DbgDX11MarkFrameEnd(); + void DbgDX11ShowCurrentGfxState(); + + class DbgDX11AutoIndentation + { + public: + DbgDX11AutoIndentation() {DbgDX11IncreaseIndentation();} + ~DbgDX11AutoIndentation() {DbgDX11DecreaseIndentation();} + }; + + inline const char* GetDX11BoolString (bool val) {return val == true ? "true" : "false";} + + #define DX11_DISABLE_LOGGING() DbgDX11DisableLogging() + #define DX11_ENABLE_LOGGING() DbgDX11EnableLogging() + #define DX11_LOG_OUTPUT(...) DbgDX11LogOutput(__VA_ARGS__); + #define DX11_LOG_ENTER_FUNCTION(...) DbgDX11LogOutput(__VA_ARGS__); DbgDX11AutoIndentation sDbgDX11AutoIndentation; + #define DX11_MARK_DRAWING(TriCount, VertexCount) DbgDX11MarkDrawing(TriCount, VertexCount); + #define DX11_MARK_FRAME_BEGIN() DbgDX11MarkFrameBegin(); + #define DX11_MARK_FRAME_END() DbgDX11MarkFrameEnd(); + #define DX11_CHK(x) {DbgDX11LogOutput(#x); x; } + +#else + #define DX11_DISABLE_LOGGING() {} + #define DX11_ENABLE_LOGGING() {} + #define DX11_LOG_OUTPUT(...) {} + #define DX11_LOG_OUTPUT_MTX3x4(m) {} + #define DX11_LOG_OUTPUT_MTX4x4(m) {} + #define DX11_LOG_ENTER_FUNCTION(...) {} + #define DX11_MARK_FRAME_BEGIN() {} + #define DX11_MARK_FRAME_END() {} + #define DX11_CHK(x) x + #define DX11_MARK_DRAWING(TriCount, VertexCount) {} + #define DX11_SET_FRAME_DEBUG(Type) {} +#endif |