authorgravatar for alichraghi@proton.meAli Chraghi <alichraghi@proton.me> 2026-07-05 10:02:39+03:30
committergravatar for alichraghi@proton.meAli Chraghi <alichraghi@proton.me> 2026-07-05 10:02:39+03:30
log501b43a75b09d0ac6e25936036316612feb2d40b
tree3fb1ee718688b0b09a93f29cb09fb1dfdc47cf53
parent18f2ab7882235009c9e8a45a776ae375132db247

spirv: add alignment info to store ops


1 files changed, 6 insertions(+), 1 deletions(-)

src/codegen/spirv/CodeGen.zig+6-1
......@@ -4222,6 +4222,8 @@ fn load(cg: *CodeGen, value_ty: Type, ptr_id: Id, options: MemoryOptions) !Id {
42224222}
42234223
42244224fn store(cg: *CodeGen, value_ty: Type, ptr_id: Id, value_id: Id, options: MemoryOptions) !void {
4225 const zcu = cg.zcu;
4226 const alignment: u32 = @intCast(value_ty.abiAlignment(zcu).toByteUnits().?);
42254227 const bare_value_id = try cg.convertToIndirect(value_ty, value_id);
42264228 const bare_ty_id = try cg.resolveType(value_ty, .indirect);
42274229 const store_ty_id = if (cg.needsLayout(options.ptr_address_space, value_ty))
......@@ -4232,7 +4234,10 @@ fn store(cg: *CodeGen, value_ty: Type, ptr_id: Id, value_id: Id, options: Memory
42324234 try cg.body.emit(cg.gpa, .OpStore, .{
42334235 .pointer = ptr_id,
42344236 .object = object_id,
4235 .memory_access = .{ .@"volatile" = options.is_volatile },
4237 .memory_access = .{
4238 .@"volatile" = options.is_volatile,
4239 .aligned = .{ .literal_integer = alignment },
4240 },
42364241 });
42374242}
42384243