Skip to content
This repository was archived by the owner on Oct 31, 2025. It is now read-only.

Commit 2ea927e

Browse files
committed
Fix Location calculation of arrays in entrypoint interfaces with updated rust-gpu
Signed-off-by: Arc-blroth <[email protected]>
1 parent dd60da0 commit 2ea927e

File tree

1 file changed

+9
-1
lines changed
  • crates/rustc_codegen_spirv/src/codegen_cx

1 file changed

+9
-1
lines changed

crates/rustc_codegen_spirv/src/codegen_cx/entry.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,15 @@ impl<'tcx> CodegenCx<'tcx> {
400400
Decoration::Location,
401401
std::iter::once(Operand::LiteralInt32(*location)),
402402
);
403-
*location += 1;
403+
// Arrays take up multiple locations
404+
*location +=
405+
if let SpirvType::Array { count, .. } = self.lookup_type(var_spirv_type_pointee) {
406+
self.builder
407+
.lookup_const_u64(count)
408+
.expect("Array type has invalid count value") as u32
409+
} else {
410+
1
411+
}
404412
}
405413

406414
// Emit the `OpVariable` with its *Result* ID set to `variable`.

0 commit comments

Comments
 (0)