summaryrefslogtreecommitdiffstats
path: root/tools/gfx/vulkan
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2023-07-18 18:45:38 -0400
committerGitHub <noreply@github.com>2023-07-18 15:45:38 -0700
commit1fe5e83f3dcc8ef0efa2dd083ebdfab5d0f101a9 (patch)
tree9ea88993d0b1f5cad76c21ae3a60ed561bdc3c83 /tools/gfx/vulkan
parent4cb3eeb832b5fb29a61f2934b3daa5e42a3d6cde (diff)
nsight Aftermath crash example (#2984)
* Small fixes and improvements around reflection tool. * Make PrettyWriter printing a class. * Aftermath crash demo WIP. * Enable aftermath in test project. * Setting failCount. * Dumping out of source maps. * Improve comments. Simplify handling of compile products. * Other small fixes to aftermath example. * Added Emit SourceLocType. Track sourcemap association meaning. Improved documentation. * Small improvements. * Capture debug information for D3D11/D3D12/Vulkan. * Enable debug info. * Small improvements. * Improve aftermath example README.md.
Diffstat (limited to 'tools/gfx/vulkan')
-rw-r--r--tools/gfx/vulkan/vk-device.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/tools/gfx/vulkan/vk-device.cpp b/tools/gfx/vulkan/vk-device.cpp
index 654353d63..8f7a88886 100644
--- a/tools/gfx/vulkan/vk-device.cpp
+++ b/tools/gfx/vulkan/vk-device.cpp
@@ -18,6 +18,12 @@
#include "vk-helper-functions.h"
+#ifdef GFX_NV_AFTERMATH
+# include "GFSDK_Aftermath.h"
+# include "GFSDK_Aftermath_Defines.h"
+# include "GFSDK_Aftermath_GpuCrashDump.h"
+#endif
+
namespace gfx
{
@@ -658,6 +664,34 @@ Result DeviceImpl::initVulkanInstanceAndDevice(
m_queueFamilyIndex = m_api.findQueue(VK_QUEUE_GRAPHICS_BIT | VK_QUEUE_COMPUTE_BIT);
assert(m_queueFamilyIndex >= 0);
+#if defined(GFX_NV_AFTERMATH)
+ VkDeviceDiagnosticsConfigCreateInfoNV aftermathInfo = {};
+
+ {
+ // Enable NV_device_diagnostic_checkpoints extension to be able to
+ // use Aftermath event markers.
+ deviceExtensions.add(VK_NV_DEVICE_DIAGNOSTIC_CHECKPOINTS_EXTENSION_NAME);
+
+ // Enable NV_device_diagnostics_config extension to configure Aftermath
+ // features.
+ deviceExtensions.add(VK_NV_DEVICE_DIAGNOSTICS_CONFIG_EXTENSION_NAME);
+
+ // Set up device creation info for Aftermath feature flag configuration.
+ VkDeviceDiagnosticsConfigFlagsNV aftermathFlags =
+ VK_DEVICE_DIAGNOSTICS_CONFIG_ENABLE_AUTOMATIC_CHECKPOINTS_BIT_NV | // Enable automatic call stack checkpoints.
+ VK_DEVICE_DIAGNOSTICS_CONFIG_ENABLE_RESOURCE_TRACKING_BIT_NV | // Enable tracking of resources.
+ VK_DEVICE_DIAGNOSTICS_CONFIG_ENABLE_SHADER_DEBUG_INFO_BIT_NV; // Generate debug information for shaders.
+ // Not available on the version of Vulkan currently building with.
+ //VK_DEVICE_DIAGNOSTICS_CONFIG_ENABLE_SHADER_ERROR_REPORTING_BIT_NV; // Enable additional runtime shader error reporting.
+
+ aftermathInfo.sType = VK_STRUCTURE_TYPE_DEVICE_DIAGNOSTICS_CONFIG_CREATE_INFO_NV;
+ aftermathInfo.flags = aftermathFlags;
+
+ aftermathInfo.pNext = deviceCreateInfo.pNext;
+ deviceCreateInfo.pNext = &aftermathInfo;
+ }
+#endif
+
if (handles[2].handleValue == 0)
{
float queuePriority = 0.0f;