yum-mirror/slang

Making it easier to work with shaders

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

Alexey PanteleevSupport for querying which parameters are used in emitted code (#2239)69cb6e8f3

master
1002 B57 linesraw
1//TEST:REFLECTION:-profile ps_4_0 -target spirv -no-codegen
2
3// Confirm that we can generate reflection info for arrays
4//
5// Note: just working with fixed-size arrays for now.
6// Unbounded arrays may require more work.
7
8layout(binding=0, set = 1) cbuffer MyConstantBuffer
9{
10	float x;
11
12	float a[10];
13
14	float y;
15}
16
17struct MyPushConstantStruct
18{
19	float pushX;
20	float pushY;
21};
22
23/* This style doesn't work
24[[vk::push_constant]] MyPushConstantStruct pushConstantBuffer;
25*/
26
27// This style does work 
28[[vk::push_constant]]ConstantBuffer<MyPushConstantStruct> pushConstantBuffer;
29 
30/* This style works too
31layout(push_constant)  
32cbuffer MyPushConstantBuffer
33{
34	float pushX;
35	float pushY;
36} 
37*/
38 
39/* This works too
40[[vk::push_constant]] cbuffer MyPushConstantBuffer
41{
42	float pushX;
43	float pushY;
44} 
45*/
46
47[[vk::binding(1,2)]] Texture2D tx;
48[gl::binding(2,3)] Texture2D ta;
49Texture2D ty;
50SamplerState sx;
51SamplerState sa[4];
52SamplerState sy;
53
54float4 main() : SV_Target
55{
56	return 0.0 + pushConstantBuffer.pushX;
57}