| 314 | } |
| 315 | |
| 316 | void enableAftermath() |
| 317 | { |
| 318 | std::lock_guard<std::mutex> lock(sMutex); |
| 319 | |
| 320 | if (sInitialized) |
| 321 | return; |
| 322 | |
| 323 | // Enable GPU crash dumps and set up the callbacks for crash dump notifications, |
| 324 | // shader debug information notifications, and providing additional crash |
| 325 | // dump description data.Only the crash dump callback is mandatory. The other two |
| 326 | // callbacks are optional and can be omitted, by passing nullptr, if the corresponding |
| 327 | // functionality is not used. |
| 328 | // The DeferDebugInfoCallbacks flag enables caching of shader debug information data |
| 329 | // in memory. If the flag is set, ShaderDebugInfoCallback will be called only |
| 330 | // in the event of a crash, right before GpuCrashDumpCallback. If the flag is not set, |
| 331 | // ShaderDebugInfoCallback will be called for every shader that is compiled. |
| 332 | AFTERMATH_CHECK_ERROR(GFSDK_Aftermath_EnableGpuCrashDumps( |
| 333 | // API version |
| 334 | GFSDK_Aftermath_Version_API, |
| 335 | // Device flags |
| 336 | GFSDK_Aftermath_GpuCrashDumpWatchedApiFlags_DX | GFSDK_Aftermath_GpuCrashDumpWatchedApiFlags_Vulkan, |
| 337 | // Let the Nsight Aftermath library cache shader debug information |
| 338 | GFSDK_Aftermath_GpuCrashDumpFeatureFlags_DeferDebugInfoCallbacks, |
| 339 | // Callbacks |
| 340 | gpuCrashDumpCallback, |
| 341 | shaderDebugInfoCallback, |
| 342 | crashDumpDescriptionCallback, |
| 343 | // Do not resolve markers for now (they are embedded with string data) |
| 344 | nullptr /* resolveMarkerCallback */, |
| 345 | // User data |
| 346 | nullptr |
| 347 | )); |
| 348 | |
| 349 | sInitialized = true; |
| 350 | } |
| 351 | |
| 352 | void disableAftermath() |
| 353 | { |