yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
80ddf4027
master
1//TEST:SIMPLE(filecheck=CHECK16): -target spirv -profile spirv_1_3 -DIN_HALF 2//TEST:SIMPLE(filecheck=CHECK16): -target spirv -profile spirv_1_3 -DIN_UINT16 3//TEST:SIMPLE(filecheck=CHECK16): -target spirv -profile spirv_1_3 -DOUT_HALF 4//TEST:SIMPLE(filecheck=CHECK): -target spirv -profile spirv_1_3 5 6//CHECK16: OpCapability StorageInputOutput16 7//CHECK-NOT: OpCapability StorageInputOutput16 8 9struct VertexInput { 10#ifdef IN_HALF 11 half4 position : POSITION; 12#else 13 float4 position : POSITION; 14#endif 15#ifdef IN_UINT16 16 uint16_t id : ID; 17#else 18 uint32_t id : ID; 19#endif 20}; 21 22#ifdef OUT_HALF 23#define OUT_TYPE half4 24#else 25#define OUT_TYPE float4 26#endif 27 28struct VertexOutput { 29 float4 position : SV_POSITION; 30 OUT_TYPE color : COLOR; 31}; 32 33[shader("vertex")] 34VertexOutput vertexMain(VertexInput input) 35{ 36 VertexOutput output; 37 output.position = float4(input.position); 38 if (input.id == 0) { 39 output.color = OUT_TYPE(input.position); 40 } else { 41 output.color = OUT_TYPE(0); 42 } 43 return output; 44}