Skip to content

Commit d7e144a

Browse files
committed
asm vector: deny OpTypeVector in asm
1 parent fb42c2b commit d7e144a

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

crates/rustc_codegen_spirv/src/builder/spirv_asm.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -367,14 +367,20 @@ impl<'cx, 'tcx> Builder<'cx, 'tcx> {
367367
SpirvType::Float(inst.operands[0].unwrap_literal_bit32()).def(self.span(), self)
368368
}
369369
Op::TypeStruct => {
370-
self.err("OpTypeStruct in asm! is not supported yet");
370+
self.err("`OpTypeStruct` in asm! is not supported");
371371
return;
372372
}
373-
Op::TypeVector => SpirvType::Vector {
374-
element: inst.operands[0].unwrap_id_ref(),
375-
count: inst.operands[1].unwrap_literal_bit32(),
373+
Op::TypeVector => {
374+
self.struct_err(
375+
"`OpTypeVector` in asm! is not supported, since `#[spirv(vector)]` structs can \
376+
create different vector types due to varying size and alignment",
377+
)
378+
.with_note(
379+
"pass `glam::VecN` as parameters and use `typeof{foo}` or `typeof*{foo}` (pointer to type) to resolve vector type",
380+
)
381+
.emit();
382+
return;
376383
}
377-
.def(self.span(), self),
378384
Op::TypeMatrix => SpirvType::Matrix {
379385
element: inst.operands[0].unwrap_id_ref(),
380386
count: inst.operands[1].unwrap_literal_bit32(),
@@ -762,12 +768,6 @@ impl<'cx, 'tcx> Builder<'cx, 'tcx> {
762768
}
763769
.def(DUMMY_SP, cx),
764770

765-
TyPat::Vector4(pat) => SpirvType::Vector {
766-
element: subst_ty_pat(cx, pat, ty_vars, leftover_operands)?,
767-
count: 4,
768-
}
769-
.def(DUMMY_SP, cx),
770-
771771
TyPat::SampledImage(pat) => SpirvType::SampledImage {
772772
image_type: subst_ty_pat(cx, pat, ty_vars, leftover_operands)?,
773773
}

0 commit comments

Comments
 (0)