blob: 7337ad77aedad599406970c861d4e7846738b1d7 (
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
// binding-spv-storage-class.slang
//TEST:SIMPLE(filecheck=GL-SPIRV): -stage anyhit -entry main -target spirv-assembly -emit-spirv-via-glsl
//TEST:SIMPLE(filecheck=SPIRV): -stage anyhit -entry main -target spirv
// This test checks that the only the resource with Uniform, Storage or UniformConstant storage class can be decorated by binding or descriptor set.
struct MyStruct
{
float3 org;
float3 dir;
};
// ShaderRecordKHR storage class
layout(shaderRecordNV) ConstantBuffer<MyStruct> myStruct : register(b0, space1);
// Uniform buffer
ConstantBuffer<MyStruct> myStruct1 : register(b1, space1);
// Storage buffer
RWStructuredBuffer<MyStruct> myStruct2 : register(u2, space1);
// UniformConstant
Texture2D<float> texture: register(t3, space1);
SamplerState sampler: register(s4, space1);
[shader("anyhit")]
void main(out float3 pos)
{
pos = myStruct.org + myStruct.dir +
myStruct1.org + myStruct1.dir +
myStruct2[0].org + myStruct2[0].dir;
pos.x = texture.SampleLevel(
sampler,
pos.xy, 0);
}
// SPIRV-DAG: OpDecorate %myStruct1{{.*}} Binding 1
// SPIRV-DAG: OpDecorate %myStruct1{{.*}} DescriptorSet 1
// SPIRV-DAG: OpDecorate %myStruct2{{.*}} Binding 2
// SPIRV-DAG: OpDecorate %myStruct2{{.*}} DescriptorSet 1
// SPIRV-DAG: OpDecorate %texture{{.*}} Binding 3
// SPIRV-DAG: OpDecorate %texture{{.*}} DescriptorSet 1
// SPIRV-DAG: OpDecorate %sampler{{.*}} Binding 4
// SPIRV-DAG: OpDecorate %sampler{{.*}} DescriptorSet 1
//
//
// GL-SPIRV-DAG: OpDecorate %myStruct1{{.*}} DescriptorSet 1
// GL-SPIRV-DAG: OpDecorate %myStruct1{{.*}} Binding 1
// GL-SPIRV-DAG: OpDecorate %myStruct2{{.*}} DescriptorSet 1
// GL-SPIRV-DAG: OpDecorate %myStruct2{{.*}} Binding 2
// GL-SPIRV-DAG: OpDecorate %texture{{.*}} DescriptorSet 1
// GL-SPIRV-DAG: OpDecorate %texture{{.*}} Binding 3
// GL-SPIRV-DAG: OpDecorate %sampler{{.*}} DescriptorSet 1
// GL-SPIRV-DAG: OpDecorate %sampler{{.*}} Binding 4
|