yum-mirror/slang

Making it easier to work with shaders

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

James Helferty (NVIDIA)Add SPIRV OpCapability for 8/16bit use in storage (#8194)80ddf4027

master
1.0 KiB35 linesraw
1//TEST:SIMPLE(filecheck=CHECK8): -target spirv -profile spirv_1_3 -DCONST_UINT8
2//TEST:SIMPLE(filecheck=CHECK16): -target spirv -profile spirv_1_3 -DCONST_UINT16
3//TEST:SIMPLE(filecheck=CHECK16): -target spirv -profile spirv_1_3 -DCONST_HALF
4//TEST:SIMPLE(filecheck=CHECKBOTH): -target spirv -profile spirv_1_3 -DCONST_UINT8 -DCONST_HALF
5//TEST:SIMPLE(filecheck=CHECK): -target spirv -profile spirv_1_3
6
7//CHECK8: OpCapability StoragePushConstant8
8//CHECK16: OpCapability StoragePushConstant16
9//CHECKBOTH-DAG: OpCapability StoragePushConstant8
10//CHECKBOTH-DAG: OpCapability StoragePushConstant16
11//CHECK-NOT: OpCapability StoragePushConstant16
12
13struct PushConstants {
14#if defined(CONST_HALF)
15    half4 color;
16#else
17    float4 color;
18#endif
19#if defined(CONST_UINT8)
20    int8_t index;
21#elif defined(CONST_UINT16)
22    int16_t index;
23#else
24    int32_t index;
25#endif
26};
27
28[[vk::push_constant]]
29PushConstants pushConstants;
30
31[shader("vertex")]
32float4 vertexMain() : SV_POSITION
33{
34    return float4(pushConstants.color);
35}