diff options
author | David Farrell <dafarrel@adobe.com> | 2021-05-02 03:29:27 +0300 |
---|---|---|
committer | David Farrell <dafarrel@adobe.com> | 2021-05-02 03:31:49 +0300 |
commit | 3f2d0bbf6ec6a495e059c62aaee8a190ef7ea0d4 (patch) | |
tree | 8f5d978966904748be5d30d0cf0a1e165fac2678 /examples | |
parent | c668a085306ac81044e1003c51016497f71f6180 (diff) |
The ToyPathTracer example uses the D3D11 GPU zones
Diffstat (limited to 'examples')
-rw-r--r-- | examples/ToyPathTracer/Windows/TestWin.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/examples/ToyPathTracer/Windows/TestWin.cpp b/examples/ToyPathTracer/Windows/TestWin.cpp index 7acc8595..c6796b90 100644 --- a/examples/ToyPathTracer/Windows/TestWin.cpp +++ b/examples/ToyPathTracer/Windows/TestWin.cpp @@ -16,6 +16,7 @@ #include "CompiledPixelShader.h" #include "../../../Tracy.hpp" +#include "../../../TracyD3D11.hpp" static HINSTANCE g_HInstance; static HWND g_Wnd; @@ -44,6 +45,7 @@ static ID3D11UnorderedAccessView *g_BackbufferUAV, *g_BackbufferUAV2; static ID3D11SamplerState* g_SamplerLinear; static ID3D11RasterizerState* g_RasterState; static int g_BackbufferIndex; +static tracy::D3D11Ctx *g_tracyCtx; #if DO_COMPUTE_GPU @@ -215,6 +217,7 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE, _In_ LPWSTR, else { RenderFrame(); + TracyD3D11Collect(g_tracyCtx); if( --framesLeft == 0 ) break; } } @@ -271,6 +274,7 @@ static int s_FrameCount = 0; static void RenderFrame() { ZoneScoped; + TracyD3D11Zone(g_tracyCtx, "RenderFrame"); LARGE_INTEGER time1; @@ -541,6 +545,10 @@ static HRESULT InitD3DDevice() vp.TopLeftY = 0; g_D3D11Ctx->RSSetViewports(1, &vp); + g_tracyCtx = TracyD3D11Context(g_D3D11Device, g_D3D11Ctx); + const char* tracyD3D11CtxName = "D3D11"; + TracyD3D11ContextName(g_tracyCtx, tracyD3D11CtxName, (uint16_t)strlen(tracyD3D11CtxName)); + return S_OK; } @@ -548,6 +556,8 @@ static void ShutdownD3DDevice() { ZoneScoped; + if (g_tracyCtx) TracyD3D11Destroy(g_tracyCtx); + if (g_D3D11Ctx) g_D3D11Ctx->ClearState(); if (g_D3D11RenderTarget) g_D3D11RenderTarget->Release(); |