From d35dfc5a3ff48331473ca42b97f3a8cba7d4ad9b Mon Sep 17 00:00:00 2001 From: Robin Voetter Date: Sat, 2 Nov 2024 18:54:34 +0100 Subject: [PATCH] add storage_buffer address space --- lib/std/Target.zig | 2 +- lib/std/builtin.zig | 1 + src/Sema.zig | 2 +- src/codegen/spirv.zig | 1 + src/target.zig | 2 +- 5 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/std/Target.zig b/lib/std/Target.zig index 298da21187..2283004115 100644 --- a/lib/std/Target.zig +++ b/lib/std/Target.zig @@ -1573,7 +1573,7 @@ pub const Cpu = struct { .fs, .gs, .ss => arch == .x86_64 or arch == .x86, .global, .constant, .local, .shared => is_gpu, .param => is_nvptx, - .input, .output, .uniform, .push_constant => is_spirv, + .input, .output, .uniform, .push_constant, .storage_buffer => is_spirv, // TODO this should also check how many flash banks the cpu has .flash, .flash1, .flash2, .flash3, .flash4, .flash5 => arch == .avr, diff --git a/lib/std/builtin.zig b/lib/std/builtin.zig index 02948d6602..ed18965e50 100644 --- a/lib/std/builtin.zig +++ b/lib/std/builtin.zig @@ -515,6 +515,7 @@ pub const AddressSpace = enum(u5) { output, uniform, push_constant, + storage_buffer, // AVR address spaces. flash, diff --git a/src/Sema.zig b/src/Sema.zig index 3082cdd3d8..30f033b0a1 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -37852,7 +37852,7 @@ pub fn analyzeAsAddressSpace( .gs, .fs, .ss => (arch == .x86 or arch == .x86_64) and ctx == .pointer, // TODO: check that .shared and .local are left uninitialized .param => is_nv, - .input, .output, .uniform, .push_constant => is_spirv, + .input, .output, .uniform, .push_constant, .storage_buffer => is_spirv, .global, .shared, .local => is_gpu, .constant => is_gpu and (ctx == .constant), // TODO this should also check how many flash banks the cpu has diff --git a/src/codegen/spirv.zig b/src/codegen/spirv.zig index baa37277e8..9197a0959f 100644 --- a/src/codegen/spirv.zig +++ b/src/codegen/spirv.zig @@ -1893,6 +1893,7 @@ const NavGen = struct { .input => .Input, .output => .Output, .uniform => .Uniform, + .storage_buffer => .StorageBuffer, .gs, .fs, .ss, diff --git a/src/target.zig b/src/target.zig index aba1fffcbc..94bb842b12 100644 --- a/src/target.zig +++ b/src/target.zig @@ -458,7 +458,7 @@ pub fn arePointersLogical(target: std.Target, as: AddressSpace) bool { .global => false, // TODO: Allowed with VK_KHR_variable_pointers. .shared => true, - .constant, .local, .input, .output, .uniform, .push_constant => true, + .constant, .local, .input, .output, .uniform, .push_constant, .storage_buffer => true, else => unreachable, }; }