summaryrefslogtreecommitdiffstats
path: root/tests/wgsl/entry-point-legalization.slang
blob: 454d3a775be99e91d751bfeeb14dd4a7dbc96d05 (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
// tests/wgsl/entry-point-legalization.slang
//TEST:SIMPLE(filecheck=CHK):-target wgsl-spirv-asm -stage vertex -entry vertexMain
//TEST:SIMPLE(filecheck=CHK):-target wgsl-spirv-asm -stage vertex -entry vertexMain -DREPRODUCE

//CHK: %vertexMain = OpFunction

struct AssembledVertex
{
        float3  position;
};

struct VertexStageInput
{
    AssembledVertex assembledVertex : A;
};

struct VertexStageOutput
{
        float4                  sv_position             : SV_Position;
};

float3 GetPosition(VertexStageInput i)
{
    return i.assembledVertex.position;
}

[shader("vertex")]
VertexStageOutput vertexMain(VertexStageInput input)
{
        VertexStageOutput output;

#if defined(REPRODUCE)
        float3 position = GetPosition(input);
#else
        float3 position = input.assembledVertex.position;
#endif

        output.sv_position = float4(position, 1.0);
        return output;
}