yum-mirror/slang

Making it easier to work with shaders

git clone https://git.yummers.dev/yum-mirror/slang

ArielG-NVImplement HLSL resource bindings and default type `float4` to `SubpassInput<T>` (#4462)e49419b06

master
1.1 KiB32 linesraw
1//TEST:SIMPLE(filecheck=CHECK_GLSL): -target glsl -stage fragment -entry main -allow-glsl
2//TEST:SIMPLE(filecheck=CHECK_SPV): -target spirv -emit-spirv-directly -stage fragment -entry main -allow-glsl
3//TEST:SIMPLE(filecheck=CHECK_HLSL): -target hlsl -stage fragment -entry main -allow-glsl
4
5// CHECK_SPV-DAG: OpEntryPoint
6// CHECK_SPV-DAG: InputAttachmentIndex 3
7// CHECK_SPV-DAG: InputAttachmentIndex
8
9// CHECK_GLSL-DAG: void main()
10// CHECK_GLSL-DAG: input_attachment_index = 3
11// CHECK_GLSL-DAG: input_attachment_index
12
13// CHECK_HLSL-DAG: main()
14// CHECK_HLSL-DAG: [vk::input_attachment_index(3)]
15// CHECK_HLSL-DAG: vk::input_attachment_index
16[[vk::input_attachment_index(3)]] SubpassInput subpassHLSL1;
17SubpassInput subpassHLSL2;
18
19RWTexture2D<float4> t;
20
21layout (location = 0) out vec4 outColor;
22
23void main() {
24// CHECK_SPV-COUNT-2: OpImageRead
25// CHECK_GLSL-COUNT-2: subpassLoad
26// CHECK_HLSL-COUNT-2: SubpassLoad
27    outColor = vec4(true
28        && subpassHLSL1.SubpassLoad() == vec4(1)
29        && subpassHLSL2.SubpassLoad() == vec4(1)
30        && t.Load(int2(0,0)) != float4(0,0,0,0)
31    );
32}