summaryrefslogtreecommitdiffstats
path: root/tests/diagnostics/vk-offset.slang
blob: 5dbd821c676b493d4bf9451415224f4a321b113a (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
//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK): -target spirv -emit-spirv-directly -entry vertexMain -stage vertex

// CHECK: error 31002: attribute 'vk_offset' is not valid here
// CHECK-NEXT: [vk::offset(16)]] struct S1
// CHECK: error 31002: attribute 'vk_offset' is not valid here
// CHECK-NEXT: [vk::offset(8)]] VertexOutput output;

[[vk::offset(16)]] struct S1
{
    [[vk::offset(32)]]
    float2 a;

    float3 b;

    [[vk::offset(16)]]
    float4 c;
  }

[[vk::push_constant]]
S1 pc;

struct VertexOutput
{
    float3 position : SV_Position;
}

[shader("vertex")]
VertexOutput vertexMain()
{
    [[vk::offset(8)]] VertexOutput output;
    output.position = float3(pc.a.x, pc.b.y, pc.c.z);
    return output;
}