blob: 009efffa1fe7ad068395661c879821acebb4e077 (
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
|
//TEST:SIMPLE(filecheck=CHECK_SPIRV): -entry main -stage vertex -target spirv
//TEST:SIMPLE(filecheck=CHECK_GLSL): -entry main -stage vertex -target glsl
//TEST:SIMPLE(filecheck=CHECK_HLSL): -entry main -stage vertex -target hlsl
//TEST:SIMPLE(filecheck=CHECK_METAL): -entry main -stage vertex -target metal
StructuredBuffer<float> scales;
struct VSInput
{
uint vertexID : SV_VertexID;
uint instanceID : SV_InstanceID;
};
struct VSOutput
{
float4 position : SV_POSITION;
};
VSOutput main(VSInput input,
uint startVertexLocation : SV_StartVertexLocation,
uint startInstanceLocation : SV_StartInstanceLocation,
uint viewIndex : SV_ViewID)
{
VSOutput output;
float x = (float)(input.vertexID + startVertexLocation) * 0.1f;
float y = (float)(input.instanceID + startInstanceLocation) * 0.2f;
output.position = float4(x, y, 0.0f, 1.0f) * scales[viewIndex];
// CHECK_SPIRV: BuiltIn BaseVertex
// CHECK_GLSL: gl_BaseVertex
// CHECK_HLSL: SV_StartVertexLocation
// CHECK_METAL: base_vertex
// CHECK_SPIRV: BuiltIn InstanceIndex
// CHECK_GLSL: gl_BaseInstance
// CHECK_HLSL: SV_StartInstanceLocation
// CHECK_METAL: base_instance
// CHECK_SPIRV: BuiltIn ViewIndex
// CHECK_GLSL: gl_ViewIndex
// CHECK_HLSL: SV_ViewID
// CHECK_METAL: amplification_id
return output;
}
|