summaryrefslogtreecommitdiffstats
path: root/tools/gfx/vulkan
diff options
context:
space:
mode:
authorccummingsNV <ccummings@nvidia.com>2024-06-27 16:25:07 +0100
committerGitHub <noreply@github.com>2024-06-27 17:25:07 +0200
commit1d4db4224bd981b54b1e5f260a232a1183bbdcda (patch)
treebc1503383b3d5a9207d20e08b0c043e50b44526f /tools/gfx/vulkan
parent7751963f14544fdb6d606a8017f58d131c852ad2 (diff)
Ray tracing validation (#4418)
* Ray tracing validation in Vulkan * Clean up RT validation code * Remove redundant api additions * Remove redundant debug utils callback * Ray tracing validation uses extended descriptor for initialization --------- Co-authored-by: Chris Cummings <chriscummings@nvidia.com> Co-authored-by: Jay Kwak <82421531+jkwak-work@users.noreply.github.com> Co-authored-by: skallweitNV <64953474+skallweitNV@users.noreply.github.com>
Diffstat (limited to 'tools/gfx/vulkan')
-rw-r--r--tools/gfx/vulkan/vk-api.h6
-rw-r--r--tools/gfx/vulkan/vk-device.cpp35
2 files changed, 40 insertions, 1 deletions
diff --git a/tools/gfx/vulkan/vk-api.h b/tools/gfx/vulkan/vk-api.h
index ff97da448..70af62ed1 100644
--- a/tools/gfx/vulkan/vk-api.h
+++ b/tools/gfx/vulkan/vk-api.h
@@ -315,6 +315,12 @@ struct VulkanExtendedFeatureProperties
VkPhysicalDeviceVulkan12Features vulkan12Features = {
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES
};
+
+ // Ray tracing validation features
+ VkPhysicalDeviceRayTracingValidationFeaturesNV rayTracingValidationFeatures = {
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_VALIDATION_FEATURES_NV
+ };
+
};
struct VulkanApi
diff --git a/tools/gfx/vulkan/vk-device.cpp b/tools/gfx/vulkan/vk-device.cpp
index b2c14873a..bc1641aff 100644
--- a/tools/gfx/vulkan/vk-device.cpp
+++ b/tools/gfx/vulkan/vk-device.cpp
@@ -161,6 +161,22 @@ Result DeviceImpl::initVulkanInstanceAndDevice(
m_queueAllocCount = 0;
+ bool enableRayTracingValidation = false;
+
+ // Read properties from extended device descriptions
+ for (GfxIndex i = 0; i < m_desc.extendedDescCount; i++)
+ {
+ StructType stype;
+ memcpy(&stype, m_desc.extendedDescs[i], sizeof(stype));
+ switch (stype)
+ {
+ case StructType::RayTracingValidationDesc:
+ enableRayTracingValidation = static_cast<RayTracingValidationDesc*>(m_desc.extendedDescs[i])->enableRaytracingValidation;
+ break;
+ }
+ }
+
+
VkInstance instance = VK_NULL_HANDLE;
if (handles[0].handleValue == 0)
{
@@ -288,7 +304,8 @@ Result DeviceImpl::initVulkanInstanceAndDevice(
if (!instance)
return SLANG_FAIL;
SLANG_RETURN_ON_FAIL(m_api.initInstanceProcs(instance));
- if (useValidationLayer && m_api.vkCreateDebugReportCallbackEXT)
+
+ if ((enableRayTracingValidation || useValidationLayer) && m_api.vkCreateDebugReportCallbackEXT)
{
VkDebugReportFlagsEXT debugFlags =
VK_DEBUG_REPORT_ERROR_BIT_EXT | VK_DEBUG_REPORT_WARNING_BIT_EXT;
@@ -512,6 +529,10 @@ Result DeviceImpl::initVulkanInstanceAndDevice(
extendedFeatures.fragmentShadingRateFeatures.pNext = deviceFeatures2.pNext;
deviceFeatures2.pNext = &extendedFeatures.fragmentShadingRateFeatures;
+ // raytracing validation features
+ extendedFeatures.rayTracingValidationFeatures.pNext = deviceFeatures2.pNext;
+ deviceFeatures2.pNext = &extendedFeatures.rayTracingValidationFeatures;
+
if (VK_MAKE_VERSION(majorVersion, minorVersion, 0) >= VK_API_VERSION_1_2)
{
extendedFeatures.vulkan12Features.pNext = deviceFeatures2.pNext;
@@ -697,6 +718,17 @@ Result DeviceImpl::initVulkanInstanceAndDevice(
"computeDerivativeGroupLinear"
);
+ // Only enable raytracing validation if both requested and supported
+ if(enableRayTracingValidation && extendedFeatures.rayTracingValidationFeatures.rayTracingValidation)
+ {
+ SIMPLE_EXTENSION_FEATURE(
+ extendedFeatures.rayTracingValidationFeatures,
+ rayTracingValidation,
+ VK_NV_RAY_TRACING_VALIDATION_EXTENSION_NAME,
+ "ray-tracing-validation"
+ );
+ }
+
#undef SIMPLE_EXTENSION_FEATURE
if (extendedFeatures.vulkan12Features.shaderBufferInt64Atomics)
@@ -934,6 +966,7 @@ Result DeviceImpl::initVulkanInstanceAndDevice(
{
installPipelineDumpLayer(m_api);
}
+
return SLANG_OK;
}