summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/diagnostics/single-shader-record.slang41
-rw-r--r--tests/diagnostics/single-shader-record.slang.expected6
2 files changed, 47 insertions, 0 deletions
diff --git a/tests/diagnostics/single-shader-record.slang b/tests/diagnostics/single-shader-record.slang
new file mode 100644
index 000000000..4dbf65daa
--- /dev/null
+++ b/tests/diagnostics/single-shader-record.slang
@@ -0,0 +1,41 @@
+// single-shader-record.slang
+//TEST:SIMPLE: -profile sm_6_3 -stage closesthit -entry main -target spirv-assembly
+
+struct ReflectionRay
+{
+ float4 color;
+};
+
+StructuredBuffer<float4> colors;
+
+// There are two constant buffers with shader_record attibuting so should produce and error
+
+layout(shaderRecordNV)
+cbuffer ShaderRecord2
+{
+ uint shaderRecordID2;
+}
+
+[[vk::shader_record]]
+cbuffer ShaderRecord
+{
+ uint shaderRecordID;
+}
+
+void main(
+ BuiltInTriangleIntersectionAttributes attributes,
+ in out ReflectionRay ioPayload)
+{
+ uint materialID = InstanceIndex()
+ + InstanceID()
+ + PrimitiveIndex()
+ + HitKind()
+ + shaderRecordID
+ + shaderRecordID2;
+
+ float4 color = colors[materialID];
+
+ color *= RayTCurrent() - RayTMin();
+
+ ioPayload.color = color;
+}
diff --git a/tests/diagnostics/single-shader-record.slang.expected b/tests/diagnostics/single-shader-record.slang.expected
new file mode 100644
index 000000000..1e80ed758
--- /dev/null
+++ b/tests/diagnostics/single-shader-record.slang.expected
@@ -0,0 +1,6 @@
+result code = -1
+standard error = {
+(0): error 39017: Can have at most one 'shader record' attributed constant buffer found 2.
+}
+standard output = {
+}