mirror of
https://github.com/EmbarkStudios/rust-gpu.git
synced 2024-10-29 21:42:20 +00:00
Address/silence new clippy lints.
This commit is contained in:
parent
50ebb52619
commit
e87c324bfd
@ -619,35 +619,40 @@ impl<'tcx> BuilderSpirv<'tcx> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
SpirvConst::Composite(v) => v.iter().fold(Ok(()), |composite_legal, field| {
|
||||
let field_entry = &self.id_to_const.borrow()[field];
|
||||
let field_legal_in_composite = field_entry.legal.and(
|
||||
// `field` is itself some legal `SpirvConst`, but can we have
|
||||
// it as part of an `OpConstantComposite`?
|
||||
match field_entry.val {
|
||||
SpirvConst::PtrTo { .. } => Err(IllegalConst::Shallow(
|
||||
LeafIllegalConst::CompositeContainsPtrTo,
|
||||
)),
|
||||
_ => Ok(()),
|
||||
},
|
||||
);
|
||||
SpirvConst::Composite(v) => v
|
||||
.iter()
|
||||
.map(|field| {
|
||||
let field_entry = &self.id_to_const.borrow()[field];
|
||||
field_entry.legal.and(
|
||||
// `field` is itself some legal `SpirvConst`, but can we have
|
||||
// it as part of an `OpConstantComposite`?
|
||||
match field_entry.val {
|
||||
SpirvConst::PtrTo { .. } => Err(IllegalConst::Shallow(
|
||||
LeafIllegalConst::CompositeContainsPtrTo,
|
||||
)),
|
||||
_ => Ok(()),
|
||||
},
|
||||
)
|
||||
})
|
||||
.reduce(|a, b| {
|
||||
match (a, b) {
|
||||
(Ok(()), Ok(())) => Ok(()),
|
||||
(Err(illegal), Ok(())) | (Ok(()), Err(illegal)) => Err(illegal),
|
||||
|
||||
match (composite_legal, field_legal_in_composite) {
|
||||
(Ok(()), Ok(())) => Ok(()),
|
||||
(Err(illegal), Ok(())) | (Ok(()), Err(illegal)) => Err(illegal),
|
||||
|
||||
// Combining two causes of an illegal `SpirvConst` has to
|
||||
// take into account which is "worse", i.e. which imposes
|
||||
// more restrictions on how the resulting value can be used.
|
||||
// `Indirect` is worse than `Shallow` because it cannot be
|
||||
// materialized at runtime in the same way `Shallow` can be.
|
||||
(Err(illegal @ IllegalConst::Indirect(_)), Err(_))
|
||||
| (Err(_), Err(illegal @ IllegalConst::Indirect(_)))
|
||||
| (Err(illegal @ IllegalConst::Shallow(_)), Err(IllegalConst::Shallow(_))) => {
|
||||
Err(illegal)
|
||||
// Combining two causes of an illegal `SpirvConst` has to
|
||||
// take into account which is "worse", i.e. which imposes
|
||||
// more restrictions on how the resulting value can be used.
|
||||
// `Indirect` is worse than `Shallow` because it cannot be
|
||||
// materialized at runtime in the same way `Shallow` can be.
|
||||
(Err(illegal @ IllegalConst::Indirect(_)), Err(_))
|
||||
| (Err(_), Err(illegal @ IllegalConst::Indirect(_)))
|
||||
| (
|
||||
Err(illegal @ IllegalConst::Shallow(_)),
|
||||
Err(IllegalConst::Shallow(_)),
|
||||
) => Err(illegal),
|
||||
}
|
||||
}
|
||||
}),
|
||||
})
|
||||
.unwrap_or(Ok(())),
|
||||
|
||||
SpirvConst::PtrTo { pointee } => match self.id_to_const.borrow()[&pointee].legal {
|
||||
Ok(()) => Ok(()),
|
||||
|
@ -105,7 +105,7 @@ impl SpirvBuilder {
|
||||
}
|
||||
}
|
||||
});
|
||||
std::mem::forget(thread);
|
||||
std::mem::drop(thread);
|
||||
Ok(first_result)
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,8 @@
|
||||
//! Types for handling memory ordering constraints for concurrent memory access.
|
||||
|
||||
// NOTE(eddyb) "&-masking with zero", likely due to `NONE = 0` in `bitflags!`.
|
||||
#![allow(clippy::bad_bit_mask)]
|
||||
|
||||
/// Specification for how large of a scope some instructions should operate on - used when calling
|
||||
/// functions that take a configurable scope.
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
|
@ -1,4 +1,8 @@
|
||||
//! Ray-tracing data types
|
||||
|
||||
// NOTE(eddyb) "&-masking with zero", likely due to `NONE = 0` in `bitflags!`.
|
||||
#![allow(clippy::bad_bit_mask)]
|
||||
|
||||
use crate::vector::Vector;
|
||||
#[cfg(target_arch = "spirv")]
|
||||
use core::arch::asm;
|
||||
|
Loading…
Reference in New Issue
Block a user