authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-06-28 17:10:32-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-06-28 17:10:32-07:00
logdda21a25ca12c1d974ace0cb3ce52aa75003da6f
tree982866a61d1dafc1329b7a852e67831dd205252a
parent175589fc713d0c706812508fb6bb566b77423b83

spirv: make `@extern` support flat for outputs too


2 files changed, 5 insertions(+), 4 deletions(-)

src/Sema.zig+3-2
......@@ -24966,8 +24966,9 @@ fn zirBuiltinExtern(
2496624966 }
2496724967
2496824968 if (options.decoration) |decoration| switch (decoration) {
24969 .flat => if (ptr_info.flags.address_space != .input) {
24970 return sema.fail(block, options_src, "'flat' decoration requires 'input' address space", .{});
24969 .flat => switch (ptr_info.flags.address_space) {
24970 .input, .output => {},
24971 else => return sema.fail(block, options_src, "\"flat\" decoration requires \"input\" or \"output\" address space", .{}),
2497124972 },
2497224973 .location, .descriptor => {},
2497324974 };
test/cases/compile_errors/extern_spirv_decoration_validation.zig+2-2
......@@ -1,4 +1,4 @@
1const x = @extern(*addrspace(.output) u32, .{
1const x = @extern(*addrspace(.push_constant) u32, .{
22 .name = "x",
33 .decoration = .{ .flat = 0 },
44});
......@@ -10,4 +10,4 @@ comptime {
1010// backend=selfhosted
1111// target=spirv32-vulkan
1212//
13// :1:45: error: 'flat' decoration requires 'input' address space
13// :1:45: error: "flat" decoration requires "input" or "output" address space