summaryrefslogtreecommitdiffstats
path: root/tests/metal/nested-struct-multi-entry-point-vertex.slang
blob: b55d943e4febda58e0130988a790430b80f58602 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//TEST:SIMPLE(filecheck=METAL1): -target metal -stage vertex -entry vertexMain1
//TEST:SIMPLE(filecheck=METALLIB1): -target metallib -stage vertex -entry vertexMain1
//TEST:SIMPLE(filecheck=METAL2): -target metal -stage vertex -entry vertexMain2
//TEST:SIMPLE(filecheck=METALLIB2): -target metallib -stage vertex -entry vertexMain2

//TEST:SIMPLE(filecheck=WGSL1): -target wgsl -stage vertex -entry vertexMain1
//TEST:SIMPLE(filecheck=WGSL2): -target wgsl -stage vertex -entry vertexMain2
//TEST:SIMPLE(filecheck=WGSLSPIRV1): -target wgsl-spirv-asm -stage vertex -entry vertexMain1
//TEST:SIMPLE(filecheck=WGSLSPIRV2): -target wgsl-spirv-asm -stage vertex -entry vertexMain2

//METALLIB1: @vertexMain1
//METAL1-DAG: attribute(0)
//METAL1-DAG: attribute(1)
//METAL1-NOT: attribute(2)

//METALLIB2: @vertexMain2
//METAL2-DAG: attribute(0)
//METAL2-DAG: attribute(1)
//METAL2-DAG: attribute(2)
//METAL2-NOT: attribute(3)

//WGSLSPIRV1: %vertexMain1 = OpFunction %void None
//WGSL1-DAG: @location(0) position
//WGSL1-DAG: @location(1) color
//WGSL1-NOT: @location(2)

//WGSLSPIRV2: %vertexMain2 = OpFunction %void None
//WGSL2-DAG: @location(0) uv
//WGSL2-DAG: @location(1) position
//WGSL2-DAG: @location(2) color
//WGSL2-NOT: @location(3)

struct SharedStruct
{
    float4 position;
    float4 color;
};

struct VertexStageInput
{
	SharedStruct assembledVertex	: CoarseVertex;
};

float4 vertexMain1(VertexStageInput vertex)
{
	return vertex.assembledVertex.position;
}

struct sharedStructWrapper
{
    float2 uv;
    SharedStruct sharedData;
};
struct VertexStageInput2
{
	sharedStructWrapper assembledVertex	: CoarseVertex;
};

float4 vertexMain2(VertexStageInput2 vertex)
{
	return vertex.assembledVertex.sharedData.position;
}