summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--source/slang/slang-emit-glsl.cpp1
-rw-r--r--tests/pipeline/ray-tracing/acceleration-structure-in-compute-nv.slang20
-rw-r--r--tests/pipeline/ray-tracing/acceleration-structure-in-compute-nv.slang.glsl18
3 files changed, 39 insertions, 0 deletions
diff --git a/source/slang/slang-emit-glsl.cpp b/source/slang/slang-emit-glsl.cpp
index 86339e94b..a1142749b 100644
--- a/source/slang/slang-emit-glsl.cpp
+++ b/source/slang/slang-emit-glsl.cpp
@@ -1822,6 +1822,7 @@ void GLSLSourceEmitter::emitSimpleTypeImpl(IRType* type)
// We know that the acceleration structure type will translate
// to the one from that extension:
//
+ _requireRayTracing();
m_writer->emit("accelerationStructureNV");
}
else
diff --git a/tests/pipeline/ray-tracing/acceleration-structure-in-compute-nv.slang b/tests/pipeline/ray-tracing/acceleration-structure-in-compute-nv.slang
new file mode 100644
index 000000000..2a9d32ffa
--- /dev/null
+++ b/tests/pipeline/ray-tracing/acceleration-structure-in-compute-nv.slang
@@ -0,0 +1,20 @@
+// acceleration-structure-in-compute.slang
+
+// Test for using ray-tracing acceleration structures as a shader input
+// in non-ray-tracing shader code (that never actually traces rays)
+
+//TEST:CROSS_COMPILE:-target spirv-asm -stage compute -profile glsl_460+GL_NV_ray_tracing -entry main -DUSE_NV_EXT=1
+
+uniform RaytracingAccelerationStructure gScene;
+
+int helper(RaytracingAccelerationStructure a, int b)
+{
+ return b;
+}
+
+[shader("compute")]
+void main(
+ uniform RaytracingAccelerationStructure x)
+{
+ helper(x, 1);
+} \ No newline at end of file
diff --git a/tests/pipeline/ray-tracing/acceleration-structure-in-compute-nv.slang.glsl b/tests/pipeline/ray-tracing/acceleration-structure-in-compute-nv.slang.glsl
new file mode 100644
index 000000000..5819d657d
--- /dev/null
+++ b/tests/pipeline/ray-tracing/acceleration-structure-in-compute-nv.slang.glsl
@@ -0,0 +1,18 @@
+#version 460
+
+#extension GL_NV_ray_tracing : require
+
+int helper_0(accelerationStructureNV a_0, int b_0)
+{
+ return b_0;
+}
+
+layout(binding = 1)
+uniform accelerationStructureNV entryPointParams_x_0;
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main()
+{
+ int _S1 = helper_0(entryPointParams_x_0, 1);
+ return;
+}