yum-mirror/slang

Making it easier to work with shaders

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

Jay KwakEnable WGSL tests that works for Metal related to Semantics (#5816)f0b991415

master
1.7 KiB62 linesraw
1//TEST:SIMPLE(filecheck=METAL1): -target metal -stage vertex -entry vertexMain1
2//TEST:SIMPLE(filecheck=METALLIB1): -target metallib -stage vertex -entry vertexMain1
3//TEST:SIMPLE(filecheck=METAL2): -target metal -stage vertex -entry vertexMain2
4//TEST:SIMPLE(filecheck=METALLIB2): -target metallib -stage vertex -entry vertexMain2
5
6//TEST:SIMPLE(filecheck=WGSL1): -target wgsl -stage vertex -entry vertexMain1
7//TEST:SIMPLE(filecheck=WGSL2): -target wgsl -stage vertex -entry vertexMain2
8//TEST:SIMPLE(filecheck=WGSLSPIRV1): -target wgsl-spirv-asm -stage vertex -entry vertexMain1
9//TEST:SIMPLE(filecheck=WGSLSPIRV2): -target wgsl-spirv-asm -stage vertex -entry vertexMain2
10
11//METALLIB1: @vertexMain1
12//METAL1-DAG: attribute(0)
13//METAL1-DAG: attribute(1)
14//METAL1-NOT: attribute(2)
15
16//METALLIB2: @vertexMain2
17//METAL2-DAG: attribute(0)
18//METAL2-DAG: attribute(1)
19//METAL2-DAG: attribute(2)
20//METAL2-NOT: attribute(3)
21
22//WGSLSPIRV1: %vertexMain1 = OpFunction %void None
23//WGSL1-DAG: @location(0) position
24//WGSL1-DAG: @location(1) color
25//WGSL1-NOT: @location(2)
26
27//WGSLSPIRV2: %vertexMain2 = OpFunction %void None
28//WGSL2-DAG: @location(0) uv
29//WGSL2-DAG: @location(1) position
30//WGSL2-DAG: @location(2) color
31//WGSL2-NOT: @location(3)
32
33struct SharedStruct
34{
35    float4 position;
36    float4 color;
37};
38
39struct VertexStageInput
40{
41	SharedStruct assembledVertex	: CoarseVertex;
42};
43
44float4 vertexMain1(VertexStageInput vertex)
45{
46	return vertex.assembledVertex.position;
47}
48
49struct sharedStructWrapper
50{
51    float2 uv;
52    SharedStruct sharedData;
53};
54struct VertexStageInput2
55{
56	sharedStructWrapper assembledVertex	: CoarseVertex;
57};
58
59float4 vertexMain2(VertexStageInput2 vertex)
60{
61	return vertex.assembledVertex.sharedData.position;
62}