yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
fdf061e27
master
1//TEST:SIMPLE(filecheck=CHECK):-target glsl -profile ps_4_0 -entry main -fvk-t-shift 10 all -fvk-s-shift 100 all -fvk-u-shift 100 all -fvk-b-shift 1000 all 2 3// CHECK:layout(binding = 10) 4// CHECK-NEXT:uniform texture2D texture0_0; 5 6// CHECK:layout(binding = 100) 7// CHECK-NEXT:uniform sampler sampler0_0; 8 9// CHECK:layout(binding = 11, set = 2) 10// CHECK-NEXT:uniform texture2D texture1_0; 11 12// CHECK:layout(binding = 101, set = 2) 13// CHECK-NEXT:uniform sampler sampler1_0; 14 15// CHECK: layout(push_constant) 16// CHECK-NEXT: layout(std430) uniform 17 18// CHECK:layout(binding = 1004) 19// CHECK-NEXT:layout(std140) uniform 20 21// CHECK:layout(binding = 1003) 22// CHECK-NEXT:layout(std140) uniform 23 24// CHECK:layout(binding = 1002) 25// CHECK-NEXT:layout(std140) uniform 26 27// CHECK:layout(binding = 1001) 28// CHECK-NEXT:layout(std140) uniform 29 30// CHECK: struct GlobalParams 31// CHECK-NEXT: { 32// CHECK-NEXT: float g_value 33// CHECK-NEXT: } 34 35// CHECK:layout(binding = 1000) 36// CHECK-NEXT:layout(std140) uniform 37 38Texture2D texture0; 39SamplerState sampler0; 40 41Texture2D texture1 : register(t1, space2); 42SamplerState sampler1 : register(s1, space2); 43 44float g_value; 45 46cbuffer ConstantBufferA 47{ 48 float constantA; 49}; 50 51cbuffer ConstantBufferB 52{ 53 float constantB; 54}; 55 56cbuffer ConstantBufferC 57{ 58 float constantC; 59}; 60 61cbuffer ConstantBufferD 62{ 63 float constantD; 64}; 65 66struct StructA 67{ 68 float a; 69}; 70 71[[ vk::push_constant ]] 72StructA pushConstantA; 73 74struct PixelInput 75{ 76 float4 t : TEXCOORD0; 77}; 78 79struct PixelOutput 80{ 81 float4 color : SV_Target0; 82}; 83 84float4 use(Texture2D t, SamplerState s) { return t.SampleLevel(s, 0.0, 0.0); } 85 86PixelOutput main(PixelInput i) 87{ 88 PixelOutput o ; 89 float4 b = use(texture0, sampler0) + use(texture1, sampler1); 90 float a = pushConstantA.a + constantD + constantC + constantB + constantA + g_value + length(b); 91 o.color = float4(1, 2, 3, 4) * a; 92 return o ; 93} 94