Skip to content

Commit

Permalink
Add NV aftermath integration for replay-time crash detection
Browse files Browse the repository at this point in the history
* As the aftermath headers can't be distributed currently this requires putting
  those headers in the right place. Then the resulting build can load the
  aftermath dll if it exists in the plugins folder.
  • Loading branch information
baldurk committed Nov 24, 2024
1 parent e2b05ec commit ca8ad9c
Show file tree
Hide file tree
Showing 11 changed files with 541 additions and 0 deletions.
4 changes: 4 additions & 0 deletions renderdoc/driver/d3d12/d3d12_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "driver/dxgi/dxgi_wrapped.h"
#include "driver/ihv/amd/amd_rgp.h"
#include "driver/ihv/amd/official/DXExt/AmdExtD3D.h"
#include "driver/ihv/nv/nv_aftermath.h"
#include "jpeg-compressor/jpge.h"
#include "maths/formatpacking.h"
#include "serialise/rdcfile.h"
Expand Down Expand Up @@ -3771,6 +3772,9 @@ void WrappedID3D12Device::CheckHRESULT(const char *file, int line, HRESULT hr)

SAFE_RELEASE(dred);
}

NVAftermath_DumpRTValidation(m_pDevice5);
NVAftermath_DumpCrash();
}
else if(hr == E_OUTOFMEMORY)
{
Expand Down
6 changes: 6 additions & 0 deletions renderdoc/driver/d3d12/d3d12_replay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "driver/dxgi/dxgi_common.h"
#include "driver/ihv/amd/amd_counters.h"
#include "driver/ihv/amd/amd_rgp.h"
#include "driver/ihv/nv/nv_aftermath.h"
#include "driver/ihv/nv/nv_d3d12_counters.h"
#include "driver/shaders/dxbc/dxbc_common.h"
#include "maths/camera.h"
Expand Down Expand Up @@ -4643,6 +4644,9 @@ RDResult D3D12_CreateReplayDevice(RDCFile *rdc, const ReplayOptions &opts, IRepl
INVAPID3DDevice *nvapiDev = NULL;
IAGSD3DDevice *agsDev = NULL;

if(!isProxy)
NVAftermath_Init();

if(initParams.VendorExtensions == GPUVendor::nVidia)
{
nvapiDev = InitialiseNVAPIReplay();
Expand Down Expand Up @@ -4777,6 +4781,8 @@ RDResult D3D12_CreateReplayDevice(RDCFile *rdc, const ReplayOptions &opts, IRepl
}
}

NVAftermath_EnableD3D12(dev);

WrappedID3D12Device *wrappedDev = new WrappedID3D12Device(dev, initParams, debugLayerEnabled);
wrappedDev->SetInitParams(initParams, ver, opts, nvapiDev, agsDev);

Expand Down
2 changes: 2 additions & 0 deletions renderdoc/driver/ihv/nv/NV.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,11 @@
<ClCompile Include="nv_d3d12_counters.cpp" />
<ClCompile Include="nv_gl_counters.cpp" />
<ClCompile Include="nv_vk_counters.cpp" />
<ClCompile Include="nv_aftermath.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="nvapi_wrapper.h" />
<ClInclude Include="nv_aftermath.h" />
<ClInclude Include="nv_counters.h" />
<ClInclude Include="nv_counter_enumerator.h" />
<ClInclude Include="nv_d3d11_counters.h" />
Expand Down
2 changes: 2 additions & 0 deletions renderdoc/driver/ihv/nv/NV.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<ClInclude Include="nv_d3d12_counters.h" />
<ClInclude Include="nv_gl_counters.h" />
<ClInclude Include="nv_vk_counters.h" />
<ClInclude Include="nv_aftermath.h" />
<ClInclude Include="official\PerfSDK\redist\include\linux-desktop-x64\nvperf_host_impl.h">
<Filter>official\PerfSDK</Filter>
</ClInclude>
Expand Down Expand Up @@ -165,5 +166,6 @@
<ClCompile Include="nv_d3d12_counters.cpp" />
<ClCompile Include="nv_gl_counters.cpp" />
<ClCompile Include="nv_vk_counters.cpp" />
<ClCompile Include="nv_aftermath.cpp" />
</ItemGroup>
</Project>
Loading

0 comments on commit ca8ad9c

Please sign in to comment.