summaryrefslogtreecommitdiffstats
path: root/tests/diagnostics/single-shader-record.slang
blob: 0c6657f2f2adac5fa9475d638eeee2905e7ab887 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// single-shader-record.slang
//DIAGNOSTIC_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;
}