mirror of
https://github.com/EmbarkStudios/rust-gpu.git
synced 2024-11-21 22:34:34 +00:00
Fix for duplicate OpMemberName, and add OpMemberName for ScalarPairs (#814)
This commit is contained in:
parent
2e4de94a66
commit
d5d0c90652
@ -381,13 +381,26 @@ impl<'tcx> ConvSpirvType<'tcx> for TyAndLayout<'tcx> {
|
||||
} else {
|
||||
Some(self.size)
|
||||
};
|
||||
let mut field_names = Vec::new();
|
||||
if let TyKind::Adt(adt, _) = self.ty.kind() {
|
||||
if let Variants::Single { index } = self.variants {
|
||||
for i in self.fields.index_by_increasing_offset() {
|
||||
let field = &adt.variants[index].fields[i];
|
||||
field_names.push(field.ident.name.to_ident_string());
|
||||
}
|
||||
}
|
||||
}
|
||||
SpirvType::Adt {
|
||||
def_id: def_id_for_spirv_type_adt(*self),
|
||||
size,
|
||||
align: self.align.abi,
|
||||
field_types: vec![a, b],
|
||||
field_offsets: vec![a_offset, b_offset],
|
||||
field_names: None,
|
||||
field_names: if field_names.len() == 2 {
|
||||
Some(field_names)
|
||||
} else {
|
||||
None
|
||||
},
|
||||
}
|
||||
.def_with_name(cx, span, TyLayoutNameKey::from(*self))
|
||||
}
|
||||
|
@ -269,8 +269,14 @@ pub fn remove_duplicate_types(module: &mut Module) {
|
||||
.retain(|inst| anno_set.insert(inst.assemble()));
|
||||
// Same thing with OpName
|
||||
let mut name_ids = FxHashSet::default();
|
||||
let mut member_name_ids = FxHashSet::default();
|
||||
module.debug_names.retain(|inst| {
|
||||
inst.class.opcode != Op::Name || name_ids.insert(inst.operands[0].unwrap_id_ref())
|
||||
(inst.class.opcode != Op::Name || name_ids.insert(inst.operands[0].unwrap_id_ref()))
|
||||
&& (inst.class.opcode != Op::MemberName
|
||||
|| member_name_ids.insert((
|
||||
inst.operands[0].unwrap_id_ref(),
|
||||
inst.operands[1].unwrap_literal_int32(),
|
||||
)))
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user