summaryrefslogtreecommitdiffstats
path: root/tests/diagnostics
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2019-02-11 09:41:10 -0500
committerGitHub <noreply@github.com>2019-02-11 09:41:10 -0500
commit1c969b9a85e2e6d6981a31bb758647fc61cf6482 (patch)
tree1c5df51b207c43198f360d353108666ab234cc4b /tests/diagnostics
parent9f8a92e468a626abf82d08a730e009321595da07 (diff)
[[vk::shader_record]] (#836)
* * Replaced ShaderRecordNVLayoutModifier with ShaderRecordAttribute * Allowed attributed [[vk::shader_record] and [[shader_record]] * Checking there is at most 1 ShaderRecord active * Small typo fixes * Slightly improve diagnostic. Replace expected file.
Diffstat (limited to 'tests/diagnostics')
-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 = {
+}