commit ce07ba754c877ae376b002e5bd6aad238d9f3d3d (tree)
parent 56827cf78f37b6d2ec0a95d385fd4b7bed4866ea
Author: Ali Cheraghi <alichraghi@proton.me>
Date: Sun, 28 Jun 2026 14:04:56 +0330
spirv: fix vector pointer access
Diffstat:
1 file changed, 2 insertions(+), 11 deletions(-)
diff --git a/src/codegen/spirv/CodeGen.zig b/src/codegen/spirv/CodeGen.zig
@@ -1881,17 +1881,8 @@ fn derivePtr(cg: *CodeGen, derivation: Value.PointerDeriveStep) !Id {
const parent_ptr_ty = try oac.parent.ptrType(pt);
const result_ty_id = try cg.resolveType(oac.new_ptr_ty, .direct);
- if (parent_ptr_ty.childType(zcu).isVector(zcu)) {
- // Vector element ptr accesses are derived as offset_and_cast.
- // We can just use OpAccessChain.
- const child_size = oac.new_ptr_ty.childType(zcu).abiSize(zcu);
- if (oac.byte_offset % child_size == 0) {
- return cg.accessChain(
- result_ty_id,
- parent_ptr_id,
- &.{@intCast(@divExact(oac.byte_offset, child_size))},
- );
- }
+ if (oac.new_ptr_ty.ptrInfo(zcu).flags.vector_index != .none) {
+ return parent_ptr_id;
}
if (oac.byte_offset == 0) {