From 1d8a4677abbd60756824c388eda5a835f8ad943b Mon Sep 17 00:00:00 2001 From: TheNumbat Date: Sun, 28 Jan 2024 13:49:20 -0500 Subject: [PATCH] add nv aftermath --- CMakeLists.txt | 2 +- deps/aftermath/GFSDK_Aftermath.h | 640 +++++++++ deps/aftermath/GFSDK_Aftermath_Defines.h | 272 ++++ deps/aftermath/GFSDK_Aftermath_GpuCrashDump.h | 481 +++++++ .../GFSDK_Aftermath_GpuCrashDumpDecoding.h | 1260 +++++++++++++++++ deps/aftermath/GFSDK_Aftermath_Lib.x64.lib | Bin 0 -> 15444 bytes deps/aftermath/LICENSE | 601 ++++++++ deps/imgui/CMakeLists.txt | 14 +- rvk/CMakeLists.txt | 10 +- rvk/fwd.h | 4 + rvk/instance.cpp | 71 + rvk/rvk.cpp | 2 +- 12 files changed, 3347 insertions(+), 10 deletions(-) create mode 100644 deps/aftermath/GFSDK_Aftermath.h create mode 100644 deps/aftermath/GFSDK_Aftermath_Defines.h create mode 100644 deps/aftermath/GFSDK_Aftermath_GpuCrashDump.h create mode 100644 deps/aftermath/GFSDK_Aftermath_GpuCrashDumpDecoding.h create mode 100644 deps/aftermath/GFSDK_Aftermath_Lib.x64.lib create mode 100644 deps/aftermath/LICENSE diff --git a/CMakeLists.txt b/CMakeLists.txt index a147700..302642a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.17) project(rvk LANGUAGES CXX) option(RVK_HAS_RPP "Use existing copy of rpp" OFF) -option(RVK_TEST "Build tests" OFF) +option(RVK_NV_AFTERMATH "Enable NV Aftermath crash dumper" OFF) if(NOT RVK_HAS_RPP) add_subdirectory("deps/rpp") diff --git a/deps/aftermath/GFSDK_Aftermath.h b/deps/aftermath/GFSDK_Aftermath.h new file mode 100644 index 0000000..1a354e4 --- /dev/null +++ b/deps/aftermath/GFSDK_Aftermath.h @@ -0,0 +1,640 @@ +/* +* Copyright (c) 2017-2023, NVIDIA CORPORATION. All rights reserved. +* +* NVIDIA CORPORATION and its licensors retain all intellectual property +* and proprietary rights in and to this software, related documentation +* and any modifications thereto. Any use, reproduction, disclosure or +* distribution of this software and related documentation without an express +* license agreement from NVIDIA CORPORATION is strictly prohibited. +*/ + +/* +* █████ █████ ██████ ████ ████ ███████ ████ ██████ ██ ██ +* ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ +* ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ +* ██████ ████ ██ ████ █████ ██ ██ ██ ██████ ██ ███████ +* ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ +* ██ ██ ██ ██ █████ ██ ██ ██ ██ ██ ██ ██ ██ ██ DEBUGGER +* ██ ██ +* ████████████████████████████████████████████████████████ ██ █ ██ ████████████ +* +* +* HOW TO USE AFTERMATH for DX11 and DX12 +* -------------------------------------- +* +* NOTE: Some of the Aftermath 1.x functionality will go away in a future release. +* The functions and structures to be removed are indicated with a DEPRECATED +* comment. The supported method for accessing this data is provided via the +* GPU crash dump functionality. Please refer to the +* 'GFSDK_Aftermath_GpuCrashDump.h' header file for more details. +* +* NOTE: Aftermath does not support UWP applications. +* +* Call 'GFSDK_Aftermath_DXxx_Initialize', to initialize the library and to enable +* the desired Aftermath feature set. See 'GFSDK_Aftermath_FeatureFlags' below for +* the list of supported features. +* This must be done before any other library calls are made, and the method must +* return 'GFSDK_Aftermath_Result_Success' for initialization to be complete. +* +* Initialization of Aftermath may fail for a variety of reasons, including: +* +* o) The initialization function was already called for the device: +* 'GFSDK_Aftermath_Result_FAIL_AlreadyInitialized'. +* +* +* o) Aftermath isn't supported on the GPU associated with the device or the NVIDIA +* display driver version installed: +* 'GFSDK_Aftermath_Result_FAIL_InvalidAdapter' +* 'GFSDK_Aftermath_Result_FAIL_DriverInitFailed', +* 'GFSDK_Aftermath_Result_FAIL_DriverVersionNotSupported', +* 'GFSDK_Aftermath_Result_FAIL_NvApiIncompatible'. +* +* +* o) A D3D API debug layer, such as PIX or other graphics debuggers, was detected +* that is incompatible with Aftermath: +* 'GFSDK_Aftermath_Result_FAIL_D3dDllInterceptionNotSupported' +* +* +* o) Aftermath was disabled on the system by the current user setting the +* 'HKEY_CURRENT_USER\Software\NVIDIA Corporation\Nsight Aftermath\ForceOff' +* Windows registry key: 'GFSDK_Aftermath_Result_FAIL_Disabled' +* +* +* After detecting D3D device lost (TDR): +* +* o) To query the fault reason after TDR, use the 'GFSDK_Aftermath_GetDeviceStatus' +* call. See 'GFSDK_Aftermath_Device_Status', for the full list of possible +* status. +* +* +* o) In the event of a GPU page fault, use the 'GFSDK_Aftermath_GetPageFaultInformation' +* method to return more information about what might of gone wrong. A GPU +* virtual address (VA) is returned, along with the resource descriptor of the +* resource that VA lands in. +* NOTE: It's not 100% certain that this is the resource is related to the fault, +* only that the faulting VA lands within this resource in memory. It is always +* possible that due to a bug or due to faulty dependency a random GPU VA is +* accessed by a shader. +* +* +* Optionally, instrument the application with Aftermath event markers: +* +* 1) For each DX12 command list or DX11 device context you expect to use with +* Aftermath, initialize them using the 'GFSDK_Aftermath_DXxx_CreateContextHandle' +* function. DX12 command lists must be in the recording state when this function +* is called, but the returned context handle will remain valid through subsequent +* command list closes and resets. +* +* +* 2) Call 'GFSDK_Aftermath_SetEventMarker' to inject an event marker directly into +* the command stream at that point. DX12 command lists must be in the recording +* state when this function is called. +* +* PERFORMANCE TIP: +* +* Do not use 'GFSDK_Aftermath_SetEventMarker' in high frequency code paths. +* Injecting event markers introduces considerable CPU overhead. For reduced +* CPU overhead, use 'GFSDK_Aftermath_SetEventMarker' with 'markerDataSize = 0'. +* This instructs Aftermath not to allocate and copy off memory internally, +* relying on the application to manage marker pointers itself. +* +* +* 3) Once TDR/hang occurs, call the 'GFSDK_Aftermath_GetData' API to fetch the +* event marker last processed by the GPU for each context. This API also +* supports fetching the current execution state for each the GPU. +* +* +* 4) Before the app shuts down, each Aftermath context handle must be cleaned +* up, this is done with the 'GFSDK_Aftermath_ReleaseContextHandle' call. +* +* +* +* HOW TO USE AFTERMATH for Vulkan +* ------------------------------- +* +* For Vulkan use the 'VK_NV_device_diagnostics_config' extension to initialize and +* configure the Aftermath feature set to use. The meaning of the flag bits +* defined by 'VkDeviceDiagnosticsConfigFlagBitsNV' correspond to the features +* defined by 'GFSDK_Aftermath_FeatureFlags' for DX11/DX12 below. +* +* Use the 'VK_NV_device_diagnostic_checkpoints' extension to add event markers into +* the command stream. +* +*/ + +#ifndef GFSDK_Aftermath_H +#define GFSDK_Aftermath_H + +#include "GFSDK_Aftermath_Defines.h" + +#pragma pack(push, 8) + +#ifdef __cplusplus +extern "C" { +#endif + +///////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_FeatureFlags +// --------------------------------- +// +// Feature flags that can be used to enabled various features when initializing DX +// Aftermath via the 'GFSDK_Aftermath_DX11_Initialize' and +// 'GFSDK_Aftermath_DX12_Initialize' functions. +// +// For Vulkan, the same set of features can be controlled through the +// 'VkDeviceDiagnosticsConfigFlagBitsNV' defined by the +// 'VK_NV_device_diagnostics_config' extension. See also the description of the +// configuration flag bits in the 'Readme.md' file. +// +///////////////////////////////////////////////////////////////////////// +GFSDK_AFTERMATH_DECLARE_ENUM(FeatureFlags) +{ + // The minimal flag only allows use of the 'GFSDK_Aftermath_GetDeviceStatus' + // entry point and GPU crash dump generation with basic information about the + // GPU fault. + GFSDK_Aftermath_FeatureFlags_Minimum = 0x00000000, + + // This flag enables support for DX Aftermath event markers, including both + // the support for user markers that are explicitly added by the application + // via 'GFSDK_Aftermath_SetEventMarker' and automatic call stack markers + // controlled by 'GFSDK_Aftermath_FeatureFlags_CallStackCapturing'. + // + // For Vulkan, the event marker (checkpoints) feature is enabled through the + // 'VK_NV_device_diagnostic_checkpoints' extension. + // + // NOTE: Using event markers should be considered carefully as they can cause + // very high CPU overhead when used in high frequency code paths. Due to the + // inherent overhead, event markers should be used only for debugging purposes on + // development or QA systems. Therefore, on some driver versions, Aftermath + // event marker tracking on DX11 and DX12 is only available if the Nsight + // Aftermath GPU Crash Dump Monitor is running on the system. This requirement + // applies to R495 to R530 drivers for DX12 and R495+ drivers for DX11. No Aftermath + // configuration needs to be made in the Monitor. It serves only as a dongle to + // ensure Aftermath event markers do not impact application performance on end + // user systems. That means this flag will be ignored if the monitor process is + // not detected. + GFSDK_Aftermath_FeatureFlags_EnableMarkers = 0x00000001, + + // With this flag set, live and recently destroyed resources are tracked by the + // display driver. In case of a page fault that information will be used to + // identify possible candidates of deleted resources that correspond to the fault + // address. Information about the most likely resource related to the fault will + // be included in the page fault data, including, for example, information about + // the size of the resource, its format, and the epoch time stamp when it was + // deleted. + // + // The corresponding feature configuration flag for Vulkan is + // 'VK_DEVICE_DIAGNOSTICS_CONFIG_ENABLE_RESOURCE_TRACKING_BIT_NV'. + // + // NOTE: Enabling this feature will incur memory overhead due to the additional + // tracking data managed by the display driver as well as CPU overhead for each + // resource creation and destruction. + GFSDK_Aftermath_FeatureFlags_EnableResourceTracking = 0x00000002, + + // With this flag set, event markers are automatically set for all draw calls, + // compute dispatches and copy operations to capture the CPU call stack for the + // corresponding API call as the event marker payload. + // + // The corresponding feature configuration flag for Vulkan is + // 'VK_DEVICE_DIAGNOSTICS_CONFIG_ENABLE_AUTOMATIC_CHECKPOINTS_BIT_NV'. + // + // NOTE: Requires also 'GFSDK_Aftermath_FeatureFlags_EnableMarkers' to be set. + // + // NOTE: Enabling this feature will cause very high CPU overhead during command + // list recording. Due to the inherent overhead, call stack capturing should only + // be used for debugging purposes on development or QA systems and should not be + // enabled in applications shipped to customers. Therefore, on R495+ drivers, + // call stack capturing on DX11 and DX12 is only available if the Nsight Aftermath + // GPU Crash Dump Monitor is running on the system. No Aftermath configuration + // needs to be made in the Monitor. It serves only as a dongle to ensure call + // stack capturing does not impact application performance on end user systems. + // That means this flag will be ignored if the monitor process is not detected. + // + // NOTE: When enabling this feature, Aftermath GPU crash dumps will include file + // paths to the crashing application's executable as well as all DLLs it has loaded. + GFSDK_Aftermath_FeatureFlags_CallStackCapturing = 0x40000000, + + // With this flag set, debug information (line tables for mapping from the shader + // IL passed to the driver to the shader microcode) for all shaders is generated + // by the display driver. + // + // The corresponding feature configuration flag for Vulkan is + // 'VK_DEVICE_DIAGNOSTICS_CONFIG_ENABLE_SHADER_DEBUG_INFO_BIT_NV'. + // + // NOTE: Using this feature should be considered carefully. It may cause + // considerable shader compilation overhead and additional overhead for handling + // the corresponding shader debug information callbacks (if provided to + // 'GFSDK_Aftermath_EnableGpuCrashDumps'). + // + // NOTE: shader debug information is only supported for DX12 applications using + // shaders compiled as DXIL. This flag has no effect on DX11 applications. + GFSDK_Aftermath_FeatureFlags_GenerateShaderDebugInfo = 0x00000008, + + // If this flag is set, the GPU will run in a mode that allows to capture runtime + // errors in shaders that are not caught with default driver settings. This may + // provide additional information for debugging GPU hangs, GPU crashes or other + // unexpected behavior related to shader execution. + // + // The corresponding feature configuration flag for Vulkan is + // 'VK_DEVICE_DIAGNOSTICS_CONFIG_ENABLE_SHADER_ERROR_REPORTING_BIT_NV'. + // + // NOTE: Enabling this feature does not cause any performance overhead, but it + // may result in additional crash dumps being generated to report issues in + // shaders that exhibit undefined behavior or have hidden bugs, which so far went + // unnoticed, because with default driver settings the HW silently ignores them. + // + // NOTE: This feature is only supported on R515 or later drivers. The feature + // flag will be ignored on earlier driver versions. + // + // Examples for problems that are caught when this feature is enabled: + // + // o) Accessing memory using misaligned addresses, such as reading or + // writing a byte address that is not a multiple of the access size. + // + // o) Accessing memory out-of-bounds, such as reading or writing beyond the + // declared bounds of (group) shared or thread local memory or reading from an + // out-of-bounds constant buffer address. + // + // o) Hitting call stack limits. + GFSDK_Aftermath_FeatureFlags_EnableShaderErrorReporting = 0x00000010, +}; + +#if defined(__d3d11_h__) || defined(__d3d12_h__) + +///////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_ContextHandle +// --------------------------------- +// +// Used with Aftermath entry points to reference an API object. +// +///////////////////////////////////////////////////////////////////////// +GFSDK_AFTERMATH_DECLARE_HANDLE(GFSDK_Aftermath_ContextHandle); + +///////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_ResourceHandle +// --------------------------------- +// +// Used with the 'GFSDK_Aftermath_DX12_RegisterResource' and +// 'GFSDK_Aftermath_DX12_UnregisterResource' entry points to reference an API +// resource object. +// +///////////////////////////////////////////////////////////////////////// +GFSDK_AFTERMATH_DECLARE_HANDLE(GFSDK_Aftermath_ResourceHandle); + +///////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_ContextData +// --------------------------------- +// +// DEPRECATED - this functionality will go away in a future release. Do not use! +// +// Used with, 'GFSDK_Aftermath_GetData'. Filled with information, about each +// requested context. +// +///////////////////////////////////////////////////////////////////////// +typedef struct GFSDK_Aftermath_ContextData +{ + GFSDK_AFTERMATH_DECLARE_POINTER_MEMBER(void*, markerData); + uint32_t markerSize; + GFSDK_Aftermath_Context_Status status; +} GFSDK_Aftermath_ContextData; + +///////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_ResourceDescriptor +// --------------------------------- +// +// DEPRECATED - this functionality will go away in a future release. Do not use! +// +// Minimal description of a graphics resource. +// +///////////////////////////////////////////////////////////////////////// +typedef struct GFSDK_Aftermath_ResourceDescriptor +{ + // This is available in DX12 only and only if the application registers the + // resource pointers using 'GFSDK_Aftermath_DX12_RegisterResource'. +#ifdef __d3d12_h__ + GFSDK_AFTERMATH_DECLARE_POINTER_MEMBER(ID3D12Resource*, pAppResource); +#else + GFSDK_AFTERMATH_DECLARE_POINTER_MEMBER(void*, pAppResource); +#endif + + uint64_t size; + + uint32_t width; + uint32_t height; + uint32_t depth; + + uint32_t mipLevels; + + uint32_t format; // DXGI_FORMAT + + GFSDK_AFTERMATH_DECLARE_BOOLEAN_MEMBER(bIsBufferHeap); + GFSDK_AFTERMATH_DECLARE_BOOLEAN_MEMBER(bIsStaticTextureHeap); + GFSDK_AFTERMATH_DECLARE_BOOLEAN_MEMBER(bIsRtvDsvTextureHeap); + GFSDK_AFTERMATH_DECLARE_BOOLEAN_MEMBER(bPlacedResource); + + GFSDK_AFTERMATH_DECLARE_BOOLEAN_MEMBER(bWasDestroyed); +} GFSDK_Aftermath_ResourceDescriptor; + +///////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_PageFaultInformation +// --------------------------------- +// +// DEPRECATED - this functionality will go away in a future release. Do not use! +// +// Used with GFSDK_Aftermath_GetPageFaultInformation +// +///////////////////////////////////////////////////////////////////////// +typedef struct GFSDK_Aftermath_PageFaultInformation +{ + uint64_t faultingGpuVA; + GFSDK_Aftermath_ResourceDescriptor resourceDesc; + GFSDK_AFTERMATH_DECLARE_BOOLEAN_MEMBER(bHasPageFaultOccured); +} GFSDK_Aftermath_PageFaultInformation; + +///////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_DX11_Initialize +// GFSDK_Aftermath_DX12_Initialize +// --------------------------------- +// +// [pDx11Device]; DX11-Only +// The current dx11 device pointer. +// +// [pDx12Device]; DX12-Only +// The current dx12 device pointer. +// +// flags; +// The set of features to enable when initializing Aftermath. +// +// version; +// Must be set to 'GFSDK_Aftermath_Version_API'. Used for checking against library +// version. +// +//// DESCRIPTION; +// Library must be initialized before any other call is made. This should be +// done after device creation. Aftermath currently only supports one D3D +// device, the first one that is initialized. +// +///////////////////////////////////////////////////////////////////////// +#ifdef __d3d11_h__ +GFSDK_Aftermath_API GFSDK_Aftermath_DX11_Initialize(GFSDK_Aftermath_Version version, uint32_t flags, ID3D11Device* const pDx11Device); +#endif +#ifdef __d3d12_h__ +GFSDK_Aftermath_API GFSDK_Aftermath_DX12_Initialize(GFSDK_Aftermath_Version version, uint32_t flags, ID3D12Device* const pDx12Device); +#endif + +///////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_DX11_CreateContextHandle +// GFSDK_Aftermath_DX12_CreateContextHandle +// --------------------------------- +// +// (pDx11DeviceContext); DX11-Only +// Device context to use with Aftermath. +// +// (pDx12Unknown); DX12-Only +// Command list, Command Queue, or Device to use with Aftermath. If a device, +// must be the same device given to 'GFSDK_Aftermath_DX12_Initialize'. If a +// command list, it must be in the recording state. +// +// pOutContextHandle; +// The context handle for the specified context/command list/command +// queue/device to be used with future Aftermath calls. +// +//// DESCRIPTION; +// Before Aftermath event markers can be inserted into the command stream of a +// DX12 command list or a DX11 device context, a context handle must first be +// fetched. A context handle is also required for querying the event marker +// status with 'GFSDK_Aftermath_GetData'. +// +///////////////////////////////////////////////////////////////////////// +#ifdef __d3d11_h__ +GFSDK_Aftermath_API GFSDK_Aftermath_DX11_CreateContextHandle(ID3D11DeviceContext* const pDx11DeviceContext, GFSDK_Aftermath_ContextHandle* pOutContextHandle); +#endif +#ifdef __d3d12_h__ +GFSDK_Aftermath_API GFSDK_Aftermath_DX12_CreateContextHandle(IUnknown* const pDx12Unknown, GFSDK_Aftermath_ContextHandle* pOutContextHandle); +#endif + +///////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_API GFSDK_Aftermath_ReleaseContextHandle +// ------------------------------------- +// +// contextHandle; +// Context to release +// +// DESCRIPTION; +// Cleans up any resources associated with an Aftermath context. +// +///////////////////////////////////////////////////////////////////////// +GFSDK_Aftermath_API GFSDK_Aftermath_ReleaseContextHandle(const GFSDK_Aftermath_ContextHandle contextHandle); + +///////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_SetEventMarker +// ------------------------------------- +// +// contextHandle; +// Command list currently being populated, which must be in the recording state. +// +// markerData; +// Pointer to data used for event marker. +// +// NOTE: If 'markerDataSize' is also provided, an internal copy will be made of this +// data. In that case there is no need to keep it around after this call - stack +// allocation of the data is safe. +// +// markerDataSize; +// Size of event marker data in bytes. +// +// NOTE: Passing a 0 for this parameter is valid, and will instruct Aftermath to +// only copy off the pointer supplied by 'markerData', rather than internally +// making a copy. In this case, additional work is required to include the +// marker data into Aftermath crash dumps. The application needs to keep track +// of the 'markerData' pointer and resolve it to the actual marker data via the +// 'resolveMarkerCb' provided to 'GFSDK_Aftermath_EnableGpuCrashDumps'. +// +// NOTE: Aftermath will internally truncate marker data to a maximum size of +// 1024 bytes. Use 'markerDataSize = 0' and manually manage memory for markers if +// the application requires larger ones. +// +// DESCRIPTION; +// Drops an event into the command stream with a payload that can be linked back +// to the data given here, 'markerData'. It's safe to call from multiple threads +// simultaneously, normal D3D API threading restrictions apply. +// +// NOTE: Using event markers should be considered carefully as they can cause +// considerable CPU overhead when used in high frequency code paths. +// +///////////////////////////////////////////////////////////////////////// +GFSDK_Aftermath_API GFSDK_Aftermath_SetEventMarker(const GFSDK_Aftermath_ContextHandle contextHandle, const void* pMarkerData, const uint32_t markerDataSize); + +///////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_GetData +// ------------------------------ +// +// DEPRECATED - this functionality will go away in a future release. Do not use! +// +// numContexts; +// Number of contexts to fetch information for. +// +// pContextHandles; +// Array of contexts containing Aftermath event markers. +// +// pOutContextData; +// OUTPUT: context data for each context requested. Contains event last reached +// on the GPU, and status of context if applicable (DX12-Only). +// +// NOTE: must allocate enough space for 'numContexts' worth of structures. +// Stack allocation is fine. +// +// DESCRIPTION; +// Once a TDR/crash/hang has occurred (or whenever you like), call this API to +// retrieve the events last processed by the GPU on the given contexts. The +// context handles may refer to DX12 command lists, queues, or DX11 device +// contexts. +// +///////////////////////////////////////////////////////////////////////// +GFSDK_Aftermath_API GFSDK_Aftermath_GetData(const uint32_t numContexts, const GFSDK_Aftermath_ContextHandle* pContextHandles, GFSDK_Aftermath_ContextData* pOutContextData); + +///////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_GetContextError +// ------------------------------ +// +// DEPRECATED - this functionality will go away in a future release. Do not use! +// +// pContextData; +// Context data for which to determine error status. +// +// DESCRIPTION; +// Call this to determine the detailed failure reason for +// GFSDK_Aftermath_ContextData with 'status == GFSDK_Aftermath_Context_Status_Invalid'. +// +///////////////////////////////////////////////////////////////////////// +GFSDK_Aftermath_API GFSDK_Aftermath_GetContextError(const GFSDK_Aftermath_ContextData* pContextData); + +///////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_GetDeviceStatus +// --------------------------------- +// +// pOutStatus; +// OUTPUT: Device status. +// +//// DESCRIPTION; +// Return the status of a D3D device. See 'GFSDK_Aftermath_Device_Status'. +// +///////////////////////////////////////////////////////////////////////// +GFSDK_Aftermath_API GFSDK_Aftermath_GetDeviceStatus(GFSDK_Aftermath_Device_Status* pOutStatus); + +///////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_GetPageFaultInformation +// --------------------------------- +// +// DEPRECATED - this functionality will go away in a future release. Do not use! +// +// pOutPageFaultInformation; +// OUTPUT: Information about a page fault which may have occurred. +// +//// DESCRIPTION; +// Return any information available about a recent page fault which may have +// occurred, causing a device removed scenario. See +// 'GFSDK_Aftermath_PageFaultInformation'. +// +// Requires WDDMv2 (Windows 10) or later +// +///////////////////////////////////////////////////////////////////////// +GFSDK_Aftermath_API GFSDK_Aftermath_GetPageFaultInformation(GFSDK_Aftermath_PageFaultInformation* pOutPageFaultInformation); + +///////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_DX12_RegisterResource +// --------------------------------- +// +// pResource; +// ID3D12Resource to register. +// +// pOutResourceHandle; +// OUTPUT: Aftermath resource handle for the resource that was registered. +// +//// DESCRIPTION; +// Registers an 'ID3D12Resource' with Aftermath. This allows Aftermath to map +// the GPU virtual address of a page fault to the corresponding 'ID3D12Resource' +// pointer and the driver level resource tracking data (enabled via +// 'GFSDK_Aftermath_FeatureFlags_EnableResourceTracking'). If called after +// 'ID3D12Object::SetName', it will also allow tracking of the debug object name +// assigned to the resource (requires R530 driver). +// +// NOTE: This function is only supported on Windows 10 RS4 and later. It will +// return 'GFSDK_Aftermath_Result_FAIL_D3dDllNotSupported', if the version of the +// D3D DLL loaded by the application is not supported. +// +// NOTE: This function is not compatible with graphics debuggers, such as Nsight +// Graphics, PIX, or the Visual Studio Graphics Debugger. It may fail with +// 'GFSDK_Aftermath_Result_FAIL_D3dDllInterceptionNotSupported' when called, if +// such a debugger is active. +// +// NOTE: This is a BETA FEATURE and may not work with all versions of Windows. +// +///////////////////////////////////////////////////////////////////////// +#if defined(__d3d12_h__) +GFSDK_Aftermath_API GFSDK_Aftermath_DX12_RegisterResource(ID3D12Resource* const pResource, GFSDK_Aftermath_ResourceHandle* pOutResourceHandle); +#endif + +///////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_DX12_UnregisterResource +// --------------------------------- +// +// resourceHandle; +// Aftermath resource handle for a resource that was registered earlier with +// 'GFSDK_Aftermath_DX12_RegisterResource'. +// +//// DESCRIPTION; +// Unregisters a previously registered resource. This will tell Aftermath +// that the resource tracking data that was allocated for this resource +// may be reused in LRU order for new resources being registered via +// 'GFSDK_Aftermath_DX12_RegisterResource'. Aftermath will guarantee a +// look-back of the least recently unregistered 1024 resources before +// reusing the corresponding tracking data. +// +// NOTE: This is a BETA FEATURE and may not work with all versions of Windows. +// +///////////////////////////////////////////////////////////////////////// +#if defined(__d3d12_h__) +GFSDK_Aftermath_API GFSDK_Aftermath_DX12_UnregisterResource(const GFSDK_Aftermath_ResourceHandle resourceHandle); +#endif + +///////////////////////////////////////////////////////////////////////// +// +// Function pointer definitions - if dynamic loading is preferred. +// +///////////////////////////////////////////////////////////////////////// +#if defined(__d3d11_h__) +GFSDK_Aftermath_PFN(GFSDK_AFTERMATH_CALL *PFN_GFSDK_Aftermath_DX11_Initialize)(GFSDK_Aftermath_Version version, uint32_t flags, ID3D11Device* const pDx11Device); +GFSDK_Aftermath_PFN(GFSDK_AFTERMATH_CALL *PFN_GFSDK_Aftermath_DX11_CreateContextHandle)(ID3D11DeviceContext* const pDx11DeviceContext, GFSDK_Aftermath_ContextHandle* pOutContextHandle); +#endif + +#if defined(__d3d12_h__) +GFSDK_Aftermath_PFN(GFSDK_AFTERMATH_CALL *PFN_GFSDK_Aftermath_DX12_Initialize)(GFSDK_Aftermath_Version version, uint32_t flags, ID3D12Device* const pDx12Device); +GFSDK_Aftermath_PFN(GFSDK_AFTERMATH_CALL *PFN_GFSDK_Aftermath_DX12_CreateContextHandle)(IUnknown* const pDx12CommandList, GFSDK_Aftermath_ContextHandle* pOutContextHandle); +GFSDK_Aftermath_PFN(GFSDK_AFTERMATH_CALL *PFN_GFSDK_Aftermath_DX12_RegisterResource)(ID3D12Resource* const pResource, GFSDK_Aftermath_ResourceHandle* pOutResourceHandle); +GFSDK_Aftermath_PFN(GFSDK_AFTERMATH_CALL *PFN_GFSDK_Aftermath_DX12_UnregisterResource)(const GFSDK_Aftermath_ResourceHandle resourceHandle); +#endif + +#if defined(__d3d11_h__) || defined(__d3d12_h__) +GFSDK_Aftermath_PFN(GFSDK_AFTERMATH_CALL *PFN_GFSDK_Aftermath_ReleaseContextHandle)(const GFSDK_Aftermath_ContextHandle contextHandle); +GFSDK_Aftermath_PFN(GFSDK_AFTERMATH_CALL *PFN_GFSDK_Aftermath_SetEventMarker)(const GFSDK_Aftermath_ContextHandle contextHandle, const void* markerData, const uint32_t markerDataSize); +GFSDK_Aftermath_PFN(GFSDK_AFTERMATH_CALL *PFN_GFSDK_Aftermath_GetData)(const uint32_t numContexts, const GFSDK_Aftermath_ContextHandle* ppContextHandles, GFSDK_Aftermath_ContextData* pOutContextData); +GFSDK_Aftermath_PFN(GFSDK_AFTERMATH_CALL *PFN_GFSDK_Aftermath_GetContextError)(const GFSDK_Aftermath_ContextData* pContextData); +GFSDK_Aftermath_PFN(GFSDK_AFTERMATH_CALL *PFN_GFSDK_Aftermath_GetDeviceStatus)(GFSDK_Aftermath_Device_Status* pOutStatus); +GFSDK_Aftermath_PFN(GFSDK_AFTERMATH_CALL *PFN_GFSDK_Aftermath_GetPageFaultInformation)(GFSDK_Aftermath_PageFaultInformation* pOutPageFaultInformation); +#endif + +#endif // defined(__d3d11_h__) || defined(__d3d12_h__) + +#if defined(VULKAN_H_) +// See VK_NV_device_diagnostics_config +// See VK_NV_device_diagnostic_checkpoints +#endif + +#ifdef __cplusplus +} // extern "C" +#endif + +#pragma pack(pop) + +#endif // GFSDK_Aftermath_H diff --git a/deps/aftermath/GFSDK_Aftermath_Defines.h b/deps/aftermath/GFSDK_Aftermath_Defines.h new file mode 100644 index 0000000..a577d03 --- /dev/null +++ b/deps/aftermath/GFSDK_Aftermath_Defines.h @@ -0,0 +1,272 @@ +/* +* Copyright (c) 2016-2023, NVIDIA CORPORATION. All rights reserved. +* +* NVIDIA CORPORATION and its licensors retain all intellectual property +* and proprietary rights in and to this software, related documentation +* and any modifications thereto. Any use, reproduction, disclosure or +* distribution of this software and related documentation without an express +* license agreement from NVIDIA CORPORATION is strictly prohibited. +*/ + +/* +* █████ █████ ██████ ████ ████ ███████ ████ ██████ ██ ██ +* ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ +* ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ +* ██████ ████ ██ ████ █████ ██ ██ ██ ██████ ██ ███████ +* ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ +* ██ ██ ██ ██ █████ ██ ██ ██ ██ ██ ██ ██ ██ ██ DEBUGGER +* ██ ██ +* ████████████████████████████████████████████████████████ ██ █ ██ ████████████ +*/ + +#ifndef GFSDK_Aftermath_Defines_H +#define GFSDK_Aftermath_Defines_H + +#if defined(_MSC_VER) +#if defined(_M_X86) +#define GFSDK_AFTERMATH_CALL __cdecl +#else +#define GFSDK_AFTERMATH_CALL +#endif +#elif defined(__clang__) || defined(__GNUC__) +#if defined(__i386__) +#define GFSDK_AFTERMATH_CALL __attribute__((cdecl)) +#else +#define GFSDK_AFTERMATH_CALL +#endif +#else +#error "Unsupported compiler" +#endif + +#ifdef __cplusplus +#include +#else +#include +#include +#endif + +// Library stuff... +#define GFSDK_Aftermath_PFN typedef GFSDK_Aftermath_Result + +#if defined(_MSC_VER) +#ifdef EXPORTS +#define GFSDK_Aftermath_DLLSPEC __declspec(dllexport) +#else +#define GFSDK_Aftermath_DLLSPEC +#endif +#elif defined(__clang__) || defined(__GNUC__) +#define GFSDK_Aftermath_DLLSPEC __attribute__((visibility("default"))) +#endif + +#ifdef __cplusplus +#define GFSDK_Aftermath_API extern "C" GFSDK_Aftermath_DLLSPEC GFSDK_Aftermath_Result GFSDK_AFTERMATH_CALL +#else +#define GFSDK_Aftermath_API GFSDK_Aftermath_DLLSPEC GFSDK_Aftermath_Result GFSDK_AFTERMATH_CALL +#endif + +#pragma pack(push, 8) + +///////////////////////////////////////////////////////////////////////// +// +// Helper macros for declaring struct members and types with guaranteed properties. +// +///////////////////////////////////////////////////////////////////////// +#define GFSDK_AFTERMATH_DECLARE_HANDLE(name) struct name##__ { int32_t ID; }; typedef struct name##__ *name +#ifdef __cplusplus +#define GFSDK_AFTERMATH_DECLARE_ENUM(name) enum GFSDK_Aftermath_##name : uint32_t +#else +#define GFSDK_AFTERMATH_DECLARE_ENUM(name) typedef uint32_t GFSDK_Aftermath_##name; enum GFSDK_Aftermath_##name +#endif +#define GFSDK_AFTERMATH_DECLARE_POINTER_MEMBER(type, name) union { type name; uint64_t ptr_align_##name; } +#define GFSDK_AFTERMATH_DECLARE_BOOLEAN_MEMBER(name) union { bool name; uint32_t bool_align_##name; } + +///////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_Version +// --------------------------------- +// +// Aftermath API version +// +// NOTE: The Aftermath SDK does not guarantee compatibility between different +// API versions. Therefore, the API version of the header files used for +// building the application needs to match the API version of the Aftermath +// library loaded by the application. +// +///////////////////////////////////////////////////////////////////////// +GFSDK_AFTERMATH_DECLARE_ENUM(Version) +{ + GFSDK_Aftermath_Version_API = 0x0000215 // Version 2.21 +}; + +///////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_Result +// --------------------------------- +// +// Result codes returned by Aftermath API functions +// +///////////////////////////////////////////////////////////////////////// +GFSDK_AFTERMATH_DECLARE_ENUM(Result) +{ + // The call was successful. + GFSDK_Aftermath_Result_Success = 0x1, + + // The requested functionality is not available. + GFSDK_Aftermath_Result_NotAvailable = 0x2, + + // The call failed with an unspecified failure. + GFSDK_Aftermath_Result_Fail = 0xBAD00000, + + // The callee tries to use a library version which does not match the built + // binary. + GFSDK_Aftermath_Result_FAIL_VersionMismatch = GFSDK_Aftermath_Result_Fail | 1, + + // The library hasn't been initialized, see 'GFSDK_Aftermath_DX*_Initialize'. + GFSDK_Aftermath_Result_FAIL_NotInitialized = GFSDK_Aftermath_Result_Fail | 2, + + // The callee tries to use the library with a non-supported GPU. Only NVIDIA GPUs + // are supported. + GFSDK_Aftermath_Result_FAIL_InvalidAdapter = GFSDK_Aftermath_Result_Fail | 3, + + // The callee passed an invalid parameter to the library, likely a null pointer + // or a bad handle. + GFSDK_Aftermath_Result_FAIL_InvalidParameter = GFSDK_Aftermath_Result_Fail | 4, + + // Something weird happened that caused the library to fail for an unknown + // reason. + GFSDK_Aftermath_Result_FAIL_Unknown = GFSDK_Aftermath_Result_Fail | 5, + + // Got a failure from the graphics API. + GFSDK_Aftermath_Result_FAIL_ApiError = GFSDK_Aftermath_Result_Fail | 6, + + // Make sure that the NvAPI DLL is up to date. + GFSDK_Aftermath_Result_FAIL_NvApiIncompatible = GFSDK_Aftermath_Result_Fail | 7, + + // It would appear as though a call has been made to fetch the Aftermath data for + // a context that hasn't yet been used with the event marker API. + GFSDK_Aftermath_Result_FAIL_GettingContextDataWithNewCommandList = GFSDK_Aftermath_Result_Fail | 8, + + // Looks like the library has already been initialized. + GFSDK_Aftermath_Result_FAIL_AlreadyInitialized = GFSDK_Aftermath_Result_Fail | 9, + + // A debug layer not compatible with Aftermath has been detected. + GFSDK_Aftermath_Result_FAIL_D3DDebugLayerNotCompatible = GFSDK_Aftermath_Result_Fail | 10, + + // Aftermath failed to initialize in the graphics driver. + GFSDK_Aftermath_Result_FAIL_DriverInitFailed = GFSDK_Aftermath_Result_Fail | 11, + + // Aftermath v2.x requires NVIDIA graphics driver version 387.xx or beyond. + GFSDK_Aftermath_Result_FAIL_DriverVersionNotSupported = GFSDK_Aftermath_Result_Fail | 12, + + // The system ran out of memory for allocations. + GFSDK_Aftermath_Result_FAIL_OutOfMemory = GFSDK_Aftermath_Result_Fail | 13, + + // No need to get data on bundles, as markers execute on the command list. + GFSDK_Aftermath_Result_FAIL_GetDataOnBundle = GFSDK_Aftermath_Result_Fail | 14, + + // No need to get data on deferred contexts, as markers execute on the immediate + // context. + GFSDK_Aftermath_Result_FAIL_GetDataOnDeferredContext = GFSDK_Aftermath_Result_Fail | 15, + + // This feature hasn't been enabled at initialization - see 'GFSDK_Aftermath_FeatureFlags'. + GFSDK_Aftermath_Result_FAIL_FeatureNotEnabled = GFSDK_Aftermath_Result_Fail | 16, + + // No resources have ever been registered. + GFSDK_Aftermath_Result_FAIL_NoResourcesRegistered = GFSDK_Aftermath_Result_Fail | 17, + + // This resource has never been registered. + GFSDK_Aftermath_Result_FAIL_ThisResourceNeverRegistered = GFSDK_Aftermath_Result_Fail | 18, + + // The functionality is not supported for UWP applications. + GFSDK_Aftermath_Result_FAIL_NotSupportedInUWP = GFSDK_Aftermath_Result_Fail | 19, + + // The version of the D3D DLL is not compatible with Aftermath. + GFSDK_Aftermath_Result_FAIL_D3dDllNotSupported = GFSDK_Aftermath_Result_Fail | 20, + + // D3D DLL interception is not compatible with Aftermath. + GFSDK_Aftermath_Result_FAIL_D3dDllInterceptionNotSupported = GFSDK_Aftermath_Result_Fail | 21, + + // Aftermath is disabled on the system by the current user. + // On Windows, this is controlled by a Windows registry key: + // KeyPath : HKEY_CURRENT_USER\Software\NVIDIA Corporation\Nsight Aftermath + // KeyValue : ForceOff + // ValueType : REG_DWORD + // ValueData : Any value != 0 will force the functionality of the Aftermath + // SDK off on the system. + // + // On Linux, this is controlled by an environment variable: + // Name : NV_AFTERMATH_FORCE_OFF + // Value : Any value != "0" will force the functionality of the Aftermath SDK + // off. + GFSDK_Aftermath_Result_FAIL_Disabled = GFSDK_Aftermath_Result_Fail | 22, + + // Markers cannot be set on queue or device contexts. + GFSDK_Aftermath_Result_FAIL_NotSupportedOnContext = GFSDK_Aftermath_Result_Fail | 23, +}; + +///////////////////////////////////////////////////////////////////////// +// +// Macro for simplified checking of API call result code. +// +///////////////////////////////////////////////////////////////////////// +#define GFSDK_Aftermath_SUCCEED(value) (((value) & 0xFFF00000) != GFSDK_Aftermath_Result_Fail) + +///////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_Context_Status +// --------------------------------- +// +// Status of an Aftermath context. +// +///////////////////////////////////////////////////////////////////////// +GFSDK_AFTERMATH_DECLARE_ENUM(Context_Status) +{ + // The GPU has not started processing this command list yet. + GFSDK_Aftermath_Context_Status_NotStarted = 0, + + // This command list has begun execution on the GPU. + GFSDK_Aftermath_Context_Status_Executing, + + // This command list has finished execution on the GPU. + GFSDK_Aftermath_Context_Status_Finished, + + // This context has an invalid state, which could be caused by an error. + GFSDK_Aftermath_Context_Status_Invalid, +}; + +///////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_Device_Status +// --------------------------------- +// +// Status of a D3D device. +// +///////////////////////////////////////////////////////////////////////// +GFSDK_AFTERMATH_DECLARE_ENUM(Device_Status) +{ + // The device is still active and hasn't gone down. + GFSDK_Aftermath_Device_Status_Active = 0, + + // A long running shader/operation has caused a GPU timeout. Reconfiguring the + // timeout length might help tease out the problem. + GFSDK_Aftermath_Device_Status_Timeout, + + // Run out of memory to complete operations. + GFSDK_Aftermath_Device_Status_OutOfMemory, + + // An invalid VA access has caused a fault. + GFSDK_Aftermath_Device_Status_PageFault, + + // The GPU has stopped executing. + GFSDK_Aftermath_Device_Status_Stopped, + + // The device has been reset. + GFSDK_Aftermath_Device_Status_Reset, + + // Unknown problem - likely using an older driver incompatible with this + // Aftermath feature. + GFSDK_Aftermath_Device_Status_Unknown, + + // An invalid rendering call has percolated through the driver. + GFSDK_Aftermath_Device_Status_DmaFault, +}; + +#pragma pack(pop) + +#endif // GFSDK_Aftermath_Defines_H diff --git a/deps/aftermath/GFSDK_Aftermath_GpuCrashDump.h b/deps/aftermath/GFSDK_Aftermath_GpuCrashDump.h new file mode 100644 index 0000000..ab6bd2e --- /dev/null +++ b/deps/aftermath/GFSDK_Aftermath_GpuCrashDump.h @@ -0,0 +1,481 @@ +/* +* Copyright (c) 2019-2023, NVIDIA CORPORATION. All rights reserved. +* +* NVIDIA CORPORATION and its licensors retain all intellectual property +* and proprietary rights in and to this software, related documentation +* and any modifications thereto. Any use, reproduction, disclosure or +* distribution of this software and related documentation without an express +* license agreement from NVIDIA CORPORATION is strictly prohibited. +*/ + +/* +* █████ █████ ██████ ████ ████ ███████ ████ ██████ ██ ██ +* ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ +* ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ +* ██████ ████ ██ ████ █████ ██ ██ ██ ██████ ██ ███████ +* ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ +* ██ ██ ██ ██ █████ ██ ██ ██ ██ ██ ██ ██ ██ ██ DEBUGGER +* ██ ██ +* ████████████████████████████████████████████████████████ ██ █ ██ ████████████ +* +* +* HOW TO USE AFTERMATH GPU CRASH DUMP COLLECTION: +* ----------------------------------------------- +* +* 1) Call 'GFSDK_Aftermath_EnableGpuCrashDumps', to enable GPU crash dump collection. +* This must be done before any other library calls are made and before any D3D +* device is created by the application. +* +* With this call the application can register a callback function that is invoked +* with the GPU crash dump data once a TDR/hang occurs. In addition, it is also +* possible to provide optional callback functions for collecting shader debug +* information and for providing additional descriptive data from the application to +* include in the crash dump. +* +* Enabling GPU crash dumps will also override any settings from an also active +* Nsight Graphics GPU crash dump monitor for the calling process. +* +* +* 2) On DX11/DX12, call 'GFSDK_Aftermath_DXxx_Initialize', to initialize the library and +* to enable additional Aftermath features that will affect the data captured in +* the GPU crash dumps, such as Aftermath event markers, automatic call stack +* markers, resource tracking, shader debug information, or additional shader +* error reporting. See 'GFSDK_Aftermath.h' for more details. +* +* On Vulkan use the 'VK_NV_device_diagnostics_config' extension to enable +* additional Aftermath features, such as automatic call stack markers, resource +* tracking, shader debug information, or additional shader error reporting. See +* 'Readme.md' for more details. +* +* +* 4) Before the application shuts down, call 'GFSDK_Aftermath_DisableGpuCrashDumps' to +* disable GPU crash dump collection. +* +* Disabling GPU crash dumps will also re-establish any settings from an also active +* Nsight Graphics GPU crash dump monitor for the calling process. +* +* +* 5) If the application detects a potential GPU crash, i.e., device removed/lost, +* call 'GFSDK_Aftermath_GetCrashDumpStatus' to check the GPU crash dump status. +* The application should then wait until Aftermath has finished processing the +* crash dump before releasing the device or exiting. +* +* The recommended process for handling device removed/lost events is as follows: +* +* a) Call 'GFSDK_Aftermath_GetCrashDumpStatus' to check the GPU crash dump status. +* +* b) If the status is "Unknown", this means the graphics driver does not support +* the crash dump status query feature. But it is still possible to receive the +* "Finished" or "Failed" status. The application should continue to poll the +* status as described in step d) below. +* +* c) If the status is not "Unknown" and not "NotStarted", this means Aftermath +* has detected the GPU crash. +* +* d) The application should wait for a few seconds to allow the Aftermath +* graphics driver thread to collect the GPU crash dump data. Start polling the +* status until the crash dump data has been collected and the notification +* callback has been processed by the application, or a timeout of a couple of +* seconds has expired. +* +* e) If the timeout expires or the status returns "Finished" or "Failed" you +* should continue handling the device lost event as normal (e.g., release +* the device and/or terminate the application). +* +* Pseudo code implementing the above steps: +* +* if (deviceLost) +* { +* // Check Aftermath crash dump status +* GFSDK_Aftermath_CrashDump_Status status = GFSDK_Aftermath_CrashDump_Status_Unknown; +* AFTERMATH_CHECK_ERROR(GFSDK_Aftermath_GetCrashDumpStatus(&status)); +* +* // Loop while Aftermath crash dump data collection has not finished or +* // the application is still processing the crash dump data. +* while (status != GFSDK_Aftermath_CrashDump_Status_CollectingDataFailed && +* status != GFSDK_Aftermath_CrashDump_Status_Finished && +* !timeout) +* { +* // Wait for a couple of milliseconds, and poll the crash dump status again. +* Sleep(50); +* GFSDK_Aftermath_GetCrashDumpStatus(&status); +* } +* +* HandleDeviceLost(); +* } +* +* +* OPTIONAL: +* +* o) (Optional) Instrument the application with event markers as described in +* 'GFSDK_Aftermath.h'. +* +* o) (Optional, DX12-Only) Register DX12 resource pointers with Aftermath as +* described in 'GFSDK_Aftermath.h'. +* +* +* PERFORMANCE TIPS: +* +* o) Enabling shader debug information creation will introduce shader compile +* time overhead as well as memory overhead for handling the debug information. +* +* o) User event markers cause considerable overhead and should be used very +* carefully. +* +* o) Automatic call stack markers for draw calls, compute and ray tracing +* dispatches, acceleration structure building, and copy operations provide a +* less intrusive alternative to manually injecting event markers for every +* command. However, they are in general even more expensive in terms of CPU +* overhead and should be avoided in shipping applications. +* +*/ + +#ifndef GFSDK_Aftermath_GpuCrashDump_H +#define GFSDK_Aftermath_GpuCrashDump_H + +#include "GFSDK_Aftermath_Defines.h" + +#pragma pack(push, 8) + +#ifdef __cplusplus +extern "C" { +#endif + +///////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_GpuCrashDumpWatchedApiFlags +// --------------------------------- +// +// Flags to configure for which graphics APIs to enable GPU crash dumps. +// +///////////////////////////////////////////////////////////////////////// +GFSDK_AFTERMATH_DECLARE_ENUM(GpuCrashDumpWatchedApiFlags) +{ + // Default setting - GPU crash dump tracking disabled. + GFSDK_Aftermath_GpuCrashDumpWatchedApiFlags_None = 0x0, + + // Enable GPU crash dump tracking for the DX API. + GFSDK_Aftermath_GpuCrashDumpWatchedApiFlags_DX = 0x1, + + // Enable GPU crash dump tracking for the Vulkan API. + GFSDK_Aftermath_GpuCrashDumpWatchedApiFlags_Vulkan = 0x2, +}; + +///////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_GpuCrashDumpFeatureFlags +// --------------------------------- +// +// Flags to configure GPU crash dump-specific Aftermath features. +// +///////////////////////////////////////////////////////////////////////// +GFSDK_AFTERMATH_DECLARE_ENUM(GpuCrashDumpFeatureFlags) +{ + // Default settings + GFSDK_Aftermath_GpuCrashDumpFeatureFlags_Default = 0x0, + + // Defer shader debug information callbacks until an actual GPU crash dump + // is generated and execute shader debug information callbacks only for the + // shaders related to the crash dump. + // + // NOTE: Using this option will increase the memory footprint of the + // application. + GFSDK_Aftermath_GpuCrashDumpFeatureFlags_DeferDebugInfoCallbacks = 0x1, +}; + +///////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_GpuCrashDumpDescriptionKey +// --------------------------------- +// +// Key definitions for user-defined GPU crash dump description. +// +///////////////////////////////////////////////////////////////////////// +GFSDK_AFTERMATH_DECLARE_ENUM(GpuCrashDumpDescriptionKey) +{ + // Predefined key for application name. + GFSDK_Aftermath_GpuCrashDumpDescriptionKey_ApplicationName = 0x1, + + // Predefined key for application version. + GFSDK_Aftermath_GpuCrashDumpDescriptionKey_ApplicationVersion = 0x2, + + // Base key for creating user-defined key-value pairs. Any value greater or equal + // to 'GFSDK_Aftermath_GpuCrashDumpDescriptionKey_UserDefined' will create a + // user-defined key-value pair. + GFSDK_Aftermath_GpuCrashDumpDescriptionKey_UserDefined = 0x10000, +}; + +///////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_CrashDump_Status +// --------------------------------- +// +// Aftermath GPU crash dump generation progress status. +// +// Applications are expected to check the status of the Aftermath crash dump +// generation progress if they detect a potential GPU crash, i.e., device +// removed/lost. For more details, see the description on how to set up an application +// for GPU crash dump collection at the beginning of this file. +// +///////////////////////////////////////////////////////////////////////// +GFSDK_AFTERMATH_DECLARE_ENUM(CrashDump_Status) +{ + // No GPU crash has been detected by Aftermath, so far. + GFSDK_Aftermath_CrashDump_Status_NotStarted = 0, + + // A GPU crash happened and was detected by Aftermath. Aftermath started to + // collect crash dump data. + GFSDK_Aftermath_CrashDump_Status_CollectingData, + + // Aftermath failed to collect crash dump data. No further callback will be + // invoked. + GFSDK_Aftermath_CrashDump_Status_CollectingDataFailed, + + // Aftermath is invoking the 'gpuCrashDumpCb' callback after collecting the crash + // dump data successfully. + GFSDK_Aftermath_CrashDump_Status_InvokingCallback, + + // The 'gpuCrashDumpCb' callback returned and Aftermath finished processing the + // GPU crash. The application should now continue with handling the device + // removed/lost situation. + GFSDK_Aftermath_CrashDump_Status_Finished, + + // Unknown problem - likely using an older driver incompatible with this + // Aftermath feature. + GFSDK_Aftermath_CrashDump_Status_Unknown, +}; + +///////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_AddGpuCrashDumpDescription +// --------------------------------- +// +// Function for adding user-defined description key-value pairs used by +// 'GFSDK_Aftermath_GpuCrashDumpDescriptionCb'. +// +// Key must be one of the predefined keys of +// 'GFSDK_Aftermath_GpuCrashDumpDescriptionKey' or a user-defined key based on +// 'GFSDK_Aftermath_GpuCrashDumpDescriptionKey_UserDefined'. All keys greater than +// the last predefined key in 'GFSDK_Aftermath_GpuCrashDumpDescriptionKey' and +// smaller than 'GFSDK_Aftermath_GpuCrashDumpDescriptionKey_UserDefined' are +// considered illegal and ignored. +// +///////////////////////////////////////////////////////////////////////// +typedef void (GFSDK_AFTERMATH_CALL *PFN_GFSDK_Aftermath_AddGpuCrashDumpDescription)(uint32_t key, const char* value); + +///////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_GpuCrashDumpCb +// --------------------------------- +// +// GPU crash dump callback. +// +// If registered via 'GFSDK_Aftermath_EnableGpuCrashDumps' it will be called with the +// crash dump data when a GPU crash is detected by Aftermath. See the description of +// 'GFSDK_Aftermath_EnableGpuCrashDumps' for more details. +// +// NOTE: Except for the 'pUserData' pointer, all pointer values passed to the +// callbacks are only valid for the duration of the call! An implementation +// must make copies of the data if it intends to store it beyond that. +// +///////////////////////////////////////////////////////////////////////// +typedef void (GFSDK_AFTERMATH_CALL *PFN_GFSDK_Aftermath_GpuCrashDumpCb)(const void* pGpuCrashDump, const uint32_t gpuCrashDumpSize, void* pUserData); + +///////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_ShaderDebugInfoCb +// --------------------------------- +// +// Shader debug information callback. +// +// If registered via 'GFSDK_Aftermath_EnableGpuCrashDumps' it will be called with +// shader debug information (line tables for mapping from the shader IL passed to the +// driver to the shader microcode) if the shader debug information generation feature +// is enabled: 'GFSDK_Aftermath_FeatureFlags_GenerateShaderDebugInfo' or +// 'VK_DEVICE_DIAGNOSTICS_CONFIG_ENABLE_SHADER_ERROR_REPORTING_BIT_NV'. Also see the +// description of 'GFSDK_Aftermath_EnableGpuCrashDumps' for more details. +// +// NOTE: Except for the 'pUserData' pointer, all pointer values passed to the +// callbacks are only valid for the duration of the call! An implementation +// must make copies of the data if it intends to store it beyond that. +// +///////////////////////////////////////////////////////////////////////// +typedef void (GFSDK_AFTERMATH_CALL *PFN_GFSDK_Aftermath_ShaderDebugInfoCb)(const void* pShaderDebugInfo, const uint32_t shaderDebugInfoSize, void* pUserData); + +///////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_GpuCrashDumpDescriptionCb +// --------------------------------- +// +// Crash dump description callback. +// +// If registered via 'GFSDK_Aftermath_EnableGpuCrashDumps' it will be called during +// GPU crash dump generation, i.e., before 'GFSDK_Aftermath_GpuCrashDumpCb' is called, +// and allows the application to provide additional information to be captured in the +// crash dump by calling the provided 'addValue' function. See the description of +// 'GFSDK_Aftermath_EnableGpuCrashDumps' for more details. +// +///////////////////////////////////////////////////////////////////////// +typedef void (GFSDK_AFTERMATH_CALL *PFN_GFSDK_Aftermath_GpuCrashDumpDescriptionCb)(PFN_GFSDK_Aftermath_AddGpuCrashDumpDescription addValue, void* pUserData); + +///////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_ResolveMarkerCb +// --------------------------------- +// +// Marker data resolution callback. +// +// If registered via 'GFSDK_Aftermath_EnableGpuCrashDumps' it will be called during +// GPU crash dump data generation, i.e., before 'GFSDK_Aftermath_GpuCrashDumpCb' is +// called, when a DX event marker or a Vulkan checkpoint will be recorded into the +// crash dump. See the description of 'GFSDK_Aftermath_EnableGpuCrashDumps' for more details. +// +// NOTE: Except for the 'pUserData' pointer, all pointer values passed to the +// callbacks are only valid for the duration of the call! The application must ensure +// that the pointer returned through 'ppResolvedMarkerData' is valid after returning +// from the callback. Then, the GPU crash dump data collection process will make an +// internal copy of it. So, it's safe to reuse the memory in the next call, i.e., it's +// OK to store the memory blob where the 'ppResolvedMarkerData' is pointed to in static memory. +// +///////////////////////////////////////////////////////////////////////// +typedef void (GFSDK_AFTERMATH_CALL *PFN_GFSDK_Aftermath_ResolveMarkerCb)(const void* pMarkerData, const uint32_t markerDataSize, void* pUserData, void** ppResolvedMarkerData, uint32_t* pResolvedMarkerDataSize); + +///////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_EnableGpuCrashDumps +// --------------------------------- +// +// apiVersion; +// Must be set to 'GFSDK_Aftermath_Version_API'. Used for checking against +// library version. +// +// watchedApis; +// Controls which graphics APIs to watch for crashes. A combination of +// 'GFSDK_Aftermath_GpuCrashDumpWatchedApiFlags'. +// +// flags; +// Controls GPU crash dump specific behavior. A combination of +// 'GFSDK_Aftermath_GpuCrashDumpFeatureFlags'. +// +// gpuCrashDumpCb; +// Callback function to be called when new GPU crash dump data is available. +// +// NOTE: This callback is free-threaded, ensure the provided function is +// thread-safe. +// +// shaderDebugInfoCb; +// Optional, can be NULL. +// +// Callback function to be called when new shader debug information data is +// available. Shader debug information generation needs to be enabled by +// setting the corresponding feature flags: +// * For DX: 'GFSDK_Aftermath_FeatureFlags_GenerateShaderDebugInfo' +// * For Vulkan: 'VK_DEVICE_DIAGNOSTICS_CONFIG_ENABLE_SHADER_ERROR_REPORTING_BIT_NV' +// +// NOTE: Shader debug information is only supported for DX12 (DXIL) and Vulkan +// (SPIR-V) shaders. +// +// NOTE: If not using 'GFSDK_Aftermath_GpuCrashDumpFeatureFlags_DeferDebugInfoCallbacks', +// 'shaderDebugInfoCb' will be invoked for every shader compilation by the +// graphics driver, even if there will be never an invocation of 'gpuCrashDumpCb'. +// +// NOTE: This callback is free-threaded, ensure the provided function is +// thread-safe. +// +// descriptionCb; +// Optional, can be NULL. +// +// Callback function that allows the application to provide additional +// descriptive values to be include in crash dumps. This will be called before +// 'gpuCrashDumpCb'. +// +// NOTE: This callback is free-threaded, ensure the provided function is +// thread-safe. +// +// resolveMarkerCb; +// Optional, can be NULL. +// +// Callback function to be called when the crash dump data generation encounters +// an event marker with a size of zero. This means that +// 'GFSDK_Aftermath_SetEventMarker' was called with 'markerDataSize = 0', meaning +// that the marker payload itself is managed by the application rather than +// copied by Aftermath internally. All Vulkan markers set using the +// 'NV_device_diagnostic_checkpoints' extension are application-managed as well. +// This callback allows the application to pass the marker's associated data +// back to the crash dump generation process to be included in the crash dump +// data. The application should set the value of 'ppResolvedMarkerData' to the +// pointer of the marker's data, and set the value of 'markerSize' to the size +// of the marker's data in bytes. +// +// NOTE: Applications must ensure that the marker data memory passed back via +// 'ppResolvedMarkerData' will remain valid for the entirety of the crash dump +// generation process, i.e., until 'gpuCrashDumpCb' is called. +// +// NOTE: This callback is only supported on R495 or later NVIDIA graphics drivers. If +// the application is running on a system using an earlier driver version, it will +// be ignored. +// +// NOTE: This callback is free-threaded, ensure the provided function is +// thread-safe. +// +// pUserData; +// Optional, can be NULL. +// +// User data pointer passed to the callbacks. +// +//// DESCRIPTION; +// Device independent initialization call to enable Aftermath GPU crash dump +// creation. This function must be called before any D3D or Vulkan device is +// created by the application. +// +// NOTE: This overrides any settings from an also active GPU crash dump monitor +// for this process! +// +///////////////////////////////////////////////////////////////////////// +GFSDK_Aftermath_API GFSDK_Aftermath_EnableGpuCrashDumps( + GFSDK_Aftermath_Version apiVersion, + uint32_t watchedApis, + uint32_t flags, + PFN_GFSDK_Aftermath_GpuCrashDumpCb gpuCrashDumpCb, + PFN_GFSDK_Aftermath_ShaderDebugInfoCb shaderDebugInfoCb, + PFN_GFSDK_Aftermath_GpuCrashDumpDescriptionCb descriptionCb, + PFN_GFSDK_Aftermath_ResolveMarkerCb resolveMarkerCb, + void* pUserData); + +///////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_DisableGpuCrashDumps +// --------------------------------- +// +//// DESCRIPTION; +// Device independent call to disable Aftermath GPU crash dump creation. +// Re-enables settings from an also active GPU crash dump monitor for the +// current process! +// +///////////////////////////////////////////////////////////////////////// +GFSDK_Aftermath_API GFSDK_Aftermath_DisableGpuCrashDumps(); + +///////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_GetCrashDumpStatus +// --------------------------------- +// +// pOutStatus; +// OUTPUT: Crash dump status. +// +//// DESCRIPTION; +// If the application detects a potential crash (i.e., device +// removed/lost event), applications are expected to check the status of +// the Aftermath crash dump generation progress. This function allows to +// query the status of the GPU crash detection and the crash dump data +// collection. For more details, see 'GFSDK_Aftermath_CrashDump_Status' +// and the description of how to set up an application for GPU crash dump +// collection at the beginning of this file. +// +///////////////////////////////////////////////////////////////////////// +GFSDK_Aftermath_API GFSDK_Aftermath_GetCrashDumpStatus(GFSDK_Aftermath_CrashDump_Status* pOutStatus); + +///////////////////////////////////////////////////////////////////////// +// +// Function pointer definitions - if dynamic loading is preferred. +// +///////////////////////////////////////////////////////////////////////// +GFSDK_Aftermath_PFN(GFSDK_AFTERMATH_CALL *PFN_GFSDK_Aftermath_EnableGpuCrashDumps)(GFSDK_Aftermath_Version apiVersion, uint32_t watchedApis, uint32_t flags, PFN_GFSDK_Aftermath_GpuCrashDumpCb gpuCrashDumpCb, PFN_GFSDK_Aftermath_ShaderDebugInfoCb shaderDebugInfoCb, PFN_GFSDK_Aftermath_GpuCrashDumpDescriptionCb descriptionCb, PFN_GFSDK_Aftermath_ResolveMarkerCb resolveMarkerCb, void* pUserData); +GFSDK_Aftermath_PFN(GFSDK_AFTERMATH_CALL *PFN_GFSDK_Aftermath_DisableGpuCrashDumps)(); +GFSDK_Aftermath_PFN(GFSDK_AFTERMATH_CALL *PFN_GFSDK_Aftermath_GetCrashDumpStatus)(GFSDK_Aftermath_CrashDump_Status* pOutStatus); + +#ifdef __cplusplus +} // extern "C" +#endif + +#pragma pack(pop) + +#endif // GFSDK_Aftermath_GpuCrashDump_H diff --git a/deps/aftermath/GFSDK_Aftermath_GpuCrashDumpDecoding.h b/deps/aftermath/GFSDK_Aftermath_GpuCrashDumpDecoding.h new file mode 100644 index 0000000..60b0106 --- /dev/null +++ b/deps/aftermath/GFSDK_Aftermath_GpuCrashDumpDecoding.h @@ -0,0 +1,1260 @@ +/* +* Copyright (c) 2019-2023, NVIDIA CORPORATION. All rights reserved. +* +* NVIDIA CORPORATION and its licensors retain all intellectual property +* and proprietary rights in and to this software, related documentation +* and any modifications thereto. Any use, reproduction, disclosure or +* distribution of this software and related documentation without an express +* license agreement from NVIDIA CORPORATION is strictly prohibited. +*/ + +/* +* █████ █████ ██████ ████ ████ ███████ ████ ██████ ██ ██ +* ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ +* ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ +* ██████ ████ ██ ████ █████ ██ ██ ██ ██████ ██ ███████ +* ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ +* ██ ██ ██ ██ █████ ██ ██ ██ ██ ██ ██ ██ ██ ██ DEBUGGER +* ██ ██ +* ████████████████████████████████████████████████████████ ██ █ ██ ████████████ +* +* +* HOW TO DECODE AFTERMATH GPU CRASH DUMPS: +* ---------------------------------------- +* +* 1) Call 'GFSDK_Aftermath_GpuCrashDump_CreateDecoder', to create a decoder object for +* a GPU crash dump. +* +* +* 2) Call one or more of the 'GFSDK_Aftermath_GpuCrashDump_Get*' functions with this +* decoder, to query information from the GPU crash dump. +* +* Some of the functions require caller allocated buffers to return the data. Those +* are accompanied with a corresponding 'GFSDK_Aftermath_GpuCrashDump_Get*Count' +* function to query the element count the caller has to reserve for these buffers. +* +* If the requested data is not available in the GPU crash dump, the functions +* will return with 'GFSDK_Aftermath_Result_NotAvailable'. +* +* +* 3) Call 'GFSDK_Aftermath_GpuCrashDump_DestroyDecoder', to destroy the decoder object +* and cleanup all related memory. +* +*/ + +#ifndef GFSDK_Aftermath_CrashDumpDecoding_H +#define GFSDK_Aftermath_CrashDumpDecoding_H + +#include "GFSDK_Aftermath_Defines.h" + +#pragma pack(push, 8) + +#ifdef __cplusplus +extern "C" { +#endif + +///////////////////////////////////////////////////////////////////////// +// +// Constants used in GPU crash dump decoding functions. +// +///////////////////////////////////////////////////////////////////////// +enum +{ + GFSDK_Aftermath_MAX_STRING_LENGTH = 127, +}; + +//////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_ShaderDebugInfoIdentifier +// --------------------------------- +// +// Unique identifier for shader debug information. +// +///////////////////////////////////////////////////////////////////////// +typedef struct GFSDK_Aftermath_ShaderDebugInfoIdentifier +{ + uint64_t id[2]; +} GFSDK_Aftermath_ShaderDebugInfoIdentifier; + +//////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_ShaderBinaryHash +// --------------------------------- +// +// Unique identifier for shader binaries. +// +///////////////////////////////////////////////////////////////////////// +typedef struct GFSDK_Aftermath_ShaderBinaryHash +{ + uint64_t hash; +} GFSDK_Aftermath_ShaderBinaryHash; + +//////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_ShaderDebugName +// --------------------------------- +// +// Shader DebugName, i.e., a unique identifier for shader source debug information. +// +///////////////////////////////////////////////////////////////////////// +typedef struct GFSDK_Aftermath_ShaderDebugName +{ + char name[GFSDK_Aftermath_MAX_STRING_LENGTH + 1]; +} GFSDK_Aftermath_ShaderDebugName; + +#if defined(VULKAN_H_) +//////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_SpirvCode +// --------------------------------- +// +// SPIR-V shader code. +// +///////////////////////////////////////////////////////////////////////// +typedef struct GFSDK_Aftermath_SpirvCode +{ + GFSDK_AFTERMATH_DECLARE_POINTER_MEMBER(const void*, pData); + uint32_t size; +} GFSDK_Aftermath_SpirvCode; +#endif + +//////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_GraphicsApi +// --------------------------------- +// +// Graphics API +// +///////////////////////////////////////////////////////////////////////// +GFSDK_AFTERMATH_DECLARE_ENUM(GraphicsApi) +{ + GFSDK_Aftermath_GraphicsApi_Unknown = 0, + GFSDK_Aftermath_GraphicsApi_D3D_10_0 = 1, + GFSDK_Aftermath_GraphicsApi_D3D_10_1 = 2, + GFSDK_Aftermath_GraphicsApi_D3D_11_0 = 3, + GFSDK_Aftermath_GraphicsApi_D3D_11_1 = 4, + GFSDK_Aftermath_GraphicsApi_D3D_11_2 = 5, + GFSDK_Aftermath_GraphicsApi_D3D_12_0 = 6, + GFSDK_Aftermath_GraphicsApi_Vulkan = 7, +}; + +//////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_GpuCrashDump_BaseInfo +// --------------------------------- +// +// GPU crash dump - base information +// +///////////////////////////////////////////////////////////////////////// +typedef struct GFSDK_Aftermath_GpuCrashDump_BaseInfo +{ + char applicationName[GFSDK_Aftermath_MAX_STRING_LENGTH + 1]; + char creationDate[GFSDK_Aftermath_MAX_STRING_LENGTH + 1]; + uint32_t pid; + GFSDK_Aftermath_GraphicsApi graphicsApi; +} GFSDK_Aftermath_GpuCrashDump_BaseInfo; + +//////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_GpuCrashDump_DeviceInfo +// --------------------------------- +// +// GPU crash dump - device information +// +///////////////////////////////////////////////////////////////////////// +typedef struct GFSDK_Aftermath_GpuCrashDump_DeviceInfo +{ + GFSDK_Aftermath_Device_Status status; + GFSDK_AFTERMATH_DECLARE_BOOLEAN_MEMBER(adapterReset); + GFSDK_AFTERMATH_DECLARE_BOOLEAN_MEMBER(engineReset); +} GFSDK_Aftermath_GpuCrashDump_DeviceInfo; + +//////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_GpuCrashDump_SystemInfo +// --------------------------------- +// +// GPU crash dump - system information +// +///////////////////////////////////////////////////////////////////////// +typedef struct GFSDK_Aftermath_GpuCrashDump_SystemInfo +{ + char osVersion[GFSDK_Aftermath_MAX_STRING_LENGTH + 1]; + struct DisplayDriverVersion + { + uint32_t major; + uint32_t minor; + } displayDriver; +} GFSDK_Aftermath_GpuCrashDump_SystemInfo; + +//////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_GpuCrashDump_GpuInfo +// --------------------------------- +// +// GPU crash dump - GPU information +// +///////////////////////////////////////////////////////////////////////// +typedef struct GFSDK_Aftermath_GpuCrashDump_GpuInfo +{ + char adapterName[GFSDK_Aftermath_MAX_STRING_LENGTH + 1]; + char generationName[GFSDK_Aftermath_MAX_STRING_LENGTH + 1]; + uint64_t adapterLUID; +} GFSDK_Aftermath_GpuCrashDump_GpuInfo; + +//////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_FaultType +// --------------------------------- +// +// GPU crash dump - page fault type +// +///////////////////////////////////////////////////////////////////////// +GFSDK_AFTERMATH_DECLARE_ENUM(FaultType) +{ + GFSDK_Aftermath_FaultType_Unknown = 0, + GFSDK_Aftermath_FaultType_AddressTranslationError, + GFSDK_Aftermath_FaultType_IllegalAccessError, +}; + +//////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_AccessType +// --------------------------------- +// +// GPU crash dump - page fault access type +// +///////////////////////////////////////////////////////////////////////// +GFSDK_AFTERMATH_DECLARE_ENUM(AccessType) +{ + GFSDK_Aftermath_AccessType_Unknown = 0, + GFSDK_Aftermath_AccessType_Read, + GFSDK_Aftermath_AccessType_Write, + GFSDK_Aftermath_AccessType_Atomic, +}; + +//////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_Engine +// --------------------------------- +// +// GPU crash dump - page fault GPU engine +// +///////////////////////////////////////////////////////////////////////// +GFSDK_AFTERMATH_DECLARE_ENUM(Engine) +{ + GFSDK_Aftermath_Engine_Unknown = 0, + GFSDK_Aftermath_Engine_Graphics, + GFSDK_Aftermath_Engine_GraphicsCompute, + GFSDK_Aftermath_Engine_Display, + GFSDK_Aftermath_Engine_CopyEngine, + GFSDK_Aftermath_Engine_VideoDecoder, + GFSDK_Aftermath_Engine_VideoEncoder, + GFSDK_Aftermath_Engine_Other, +}; + +//////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_Client +// --------------------------------- +// +// GPU crash dump - page fault GPU client +// +///////////////////////////////////////////////////////////////////////// +GFSDK_AFTERMATH_DECLARE_ENUM(Client) +{ + GFSDK_Aftermath_Client_Unknown = 0, + GFSDK_Aftermath_Client_HostInterface, + GFSDK_Aftermath_Client_FrontEnd, + GFSDK_Aftermath_Client_PrimitiveDistributor, + GFSDK_Aftermath_Client_GraphicsProcessingCluster, + GFSDK_Aftermath_Client_PolymorphEngine, + GFSDK_Aftermath_Client_RasterEngine, + GFSDK_Aftermath_Client_Rasterizer2D, + GFSDK_Aftermath_Client_RenderOutputUnit, + GFSDK_Aftermath_Client_TextureProcessingCluster, + GFSDK_Aftermath_Client_CopyEngine, + GFSDK_Aftermath_Client_VideoDecoder, + GFSDK_Aftermath_Client_VideoEncoder, + GFSDK_Aftermath_Client_Other, +}; + +//////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_GpuCrashDump_PageFaultInfo +// --------------------------------- +// +// GPU crash dump - page fault information +// +///////////////////////////////////////////////////////////////////////// +typedef struct GFSDK_Aftermath_GpuCrashDump_PageFaultInfo +{ + uint64_t faultingGpuVA; + GFSDK_Aftermath_FaultType faultType; + GFSDK_Aftermath_AccessType accessType; + GFSDK_Aftermath_Engine engine; + GFSDK_Aftermath_Client client; + GFSDK_AFTERMATH_DECLARE_BOOLEAN_MEMBER(bHasResourceInfo); + struct ResourceInfo { + uint64_t gpuVa; + + uint64_t size; + + uint32_t width; + uint32_t height; + uint32_t depth; + + uint32_t mipLevels; + + uint32_t format; // DXGI_Format for DX, VkFormat for Vulkan + + GFSDK_AFTERMATH_DECLARE_BOOLEAN_MEMBER(bIsBufferHeap); + GFSDK_AFTERMATH_DECLARE_BOOLEAN_MEMBER(bIsStaticTextureHeap); + GFSDK_AFTERMATH_DECLARE_BOOLEAN_MEMBER(bIsRenderTargetOrDepthStencilViewHeap); + GFSDK_AFTERMATH_DECLARE_BOOLEAN_MEMBER(bPlacedResource); + + GFSDK_AFTERMATH_DECLARE_BOOLEAN_MEMBER(bWasDestroyed); + uint32_t createDestroyTickCount; + } resourceInfo; +} GFSDK_Aftermath_GpuCrashDump_PageFaultInfo; + +//////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_ShaderType +// --------------------------------- +// +// GPU crash dump - shader types +// +///////////////////////////////////////////////////////////////////////// +GFSDK_AFTERMATH_DECLARE_ENUM(ShaderType) +{ + GFSDK_Aftermath_ShaderType_Unknown = 0, + GFSDK_Aftermath_ShaderType_Vertex, + GFSDK_Aftermath_ShaderType_Tessellation_Control, + GFSDK_Aftermath_ShaderType_Hull = GFSDK_Aftermath_ShaderType_Tessellation_Control, + GFSDK_Aftermath_ShaderType_Tessellation_Evaluation, + GFSDK_Aftermath_ShaderType_Domain = GFSDK_Aftermath_ShaderType_Tessellation_Evaluation, + GFSDK_Aftermath_ShaderType_Geometry, + GFSDK_Aftermath_ShaderType_Fragment, + GFSDK_Aftermath_ShaderType_Pixel = GFSDK_Aftermath_ShaderType_Fragment, + GFSDK_Aftermath_ShaderType_Compute, + GFSDK_Aftermath_ShaderType_RayTracing_RayGeneration, + GFSDK_Aftermath_ShaderType_RayTracing_Miss, + GFSDK_Aftermath_ShaderType_RayTracing_Intersection, + GFSDK_Aftermath_ShaderType_RayTracing_AnyHit, + GFSDK_Aftermath_ShaderType_RayTracing_ClosestHit, + GFSDK_Aftermath_ShaderType_RayTracing_Callable, + GFSDK_Aftermath_ShaderType_RayTracing_Internal, + GFSDK_Aftermath_ShaderType_Mesh, + GFSDK_Aftermath_ShaderType_Task, +}; + +//////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_GpuCrashDump_ShaderInfo +// --------------------------------- +// +// GPU crash dump - shader information +// +///////////////////////////////////////////////////////////////////////// +typedef struct GFSDK_Aftermath_GpuCrashDump_ShaderInfo +{ + // NOTE: This shader hash value is not necessarily the same as the GFSDK_Aftermath_ShaderBinaryHash + // value for this shader info, which must be calculated with GFSDK_Aftermath_GetShaderHashForShaderInfo. + uint64_t shaderHash; + uint64_t shaderInstance; + GFSDK_AFTERMATH_DECLARE_BOOLEAN_MEMBER(isInternal); + GFSDK_Aftermath_ShaderType shaderType; +} GFSDK_Aftermath_GpuCrashDump_ShaderInfo; + +//////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_Context_Type +// --------------------------------- +// +// GPU crash dump - event marker context type +// +///////////////////////////////////////////////////////////////////////// +GFSDK_AFTERMATH_DECLARE_ENUM(Context_Type) +{ + GFSDK_Aftermath_Context_Type_Invalid = 0, + GFSDK_Aftermath_Context_Type_Immediate, + GFSDK_Aftermath_Context_Type_CommandList, + GFSDK_Aftermath_Context_Type_Bundle, + GFSDK_Aftermath_Context_Type_CommandQueue +}; + +///////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_EventMarkerDataOwnership +// --------------------------------- +// +// GPU crash dump - Event marker data ownership. +// +///////////////////////////////////////////////////////////////////////// +GFSDK_AFTERMATH_DECLARE_ENUM(EventMarkerDataOwnership) +{ + // Data is owned by the user application. + GFSDK_Aftermath_EventMarkerDataOwnership_User = 0, + + // Data is part of the GPU crash dump and is owned by the decoder. + GFSDK_Aftermath_EventMarkerDataOwnership_Decoder, +}; + +///////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_GpuCrashDump_EventMarkerInfo +// --------------------------------- +// +// GPU crash dump - Aftermath event marker information. +// +// NOTE: If 'GFSDK_Aftermath_SetEventMarker' was called with 'markerDataSize=0', +// 'markerDataOwnership' will be set to 'GFSDK_Aftermath_EventMarkerDataOwnership_User' +// and the 'markerData' pointer will be only valid within the context of the process +// setting the marker and if the application properly manages the lifetime of the +// pointed to data. It is the responsibility of the caller to ensure that the pointer +// is valid before accessing the pointed to data. +// +///////////////////////////////////////////////////////////////////////// +typedef struct GFSDK_Aftermath_GpuCrashDump_EventMarkerInfo +{ + uint64_t contextId; + GFSDK_Aftermath_Context_Status contextStatus; + GFSDK_Aftermath_Context_Type contextType; + GFSDK_AFTERMATH_DECLARE_POINTER_MEMBER(const void*, markerData); + GFSDK_Aftermath_EventMarkerDataOwnership markerDataOwnership; + uint32_t markerDataSize; +} GFSDK_Aftermath_GpuCrashDump_EventMarkerInfo; + +///////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_GpuCrashDumpDecoderFlags +// --------------------------------- +// +// Flags that allow to specify the data to be included in the JSON generated by +// 'GFSDK_Aftermath_GpuCrashDump_GenerateJSON'. +// +///////////////////////////////////////////////////////////////////////// +GFSDK_AFTERMATH_DECLARE_ENUM(GpuCrashDumpDecoderFlags) +{ + // Include basic information about the GPU crash dump. + GFSDK_Aftermath_GpuCrashDumpDecoderFlags_BASE_INFO = 0x1, + + // Include information about the device state. + GFSDK_Aftermath_GpuCrashDumpDecoderFlags_DEVICE_INFO = 0x2, + + // Include information about the OS. + GFSDK_Aftermath_GpuCrashDumpDecoderFlags_OS_INFO = 0x4, + + // Include information about the display driver. + GFSDK_Aftermath_GpuCrashDumpDecoderFlags_DISPLAY_DRIVER_INFO = 0x8, + + // Include information about the GPU. + GFSDK_Aftermath_GpuCrashDumpDecoderFlags_GPU_INFO = 0x10, + + // Include information about page faults (if available). + GFSDK_Aftermath_GpuCrashDumpDecoderFlags_PAGE_FAULT_INFO = 0x20, + + // Include information about shaders (if available). + GFSDK_Aftermath_GpuCrashDumpDecoderFlags_SHADER_INFO = 0x40, + + // Include information about active warps (if available). + GFSDK_Aftermath_GpuCrashDumpDecoderFlags_WARP_STATE_INFO = 0x80, + + // Try to map shader addresses to source or intermediate assembly lines using + // additional information provided through 'shaderDebugInfoLookupCb', + // 'shaderLookupCb', and 'shaderSourceDebugInfoLookupCb', if provided. + GFSDK_Aftermath_GpuCrashDumpDecoderFlags_SHADER_MAPPING_INFO = 0x100, + + // Include Aftermath event marker data (if available). + GFSDK_Aftermath_GpuCrashDumpDecoderFlags_EVENT_MARKER_INFO = 0x200, + + // Include automatic event marker call stack data (if available). + GFSDK_Aftermath_GpuCrashDumpDecoderFlags_CALL_STACK_INFO = 0x400, + + // Include user provided GPU crash dump description values (if available). + GFSDK_Aftermath_GpuCrashDumpDecoderFlags_DESCRIPTION_INFO = 0x800, + + // Include information about faulted warps (if available). + GFSDK_Aftermath_GpuCrashDumpDecoderFlags_FAULTED_WARP_INFO = 0x1000, + + // Include information about the fingerprint of the GPU crash dump (if available). + GFSDK_Aftermath_GpuCrashDumpDecoderFlags_FINGERPRINT_INFO = 0x2000, + + // Include all available information. + GFSDK_Aftermath_GpuCrashDumpDecoderFlags_ALL_INFO = 0x3FFF, +}; + +///////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_GpuCrashDumpFormatterFlags +// --------------------------------- +// +// Flags controlling the formatting of the JSON generated by +// 'GFSDK_Aftermath_GpuCrashDump_GenerateJSON'. +// +///////////////////////////////////////////////////////////////////////// +GFSDK_AFTERMATH_DECLARE_ENUM(GpuCrashDumpFormatterFlags) +{ + // No special formatting + GFSDK_Aftermath_GpuCrashDumpFormatterFlags_NONE = 0x0, + + // Remove all unnecessary whitespace from formatted string. + GFSDK_Aftermath_GpuCrashDumpFormatterFlags_CONDENSED_OUTPUT = 0x1, + + // Use UTF8 encoding. + GFSDK_Aftermath_GpuCrashDumpFormatterFlags_UTF8_OUTPUT = 0x2, +}; + +///////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_GpuCrashDump_Decoder +// --------------------------------- +// +// GPU crash dump decoder handle. +// +///////////////////////////////////////////////////////////////////////// +GFSDK_AFTERMATH_DECLARE_HANDLE(GFSDK_Aftermath_GpuCrashDump_Decoder); + + +///////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_SetData +// --------------------------------- +// +// Callback function for providing shader debug information and shader binary data to +// the GPU crash dump decoder. +// +///////////////////////////////////////////////////////////////////////// +typedef void(GFSDK_AFTERMATH_CALL *PFN_GFSDK_Aftermath_SetData)(const void* pData, uint32_t size); + +///////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_ShaderDebugInfoLookupCb +// --------------------------------- +// +// Callback used by the GPU crash dump decoder to query shader debug information. See +// the description of 'GFSDK_Aftermath_GpuCrashDump_GenerateJSON' for more details. +// +///////////////////////////////////////////////////////////////////////// +typedef void(GFSDK_AFTERMATH_CALL *PFN_GFSDK_Aftermath_ShaderDebugInfoLookupCb)(const GFSDK_Aftermath_ShaderDebugInfoIdentifier* pIdentifier, PFN_GFSDK_Aftermath_SetData setShaderDebugInfo, void* pUserData); + +///////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_ShaderLookupCb +// --------------------------------- +// +// Callback used by the GPU crash dump decoder to query shader binary information. +// See the description of 'GFSDK_Aftermath_GpuCrashDump_GenerateJSON' for more +// details. +// +///////////////////////////////////////////////////////////////////////// +typedef void(GFSDK_AFTERMATH_CALL *PFN_GFSDK_Aftermath_ShaderLookupCb)(const GFSDK_Aftermath_ShaderBinaryHash* pShaderHash, PFN_GFSDK_Aftermath_SetData setShaderBinary, void* pUserData); + +///////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_ShaderSourceDebugInfoLookupCb +// --------------------------------- +// +// Callback used by the GPU crash dump decoder to query source shader debug +// information. See the description of 'GFSDK_Aftermath_GpuCrashDump_GenerateJSON' +// for more details. +// +///////////////////////////////////////////////////////////////////////// +typedef void(GFSDK_AFTERMATH_CALL *PFN_GFSDK_Aftermath_ShaderSourceDebugInfoLookupCb)(const GFSDK_Aftermath_ShaderDebugName* pShaderDebugName, PFN_GFSDK_Aftermath_SetData setShaderBinary, void* pUserData); + +///////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_GpuCrashDump_CreateDecoder +// --------------------------------- +// +// apiVersion; +// Must be set to 'GFSDK_Aftermath_Version_API'. Used for checking against +// library version. +// +// pGpuCrashDump; +// Pointer to GPU crash dump data captured in a 'GFSDK_Aftermath_GpuCrashDumpCb' +// callback. +// +// gpuCrashDumpSize; +// Size of GPU crash dump data in bytes. +// +// pDecoder; +// Pointer to a decoder object owned by the caller that is initialized. +// +//// DESCRIPTION; +// Create a decoder object that can be used to query information about the +// provided GPU crash dump. +// +///////////////////////////////////////////////////////////////////////// +GFSDK_Aftermath_API GFSDK_Aftermath_GpuCrashDump_CreateDecoder( + GFSDK_Aftermath_Version apiVersion, + const void* pGpuCrashDump, + const uint32_t gpuCrashDumpSize, + GFSDK_Aftermath_GpuCrashDump_Decoder* pDecoder); + +///////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_GpuCrashDump_DestroyDecoder +// --------------------------------- +// +// decoder; +// A valid GPU crash dump decoder object. +// +//// DESCRIPTION; +// Free any data related to the passed in GPU crash dump decoder object. +// +///////////////////////////////////////////////////////////////////////// +GFSDK_Aftermath_API GFSDK_Aftermath_GpuCrashDump_DestroyDecoder( + const GFSDK_Aftermath_GpuCrashDump_Decoder decoder); + +///////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_GpuCrashDump_GetBaseInfo +// --------------------------------- +// +// decoder; +// A valid decoder object. +// +// pBaseInfo; +// Pointer to data structure owned by the caller that is filled in with +// information from the GPU crash dump. +// +//// DESCRIPTION; +// Query basic information from the GPU crash dump. +// +///////////////////////////////////////////////////////////////////////// +GFSDK_Aftermath_API GFSDK_Aftermath_GpuCrashDump_GetBaseInfo( + const GFSDK_Aftermath_GpuCrashDump_Decoder decoder, + GFSDK_Aftermath_GpuCrashDump_BaseInfo* pBaseInfo); + +///////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_GpuCrashDump_GetDescriptionSize +// --------------------------------- +// +// decoder; +// A valid decoder object. +// +// key; +// What value to query from the description section. +// +// pValueSize; +// Populated with the size of the value in bytes (including 0-termination +// of the string). +// +//// DESCRIPTION; +// Query the size of a description value from the GPU crash dump. +// +///////////////////////////////////////////////////////////////////////// +GFSDK_Aftermath_API GFSDK_Aftermath_GpuCrashDump_GetDescriptionSize( + const GFSDK_Aftermath_GpuCrashDump_Decoder decoder, + const uint32_t key, + uint32_t* pValueSize); + +///////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_GpuCrashDump_GetDescription +// --------------------------------- +// +// decoder; +// A valid decoder object. +// +// key; +// What value to query from the description section. +// +// valueBufferSize; +// Size in bytes of the caller allocated results buffer 'pValue'. +// +// pValue; +// Caller allocated results buffer. +// +//// DESCRIPTION; +// Query description value from the GPU crash dump. +// +///////////////////////////////////////////////////////////////////////// +GFSDK_Aftermath_API GFSDK_Aftermath_GpuCrashDump_GetDescription( + const GFSDK_Aftermath_GpuCrashDump_Decoder decoder, + const uint32_t key, + const uint32_t valueBufferSize, + char* pValue); + +///////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_GpuCrashDump_GetDeviceInfo +// --------------------------------- +// +// decoder; +// A valid decoder object. +// +// pDeviceInfo; +// Pointer to data structure owned by the caller that is filled in with +// information from the GPU crash dump. +// +//// DESCRIPTION; +// Query device state information from the GPU crash dump. +// +///////////////////////////////////////////////////////////////////////// +GFSDK_Aftermath_API GFSDK_Aftermath_GpuCrashDump_GetDeviceInfo( + const GFSDK_Aftermath_GpuCrashDump_Decoder decoder, + GFSDK_Aftermath_GpuCrashDump_DeviceInfo* pDeviceInfo); + +///////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_GpuCrashDump_GetSystemInfo +// --------------------------------- +// +// decoder; +// A valid decoder object. +// +// pSystemInfo; +// Pointer to data structure owned by the caller that is filled in with +// information from the GPU crash dump. +// +//// DESCRIPTION; +// Query system information (OS, display driver) from the GPU crash dump. +// +///////////////////////////////////////////////////////////////////////// +GFSDK_Aftermath_API GFSDK_Aftermath_GpuCrashDump_GetSystemInfo( + const GFSDK_Aftermath_GpuCrashDump_Decoder decoder, + GFSDK_Aftermath_GpuCrashDump_SystemInfo* pSystemInfo); + +///////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_GpuCrashDump_GetGpuInfoCount +// --------------------------------- +// +// decoder; +// A valid decoder object. +// +// pGpuCount; +// Populated with the number of GPU entries from the GPU crash dump. +// +//// DESCRIPTION; +// Query number of GPU entries from the GPU crash dump. +// +///////////////////////////////////////////////////////////////////////// +GFSDK_Aftermath_API GFSDK_Aftermath_GpuCrashDump_GetGpuInfoCount( + const GFSDK_Aftermath_GpuCrashDump_Decoder decoder, + uint32_t* pGpuCount); + +///////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_GpuCrashDump_GetGpuInfo +// --------------------------------- +// +// decoder; +// A valid decoder object. +// +// gpuInfoBufferCount; +// Number of elements in caller allocated array passed in 'pGpuInfo'. +// +// pGpuInfo; +// Pointer to caller allocated array of 'GFSDK_Aftermath_GpuCrashDump_GpuInfo' +// that is filled in with information from the GPU crash dump. +// +//// DESCRIPTION; +// Query information about the GPUs from the GPU crash dump. +// +///////////////////////////////////////////////////////////////////////// +GFSDK_Aftermath_API GFSDK_Aftermath_GpuCrashDump_GetGpuInfo( + const GFSDK_Aftermath_GpuCrashDump_Decoder decoder, + const uint32_t gpuInfoBufferCount, + GFSDK_Aftermath_GpuCrashDump_GpuInfo* pGpuInfo); + +///////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_GpuCrashDump_GetPageFaultInfo +// --------------------------------- +// +// decoder; +// A valid decoder object. +// +// pPageFaultInfo; +// Pointer to data structure owned by the caller that is filled in with +// information from the GPU crash dump. +// +//// DESCRIPTION; +// Query page fault information from a GPU crash dump. +// +///////////////////////////////////////////////////////////////////////// +GFSDK_Aftermath_API GFSDK_Aftermath_GpuCrashDump_GetPageFaultInfo( + const GFSDK_Aftermath_GpuCrashDump_Decoder decoder, + GFSDK_Aftermath_GpuCrashDump_PageFaultInfo* pPageFaultInfo); + +///////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_GpuCrashDump_GetActiveShadersInfoCount +// --------------------------------- +// +// decoder; +// A valid decoder object. +// +// pShaderCount; +// Populated with the number of active shaders from the GPU crash dump. +// +//// DESCRIPTION; +// Query the number of active shaders from the GPU crash dump. +// +///////////////////////////////////////////////////////////////////////// +GFSDK_Aftermath_API GFSDK_Aftermath_GpuCrashDump_GetActiveShadersInfoCount( + const GFSDK_Aftermath_GpuCrashDump_Decoder decoder, + uint32_t* pShaderCount); + +///////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_GpuCrashDump_GetActiveShadersInfo +// --------------------------------- +// +// decoder; +// A valid decoder object. +// +// shaderInfoBufferCount; +// Number of elements in caller allocated array passed in 'pShaderInfo'. +// +// pShaderInfo; +// Pointer to caller allocated array of'GFSDK_Aftermath_GpuCrashDump_ShaderInfo' +// that is filled in with information from the GPU crash dump. +// +//// DESCRIPTION; +// Query information about active shaders from the GPU crash dump. +// +///////////////////////////////////////////////////////////////////////// +GFSDK_Aftermath_API GFSDK_Aftermath_GpuCrashDump_GetActiveShadersInfo( + const GFSDK_Aftermath_GpuCrashDump_Decoder decoder, + const uint32_t shaderInfoBufferCount, + GFSDK_Aftermath_GpuCrashDump_ShaderInfo* pShaderInfo); + +///////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_GpuCrashDump_GetEventMarkersInfoCount +// --------------------------------- +// +// decoder; +// A valid decoder object. +// +// pMarkerCount; +// Populated with the number of event markers from the GPU crash dump. +// +//// DESCRIPTION; +// Query the number of DX event markers or Vulkan checkpoint markers from +// the GPU crash dump. +// +///////////////////////////////////////////////////////////////////////// +GFSDK_Aftermath_API GFSDK_Aftermath_GpuCrashDump_GetEventMarkersInfoCount( + const GFSDK_Aftermath_GpuCrashDump_Decoder decoder, + uint32_t* pMarkerCount); + +///////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_GpuCrashDump_GetEventMarkersInfo +// --------------------------------- +// +// decoder; +// A valid decoder object. +// +// markerInfoBufferCount; +// Number of elements in caller allocated array passed in 'pMarkerInfo'. +// +// pMarkerInfo; +// Pointer to caller allocated array of +// 'GFSDK_Aftermath_GpuCrashDump_EventMarkerInfo' that is filled in with +// information from the GPU crash dump. +// +//// DESCRIPTION; +// Query information about DX event markers or Vulkan checkpoint markers +// from the GPU crash dump. +// +///////////////////////////////////////////////////////////////////////// +GFSDK_Aftermath_API GFSDK_Aftermath_GpuCrashDump_GetEventMarkersInfo( + const GFSDK_Aftermath_GpuCrashDump_Decoder decoder, + const uint32_t markerInfoBufferCount, + GFSDK_Aftermath_GpuCrashDump_EventMarkerInfo* pMarkerInfo); + +///////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_GpuCrashDump_GenerateJSON +// --------------------------------- +// +// decoder; +// A valid decoder object. +// +// decoderFlags; +// Flags that define what information to include in the decoding. Bitwise OR of +// any of the flags defined in 'GFSDK_Aftermath_GpuCrashDumpDecoderFlags'. +// +// formatFlags; +// Flags controlling the formatting. Bitwise OR of any of the flags defined in +// 'GFSDK_Aftermath_GpuCrashDumpFormatterFlags'. +// +// shaderDebugInfoLookupCb; +// Callback used by the decoder to query shader debug information for mapping +// shader addresses to source or intermediate assembly line. +// +// Optional, can be NULL. +// +// Used when 'GFSDK_Aftermath_GpuCrashDumpDecoderFlags_SHADER_MAPPING_INFO' is +// set in 'decoderFlags'. +// +// shaderLookupCb; +// Callback used by the decoder to query shader information for mapping shader +// addresses to shader intermediate assembly (DXIL/SPIR-V) or source. +// +// Optional, can be NULL. +// +// Used when 'GFSDK_Aftermath_GpuCrashDumpDecoderFlags_SHADER_MAPPING_INFO' is +// set in 'decoderFlags'. +// +// shaderSourceDebugInfoLookupCb; +// Callback used by the decoder to query high-level shader debug information for +// mapping shader addresses to shader source, if the shaders used by the +// application are stripped of debug information. This lookup is done by the +// shader's DebugName, a unique identifier of the source debug information. +// +// Optional, can be NULL. +// +// Used when 'GFSDK_Aftermath_GpuCrashDumpDecoderFlags_SHADER_MAPPING_INFO' is +// set in 'decoderFlags'. +// +// For DXIL shaders DebugName is generated by the dxc compiler and is defined here: +// https://github.com/microsoft/DirectXShaderCompiler/blob/master/docs/SourceLevelDebuggingHLSL.rst#using-debug-names. +// +// The following variants of generating source shader debug information for DXIL shaders +// are supported: +// +// 1) Compile and use a full shader blob +// +// Compile the shaders with the debug information. Use the full (i.e., +// not stripped) shader binary when running the application and make it +// accessible through shaderLookupCb. In this case there is no need to +// provide 'shaderSourceDebugInfoLookupCb'. +// +// Compilation example: +// +// dxc -Zi [..] -Fo shader.bin shader.hlsl +// +// 2) Compile and strip +// +// Compile the shaders with debug information and then strip off the debug +// information. Use the stripped shader binary data when running the +// application. Make the stripped shader binary data accessible through +// shaderLookupCb. In addition, make the non-stripped shader binary data +// accessible through 'shaderSourceDebugInfoLookupCb'. +// +// Compilation example: +// +// dxc -Zi [..] -Fo full_shader.bin shader.hlsl +// dxc -dumpbin -Qstrip_debug -Fo shader.bin full_shader.bin +// +// The shader's DebugName required for implementing the +// 'shaderSourceDebugInfoLookupCb' may be extracted from the stripped or the +// non-stripped shader binary data with 'GFSDK_Aftermath_GetShaderDebugName'. +// +// 3) Compile with separate debug information (and auto-generated debug data file name) +// +// Compile the shaders with debug information and instruct the compiler to store +// the debug meta data in a separate shader debug information file. The name of +// the file generated by the compiler will match the DebugName of the shader. +// Make the shader binary data accessible through 'shaderLookupCb'. In addition, make +// the data from the compiler generated shader debug data file accessible through +// 'shaderSourceDebugInfoLookupCb'. +// +// Compilation example: +// +// dxc -Zi [..] -Fo shader.bin -Fd debugInfo\ shader.hlsl +// +// The debug data file generated by the compiler does not contain any reference to +// the shader's DebugName. It is the responsibility of the user providing the +// 'shaderSourceDebugInfoLookupCb' callback to implement a solution to lookup the +// debug data based on the name of the generated debug data file. +// +// 4) Compile with separate debug information (and user-defined debug data file name) +// +// Compile the shaders with debug information and instruct the compiler to +// store the debug meta data in a separate shader debug information file. The +// name of the file is freely chosen by the user. Make the shader binary +// data accessible through 'shaderLookupCb'. In addition, make the data from +// the compiler generated shader debug data file accessible through +// 'shaderSourceDebugInfoLookupCb'. +// +// Compilation example: +// +// dxc -Zi [..] -Fo shader.bin -Fd debugInfo\shader.dbg shader.hlsl +// +// The debug data file generated by the compiler does not contain any +// reference to the shader's DebugName. It is the responsibility of the +// user providing the 'shaderSourceDebugInfoLookupCb' callback to +// implement a solution that performs the lookup of the debug data +// based on a mapping between the shader's DebugName and the debug data +// file's name that was chosen for the compilation. The shader's +// DebugName may be extracted from the shader binary data with +// 'GFSDK_Aftermath_GetShaderDebugName'. +// +// For SPIR-V shaders the Aftermath SDK provides support for the following variants of +// generating source shader debug information: +// +// 1) Compile and use a full shader blob +// +// Compile the shaders with debug information. Use the full (i.e., not +// stripped) shader binary when running the application and make it +// accessible through 'shaderLookupCb'. In this case there is no need +// to provide 'shaderSourceDebugInfoLookupCb'. +// +// Compilation example using Vulkan SDK toolchain: +// +// glslangValidator -V -g -o ./full/shader.spv shader.vert +// +// Compilation example using the DirectX Shader Compiler: +// +// dxc -spirv -Zi [..] -Fo shader.spv shader.hlsl +// +// 2) Compile and strip +// +// Compile the shaders with debug information and then strip off the debug +// information. Use the stripped shader binary data when running the +// application. Make the stripped shader binary data accessible through +// 'shaderLookupCb'. In addition, make the non-stripped shader binary data +// accessible through 'shaderSourceDebugInfoLookupCb'. +// +// Compilation example using Vulkan SDK toolchain: +// +// glslangValidator -V -g -o ./full/shader.spv shader.vert +// spirv-remap --map all --strip-all --input full/shader.spv --output ./stripped/ +// +// Compilation example using the DirectX Shader Compiler: +// +// dxc -spirv -Zi [..] -Fo ./full/shader.spv shader.hlsl +// spirv-remap --map all --strip-all --input full/shader.spv --output ./stripped/ +// +// Then pass the content of ./full/shader.spv and ./stripped/shader.spv to +// 'GFSDK_Aftermath_GetDebugNameSpirv' to generate the debug name to use with +// 'shaderSourceDebugInfoLookupCb'. +// +// pUserData; +// User data made available in callbacks. +// +// pJsonSize; +// Populated with the size of the generated JSON data in bytes. +// +//// DESCRIPTION; +// Decode the GPU crash dump to JSON format. The decoded JSON can be later +// queried by calling 'GFSDK_Aftermath_GpuCrashDump_GetJSON'. +// +///////////////////////////////////////////////////////////////////////// +GFSDK_Aftermath_API GFSDK_Aftermath_GpuCrashDump_GenerateJSON( + const GFSDK_Aftermath_GpuCrashDump_Decoder decoder, + uint32_t decoderFlags, + uint32_t formatFlags, + PFN_GFSDK_Aftermath_ShaderDebugInfoLookupCb shaderDebugInfoLookupCb, + PFN_GFSDK_Aftermath_ShaderLookupCb shaderLookupCb, + PFN_GFSDK_Aftermath_ShaderSourceDebugInfoLookupCb shaderSourceDebugInfoLookupCb, + void* pUserData, + uint32_t* pJsonSize); + +///////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_GpuCrashDump_GetJSON +// --------------------------------- +// +// decoder; +// A valid decoder object. +// +// jsonBufferSize; +// The size of the caller allocated buffer for the JSON data in bytes. +// +// pJson; +// Caller allocated buffer populated with the JSON data (0-terminated string). +// +//// DESCRIPTION; +// Copy the JSON generated by the last call to 'GFSDK_Aftermath_GpuCrashDump_GenerateJSON' +// into a caller provided buffer. +// +///////////////////////////////////////////////////////////////////////// +GFSDK_Aftermath_API GFSDK_Aftermath_GpuCrashDump_GetJSON( + const GFSDK_Aftermath_GpuCrashDump_Decoder decoder, + const uint32_t jsonBufferSize, + char* pJson); + +///////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_GetShaderDebugInfoIdentifier +// --------------------------------- +// +// apiVersion; +// Must be set to 'GFSDK_Aftermath_Version_API'. Used for checking against +// library version. +// +// pShaderDebugInfo; +// Pointer to shader debug information data captured in a +// 'GFSDK_Aftermath_ShaderDebugInfoCb' callback. +// +// shaderDebugInfoSize; +// Size in bytes of the shader debug information data. +// +// pIdentifier; +// Pointer to a 'GFSDK_Aftermath_ShaderDebugInfoIdentifier' structure that will +// receive the result. +// +//// DESCRIPTION; +// Read the shader debug information identifier from shader debug information. +// The shader debug information identifier is required when implementing the +// 'GFSDK_Aftermath_ShaderDebugInfoLookupCb' callback. +// +///////////////////////////////////////////////////////////////////////// +GFSDK_Aftermath_API GFSDK_Aftermath_GetShaderDebugInfoIdentifier( + GFSDK_Aftermath_Version apiVersion, + const void* pShaderDebugInfo, + const uint32_t shaderDebugInfoSize, + GFSDK_Aftermath_ShaderDebugInfoIdentifier* pIdentifier); + +///////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_GetShaderHash +// --------------------------------- +// +// apiVersion; +// Must be set to 'GFSDK_Aftermath_Version_API'. Used for checking against +// library version. +// +// pShader; +// The binary shader blob for which to compute the identifier. +// +// pShaderHash; +// Pointer to a 'GFSDK_Aftermath_ShaderBinaryHash' structure that will receive +// the computed shader hash. +// +//// DESCRIPTION; +// Computes a shader hash uniquely identifying the provided DXBC shader binary. +// This is, for example, required for comparison in the shader binary lookup by +// 'GFSDK_Aftermath_ShaderLookupCb' or for matching a +// 'GFSDK_Aftermath_GpuCrashDump_ShaderInfo' with a shader binary using +// 'GFSDK_Aftermath_GetShaderHashForShaderInfo'. +// +///////////////////////////////////////////////////////////////////////// +#if defined(__d3d12_h__) +GFSDK_Aftermath_API GFSDK_Aftermath_GetShaderHash( + GFSDK_Aftermath_Version apiVersion, + const D3D12_SHADER_BYTECODE* pShader, + GFSDK_Aftermath_ShaderBinaryHash* pShaderHash); +#endif + +///////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_GetShaderHashSpirv +// --------------------------------- +// +// apiVersion; +// Must be set to 'GFSDK_Aftermath_Version_API'. Used for checking against +// library version. +// +// pShader; +// The SPIR-V shader binary for which to compute the identifier. +// +// pShaderHash; +// Pointer to a 'GFSDK_Aftermath_ShaderBinaryHash' structure that will receive +// the computed shader hash. +// +//// DESCRIPTION; +// Computes a shader hash uniquely identifying the provided SPIR-V shader +// binary. This is, for example, required for comparison in the shader binary +// lookup by 'GFSDK_Aftermath_ShaderLookupCb' or for matching a +// 'GFSDK_Aftermath_GpuCrashDump_ShaderInfo' with a shader binary using +// 'GFSDK_Aftermath_GetShaderHashForShaderInfo'. +// +///////////////////////////////////////////////////////////////////////// +#if defined(VULKAN_H_) +GFSDK_Aftermath_API GFSDK_Aftermath_GetShaderHashSpirv( + GFSDK_Aftermath_Version apiVersion, + const GFSDK_Aftermath_SpirvCode *pShader, + GFSDK_Aftermath_ShaderBinaryHash* pShaderHash); +#endif + +///////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_GetShaderDebugName +// --------------------------------- +// +// apiVersion; +// Must be set to 'GFSDK_Aftermath_Version_API'. Used for checking against +// library version. +// +// pShader; +// The binary shader data blob from which to extract the DebugName. +// +// pShaderDebugName; +// Pointer to a 'GFSDK_Aftermath_ShaderDebugName' structure that will receive +// the generated DebugName. +// +//// DESCRIPTION; +// Extracts the shader's DebugName (if available) from the provided DXBC shader +// binary. This is, for example, required for comparison in the shader debug +// data lookup by 'GFSDK_Aftermath_ShaderSourceDebugInfoLookupCb'. For more +// information about shader debug names please read: +// https://github.com/microsoft/DirectXShaderCompiler/blob/master/docs/SourceLevelDebuggingHLSL.rst#using-debug-names. +// +///////////////////////////////////////////////////////////////////////// +#if defined(__d3d12_h__) +GFSDK_Aftermath_API GFSDK_Aftermath_GetShaderDebugName( + GFSDK_Aftermath_Version apiVersion, + const D3D12_SHADER_BYTECODE* pShader, + GFSDK_Aftermath_ShaderDebugName* pShaderDebugName); +#endif + +///////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_GetShaderDebugNameSpirv +// --------------------------------- +// +// apiVersion; +// Must be set to 'GFSDK_Aftermath_Version_API'. Used for checking against +// library version. +// +// pShader; +// The not-stripped SPIR-V binary shader data of the shader pair for which to +// generate the DebugName. +// +// pStrippedShader; +// The stripped SPIR-V binary shader data of the shader pair for which to +// generate the DebugName. +// +// pShaderDebugName; +// Pointer to a 'GFSDK_Aftermath_ShaderDebugName' structure that will receive +// the generated DebugName. +// +//// DESCRIPTION; +// Generates a shader DebugName from the provided pair of SPIR-V shader binary +// data. This is, for example, required for comparison in the shader debug data +// lookup by 'GFSDK_Aftermath_ShaderSourceDebugInfoLookupCb'. For more +// information about how to generate the pair of shader binaries, see the +// description of 'GFSDK_Aftermath_GpuCrashDump_GenerateJSON'. +// +///////////////////////////////////////////////////////////////////////// +#if defined(VULKAN_H_) +GFSDK_Aftermath_API GFSDK_Aftermath_GetShaderDebugNameSpirv( + GFSDK_Aftermath_Version apiVersion, + const GFSDK_Aftermath_SpirvCode *pShader, + const GFSDK_Aftermath_SpirvCode *pStrippedShader, + GFSDK_Aftermath_ShaderDebugName* pShaderDebugName); +#endif + +///////////////////////////////////////////////////////////////////////// +// GFSDK_Aftermath_GetShaderHashForShaderInfo +// --------------------------------- +// +// decoder; +// A valid decoder object. +// +// pShaderInfo; +// Pointer to 'GFSDK_Aftermath_GpuCrashDump_ShaderInfo' for which to generate +// the 'GFSDK_Aftermath_ShaderBinaryHash'. +// +// pShaderHash; +// Pointer to a 'GFSDK_Aftermath_ShaderBinaryHash' structure that will receive +// the computed shader hash. +// +//// DESCRIPTION; +// Computes a shader hash for the provided shader info. This is, for example, +// useful for matching against the 'GFSDK_Aftermath_ShaderBinaryHash' values +// calculated for shader binaries using 'GFSDK_Aftermath_GetShaderHash' or +// 'GFSDK_Aftermath_GetShaderHashSpirv'. +// +///////////////////////////////////////////////////////////////////////// +GFSDK_Aftermath_API GFSDK_Aftermath_GetShaderHashForShaderInfo( + const GFSDK_Aftermath_GpuCrashDump_Decoder decoder, + const GFSDK_Aftermath_GpuCrashDump_ShaderInfo* pShaderInfo, + GFSDK_Aftermath_ShaderBinaryHash* pShaderHash); + +///////////////////////////////////////////////////////////////////////// +// +// Function pointer definitions - if dynamic loading is preferred. +// +///////////////////////////////////////////////////////////////////////// + +GFSDK_Aftermath_PFN(GFSDK_AFTERMATH_CALL *PFN_GFSDK_Aftermath_GpuCrashDump_CreateDecoder)(GFSDK_Aftermath_Version apiVersion, const void* pGpuCrashDump, const uint32_t gpuCrashDumpSize, GFSDK_Aftermath_GpuCrashDump_Decoder* pDecoder); +GFSDK_Aftermath_PFN(GFSDK_AFTERMATH_CALL *PFN_GFSDK_Aftermath_GpuCrashDump_DestroyDecoder)(const GFSDK_Aftermath_GpuCrashDump_Decoder decoder); +GFSDK_Aftermath_PFN(GFSDK_AFTERMATH_CALL *PFN_GFSDK_Aftermath_GpuCrashDump_GetBaseInfo)(const GFSDK_Aftermath_GpuCrashDump_Decoder decoder, GFSDK_Aftermath_GpuCrashDump_BaseInfo* pBaseInfo); +GFSDK_Aftermath_PFN(GFSDK_AFTERMATH_CALL *PFN_GFSDK_Aftermath_GpuCrashDump_GetDescriptionSize)(const GFSDK_Aftermath_GpuCrashDump_Decoder decoder, const uint32_t key, uint32_t* pValueSize); +GFSDK_Aftermath_PFN(GFSDK_AFTERMATH_CALL *PFN_GFSDK_Aftermath_GpuCrashDump_GetDescription)(const GFSDK_Aftermath_GpuCrashDump_Decoder decoder, const uint32_t key, const uint32_t valueBufferSize, char* pValue); +GFSDK_Aftermath_PFN(GFSDK_AFTERMATH_CALL *PFN_GFSDK_Aftermath_GpuCrashDump_GetDeviceInfo)(const GFSDK_Aftermath_GpuCrashDump_Decoder decoder, GFSDK_Aftermath_GpuCrashDump_DeviceInfo* pDeviceInfo); +GFSDK_Aftermath_PFN(GFSDK_AFTERMATH_CALL *PFN_GFSDK_Aftermath_GpuCrashDump_GetSystemInfo)(const GFSDK_Aftermath_GpuCrashDump_Decoder decoder, GFSDK_Aftermath_GpuCrashDump_SystemInfo* pSystemInfo); +GFSDK_Aftermath_PFN(GFSDK_AFTERMATH_CALL *PFN_GFSDK_Aftermath_GpuCrashDump_GetGpuInfoCount)(const GFSDK_Aftermath_GpuCrashDump_Decoder decoder, uint32_t* pGpuCount); +GFSDK_Aftermath_PFN(GFSDK_AFTERMATH_CALL *PFN_GFSDK_Aftermath_GpuCrashDump_GetGpuInfo)(const GFSDK_Aftermath_GpuCrashDump_Decoder decoder, const uint32_t gpuInfoBufferCount, GFSDK_Aftermath_GpuCrashDump_GpuInfo* pGpuInfo); +GFSDK_Aftermath_PFN(GFSDK_AFTERMATH_CALL *PFN_GFSDK_Aftermath_GpuCrashDump_GetPageFaultInfo)(const GFSDK_Aftermath_GpuCrashDump_Decoder decoder, GFSDK_Aftermath_GpuCrashDump_PageFaultInfo* pPageFaultInfo); +GFSDK_Aftermath_PFN(GFSDK_AFTERMATH_CALL *PFN_GFSDK_Aftermath_GpuCrashDump_GetActiveShadersInfoCount)(const GFSDK_Aftermath_GpuCrashDump_Decoder decoder, uint32_t* pShaderCount); +GFSDK_Aftermath_PFN(GFSDK_AFTERMATH_CALL *PFN_GFSDK_Aftermath_GpuCrashDump_GetActiveShadersInfo)(const GFSDK_Aftermath_GpuCrashDump_Decoder decoder, const uint32_t shaderInfoBufferCount, GFSDK_Aftermath_GpuCrashDump_ShaderInfo* pShaderInfo); +GFSDK_Aftermath_PFN(GFSDK_AFTERMATH_CALL *PFN_GFSDK_Aftermath_GpuCrashDump_GetEventMarkersInfoCount)(const GFSDK_Aftermath_GpuCrashDump_Decoder decoder, const uint32_t markerInfoBufferCount); +GFSDK_Aftermath_PFN(GFSDK_AFTERMATH_CALL *PFN_GFSDK_Aftermath_GpuCrashDump_GetEventMarkersInfo)(const GFSDK_Aftermath_GpuCrashDump_Decoder decoder, const uint32_t markerInfoBufferCount, GFSDK_Aftermath_GpuCrashDump_EventMarkerInfo* pMarkerInfo); +GFSDK_Aftermath_PFN(GFSDK_AFTERMATH_CALL *PFN_GFSDK_Aftermath_GpuCrashDump_GenerateJSON)(const GFSDK_Aftermath_GpuCrashDump_Decoder decoder, uint32_t decoderFlags, uint32_t formatFlags, PFN_GFSDK_Aftermath_ShaderDebugInfoLookupCb shaderDebugInfoLookupCb, PFN_GFSDK_Aftermath_ShaderLookupCb shaderLookupCb, PFN_GFSDK_Aftermath_ShaderSourceDebugInfoLookupCb shaderSourceDebugInfoLookupCb, void* pUserData, uint32_t* pJsonSize); +GFSDK_Aftermath_PFN(GFSDK_AFTERMATH_CALL *PFN_GFSDK_Aftermath_GpuCrashDump_GetJSON)(const GFSDK_Aftermath_GpuCrashDump_Decoder decoder, const uint32_t jsonBufferSize, char* pJson); +GFSDK_Aftermath_PFN(GFSDK_AFTERMATH_CALL *PFN_GFSDK_Aftermath_GetShaderDebugInfoIdentifier)(GFSDK_Aftermath_Version apiVersion, const void* pShaderDebugInfo, const uint32_t shaderDebugInfoSize, GFSDK_Aftermath_ShaderDebugInfoIdentifier* pIdentifier); +GFSDK_Aftermath_PFN(GFSDK_AFTERMATH_CALL *PFN_GFSDK_Aftermath_GetShaderHashForShaderInfo)(const GFSDK_Aftermath_GpuCrashDump_Decoder decoder, const GFSDK_Aftermath_GpuCrashDump_ShaderInfo* pShaderInfo, GFSDK_Aftermath_ShaderBinaryHash* pShaderHash); +#if defined(__d3d12_h__) +GFSDK_Aftermath_PFN(GFSDK_AFTERMATH_CALL *PFN_GFSDK_Aftermath_GetShaderHash)(GFSDK_Aftermath_Version apiVersion, const D3D12_SHADER_BYTECODE* pShader, GFSDK_Aftermath_ShaderBinaryHash* pShaderHash); +GFSDK_Aftermath_PFN(*GPFN_GFSDK_Aftermath_GetShaderDebugName)(GFSDK_Aftermath_Version apiVersion, const D3D12_SHADER_BYTECODE* pShader, GFSDK_Aftermath_ShaderDebugName* pShaderDebugName); +#endif +#if defined(VULKAN_H_) +GFSDK_Aftermath_PFN(GFSDK_AFTERMATH_CALL *PFN_GFSDK_Aftermath_GetShaderHashSpirv)(GFSDK_Aftermath_Version apiVersion, const GFSDK_Aftermath_SpirvCode* pShader, GFSDK_Aftermath_ShaderBinaryHash* pShaderHash); +GFSDK_Aftermath_PFN(GFSDK_AFTERMATH_CALL *PFN_GFSDK_Aftermath_GetShaderDebugNameSpirv)(GFSDK_Aftermath_Version apiVersion, const GFSDK_Aftermath_SpirvCode *pShader, const GFSDK_Aftermath_SpirvCode *pStrippedShader, GFSDK_Aftermath_ShaderDebugName* pShaderDebugName); +#endif + +#ifdef __cplusplus +} // extern "C" +#endif + +#pragma pack(pop) + +#endif // GFSDK_Aftermath_CrashDumpDecoding_H + diff --git a/deps/aftermath/GFSDK_Aftermath_Lib.x64.lib b/deps/aftermath/GFSDK_Aftermath_Lib.x64.lib new file mode 100644 index 0000000000000000000000000000000000000000..e62ce4f67803c95064d6466f83fab6482e9f81c4 GIT binary patch literal 15444 zcmcIqYitzP6+Y$>5<|fOCy-#`2gVPKAM58Dr^Ju7jj=Ig*H$Qh)@yr=x3zb-<1sS+ z5u^&Gf2yid8Y!w$TDAOWn^cOT=1*HunyN}d8|p?>P`8kzP*g>jmh?x`QiYzoGqb*P z=gi~U%Sgww<2m=-@1A?^x#yfa#ZSl7vB?9uwMEveI$(V^pX!Vs4Z)V6{&OT30G<1b2VfL@U8mMgl!LSvyI@pt zQ>VRW@ENHJ+cGM9MW=Gaz^GzKr}DS(8L2X*Q*Ay#nqI>@Qhk9=4Tk_2)xV)r!!3M9 z3hvOUISjz4>AX%Y&jT)!_~?=FP&CvX=?eE99Xb+@_Vz?V{n3sIO;M*~+GKPfK3X%^ z+z8R=;PAkJy#btdXrc2D9ULC)kA^yiI-pn4B9pOkMGYyVvnK{)(+UcWPp6{9i_E_c z#%3lXsknMl7Alt8pgRbrabl}u>LoOUpl7@u+lMX?id>*eIq?4sPTGNr_3d|@S7 zMR^fL>prO@w8Js=D~f8)r7#r&lPCjiBNWqO4vo#XL@Pt%-Kv^&>Ka>HxCkjBI^AkNp!MKQ|;WqRdz_3(bVKA3E@HuSLvvdPILmi_Z3zwKbdU9$gq3KMHpjh zJjJX(;_RD6@nS29Ui>H?2f+0J-qM*vkkF3qLDCJpWJgZnVxE?e%{B0njap@byOOgB z&8J!{O?=9i6YZ&Oi!1ag+uFtpcgL6(KdI;u$Be9o92!ga>2qYZ?mYF!ZNJikquY9o zO>E_JXtrh^{Uj6>qpCxZBZK}r;P^cxYyO4mtTuU;*qWJC-#7+A@rk(ePT8rDfdg?hf zmP+A_S{~#x>|iFtuEyNArV!xeVu0%<0GC<;j<*2}?gw}u=}sv?UKzkKywC3ecs&Tv zi99T6zF7fq2Jd-Q0IwiVO*z02{_ickrz!#RYXM$EDyRoI)Bx}X-f!W32g(RH1DtOH zc)kT-E&#AthkWe05g>%WZ{z!OD0dVAp258Pz&^x=bQ_-+5g(QXAQv8njqnI;g>CQ{ z$)A5_A2*a3T>1d8Da*a=TU0hGdSD1@h=42obEY=SSqI(P^+ zzh}1ntDizVE z;~=k|<$`UOd}SpCrOc|zL;yr#(^x_-3y^=Mb7!R(YZO$4;KFgQabfpU&ZH}RjzTTF zj|-Pfg^8#JIY_4VBbt@km1s_JZ*t}mb|^bPK8SoMb`FwkP^SCpME&ow+~y>&dc9`fDOlGq89BpLWCTn=~GB_oP{c z^A>~2+yj?)Ql}S|rE4~GbOJmB-_nvbTONF$Vb%)Cw%2KPy^(1b6^-PIVU2OJS~EU1 z1-0h!w{Z&YCAX=m#o!#t9e-gh{HNsj-KreGj99;F#@QKbX~cMhXYt23%m?G%4tbq5 z@o_xpD#grPzwj6vt|8qup4Z~N9qKL^e3+H%7am2!7VOXDWB+Z3q6=&AUV=F}yLP$^ zxE!|SZ9txdG$&x*UJCiAw;qmAU}4n3xPO(^dPInhJfh^^!2KY{qr|V*nyiCUDhjB%Jhq^ zceY;ns~y_S^@`Or{bGE7Hy?~U<9p!R_M>T5g!FB|vYHRJ8s>{07=SJM@fYqaBtPg* zYhj%&eRa&0-2964stRWO{W7Yb-M;qD(}*euU7FZg8Woq4iSJjlmrxoy(Y*0frlB=7 z7CP~B1Czxo0xpG!9HQ85M&Y$N#??6lsQJAQV+zpVt4K>;k{pzQmebSDIHV}xY#NQ2& z^sEu9zIvqd2D9mh2|QwXA*)y#?7F#o@ABd^h~*InEJ6{(4UY6&wba}3{OP4HF0d^u zm&QZZ^jGBxiTRnocm5)qpN$R}_==31LZoelSm6tA=YGUi_$C^QCCfAGKH0?7O4!W5 z-YLJ%f?9TpCiZ2m0C}8?@DnF(JwXE5#b;`6GHc%KiHtmiSsfl?_OARbevQrE7GHSu z#8uQN4@%ae%Tz#W_5!ZW&#uNR z1nNxJxx5y?e)iSNtaP+}CFtlwRUV@BI-oL?uN7=d=WsiGV9Zpp-KJF<6}1Xp+&ugt zTLn+}K*bl!-GE820wP-(y?o`$0OER54i|Ye%}=E?Hp27&qW>osm`B^`3tOh}@1`>O zxirhE+}?QOFF$@TbRQ`Lm;RsHxwR!t})`}YptWi7XbSmkqXe)He>$t!-L%IUyF~rK=ya hxu_6vc&kBrr8E;Oxa|+SFIHmzmDs=KB-VB0{|Cltq?-T$ literal 0 HcmV?d00001 diff --git a/deps/aftermath/LICENSE b/deps/aftermath/LICENSE new file mode 100644 index 0000000..45c6adf --- /dev/null +++ b/deps/aftermath/LICENSE @@ -0,0 +1,601 @@ +Copyright (c) 2017-2023, NVIDIA CORPORATION. All rights reserved. + +NVIDIA CORPORATION and its licensors retain all intellectual property and proprietary +rights in and to this software, related documentation and any modifications thereto. Any +use, reproduction, disclosure or distribution of this software and related documentation +without an express license agreement from NVIDIA CORPORATION is strictly prohibited. + +LICENSE AGREEMENT FOR NVIDIA SOFTWARE DEVELOPMENT KITS + +This license agreement, including exhibits attached ("Agreement") is a legal agreement +between you and NVIDIA Corporation ("NVIDIA") and governs your use of a NVIDIA software +development kit ("SDK"). + +Each SDK has its own set of software and materials, but here is a description of the types +of items that may be included in a SDK: source code, header files, APIs, data sets and +assets (examples include images, textures, models, scenes, videos, native API input/output +files), binary software, sample code, libraries, utility programs, programming code and +documentation. + +This Agreement can be accepted only by an adult of legal age of majority in the country in +which the SDK is used. + +If you are entering into this Agreement on behalf of a company or other legal entity, you +represent that you have the legal authority to bind the entity to this Agreement, in which +case "you" will mean the entity you represent. + +If you don't have the required age or authority to accept this Agreement, or if you don't +accept all the terms and conditions of this Agreement, do not download, install or use the +SDK. + +You agree to use the SDK only for purposes that are permitted by (a) this Agreement, and +(b) any applicable law, regulation or generally accepted practices or guidelines in the +relevant jurisdictions. + +1. License. + +1.1 Grant + +Subject to the terms of this Agreement, NVIDIA hereby grants you a non-exclusive, +non-transferable license, without the right to sublicense (except as expressly provided in +this Agreement) to: + +(i) Install and use the SDK, and + +(ii) Distribute those portions of the SDK that are identified in this Agreement as +distributable, as incorporated in object code format into a software application that +meets the distribution requirements indicated in this Agreement. + +1.2 Distribution Requirements + +These are the distribution requirements for you to exercise the distribution grant: + +(i) Your application must have material additional functionality, beyond the included +portions of the SDK. + +(ii) The distributable portions of the SDK shall only be accessed by your application. + +(iii) The following notice shall be included in modifications and derivative works of +sample source code distributed: "This software contains source code provided by NVIDIA +Corporation." + +(iv) Unless a developer tool is identified in this Agreement as distributable, it is +delivered for your internal use only. + +(v) The terms under which you distribute your application must be consistent with the +terms of this Agreement, including (without limitation) terms relating to the license +grant and license restrictions and protection of NVIDIA's intellectual property rights. +Additionally, you agree that you will protect the privacy, security and legal rights of +your application users. + +(vi) You agree to notify NVIDIA in writing of any known or suspected distribution or use +of the SDK not in compliance with the requirements of this Agreement, and to enforce the +terms of your agreements with respect to distributed SDK. + +1.3 Authorized Users + +You may allow employees and contractors of your entity or of your subsidiary(ies) to +access and use the SDK from your secure network to perform work on your behalf. + +If you are an academic institution you may allow users enrolled or employed by the +academic institution to access and use the SDK from your secure network. + +You are responsible for the compliance with the terms of this Agreement by your authorized +users. If you become aware that your authorized users didn't follow the terms of this +Agreement, you agree to take reasonable steps to resolve the non-compliance and prevent +new occurrences. + +1.4 Pre-Release SDK + +The SDK versions identified as alpha, beta, preview or otherwise as pre-release, may not +be fully functional, may contain errors or design flaws, and may have reduced or different +security, privacy, accessibility, availability, and reliability standards relative to +commercial versions of NVIDIA software and materials. Use of a pre-release SDK may result +in unexpected results, loss of data, project delays or other unpredictable damage or loss. +You may use a pre-release SDK at your own risk, understanding that pre-release SDKs are +not intended for use in production or business-critical systems. NVIDIA may choose not to +make available a commercial version of any pre-release SDK. NVIDIA may also choose to +abandon development and terminate the availability of a pre-release SDK at any time +without liability. + +1.5 Updates + +NVIDIA may, at its option, make available patches, workarounds or other updates to this +SDK. Unless the updates are provided with their separate governing terms, they are deemed +part of the SDK licensed to you as provided in this Agreement. + +You agree that the form and content of the SDK that NVIDIA provides may change without +prior notice to you. While NVIDIA generally maintains compatibility between versions, +NVIDIA may in some cases make changes that introduce incompatibilities in future versions +of the SDK. + +1.6 Third Party Licenses + +The SDK may come bundled with, or otherwise include or be distributed with, third party +software licensed by a NVIDIA supplier and/or open source software provided under an open +source license. Use of third-party software is subject to the third-party license terms, +or in the absence of third party terms, the terms of this Agreement. Copyright to +third-party software is held by the copyright holders indicated in the third-party +software or license. + +1.7 Reservation of Rights + +NVIDIA reserves all rights, title and interest in and to the SDK not expressly granted to +you under this Agreement. + +2. Limitations. + +The following license limitations apply to your use of the SDK: + +2.1 You may not reverse engineer, decompile or disassemble, or remove copyright or other +proprietary notices from any portion of the SDK or copies of the SDK. + +2.2 Except as expressly provided in this Agreement, you may not copy, sell, rent, +sublicense, transfer, distribute, modify, or create derivative works of any portion of the +SDK. + +2.3 Unless you have an agreement with NVIDIA for this purpose, you may not indicate that +an application created with the SDK is sponsored or endorsed by NVIDIA. + +2.4 You may not bypass, disable, or circumvent any encryption, security, digital rights +management or authentication mechanism in the SDK. + +2.5 You may not use the SDK in any manner that would cause it to become subject to an open +source software license. As examples, licenses that require as a condition of use, +modification, and/or distribution that the SDK be (i) disclosed or distributed in source +code form; (ii) licensed for the purpose of making derivative works; or (iii) +redistributable at no charge. + +2.6 Unless you have an agreement with NVIDIA for this purpose, you may not use the SDK +with any system or application where the use or failure of the system or application can +reasonably be expected to threaten or result in personal injury, death, or catastrophic +loss. Examples include use in nuclear, avionics, navigation, military, medical, life +support or other life critical applications. NVIDIA does not design, test or manufacture +the SDK for these critical uses and NVIDIA shall not be liable to you or any third party, +in whole or in part, for any claims or damages arising from such uses. + +2.7 You agree to defend, indemnify and hold harmless NVIDIA and its affiliates, and their +respective employees, contractors, agents, officers and directors, from and against any +and all claims, damages, obligations, losses, liabilities, costs or debt, fines, +restitutions and expenses (including but not limited to attorney's fees and costs incident +to establishing the right of indemnification) arising out of or related to your use of the +SDK outside of the scope of this Agreement, or not in compliance with its terms. + +3. Ownership. + +3.1 NVIDIA or its licensors hold all rights, title and interest in and to the SDK and its +modifications and derivative works, including their respective intellectual property +rights. This SDK may include software and materials from NVIDIA's licensors, and these +licensors are intended third party beneficiaries that may enforce this Agreement with +respect to their intellectual property rights. + +3.2 You may, but don't have to, provide to NVIDIA suggestions, feature requests or other +feedback regarding the SDK, including possible enhancements or modifications to the SDK. +For any feedback that you voluntarily provide, you hereby grant NVIDIA and its affiliates +a perpetual, non-exclusive, worldwide, irrevocable license to use, reproduce, modify, +license, sublicense (through multiple tiers of sublicensees), and distribute (through +multiple tiers of distributors) it without the payment of any royalties or fees to you. +NVIDIA will use feedback at its choice. NVIDIA is constantly looking for ways to improve +its products, so you may send feedback to NVIDIA through the developer portal at +https://developer.nvidia.com. + +4. No Warranties. + +THE SDK IS PROVIDED BY NVIDIA "AS IS" AND "WITH ALL FAULTS." TO THE MAXIMUM EXTENT +PERMITTED BY LAW, NVIDIA AND ITS AFFILIATES EXPRESSLY DISCLAIM ALL WARRANTIES OF ANY KIND +OR NATURE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, ANY +WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE, NON-INFRINGEMENT, +OR THE ABSENCE OF ANY DEFECTS THEREIN, WHETHER LATENT OR PATENT. NO WARRANTY IS MADE ON +THE BASIS OF TRADE USAGE, COURSE OF DEALING OR COURSE OF TRADE. + +5. Limitations of Liability. + +TO THE MAXIMUM EXTENT PERMITTED BY LAW, NVIDIA AND ITS AFFILIATES SHALL NOT BE LIABLE FOR +ANY SPECIAL, INCIDENTAL, PUNITIVE OR CONSEQUENTIAL DAMAGES, OR ANY LOST PROFITS, LOSS OF +USE, LOSS OF DATA OR LOSS OF GOODWILL, OR THE COSTS OF PROCURING SUBSTITUTE PRODUCTS, +ARISING OUT OF OR IN CONNECTION WITH THIS AGREEMENT OR THE USE OR PERFORMANCE OF THE SDK, +WHETHER SUCH LIABILITY ARISES FROM ANY CLAIM BASED UPON BREACH OF CONTRACT, BREACH OF +WARRANTY, TORT (INCLUDING NEGLIGENCE), PRODUCT LIABILITY OR ANY OTHER CAUSE OF ACTION OR +THEORY OF LIABILITY. IN NO EVENT WILL NVIDIA'S AND ITS AFFILIATES TOTAL CUMULATIVE +LIABILITY UNDER OR ARISING OUT OF THIS AGREEMENT EXCEED US$10.00. THE NATURE OF THE +LIABILITY OR THE NUMBER OF CLAIMS OR SUITS SHALL NOT ENLARGE OR EXTEND THIS LIMIT. + +These exclusions and limitations of liability shall apply regardless if NVIDIA or its +affiliates have been advised of the possibility of such damages, and regardless of whether +a remedy fails its essential purpose. These exclusions and limitations of liability form +an essential basis of the bargain between the parties, and, absent any of these exclusions +or limitations of liability, the provisions of this Agreement, including, without +limitation, the economic terms, would be substantially different. + +6. Termination. + +6.1 This Agreement will continue to apply until terminated by either you or NVIDIA as +described below. + +6.2 If you want to terminate this Agreement, you may do so by stopping to use the SDK. + +6.3 NVIDIA may, at any time, terminate this Agreement if: (i) you fail to comply with any +term of this Agreement and the non-compliance is not fixed within thirty (30) days +following notice from NVIDIA (or immediately if you violate NVIDIA's intellectual property +rights); (ii) you commence or participate in any legal proceeding against NVIDIA with +respect to the SDK; or (iii) NVIDIA decides to no longer provide the SDK in a country or, +in NVIDIA's sole discretion, the continued use of it is no longer commercially viable. + +6.4 Upon any termination of this Agreement, you agree to promptly discontinue use of the +SDK and destroy all copies in your possession or control. Your prior distributions in +accordance with this Agreement are not affected by the termination of this Agreement. Upon +written request, you will certify in writing that you have complied with your commitments +under this section. Upon any termination of this Agreement all provisions survive except +for the licenses granted to you. + +7. General. + +If you wish to assign this Agreement or your rights and obligations, including by merger, +consolidation, dissolution or operation of law, contact NVIDIA to ask for permission. Any +attempted assignment not approved by NVIDIA in writing shall be void and of no effect. +NVIDIA may assign, delegate or transfer this Agreement and its rights and obligations, and +if to a non-affiliate you will be notified. + +You agree to cooperate with NVIDIA and provide reasonably requested information to verify +your compliance with this Agreement. + +This Agreement will be governed in all respects by the laws of the United States and of +the State of Delaware as those laws are applied to contracts entered into and performed +entirely within Delaware by Delaware residents, without regard to the conflicts of laws +principles. The United Nations Convention on Contracts for the International Sale of Goods +is specifically disclaimed. You agree to all terms of this Agreement in the English +language. + +The state or federal courts residing in Santa Clara County, California shall have +exclusive jurisdiction over any dispute or claim arising out of this Agreement. +Notwithstanding this, you agree that NVIDIA shall still be allowed to apply for injunctive +remedies or an equivalent type of urgent legal relief in any jurisdiction. + +If any court of competent jurisdiction determines that any provision of this Agreement is +illegal, invalid or unenforceable, such provision will be construed as limited to the +extent necessary to be consistent with and fully enforceable under the law and the +remaining provisions will remain in full force and effect. Unless otherwise specified, +remedies are cumulative. + +Each party acknowledges and agrees that the other is an independent contractor in the +performance of this Agreement. + +The SDK has been developed entirely at private expense and is "commercial items" +consisting of "commercial computer software" and "commercial computer software +documentation" provided with RESTRICTED RIGHTS. Use, duplication or disclosure by the U.S. +Government or a U.S. Government subcontractor is subject to the restrictions in this +Agreement pursuant to DFARS 227.7202-3(a) or as set forth in subparagraphs (b)(1) and (2) +of the Commercial Computer Software - Restricted Rights clause at FAR 52.227-19, as +applicable. Contractor/manufacturer is NVIDIA, 2788 San Tomas Expressway, Santa Clara, CA +95051. + +The SDK is subject to United States export laws and regulations. You agree that you will +not ship, transfer or export the SDK into any country, or use the SDK in any manner, +prohibited by the United States Bureau of Industry and Security or economic sanctions +regulations administered by the U.S. Department of Treasury's Office of Foreign Assets +Control (OFAC), or any applicable export laws, restrictions or regulations. These laws +include restrictions on destinations, end users and end use. By accepting this Agreement, +you confirm that you are not a resident or citizen of any country currently embargoed by +the U.S. and that you are not otherwise prohibited from receiving the SDK. + +Any notice delivered by NVIDIA to you under this Agreement will be delivered via mail, +email or fax. You agree that any notices that NVIDIA sends you electronically will satisfy +any legal communication requirements. Please direct your legal notices or other +correspondence to NVIDIA Corporation, 2788 San Tomas Expressway, Santa Clara, California +95051, United States of America, Attention: Legal Department. + +This Agreement and any exhibits incorporated into this Agreement constitute the entire +agreement of the parties with respect to the subject matter of this Agreement and +supersede all prior negotiations or documentation exchanged between the parties relating +to this SDK license. Any additional and/or conflicting terms on documents issued by you +are null, void, and invalid. Any amendment or waiver under this Agreement shall be in +writing and signed by representatives of both parties. + +(v. July 22, 2019) + +NSIGHT AFTERMATH SUPPLEMENT TO SOFTWARE LICENSE AGREEMENT FOR NVIDIA SOFTWARE DEVELOPMENT +KITS + +The terms in this supplement govern your use of the NVIDIA Nsight Aftermath SDK under the +terms of your license agreement ("Agreement") as modified by this supplement. Capitalized +terms used but not defined below have the meaning assigned to them in the Agreement. + +This supplement is an exhibit to the Agreement and is incorporated as an integral part of +the Agreement. In the event of conflict between the terms in this supplement and the terms +in the Agreement, the terms in this supplement govern. + +1. Distribution. + +The following portions of the SDK are distributable under the Agreement: the .dll / .so files. + +2. Usage. + +Please read the accompanying usage guidelines document (nsight-aftermath-usage-guidelines.txt) +for information on how Nsight Aftermath is intended to be used. + +(v. October 30, 2019) + + +------------------------------------------------------------------------------------------ +------------------------------------------------------------------------------------------ + +The Nsight Aftermath SDK makes use of third-party libraries. The licensee's use of the +SDK is subject to the following additional terms and conditions: + +JSON for Modern C++ (https://nlohmann.github.io/json/) + + The class is licensed under the MIT License: + + Copyright (c) 2013-2019 Niels Lohmann + + Permission is hereby granted, free of charge, to any person obtaining a copy of this + software and associated documentation files (the "Software"), to deal in the Software + without restriction, including without limitation the rights to use, copy, modify, + merge, publish, distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be included in all copies + or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A + PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE + OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + The class contains the UTF-8 Decoder from Bjoern Hoehrmann which is licensed under the + MIT License (see above). Copyright (c) 2008-2009 Björn Hoehrmann bjoern@hoehrmann.de + + The class contains a slightly modified version of the Grisu2 algorithm from Florian + Loitsch which is licensed under the MIT License (see above). Copyright (c) 2009 + Florian Loitsch + + +FlatBuffers: Memory Efficient Serialization Library (http://google.github.io/flatbuffers/) + + Apache License Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, and distribution + as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by the copyright owner + that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all other entities that + control, are controlled by, or are under common control with that entity. For the + purposes of this definition, "control" means (i) the power, direct or indirect, to + cause the direction or management of such entity, whether by contract or otherwise, or + (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) + beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity exercising permissions + granted by this License. + + "Source" form shall mean the preferred form for making modifications, including but + not limited to software source code, documentation source, and configuration files. + + "Object" form shall mean any form resulting from mechanical transformation or + translation of a Source form, including but not limited to compiled object code, + generated documentation, and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or Object form, made + available under the License, as indicated by a copyright notice that is included in or + attached to the work (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object form, that is + based on (or derived from) the Work and for which the editorial revisions, + annotations, elaborations, or other modifications represent, as a whole, an original + work of authorship. For the purposes of this License, Derivative Works shall not + include works that remain separable from, or merely link (or bind by name) to the + interfaces of, the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including the original version of + the Work and any modifications or additions to that Work or Derivative Works thereof, + that is intentionally submitted to Licensor for inclusion in the Work by the copyright + owner or by an individual or Legal Entity authorized to submit on behalf of the + copyright owner. For the purposes of this definition, "submitted" means any form of + electronic, verbal, or written communication sent to the Licensor or its + representatives, including but not limited to communication on electronic mailing + lists, source code control systems, and issue tracking systems that are managed by, or + on behalf of, the Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise designated in + writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom + a Contribution has been received by Licensor and subsequently incorporated within the + Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of this License, + each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, + no-charge, royalty-free, irrevocable copyright license to reproduce, prepare + Derivative Works of, publicly display, publicly perform, sublicense, and distribute + the Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of this License, each + Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, + royalty-free, irrevocable (except as stated in this section) patent license to make, + have made, use, offer to sell, sell, import, and otherwise transfer the Work, where + such license applies only to those patent claims licensable by such Contributor that + are necessarily infringed by their Contribution(s) alone or by combination of their + Contribution(s) with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a cross-claim or + counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated + within the Work constitutes direct or contributory patent infringement, then any + patent licenses granted to You under this License for that Work shall terminate as of + the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative + Works thereof in any medium, with or without modifications, and in Source or Object + form, provided that You meet the following conditions: + + (a) You must give any other recipients of the Work or Derivative Works a copy of this + License; and + + (b) You must cause any modified files to carry prominent notices stating that You + changed the files; and + + (c) You must retain, in the Source form of any Derivative Works that You distribute, + all copyright, patent, trademark, and attribution notices from the Source form of the + Work, excluding those notices that do not pertain to any part of the Derivative Works; + and + + (d) If the Work includes a "NOTICE" text file as part of its distribution, then any + Derivative Works that You distribute must include a readable copy of the attribution + notices contained within such NOTICE file, excluding those notices that do not pertain + to any part of the Derivative Works, in at least one of the following places: within a + NOTICE text file distributed as part of the Derivative Works; within the Source form + or documentation, if provided along with the Derivative Works; or, within a display + generated by the Derivative Works, if and wherever such third-party notices normally + appear. The contents of the NOTICE file are for informational purposes only and do not + modify the License. You may add Your own attribution notices within Derivative Works + that You distribute, alongside or as an addendum to the NOTICE text from the Work, + provided that such additional attribution notices cannot be construed as modifying the + License. + + You may add Your own copyright statement to Your modifications and may provide + additional or different license terms and conditions for use, reproduction, or + distribution of Your modifications, or for any such Derivative Works as a whole, + provided Your use, reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, any + Contribution intentionally submitted for inclusion in the Work by You to the Licensor + shall be under the terms and conditions of this License, without any additional terms + or conditions. Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed with Licensor + regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade names, + trademarks, service marks, or product names of the Licensor, except as required for + reasonable and customary use in describing the origin of the Work and reproducing the + content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, + Licensor provides the Work (and each Contributor provides its Contributions) on an "AS + IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, + including, without limitation, any warranties or conditions of TITLE, + NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely + responsible for determining the appropriateness of using or redistributing the Work + and assume any risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, whether in tort + (including negligence), contract, or otherwise, unless required by applicable law + (such as deliberate and grossly negligent acts) or agreed to in writing, shall any + Contributor be liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a result of this + License or out of the use or inability to use the Work (including but not limited to + damages for loss of goodwill, work stoppage, computer failure or malfunction, or any + and all other commercial damages or losses), even if such Contributor has been advised + of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing the Work or + Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of + support, warranty, indemnity, or other liability obligations and/or rights consistent + with this License. However, in accepting such obligations, You may act only on Your + own behalf and on Your sole responsibility, not on behalf of any other Contributor, + and only if You agree to indemnify, defend, and hold each Contributor harmless for any + liability incurred by, or claims asserted against, such Contributor by reason of your + accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following boilerplate notice, + with the fields enclosed by brackets "[]" replaced with your own identifying + information. (Don't include the brackets!) The text should be enclosed in the + appropriate comment syntax for the file format. We also recommend that a file or class + name and description of purpose be included on the same "printed page" as the + copyright notice for easier identification within third-party archives. + + Copyright 2014 Google Inc. + + Licensed under the Apache License, Version 2.0 (the "License"); you may not use this + file except in compliance with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software distributed under + the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF + ANY KIND, either express or implied. See the License for the specific language + governing permissions and limitations under the License. + + +The LLVM Compiler Infrastructure (http://llvm.org/) + + ============================================================================== + LLVM Release License + ============================================================================== + University of Illinois/NCSA + Open Source License + + Copyright (c) 2003-2018 University of Illinois at Urbana-Champaign. + All rights reserved. + + Developed by: + + LLVM Team + + University of Illinois at Urbana-Champaign + + http://llvm.org + + Permission is hereby granted, free of charge, to any person obtaining a copy of + this software and associated documentation files (the "Software"), to deal with + the Software without restriction, including without limitation the rights to + use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies + of the Software, and to permit persons to whom the Software is furnished to do + so, subject to the following conditions: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimers. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimers in the + documentation and/or other materials provided with the distribution. + + * Neither the names of the LLVM Team, University of Illinois at + Urbana-Champaign, nor the names of its contributors may be used to + endorse or promote products derived from this Software without specific + prior written permission. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE + SOFTWARE. + + ============================================================================== + Copyrights and Licenses for Third Party Software Distributed with LLVM: + ============================================================================== + The LLVM software contains code written by third parties. Such software will + have its own individual LICENSE.TXT file in the directory in which it appears. + This file will describe the copyrights, license, and restrictions which apply + to that code. + + The disclaimer of warranty in the University of Illinois Open Source License + applies to all code in the LLVM Distribution, and nothing in any of the + other licenses gives permission to use the names of the LLVM Team or the + University of Illinois to endorse or promote products derived from this + Software. + + The following pieces of software have additional or alternate copyrights, + licenses, and/or restrictions: + + Program Directory + ------- --------- + Google Test llvm/utils/unittest/googletest + OpenBSD regex llvm/lib/Support/{reg*, COPYRIGHT.regex} + pyyaml tests llvm/test/YAMLParser/{*.data, LICENSE.TXT} + ARM contributions llvm/lib/Target/ARM/LICENSE.TXT + md5 contributions llvm/lib/Support/MD5.cpp llvm/include/llvm/Support/MD5.h + diff --git a/deps/imgui/CMakeLists.txt b/deps/imgui/CMakeLists.txt index 544264a..13d0ca6 100644 --- a/deps/imgui/CMakeLists.txt +++ b/deps/imgui/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.17) -project(ImGui LANGUAGES CXX) +project(imgui LANGUAGES CXX) set(SOURCES_IMGUI "imgui.cpp" @@ -15,12 +15,12 @@ set(SOURCES_IMGUI "imstb_truetype.h" ) -add_library(ImGui STATIC ${SOURCES_IMGUI}) +add_library(imgui STATIC ${SOURCES_IMGUI}) -target_include_directories(ImGui PRIVATE ${RPP_INCLUDE_DIRS}) +target_include_directories(imgui PRIVATE ${RPP_INCLUDE_DIRS}) if(MSVC) - target_compile_definitions(ImGui + target_compile_definitions(imgui PRIVATE WIN32_LEAN_AND_MEAN NOMINMAX _HAS_EXCEPTIONS=0 $<$:> @@ -31,9 +31,9 @@ if(MSVC) string(REPLACE "/GR" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) - target_compile_options(ImGui PRIVATE /arch:AVX2 /MP /W4 /GR- /GS- /EHa- /wd4201) + target_compile_options(imgui PRIVATE /arch:AVX2 /MP /W4 /GR- /GS- /EHa- /wd4201) else() - target_compile_options(ImGui PRIVATE -mavx2 -Wall -Wextra -fno-exceptions -fno-rtti) + target_compile_options(imgui PRIVATE -mavx2 -Wall -Wextra -fno-exceptions -fno-rtti) endif() -set_target_properties(ImGui PROPERTIES CXX_STANDARD 20 CXX_EXTENSIONS OFF) +set_target_properties(imgui PROPERTIES CXX_STANDARD 20 CXX_EXTENSIONS OFF) diff --git a/rvk/CMakeLists.txt b/rvk/CMakeLists.txt index cf1d7fd..630529e 100644 --- a/rvk/CMakeLists.txt +++ b/rvk/CMakeLists.txt @@ -59,7 +59,7 @@ set_property(TARGET rvk PROPERTY INTERPROCEDURAL_OPTIMIZATION $<$:TRUE> $<$:TRUE>) -target_link_libraries(rvk PRIVATE rpp volk ImGui) +target_link_libraries(rvk PRIVATE rpp volk imgui) target_include_directories(rvk PRIVATE "../deps/" ${RPP_INCLUDE_DIRS}) if(MSVC) @@ -80,6 +80,14 @@ if(MSVC) target_link_options(rvk PRIVATE /NODEFAULTLIB:MSVCRT) target_compile_options(rvk PRIVATE /MP /W4 /GR- /GS- /EHa- /wd4201) + if(RVK_NV_AFTERMATH) + target_compile_definitions(rvk PRIVATE NV_AFTERMATH) + target_link_libraries(rvk PRIVATE "${PROJECT_SOURCE_DIR}/../deps/aftermath/GFSDK_Aftermath_Lib.x64.lib") + add_custom_command(TARGET rvk POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + "${PROJECT_SOURCE_DIR}/../deps/aftermath/GFSDK_Aftermath_Lib.x64.dll" + ${CMAKE_BINARY_DIR}) + endif() elseif(CLANG) if(CLANG_VERSION_MAJOR LESS 17) message(FATAL_ERROR "Unsupported Clang version: only 17+ is supported.") diff --git a/rvk/fwd.h b/rvk/fwd.h index 57c1c2b..80780b4 100644 --- a/rvk/fwd.h +++ b/rvk/fwd.h @@ -8,6 +8,7 @@ #include #include +#ifdef RPP_DEBUG_BUILD #define RVK_CHECK(f) \ do { \ VkResult _vk_res = (f); \ @@ -16,6 +17,9 @@ die("RVK_CHECK: %", describe(_vk_res)); \ } \ } while(0) +#else +#define RVK_CHECK(f) (f) +#endif namespace rvk { diff --git a/rvk/instance.cpp b/rvk/instance.cpp index 80a2086..ececda5 100644 --- a/rvk/instance.cpp +++ b/rvk/instance.cpp @@ -4,8 +4,64 @@ #include "device.h" #include "instance.h" +#ifdef NV_AFTERMATH +#include +#include +#endif + namespace rvk::impl { +#ifdef NV_AFTERMATH +namespace aftermath { + +#define AFTERMATH_CHECK(f) \ + do { \ + GFSDK_Aftermath_Result _af_res = (f); \ + if(!GFSDK_Aftermath_SUCCEED(_af_res)) { \ + RPP_DEBUG_BREAK; \ + die("AFTERMATH_CHECK: %", aftermath::describe(_af_res)); \ + } \ + } while(0) + +String_View describe(GFSDK_Aftermath_Result result) { + switch(result) { + case GFSDK_Aftermath_Result_FAIL_DriverVersionNotSupported: + return "Unsupported driver version - requires an NVIDIA R495 display driver or newer."_v; + default: return "Unknown aftermath error."_v; + } +} + +void crash_dump_callback(const void* dump, u32 dump_size, void*) { + warn("[aftermath] Crash dump received, size %.", dump_size); + Region(R) { + static u64 count = 0; + auto filename = format>("gpu-dump-%.nv-gpudmp"_v, count++); + static_cast(Files::write( + filename.view(), Slice{reinterpret_cast(const_cast(dump)), dump_size})); + } +} + +void shader_debug_info_callback(const void* dump, u32 debug_info_size, void*) { + info("[aftermath] Shader debug info received, size %.", debug_info_size); + Region(R) { + static u64 count = 0; + auto filename = format>("gpu-dump-%.nvdbg"_v, count++); + static_cast( + Files::write(filename.view(), Slice{reinterpret_cast(const_cast(dump)), + debug_info_size})); + } +} + +void crash_dump_desc_callback(PFN_GFSDK_Aftermath_AddGpuCrashDumpDescription, void*) { + info("[aftermath] Crash dump description requested (ignored)."); +} + +void resolve_marker_callback(const void*, const uint32_t, void*, void**, uint32_t*) { + info("[aftermath] Resolve marker requested (ignored)."); +} +} // namespace aftermath +#endif + using namespace rpp; static VkBool32 debug_callback(VkDebugUtilsMessageSeverityFlagBitsEXT sev, @@ -53,7 +109,9 @@ static VkBool32 debug_callback(VkDebugUtilsMessageSeverityFlagBitsEXT sev, obj->pObjectName ? String_View{obj->pObjectName} : "?"_v, obj->objectHandle); } +#ifdef RPP_DEBUG_BUILD if(is_error) RPP_DEBUG_BREAK; +#endif return is_error; } @@ -147,6 +205,15 @@ Instance::Instance(Slice extensions, Slice layers, die("[rvk] did not load a platform-specific surface extension!"); } +#ifdef NV_AFTERMATH + AFTERMATH_CHECK(GFSDK_Aftermath_EnableGpuCrashDumps( + GFSDK_Aftermath_Version_API, GFSDK_Aftermath_GpuCrashDumpWatchedApiFlags_Vulkan, + GFSDK_Aftermath_GpuCrashDumpFeatureFlags_DeferDebugInfoCallbacks, + aftermath::crash_dump_callback, aftermath::shader_debug_info_callback, + aftermath::crash_dump_desc_callback, aftermath::resolve_marker_callback, null)); + info("[aftermath] Loaded crash dumper."); +#endif + Profile::Time_Point end = Profile::timestamp(); info("[rvk] Created instance in %ms.", Profile::ms(end - start)); } @@ -163,6 +230,10 @@ Instance::~Instance() { info("[rvk] Destroyed surface."); } if(instance) { +#ifdef NV_AFTERMATH + GFSDK_Aftermath_DisableGpuCrashDumps(); +#endif + vkDestroyInstance(instance, null); info("[rvk] Destroyed instance."); diff --git a/rvk/rvk.cpp b/rvk/rvk.cpp index 61cd3be..8a99979 100644 --- a/rvk/rvk.cpp +++ b/rvk/rvk.cpp @@ -472,7 +472,7 @@ void shutdown() { } void reset_imgui() { - vkDeviceWaitIdle(*impl::singleton->device); + impl::singleton->wait_idle(); impl::singleton->destroy_imgui(); impl::singleton->create_imgui(); }