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(...@@ -24966,8 +24966,9 @@ fn zirBuiltinExtern(
24966 }24966 }
2496724967
24968 if (options.decoration) |decoration| switch (decoration) {24968 if (options.decoration) |decoration| switch (decoration) {
24969 .flat => if (ptr_info.flags.address_space != .input) {24969 .flat => switch (ptr_info.flags.address_space) {
24970 return sema.fail(block, options_src, "'flat' decoration requires 'input' address space", .{});24970 .input, .output => {},
24971 else => return sema.fail(block, options_src, "\"flat\" decoration requires \"input\" or \"output\" address space", .{}),
24971 },24972 },
24972 .location, .descriptor => {},24973 .location, .descriptor => {},
24973 };24974 };
test/cases/compile_errors/extern_spirv_decoration_validation.zig+2-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1const x = @extern(*addrspace(.output) u32, .{1const x = @extern(*addrspace(.push_constant) u32, .{
2 .name = "x",2 .name = "x",
3 .decoration = .{ .flat = 0 },3 .decoration = .{ .flat = 0 },
4});4});
...@@ -10,4 +10,4 @@ comptime {...@@ -10,4 +10,4 @@ comptime {
10// backend=selfhosted10// backend=selfhosted
11// target=spirv32-vulkan11// target=spirv32-vulkan
12//12//
13// :1:45: error: 'flat' decoration requires 'input' address space13// :1:45: error: "flat" decoration requires "input" or "output" address space