summaryrefslogtreecommitdiff
path: root/tools/gfx
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2021-07-08 13:55:21 -0700
committerGitHub <noreply@github.com>2021-07-08 13:55:21 -0700
commitaba2731f0427a04a119a59567e6715ba4034920a (patch)
treeb5b127f776db65c7154c31a41f1e91eaeb738503 /tools/gfx
parent09950676b3f73bb9967aea183d27a30d63098475 (diff)
Allow render-test to run inline ray tracing tests. (#1903)
* Update VS projects to 2019. * Empty commit to trigger build * Implement gfx inline ray tracing on D3D12. * Allow render-test to run inline ray tracing tests. Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'tools/gfx')
-rw-r--r--tools/gfx/d3d12/render-d3d12.cpp16
-rw-r--r--tools/gfx/debug-layer.cpp35
-rw-r--r--tools/gfx/vulkan/render-vk.cpp1
-rw-r--r--tools/gfx/vulkan/vk-util.cpp3
4 files changed, 54 insertions, 1 deletions
diff --git a/tools/gfx/d3d12/render-d3d12.cpp b/tools/gfx/d3d12/render-d3d12.cpp
index 277491ccd..e85fa84a3 100644
--- a/tools/gfx/d3d12/render-d3d12.cpp
+++ b/tools/gfx/d3d12/render-d3d12.cpp
@@ -4316,6 +4316,22 @@ Result D3D12Device::initialize(const Desc& desc)
auto minPrecisionSupport = options.MinPrecisionSupport;
}
}
+ // Check ray tracing support
+ {
+ D3D12_FEATURE_DATA_D3D12_OPTIONS5 options;
+ if (SLANG_SUCCEEDED(m_device->CheckFeatureSupport(
+ D3D12_FEATURE_D3D12_OPTIONS5, &options, sizeof(options))))
+ {
+ if (options.RaytracingTier != D3D12_RAYTRACING_TIER_NOT_SUPPORTED)
+ {
+ m_features.add("ray-tracing");
+ }
+ if (options.RaytracingTier >= D3D12_RAYTRACING_TIER_1_1)
+ {
+ m_features.add("ray-query");
+ }
+ }
+ }
}
m_desc = desc;
diff --git a/tools/gfx/debug-layer.cpp b/tools/gfx/debug-layer.cpp
index 77dd8543e..61ec856e9 100644
--- a/tools/gfx/debug-layer.cpp
+++ b/tools/gfx/debug-layer.cpp
@@ -228,7 +228,7 @@ void validateAccelerationStructureBuildInputs(
default:
GFX_DIAGNOSE_ERROR(
"Unsupported IAccelerationStructure::TriangleDesc::indexFormat. Valid "
- "values are R_UInt32 or R_UInt16.");
+ "values are Unknown, R_UInt32 or R_UInt16.");
}
if (!buildInputs.geometryDescs[i].content.triangles.indexData)
{
@@ -237,6 +237,39 @@ void validateAccelerationStructureBuildInputs(
"IAccelerationStructure::TriangleDesc::indexCount is not 0");
}
}
+ if (buildInputs.geometryDescs[i].content.triangles.indexFormat != Format::Unknown)
+ {
+ if (buildInputs.geometryDescs[i].content.triangles.indexCount == 0)
+ {
+ GFX_DIAGNOSE_ERROR(
+ "IAccelerationStructure::TriangleDesc::indexCount cannot be 0 if "
+ "IAccelerationStructure::TriangleDesc::indexFormat is not Format::Unknown");
+ }
+ if (buildInputs.geometryDescs[i].content.triangles.indexData == 0)
+ {
+ GFX_DIAGNOSE_ERROR(
+ "IAccelerationStructure::TriangleDesc::indexData cannot be null if "
+ "IAccelerationStructure::TriangleDesc::indexFormat is not "
+ "Format::Unknown");
+ }
+ }
+ else
+ {
+ if (buildInputs.geometryDescs[i].content.triangles.indexCount != 0)
+ {
+ GFX_DIAGNOSE_ERROR(
+ "IAccelerationStructure::TriangleDesc::indexCount must be 0 if "
+ "IAccelerationStructure::TriangleDesc::indexFormat is "
+ "Format::Unknown");
+ }
+ if (buildInputs.geometryDescs[i].content.triangles.indexData != 0)
+ {
+ GFX_DIAGNOSE_ERROR(
+ "IAccelerationStructure::TriangleDesc::indexData must be null if "
+ "IAccelerationStructure::TriangleDesc::indexFormat is "
+ "Format::Unknown");
+ }
+ }
if (!buildInputs.geometryDescs[i].content.triangles.vertexData)
{
GFX_DIAGNOSE_ERROR(
diff --git a/tools/gfx/vulkan/render-vk.cpp b/tools/gfx/vulkan/render-vk.cpp
index 90bd49868..0e3640d1f 100644
--- a/tools/gfx/vulkan/render-vk.cpp
+++ b/tools/gfx/vulkan/render-vk.cpp
@@ -5552,6 +5552,7 @@ Result VKDevice::initVulkanInstanceAndDevice(bool useValidationLayer)
deviceCreateInfo.pNext = &rayQueryFeatures;
deviceExtensions.add(VK_KHR_RAY_QUERY_EXTENSION_NAME);
m_features.add("ray-query");
+ m_features.add("ray-tracing");
}
if (bufferDeviceAddressFeatures.bufferDeviceAddress)
diff --git a/tools/gfx/vulkan/vk-util.cpp b/tools/gfx/vulkan/vk-util.cpp
index c138254c0..56664d9e4 100644
--- a/tools/gfx/vulkan/vk-util.cpp
+++ b/tools/gfx/vulkan/vk-util.cpp
@@ -262,6 +262,9 @@ Result AccelerationStructureBuildGeometryInfoBuilder::build(
case Format::R_UInt16:
vkGeomData.triangles.indexType = VK_INDEX_TYPE_UINT16;
break;
+ case Format::Unknown:
+ vkGeomData.triangles.indexType = VK_INDEX_TYPE_NONE_KHR;
+ break;
default:
debugCallback->handleMessage(
DebugMessageType::Error,