aboutsummaryrefslogtreecommitdiff
path: root/src/codegen
diff options
context:
space:
mode:
authorAli Cheraghi <alichraghi@proton.me>2025-08-15 19:36:15 +0330
committerAndrew Kelley <andrew@ziglang.org>2025-08-18 11:24:57 -0700
commit2f422372b588789a5ce208bb85c9bfeee84dd980 (patch)
treed9845ab3cb8b59ecd05cf7c75aa44b9b2b5c4cde /src/codegen
parentcf90a5e451fc170738966a0a1a06c2dd5cddc066 (diff)
downloadzig-2f422372b588789a5ce208bb85c9bfeee84dd980.tar.gz
zig-2f422372b588789a5ce208bb85c9bfeee84dd980.zip
spirv: do not decorate nav alignment
they seem to be always `null` even when accessed through extern key so we have no way to tell whether they have natural alignment or not to decorate. And the reason we don't always decorate them is because some environments might be too dumb and crash for this.
Diffstat (limited to 'src/codegen')
-rw-r--r--src/codegen/spirv/CodeGen.zig15
1 files changed, 1 insertions, 14 deletions
diff --git a/src/codegen/spirv/CodeGen.zig b/src/codegen/spirv/CodeGen.zig
index ebfa063556..0edcfa5919 100644
--- a/src/codegen/spirv/CodeGen.zig
+++ b/src/codegen/spirv/CodeGen.zig
@@ -254,13 +254,7 @@ pub fn genNav(cg: *CodeGen, do_codegen: bool) Error!void {
try cg.module.debugName(func_result_id, nav.fqn.toSlice(ip));
},
.global => {
- const maybe_init_val: ?Value = switch (ip.indexToKey(val.toIntern())) {
- .func => unreachable,
- .variable => |variable| .fromInterned(variable.init),
- .@"extern" => null,
- else => val,
- };
- assert(maybe_init_val == null); // TODO
+ assert(ip.indexToKey(val.toIntern()) == .@"extern");
const storage_class = cg.module.storageClass(nav.getAddrspace());
assert(storage_class != .generic); // These should be instance globals
@@ -274,13 +268,6 @@ pub fn genNav(cg: *CodeGen, do_codegen: bool) Error!void {
.storage_class = storage_class,
});
- if (nav.getAlignment() != ty.abiAlignment(zcu)) {
- if (target.os.tag != .opencl) return cg.fail("cannot apply alignment to variables", .{});
- try cg.module.decorate(result_id, .{
- .alignment = .{ .alignment = @intCast(nav.getAlignment().toByteUnits().?) },
- });
- }
-
switch (target.os.tag) {
.vulkan, .opengl => {
if (ty.zigTypeTag(zcu) == .@"struct") {