summaryrefslogtreecommitdiffstats
path: root/tests/spirv/ptr-unsized-array-2.slang
blob: ac0911d76d8fe2a8bf60d2dc79fb55b8545d0f05 (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
//TEST:SIMPLE(filecheck=CHECK): -target spirv

// CHECK-DAG: %[[cbuffer__t:[A-Za-z0-9_]+]] = OpTypeStruct %_ptr_PhysicalStorageBuffer_uint 
// CHECK-DAG: %light_buffer = OpVariable %_ptr_PushConstant_[[cbuffer__t]] PushConstant

// CHECK: OpAccessChain %_ptr_PushConstant
// CHECK-NEXT: OpLoad
// CHECK-NEXT: OpBitcast %_ptr_PhysicalStorageBuffer

struct LightBuffer {
    uint8_t lights[];
}

[vk::push_constant]
LightBuffer* light_buffer;

[shader("vertex")]
float4 vertMain() : SV_Position {
    return float4(light_buffer.lights[0]);
}

[shader("fragment")]
float4 fragMain() : COLOR0 {
    return float4(1.0);
}