From 1c969b9a85e2e6d6981a31bb758647fc61cf6482 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Mon, 11 Feb 2019 09:41:10 -0500 Subject: [[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. --- tests/diagnostics/single-shader-record.slang | 41 ++++++++++++++++++++++ .../single-shader-record.slang.expected | 6 ++++ 2 files changed, 47 insertions(+) create mode 100644 tests/diagnostics/single-shader-record.slang create mode 100644 tests/diagnostics/single-shader-record.slang.expected (limited to 'tests') 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 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 = { +} -- cgit v1.2.3