1const RuntimeArray = @SpirvType(.{ .runtime_array = f32 });
2const Buffer = extern struct {
3 data: RuntimeArray,
4};
5const buf = @extern(*addrspace(.storage_buffer) Buffer, .{
6 .name = "buf",
7 .decoration = .{ .descriptor = .{ .set = 0, .binding = 0 } },
8});
9export fn main() callconv(.kernel) void {
10 const a = buf.data;
11 _ = a;
12}
13export fn main2() callconv(.kernel) void {
14 const p: *addrspace(.storage_buffer) const RuntimeArray = &buf.data;
15 _ = p.*;
16}
17
18// error
19// backend=selfhosted
20// target=spirv32-vulkan
21//
22// :10:18: error: cannot load SPIR-V runtime array value
23// :15:10: error: cannot load SPIR-V runtime array value