mirror of
https://github.com/EmbarkStudios/rust-gpu.git
synced 2024-11-23 15:24:19 +00:00
rustup update and embark standard lints v0.4 (#672)
* rustup update * update to embark standard lints v0.4
This commit is contained in:
parent
04dfa80266
commit
db5e5fd336
1
clippy.toml
Normal file
1
clippy.toml
Normal file
@ -0,0 +1 @@
|
||||
avoid-breaking-exported-api = false
|
@ -410,19 +410,19 @@ impl<'tcx> Visitor<'tcx> for CheckSpirvAttrVisitor<'tcx> {
|
||||
fn visit_item(&mut self, item: &'tcx hir::Item<'tcx>) {
|
||||
let target = Target::from_item(item);
|
||||
self.check_spirv_attributes(item.hir_id(), target);
|
||||
intravisit::walk_item(self, item)
|
||||
intravisit::walk_item(self, item);
|
||||
}
|
||||
|
||||
fn visit_generic_param(&mut self, generic_param: &'tcx hir::GenericParam<'tcx>) {
|
||||
let target = Target::from_generic_param(generic_param);
|
||||
self.check_spirv_attributes(generic_param.hir_id, target);
|
||||
intravisit::walk_generic_param(self, generic_param)
|
||||
intravisit::walk_generic_param(self, generic_param);
|
||||
}
|
||||
|
||||
fn visit_trait_item(&mut self, trait_item: &'tcx hir::TraitItem<'tcx>) {
|
||||
let target = Target::from_trait_item(trait_item);
|
||||
self.check_spirv_attributes(trait_item.hir_id(), target);
|
||||
intravisit::walk_trait_item(self, trait_item)
|
||||
intravisit::walk_trait_item(self, trait_item);
|
||||
}
|
||||
|
||||
fn visit_field_def(&mut self, field: &'tcx hir::FieldDef<'tcx>) {
|
||||
@ -438,13 +438,13 @@ impl<'tcx> Visitor<'tcx> for CheckSpirvAttrVisitor<'tcx> {
|
||||
fn visit_foreign_item(&mut self, f_item: &'tcx hir::ForeignItem<'tcx>) {
|
||||
let target = Target::from_foreign_item(f_item);
|
||||
self.check_spirv_attributes(f_item.hir_id(), target);
|
||||
intravisit::walk_foreign_item(self, f_item)
|
||||
intravisit::walk_foreign_item(self, f_item);
|
||||
}
|
||||
|
||||
fn visit_impl_item(&mut self, impl_item: &'tcx hir::ImplItem<'tcx>) {
|
||||
let target = target_from_impl_item(self.tcx, impl_item);
|
||||
self.check_spirv_attributes(impl_item.hir_id(), target);
|
||||
intravisit::walk_impl_item(self, impl_item)
|
||||
intravisit::walk_impl_item(self, impl_item);
|
||||
}
|
||||
|
||||
fn visit_stmt(&mut self, stmt: &'tcx hir::Stmt<'tcx>) {
|
||||
@ -452,7 +452,7 @@ impl<'tcx> Visitor<'tcx> for CheckSpirvAttrVisitor<'tcx> {
|
||||
if let hir::StmtKind::Local(l) = stmt.kind {
|
||||
self.check_spirv_attributes(l.hir_id, Target::Statement);
|
||||
}
|
||||
intravisit::walk_stmt(self, stmt)
|
||||
intravisit::walk_stmt(self, stmt);
|
||||
}
|
||||
|
||||
fn visit_expr(&mut self, expr: &'tcx hir::Expr<'tcx>) {
|
||||
@ -462,7 +462,7 @@ impl<'tcx> Visitor<'tcx> for CheckSpirvAttrVisitor<'tcx> {
|
||||
};
|
||||
|
||||
self.check_spirv_attributes(expr.hir_id, target);
|
||||
intravisit::walk_expr(self, expr)
|
||||
intravisit::walk_expr(self, expr);
|
||||
}
|
||||
|
||||
fn visit_variant(
|
||||
@ -472,7 +472,7 @@ impl<'tcx> Visitor<'tcx> for CheckSpirvAttrVisitor<'tcx> {
|
||||
item_id: HirId,
|
||||
) {
|
||||
self.check_spirv_attributes(variant.id, Target::Variant);
|
||||
intravisit::walk_variant(self, variant, generics, item_id)
|
||||
intravisit::walk_variant(self, variant, generics, item_id);
|
||||
}
|
||||
|
||||
fn visit_macro_def(&mut self, macro_def: &'tcx hir::MacroDef<'tcx>) {
|
||||
@ -528,7 +528,7 @@ pub(crate) fn provide(providers: &mut Providers) {
|
||||
check_mod_attrs: |tcx, def_id| {
|
||||
// Run both the default checks, and our `#[spirv(...)]` ones.
|
||||
(rustc_interface::DEFAULT_QUERY_PROVIDERS.check_mod_attrs)(tcx, def_id);
|
||||
check_mod_attrs(tcx, def_id)
|
||||
check_mod_attrs(tcx, def_id);
|
||||
},
|
||||
..*providers
|
||||
};
|
||||
|
@ -550,7 +550,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
|
||||
}
|
||||
|
||||
fn br(&mut self, dest: Self::BasicBlock) {
|
||||
self.emit().branch(dest).unwrap()
|
||||
self.emit().branch(dest).unwrap();
|
||||
}
|
||||
|
||||
fn cond_br(
|
||||
@ -561,7 +561,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
|
||||
) {
|
||||
self.emit()
|
||||
.branch_conditional(cond.def(self), then_llbb, else_llbb, empty())
|
||||
.unwrap()
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
fn switch(
|
||||
@ -638,7 +638,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
|
||||
let cases = cases
|
||||
.map(|(i, b)| (construct_case(self, signed, i), b))
|
||||
.collect::<Vec<_>>();
|
||||
self.emit().switch(v.def(self), else_llbb, cases).unwrap()
|
||||
self.emit().switch(v.def(self), else_llbb, cases).unwrap();
|
||||
}
|
||||
|
||||
fn invoke(
|
||||
@ -656,7 +656,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
|
||||
}
|
||||
|
||||
fn unreachable(&mut self) {
|
||||
self.emit().unreachable().unwrap()
|
||||
self.emit().unreachable().unwrap();
|
||||
}
|
||||
|
||||
simple_op! {add, i_add}
|
||||
@ -1281,12 +1281,12 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
|
||||
self.zombie(
|
||||
result.def(self),
|
||||
"OpBitcast between ptr and non-ptr without AddressingModel != Logical",
|
||||
)
|
||||
);
|
||||
} else {
|
||||
self.struct_err("Cannot cast between pointer and non-pointer types")
|
||||
.note(&format!("from: {}", self.debug_type(val.ty)))
|
||||
.note(&format!("to: {}", self.debug_type(dest_ty)))
|
||||
.emit()
|
||||
.emit();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1717,7 +1717,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
|
||||
self.zombie(
|
||||
dst.def(self),
|
||||
"OpCopyMemorySized without OpCapability Addresses",
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1731,7 +1731,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
|
||||
size: Self::Value,
|
||||
flags: MemFlags,
|
||||
) {
|
||||
self.memcpy(dst, dst_align, src, src_align, size, flags)
|
||||
self.memcpy(dst, dst_align, src, src_align, size, flags);
|
||||
}
|
||||
|
||||
fn memset(
|
||||
@ -1858,7 +1858,7 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
|
||||
fn insert_value(&mut self, agg_val: Self::Value, elt: Self::Value, idx: u64) -> Self::Value {
|
||||
match self.lookup_type(agg_val.ty) {
|
||||
SpirvType::Adt { field_types, .. } => {
|
||||
assert_ty_eq!(self, field_types[idx as usize], elt.ty)
|
||||
assert_ty_eq!(self, field_types[idx as usize], elt.ty);
|
||||
}
|
||||
other => self.fatal(&format!("insert_value not implemented on type {:?}", other)),
|
||||
};
|
||||
|
@ -76,9 +76,9 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
|
||||
|
||||
pub fn err(&self, msg: &str) {
|
||||
if let Some(current_span) = self.current_span {
|
||||
self.tcx.sess.span_err(current_span, msg)
|
||||
self.tcx.sess.span_err(current_span, msg);
|
||||
} else {
|
||||
self.tcx.sess.err(msg)
|
||||
self.tcx.sess.err(msg);
|
||||
}
|
||||
}
|
||||
|
||||
@ -286,7 +286,7 @@ impl<'a, 'tcx> ArgAbiMethods<'tcx> for Builder<'a, 'tcx> {
|
||||
match arg_abi.mode {
|
||||
PassMode::Ignore => (),
|
||||
PassMode::Pair(..) => {
|
||||
OperandValue::Pair(next(self, idx), next(self, idx)).store(self, dst)
|
||||
OperandValue::Pair(next(self, idx), next(self, idx)).store(self, dst);
|
||||
}
|
||||
PassMode::Indirect {
|
||||
extra_attrs: Some(_),
|
||||
@ -303,7 +303,7 @@ impl<'a, 'tcx> ArgAbiMethods<'tcx> for Builder<'a, 'tcx> {
|
||||
}
|
||||
| PassMode::Cast(_) => {
|
||||
let next_arg = next(self, idx);
|
||||
self.store_arg(arg_abi, next_arg, dst)
|
||||
self.store_arg(arg_abi, next_arg, dst);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ impl<'a, 'tcx> AsmBuilderMethods<'tcx> for Builder<'a, 'tcx> {
|
||||
match typeof_kind {
|
||||
Some(kind) => {
|
||||
*line.last_mut().unwrap() =
|
||||
Token::Typeof(&operands[operand_idx], span, kind)
|
||||
Token::Typeof(&operands[operand_idx], span, kind);
|
||||
}
|
||||
None => match &operands[operand_idx] {
|
||||
InlineAsmOperandRef::Const { string } => line.push(Token::Word(string)),
|
||||
@ -992,21 +992,21 @@ impl<'cx, 'tcx> Builder<'cx, 'tcx> {
|
||||
};
|
||||
match (kind, word) {
|
||||
(OperandKind::IdResultType | OperandKind::IdResult, _) => {
|
||||
bug!("should be handled by parse_operands")
|
||||
bug!("should be handled by parse_operands");
|
||||
}
|
||||
(OperandKind::IdMemorySemantics, _) => {
|
||||
if let Some(id) = self.parse_id_in(id_map, token) {
|
||||
inst.operands.push(dr::Operand::IdMemorySemantics(id))
|
||||
inst.operands.push(dr::Operand::IdMemorySemantics(id));
|
||||
}
|
||||
}
|
||||
(OperandKind::IdScope, _) => {
|
||||
if let Some(id) = self.parse_id_in(id_map, token) {
|
||||
inst.operands.push(dr::Operand::IdScope(id))
|
||||
inst.operands.push(dr::Operand::IdScope(id));
|
||||
}
|
||||
}
|
||||
(OperandKind::IdRef, _) => {
|
||||
if let Some(id) = self.parse_id_in(id_map, token) {
|
||||
inst.operands.push(dr::Operand::IdRef(id))
|
||||
inst.operands.push(dr::Operand::IdRef(id));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1079,7 +1079,7 @@ impl<'cx, 'tcx> Builder<'cx, 'tcx> {
|
||||
}
|
||||
}
|
||||
(OperandKind::PairLiteralIntegerIdRef, _) => {
|
||||
self.err("PairLiteralIntegerIdRef not supported yet")
|
||||
self.err("PairLiteralIntegerIdRef not supported yet");
|
||||
}
|
||||
(OperandKind::PairIdRefLiteralInteger, _) => {
|
||||
if let Some(id) = self.parse_id_in(id_map, token) {
|
||||
|
@ -177,14 +177,14 @@ impl SpirvValue {
|
||||
zombie_target_undef,
|
||||
span,
|
||||
"OpBitcast on ptr without AddressingModel != Logical",
|
||||
)
|
||||
);
|
||||
} else {
|
||||
cx.tcx
|
||||
.sess
|
||||
.struct_span_err(span, "Cannot cast between pointer types")
|
||||
.note(&format!("from: *{}", cx.debug_type(original_pointee_ty)))
|
||||
.note(&format!("to: {}", cx.debug_type(self.ty)))
|
||||
.emit()
|
||||
.emit();
|
||||
}
|
||||
|
||||
zombie_target_undef
|
||||
|
@ -2,7 +2,6 @@ use super::CodegenCx;
|
||||
use crate::abi::ConvSpirvType;
|
||||
use crate::attr::AggregatedSpirvAttributes;
|
||||
use crate::builder_spirv::{SpirvConst, SpirvValue, SpirvValueExt};
|
||||
use crate::decorations::UnrollLoopsDecoration;
|
||||
use crate::spirv_type::SpirvType;
|
||||
use rspirv::spirv::{FunctionControl, LinkageType, StorageClass, Word};
|
||||
use rustc_attr::InlineAttr;
|
||||
@ -25,10 +24,10 @@ fn attrs_to_spirv(attrs: &CodegenFnAttrs) -> FunctionControl {
|
||||
InlineAttr::Never => control.insert(FunctionControl::DONT_INLINE),
|
||||
}
|
||||
if attrs.flags.contains(CodegenFnAttrFlags::FFI_PURE) {
|
||||
control.insert(FunctionControl::PURE)
|
||||
control.insert(FunctionControl::PURE);
|
||||
}
|
||||
if attrs.flags.contains(CodegenFnAttrFlags::FFI_CONST) {
|
||||
control.insert(FunctionControl::CONST)
|
||||
control.insert(FunctionControl::CONST);
|
||||
}
|
||||
control
|
||||
}
|
||||
@ -117,12 +116,10 @@ impl<'tcx> CodegenCx<'tcx> {
|
||||
.as_ref()
|
||||
.map(ToString::to_string)
|
||||
.unwrap_or_else(|| instance.to_string());
|
||||
self.entry_stub(&instance, &fn_abi, declared, entry_name, entry)
|
||||
self.entry_stub(&instance, &fn_abi, declared, entry_name, entry);
|
||||
}
|
||||
if attrs.unroll_loops.is_some() {
|
||||
self.unroll_loops_decorations
|
||||
.borrow_mut()
|
||||
.insert(fn_id, UnrollLoopsDecoration {});
|
||||
self.unroll_loops_decorations.borrow_mut().insert(fn_id);
|
||||
}
|
||||
if attrs.internal_buffer_load.is_some() {
|
||||
self.internal_buffer_load_id.borrow_mut().insert(fn_id);
|
||||
|
@ -83,7 +83,7 @@ impl<'tcx> CodegenCx<'tcx> {
|
||||
"PassMode {:?} invalid for entry point return type",
|
||||
fn_abi.ret.mode
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
let execution_model = entry.execution_model;
|
||||
let fn_id = if execution_model == ExecutionModel::Kernel {
|
||||
@ -306,7 +306,7 @@ impl<'tcx> CodegenCx<'tcx> {
|
||||
&mut bx,
|
||||
&mut call_args,
|
||||
&mut decoration_locations,
|
||||
)
|
||||
);
|
||||
}
|
||||
bx.set_span(span);
|
||||
bx.call(entry_func, &call_args, None);
|
||||
@ -540,7 +540,7 @@ impl<'tcx> CodegenCx<'tcx> {
|
||||
self.tcx.sess.span_err(
|
||||
hir_param.ty_span,
|
||||
"uniform_constant must use &RuntimeArray<T>, not &[T]",
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
@ -548,7 +548,7 @@ impl<'tcx> CodegenCx<'tcx> {
|
||||
self.tcx.sess.span_err(
|
||||
hir_param.ty_span,
|
||||
"only plain slices are supported as unsized types",
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -686,11 +686,11 @@ impl<'tcx> CodegenCx<'tcx> {
|
||||
var,
|
||||
Decoration::InputAttachmentIndex,
|
||||
std::iter::once(Operand::LiteralInt32(attachment_index.value)),
|
||||
)
|
||||
);
|
||||
} else if is_subpass_input {
|
||||
self.tcx
|
||||
.sess
|
||||
.span_err(hir_param.ty_span, "Missing capability InputAttachment")
|
||||
.span_err(hir_param.ty_span, "Missing capability InputAttachment");
|
||||
} else {
|
||||
self.tcx.sess.span_err(
|
||||
attachment_index.span,
|
||||
@ -702,7 +702,7 @@ impl<'tcx> CodegenCx<'tcx> {
|
||||
self.tcx.sess.span_err(
|
||||
hir_param.ty_span,
|
||||
"Image types with dim = SubpassData require #[spirv(input_attachment_index)] decoration",
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Assign locations from left to right, incrementing each storage class
|
||||
|
@ -66,7 +66,7 @@ pub struct CodegenCx<'tcx> {
|
||||
/// Functions that have `#[spirv(unroll_loops)]`, and therefore should
|
||||
/// get `LoopControl::UNROLL` applied to all of their loops' `OpLoopMerge`
|
||||
/// instructions, during structuralization.
|
||||
unroll_loops_decorations: RefCell<FxHashMap<Word, UnrollLoopsDecoration>>,
|
||||
unroll_loops_decorations: RefCell<FxHashSet<Word>>,
|
||||
/// Cache of all the builtin symbols we need
|
||||
pub sym: Rc<Symbols>,
|
||||
pub instruction_table: InstructionTable,
|
||||
@ -211,7 +211,7 @@ impl<'tcx> CodegenCx<'tcx> {
|
||||
}
|
||||
}
|
||||
pub fn zombie_no_span(&self, word: Word, reason: &str) {
|
||||
self.zombie_with_span(word, DUMMY_SP, reason)
|
||||
self.zombie_with_span(word, DUMMY_SP, reason);
|
||||
}
|
||||
pub fn zombie_even_in_user_code(&self, word: Word, span: Span, reason: &str) {
|
||||
self.zombie_decorations.borrow_mut().insert(
|
||||
@ -255,7 +255,7 @@ impl<'tcx> CodegenCx<'tcx> {
|
||||
self.unroll_loops_decorations
|
||||
.into_inner()
|
||||
.into_iter()
|
||||
.map(|(id, unroll_loops)| unroll_loops.encode(id)),
|
||||
.map(|id| UnrollLoopsDecoration {}.encode(id)),
|
||||
),
|
||||
);
|
||||
result
|
||||
@ -266,7 +266,7 @@ impl<'tcx> CodegenCx<'tcx> {
|
||||
target,
|
||||
Decoration::LinkageAttributes,
|
||||
once(Operand::LiteralString(name)).chain(once(Operand::LinkageType(linkage))),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -371,20 +371,20 @@ impl CodegenArgs {
|
||||
let mut remap = std::collections::HashMap::new();
|
||||
let mut insert = |current_id: &mut u32| {
|
||||
let len = remap.len();
|
||||
*current_id = *remap.entry(*current_id).or_insert_with(|| len as u32 + 1)
|
||||
*current_id = *remap.entry(*current_id).or_insert_with(|| len as u32 + 1);
|
||||
};
|
||||
module.all_inst_iter_mut().for_each(|inst| {
|
||||
if let Some(ref mut result_id) = &mut inst.result_id {
|
||||
insert(result_id)
|
||||
insert(result_id);
|
||||
}
|
||||
if let Some(ref mut result_type) = &mut inst.result_type {
|
||||
insert(result_type)
|
||||
insert(result_type);
|
||||
}
|
||||
inst.operands.iter_mut().for_each(|op| {
|
||||
if let Some(w) = op.id_ref_any_mut() {
|
||||
insert(w)
|
||||
insert(w);
|
||||
}
|
||||
})
|
||||
});
|
||||
});
|
||||
remap.len() as u32 + 1
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ impl<'tcx> LayoutTypeMethods<'tcx> for CodegenCx<'tcx> {
|
||||
fn backend_field_index(&self, layout: TyAndLayout<'tcx>, index: usize) -> u64 {
|
||||
match layout.abi {
|
||||
Abi::Scalar(_) | Abi::ScalarPair(..) => {
|
||||
bug!("backend_field_index({:?}): not applicable", layout)
|
||||
bug!("backend_field_index({:?}): not applicable", layout);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ pub trait CustomDecoration: for<'de> Deserialize<'de> + Serialize {
|
||||
fn remove_all(module: &mut Module) {
|
||||
module
|
||||
.annotations
|
||||
.retain(|inst| Self::try_decode(inst).is_none())
|
||||
.retain(|inst| Self::try_decode(inst).is_none());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,30 +18,39 @@
|
||||
#![feature(rustc_private)]
|
||||
#![feature(assert_matches)]
|
||||
#![feature(once_cell)]
|
||||
// BEGIN - Embark standard lints v0.3
|
||||
// BEGIN - Embark standard lints v0.4
|
||||
// do not change or add/remove here, but one can add exceptions after this section
|
||||
// for more info see: <https://github.com/EmbarkStudios/rust-ecosystem/issues/59>
|
||||
#![deny(unsafe_code)]
|
||||
#![warn(
|
||||
clippy::all,
|
||||
clippy::await_holding_lock,
|
||||
clippy::char_lit_as_u8,
|
||||
clippy::checked_conversions,
|
||||
clippy::dbg_macro,
|
||||
clippy::debug_assert_with_mut_call,
|
||||
clippy::doc_markdown,
|
||||
clippy::empty_enum,
|
||||
clippy::enum_glob_use,
|
||||
clippy::exit,
|
||||
clippy::expl_impl_clone_on_copy,
|
||||
clippy::explicit_deref_methods,
|
||||
clippy::explicit_into_iter_loop,
|
||||
clippy::fallible_impl_from,
|
||||
clippy::filter_map_next,
|
||||
clippy::float_cmp_const,
|
||||
clippy::fn_params_excessive_bools,
|
||||
clippy::if_let_mutex,
|
||||
clippy::implicit_clone,
|
||||
clippy::imprecise_flops,
|
||||
clippy::inefficient_to_string,
|
||||
clippy::invalid_upcast_comparisons,
|
||||
clippy::large_types_passed_by_value,
|
||||
clippy::let_unit_value,
|
||||
clippy::linkedlist,
|
||||
clippy::lossy_float_literal,
|
||||
clippy::macro_use_imports,
|
||||
clippy::manual_ok_or,
|
||||
clippy::map_err_ignore,
|
||||
clippy::map_flatten,
|
||||
clippy::map_unwrap_or,
|
||||
@ -50,26 +59,34 @@
|
||||
clippy::match_wildcard_for_single_variants,
|
||||
clippy::mem_forget,
|
||||
clippy::mismatched_target_os,
|
||||
clippy::mut_mut,
|
||||
clippy::mutex_integer,
|
||||
clippy::needless_borrow,
|
||||
clippy::needless_continue,
|
||||
clippy::option_option,
|
||||
clippy::pub_enum_variant_names,
|
||||
clippy::path_buf_push_overwrite,
|
||||
clippy::ptr_as_ptr,
|
||||
clippy::ref_option_ref,
|
||||
clippy::rest_pat_in_fully_bound_structs,
|
||||
clippy::same_functions_in_if_condition,
|
||||
clippy::semicolon_if_nothing_returned,
|
||||
clippy::string_add_assign,
|
||||
clippy::string_add,
|
||||
clippy::string_lit_as_bytes,
|
||||
clippy::string_to_string,
|
||||
clippy::suboptimal_flops,
|
||||
clippy::todo,
|
||||
clippy::trait_duplication_in_bounds,
|
||||
clippy::unimplemented,
|
||||
clippy::unnested_or_patterns,
|
||||
clippy::unused_self,
|
||||
clippy::useless_transmute,
|
||||
clippy::verbose_file_reads,
|
||||
clippy::zero_sized_map_values,
|
||||
future_incompatible,
|
||||
nonstandard_style,
|
||||
rust_2018_idioms
|
||||
)]
|
||||
// END - Embark standard lints v0.3
|
||||
// END - Embark standard lints v0.4
|
||||
// crate-specific exceptions:
|
||||
#![allow(
|
||||
unsafe_code, // still quite a bit of unsafe
|
||||
@ -182,7 +199,7 @@ fn dump_mir<'tcx>(
|
||||
if matches!(instance.def, InstanceDef::Item(_)) {
|
||||
let mut mir = Cursor::new(Vec::new());
|
||||
if write_mir_pretty(tcx, Some(instance.def_id()), &mut mir).is_ok() {
|
||||
writeln!(file, "{}", String::from_utf8(mir.into_inner()).unwrap()).unwrap()
|
||||
writeln!(file, "{}", String::from_utf8(mir.into_inner()).unwrap()).unwrap();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -378,7 +395,7 @@ impl CodegenBackend for SpirvCodegenBackend {
|
||||
sess,
|
||||
&codegen_results,
|
||||
outputs,
|
||||
&codegen_results.crate_name.as_str(),
|
||||
&codegen_results.crate_info.local_crate_name.as_str(),
|
||||
);
|
||||
drop(timer);
|
||||
|
||||
@ -561,7 +578,7 @@ impl ExtraBackendMethods for SpirvCodegenBackend {
|
||||
if let Ok(ref path) = env::var("DUMP_MODULE_ON_PANIC") {
|
||||
let module_dumper = DumpModuleOnPanic { cx: &cx, path };
|
||||
with_no_trimmed_paths(do_codegen);
|
||||
drop(module_dumper)
|
||||
drop(module_dumper);
|
||||
} else {
|
||||
with_no_trimmed_paths(do_codegen);
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ pub fn link<'a>(
|
||||
link_rlib(sess, codegen_results, &out_filename);
|
||||
}
|
||||
CrateType::Executable | CrateType::Cdylib | CrateType::Dylib => {
|
||||
link_exe(sess, crate_type, &out_filename, codegen_results)
|
||||
link_exe(sess, crate_type, &out_filename, codegen_results);
|
||||
}
|
||||
other => sess.err(&format!("CrateType {:?} not supported yet", other)),
|
||||
}
|
||||
|
@ -112,6 +112,6 @@ pub fn dce_phi(func: &mut Function) {
|
||||
for block in &mut func.blocks {
|
||||
block
|
||||
.instructions
|
||||
.retain(|inst| inst.class.opcode != Op::Phi || used.contains(&inst.result_id.unwrap()))
|
||||
.retain(|inst| inst.class.opcode != Op::Phi || used.contains(&inst.result_id.unwrap()));
|
||||
}
|
||||
}
|
||||
|
@ -146,7 +146,7 @@ fn make_dedupe_key(
|
||||
0
|
||||
});
|
||||
if let Some(annos) = annotations.get(&id) {
|
||||
data.extend_from_slice(annos)
|
||||
data.extend_from_slice(annos);
|
||||
}
|
||||
if inst.class.opcode == Op::Variable {
|
||||
// Names only matter for OpVariable.
|
||||
|
@ -176,7 +176,7 @@ fn replace_all_uses_with(module: &mut Module, rules: &FxHashMap<u32, u32>) {
|
||||
*w = rewrite;
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@ -201,7 +201,7 @@ fn kill_linkage_instructions(module: &mut Module, rewrite_rules: &FxHashMap<u32,
|
||||
module.capabilities.retain(|inst| {
|
||||
inst.class.opcode != Op::Capability
|
||||
|| inst.operands[0].unwrap_capability() != Capability::Linkage
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
fn import_kill_annotations_and_debug(
|
||||
@ -228,7 +228,7 @@ fn import_kill_annotations_and_debug(
|
||||
op.id_ref_any().map_or(true, |id| {
|
||||
!rewrite_rules.contains_key(&id) && !killed_parameters.contains(&id)
|
||||
})
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -344,9 +344,9 @@ fn get_inlined_blocks(
|
||||
Operand::IdRef(return_value),
|
||||
],
|
||||
),
|
||||
)
|
||||
);
|
||||
} else {
|
||||
assert!(return_variable.is_none())
|
||||
assert!(return_variable.is_none());
|
||||
}
|
||||
*block.instructions.last_mut().unwrap() =
|
||||
Instruction::new(Op::Branch, None, None, vec![Operand::IdRef(return_jump)]);
|
||||
|
@ -219,7 +219,7 @@ fn collect_access_chains(
|
||||
indices: {
|
||||
let mut base_indicies = base.indices.clone();
|
||||
for op in inst.operands.iter().skip(1) {
|
||||
base_indicies.push(*constants.get(&op.id_ref_any().unwrap())?)
|
||||
base_indicies.push(*constants.get(&op.id_ref_any().unwrap())?);
|
||||
}
|
||||
base_indicies
|
||||
},
|
||||
@ -302,7 +302,7 @@ fn insert_phis(
|
||||
while let Some(x) = work_list.pop() {
|
||||
for &y in &dominance_frontier[x] {
|
||||
if blocks_with_phi.insert(y) && ever_on_work_list.insert(y) {
|
||||
work_list.push(y)
|
||||
work_list.push(y);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -515,6 +515,6 @@ fn remove_old_variables(
|
||||
.all(|(var_map, _)| !var_map.contains_key(&id))
|
||||
})
|
||||
})
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ use crate::decorations::{CustomDecoration, UnrollLoopsDecoration};
|
||||
use rspirv::binary::Consumer;
|
||||
use rspirv::dr::{Block, Instruction, Loader, Module, ModuleHeader, Operand};
|
||||
use rspirv::spirv::{Op, StorageClass, Word};
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
||||
use rustc_errors::ErrorReported;
|
||||
use rustc_session::Session;
|
||||
|
||||
@ -63,7 +63,7 @@ fn apply_rewrite_rules(rewrite_rules: &FxHashMap<Word, Word>, blocks: &mut [Bloc
|
||||
*id = rewrite;
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
};
|
||||
for block in blocks {
|
||||
for inst in &mut block.label {
|
||||
@ -183,8 +183,8 @@ pub fn link(sess: &Session, mut inputs: Vec<Module>, opts: &Options) -> Result<L
|
||||
}
|
||||
|
||||
let unroll_loops_decorations = UnrollLoopsDecoration::decode_all(&output)
|
||||
.map(|(id, unroll_loops)| (id, unroll_loops.deserialize()))
|
||||
.collect::<FxHashMap<_, _>>();
|
||||
.map(|(id, _)| id)
|
||||
.collect::<FxHashSet<_>>();
|
||||
UnrollLoopsDecoration::remove_all(&mut output);
|
||||
|
||||
let mut output = if opts.structurize {
|
||||
|
@ -15,9 +15,9 @@ pub fn shift_ids(module: &mut Module, add: u32) {
|
||||
|
||||
inst.operands.iter_mut().for_each(|op| {
|
||||
if let Some(w) = op.id_ref_any_mut() {
|
||||
*w += add
|
||||
*w += add;
|
||||
}
|
||||
})
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@ -118,7 +118,7 @@ pub fn compact_ids(module: &mut Module) -> u32 {
|
||||
if let Some(w) = op.id_ref_any_mut() {
|
||||
*w = insert(*w);
|
||||
}
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
remap.len() as u32 + 1
|
||||
|
@ -261,7 +261,7 @@ impl CallGraph {
|
||||
visited[func] = true;
|
||||
|
||||
for &callee in &self.callees[func] {
|
||||
self.post_order_step(callee, visited, post_order)
|
||||
self.post_order_step(callee, visited, post_order);
|
||||
}
|
||||
|
||||
post_order.push(func);
|
||||
|
@ -1,8 +1,7 @@
|
||||
use crate::decorations::UnrollLoopsDecoration;
|
||||
use indexmap::{indexmap, IndexMap};
|
||||
use rspirv::dr::{Block, Builder, Function, InsertPoint, Module, Operand};
|
||||
use rspirv::spirv::{LoopControl, Op, SelectionControl, Word};
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
||||
use std::{iter, mem};
|
||||
|
||||
/// Cached IDs of `OpTypeBool`, `OpConstantFalse`, and `OpConstantTrue`.
|
||||
@ -38,10 +37,7 @@ impl FuncBuilder<'_> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn structurize(
|
||||
module: Module,
|
||||
unroll_loops_decorations: FxHashMap<Word, UnrollLoopsDecoration>,
|
||||
) -> Module {
|
||||
pub fn structurize(module: Module, unroll_loops_decorations: FxHashSet<Word>) -> Module {
|
||||
let mut builder = Builder::new_from_module(module);
|
||||
|
||||
// Get the `OpTypeBool` type (it will only be created if it's missing).
|
||||
@ -78,9 +74,10 @@ pub fn structurize(
|
||||
|
||||
let func_id = func.function().def_id().unwrap();
|
||||
|
||||
let loop_control = match unroll_loops_decorations.get(&func_id) {
|
||||
Some(UnrollLoopsDecoration {}) => LoopControl::UNROLL,
|
||||
None => LoopControl::NONE,
|
||||
let loop_control = if unroll_loops_decorations.contains(&func_id) {
|
||||
LoopControl::UNROLL
|
||||
} else {
|
||||
LoopControl::NONE
|
||||
};
|
||||
|
||||
let block_id_to_idx = func
|
||||
@ -570,7 +567,7 @@ impl Structurizer<'_> {
|
||||
for target in
|
||||
super::simple_passes::outgoing_edges(&self.func.blocks()[block]).collect::<Vec<_>>()
|
||||
{
|
||||
self.post_order_step(self.block_id_to_idx[&target], visited, post_order)
|
||||
self.post_order_step(self.block_id_to_idx[&target], visited, post_order);
|
||||
}
|
||||
|
||||
post_order.push(block);
|
||||
|
@ -136,7 +136,7 @@ fn without_header_eq(mut result: Module, expected: &str) {
|
||||
\n{}\
|
||||
\n",
|
||||
pretty_assertions::Comparison::new(&PrettyString(&result), &PrettyString(&expected))
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -186,7 +186,7 @@ pub fn remove_zombies(sess: &Session, module: &mut Module) {
|
||||
}
|
||||
_ => format!("{}", name_id),
|
||||
};
|
||||
println!("Function removed {:?} because {:?}", name, reason.reason)
|
||||
println!("Function removed {:?} because {:?}", name, reason.reason);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -304,7 +304,7 @@ impl SpirvType {
|
||||
result,
|
||||
def_span,
|
||||
"function pointer types are not allowed",
|
||||
)
|
||||
);
|
||||
}
|
||||
result
|
||||
}
|
||||
|
@ -766,7 +766,7 @@ pub fn instruction_signatures(op: Op) -> Option<&'static [InstSig<'static>]> {
|
||||
| Op::CooperativeMatrixLengthNV => reserved!(SPV_NV_cooperative_matrix),
|
||||
// SPV_EXT_fragment_shader_interlock
|
||||
Op::BeginInvocationInterlockEXT | Op::EndInvocationInterlockEXT => {
|
||||
reserved!(SPV_EXT_fragment_shader_interlock)
|
||||
reserved!(SPV_EXT_fragment_shader_interlock);
|
||||
}
|
||||
// SPV_EXT_demote_to_helper_invocation
|
||||
Op::DemoteToHelperInvocationEXT | Op::IsHelperInvocationEXT => {
|
||||
@ -819,7 +819,7 @@ pub fn instruction_signatures(op: Op) -> Option<&'static [InstSig<'static>]> {
|
||||
// Instructions not present in current SPIR-V specification
|
||||
// SPV_INTEL_function_pointers
|
||||
Op::FunctionPointerINTEL | Op::FunctionPointerCallINTEL => {
|
||||
reserved!(SPV_INTEL_function_pointers)
|
||||
reserved!(SPV_INTEL_function_pointers);
|
||||
}
|
||||
// SPV_INTEL_device_side_avc_motion_estimation
|
||||
Op::VmeImageINTEL
|
||||
@ -940,7 +940,7 @@ pub fn instruction_signatures(op: Op) -> Option<&'static [InstSig<'static>]> {
|
||||
| Op::SubgroupAvcSicGetPackedSkcLumaCountThresholdINTEL
|
||||
| Op::SubgroupAvcSicGetPackedSkcLumaSumThresholdINTEL
|
||||
| Op::SubgroupAvcSicGetInterRawSadsINTEL => {
|
||||
reserved!(SPV_INTEL_device_side_avc_motion_estimation)
|
||||
reserved!(SPV_INTEL_device_side_avc_motion_estimation);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,27 +1,36 @@
|
||||
// BEGIN - Embark standard lints v0.3
|
||||
// BEGIN - Embark standard lints v0.4
|
||||
// do not change or add/remove here, but one can add exceptions after this section
|
||||
// for more info see: <https://github.com/EmbarkStudios/rust-ecosystem/issues/59>
|
||||
#![deny(unsafe_code)]
|
||||
#![warn(
|
||||
clippy::all,
|
||||
clippy::await_holding_lock,
|
||||
clippy::char_lit_as_u8,
|
||||
clippy::checked_conversions,
|
||||
clippy::dbg_macro,
|
||||
clippy::debug_assert_with_mut_call,
|
||||
clippy::doc_markdown,
|
||||
clippy::empty_enum,
|
||||
clippy::enum_glob_use,
|
||||
clippy::exit,
|
||||
clippy::expl_impl_clone_on_copy,
|
||||
clippy::explicit_deref_methods,
|
||||
clippy::explicit_into_iter_loop,
|
||||
clippy::fallible_impl_from,
|
||||
clippy::filter_map_next,
|
||||
clippy::float_cmp_const,
|
||||
clippy::fn_params_excessive_bools,
|
||||
clippy::if_let_mutex,
|
||||
clippy::implicit_clone,
|
||||
clippy::imprecise_flops,
|
||||
clippy::inefficient_to_string,
|
||||
clippy::invalid_upcast_comparisons,
|
||||
clippy::large_types_passed_by_value,
|
||||
clippy::let_unit_value,
|
||||
clippy::linkedlist,
|
||||
clippy::lossy_float_literal,
|
||||
clippy::macro_use_imports,
|
||||
clippy::manual_ok_or,
|
||||
clippy::map_err_ignore,
|
||||
clippy::map_flatten,
|
||||
clippy::map_unwrap_or,
|
||||
@ -30,26 +39,34 @@
|
||||
clippy::match_wildcard_for_single_variants,
|
||||
clippy::mem_forget,
|
||||
clippy::mismatched_target_os,
|
||||
clippy::mut_mut,
|
||||
clippy::mutex_integer,
|
||||
clippy::needless_borrow,
|
||||
clippy::needless_continue,
|
||||
clippy::option_option,
|
||||
clippy::pub_enum_variant_names,
|
||||
clippy::path_buf_push_overwrite,
|
||||
clippy::ptr_as_ptr,
|
||||
clippy::ref_option_ref,
|
||||
clippy::rest_pat_in_fully_bound_structs,
|
||||
clippy::same_functions_in_if_condition,
|
||||
clippy::semicolon_if_nothing_returned,
|
||||
clippy::string_add_assign,
|
||||
clippy::string_add,
|
||||
clippy::string_lit_as_bytes,
|
||||
clippy::string_to_string,
|
||||
clippy::suboptimal_flops,
|
||||
clippy::todo,
|
||||
clippy::trait_duplication_in_bounds,
|
||||
clippy::unimplemented,
|
||||
clippy::unnested_or_patterns,
|
||||
clippy::unused_self,
|
||||
clippy::useless_transmute,
|
||||
clippy::verbose_file_reads,
|
||||
clippy::zero_sized_map_values,
|
||||
future_incompatible,
|
||||
nonstandard_style,
|
||||
rust_2018_idioms
|
||||
)]
|
||||
// END - Embark standard lints v0.3
|
||||
// END - Embark standard lints v0.4
|
||||
// crate-specific exceptions:
|
||||
#![allow()]
|
||||
|
||||
@ -268,7 +285,7 @@ impl SpirvBuilder {
|
||||
match self.print_metadata {
|
||||
MetadataPrintout::Full | MetadataPrintout::DependencyOnly => {
|
||||
leaf_deps(&metadata_file, |artifact| {
|
||||
println!("cargo:rerun-if-changed={}", artifact)
|
||||
println!("cargo:rerun-if-changed={}", artifact);
|
||||
})
|
||||
// Close enough
|
||||
.map_err(SpirvBuilderError::MetadataFileMissing)?;
|
||||
@ -524,7 +541,7 @@ fn leaf_deps(artifact: &Path, mut handle: impl FnMut(&RawStr)) -> std::io::Resul
|
||||
match map.get(artifact) {
|
||||
Some(entries) => {
|
||||
for entry in entries {
|
||||
recurse(map, entry, handle)
|
||||
recurse(map, entry, handle);
|
||||
}
|
||||
}
|
||||
None => handle(artifact),
|
||||
|
@ -350,7 +350,7 @@ impl quote::ToTokens for ImageType {
|
||||
{ #crate_root::image::#format },
|
||||
{ #access_qualifier },
|
||||
>
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,27 +1,36 @@
|
||||
// BEGIN - Embark standard lints v0.3
|
||||
// BEGIN - Embark standard lints v0.4
|
||||
// do not change or add/remove here, but one can add exceptions after this section
|
||||
// for more info see: <https://github.com/EmbarkStudios/rust-ecosystem/issues/59>
|
||||
#![deny(unsafe_code)]
|
||||
#![warn(
|
||||
clippy::all,
|
||||
clippy::await_holding_lock,
|
||||
clippy::char_lit_as_u8,
|
||||
clippy::checked_conversions,
|
||||
clippy::dbg_macro,
|
||||
clippy::debug_assert_with_mut_call,
|
||||
clippy::doc_markdown,
|
||||
clippy::empty_enum,
|
||||
clippy::enum_glob_use,
|
||||
clippy::exit,
|
||||
clippy::expl_impl_clone_on_copy,
|
||||
clippy::explicit_deref_methods,
|
||||
clippy::explicit_into_iter_loop,
|
||||
clippy::fallible_impl_from,
|
||||
clippy::filter_map_next,
|
||||
clippy::float_cmp_const,
|
||||
clippy::fn_params_excessive_bools,
|
||||
clippy::if_let_mutex,
|
||||
clippy::implicit_clone,
|
||||
clippy::imprecise_flops,
|
||||
clippy::inefficient_to_string,
|
||||
clippy::invalid_upcast_comparisons,
|
||||
clippy::large_types_passed_by_value,
|
||||
clippy::let_unit_value,
|
||||
clippy::linkedlist,
|
||||
clippy::lossy_float_literal,
|
||||
clippy::macro_use_imports,
|
||||
clippy::manual_ok_or,
|
||||
clippy::map_err_ignore,
|
||||
clippy::map_flatten,
|
||||
clippy::map_unwrap_or,
|
||||
@ -30,26 +39,34 @@
|
||||
clippy::match_wildcard_for_single_variants,
|
||||
clippy::mem_forget,
|
||||
clippy::mismatched_target_os,
|
||||
clippy::mut_mut,
|
||||
clippy::mutex_integer,
|
||||
clippy::needless_borrow,
|
||||
clippy::needless_continue,
|
||||
clippy::option_option,
|
||||
clippy::pub_enum_variant_names,
|
||||
clippy::path_buf_push_overwrite,
|
||||
clippy::ptr_as_ptr,
|
||||
clippy::ref_option_ref,
|
||||
clippy::rest_pat_in_fully_bound_structs,
|
||||
clippy::same_functions_in_if_condition,
|
||||
clippy::semicolon_if_nothing_returned,
|
||||
clippy::string_add_assign,
|
||||
clippy::string_add,
|
||||
clippy::string_lit_as_bytes,
|
||||
clippy::string_to_string,
|
||||
clippy::suboptimal_flops,
|
||||
clippy::todo,
|
||||
clippy::trait_duplication_in_bounds,
|
||||
clippy::unimplemented,
|
||||
clippy::unnested_or_patterns,
|
||||
clippy::unused_self,
|
||||
clippy::useless_transmute,
|
||||
clippy::verbose_file_reads,
|
||||
clippy::zero_sized_map_values,
|
||||
future_incompatible,
|
||||
nonstandard_style,
|
||||
rust_2018_idioms
|
||||
)]
|
||||
// END - Embark standard lints v0.3
|
||||
// END - Embark standard lints v0.4
|
||||
// crate-specific exceptions:
|
||||
// `or_patterns` is not stable yet.
|
||||
#![allow(clippy::unnested_or_patterns)]
|
||||
|
@ -12,30 +12,39 @@
|
||||
register_attr(spirv)
|
||||
)]
|
||||
#![feature(const_generics)]
|
||||
// BEGIN - Embark standard lints v0.3
|
||||
// BEGIN - Embark standard lints v0.4
|
||||
// do not change or add/remove here, but one can add exceptions after this section
|
||||
// for more info see: <https://github.com/EmbarkStudios/rust-ecosystem/issues/59>
|
||||
#![deny(unsafe_code)]
|
||||
#![warn(
|
||||
clippy::all,
|
||||
clippy::await_holding_lock,
|
||||
clippy::char_lit_as_u8,
|
||||
clippy::checked_conversions,
|
||||
clippy::dbg_macro,
|
||||
clippy::debug_assert_with_mut_call,
|
||||
clippy::doc_markdown,
|
||||
clippy::empty_enum,
|
||||
clippy::enum_glob_use,
|
||||
clippy::exit,
|
||||
clippy::expl_impl_clone_on_copy,
|
||||
clippy::explicit_deref_methods,
|
||||
clippy::explicit_into_iter_loop,
|
||||
clippy::fallible_impl_from,
|
||||
clippy::filter_map_next,
|
||||
clippy::float_cmp_const,
|
||||
clippy::fn_params_excessive_bools,
|
||||
clippy::if_let_mutex,
|
||||
clippy::implicit_clone,
|
||||
clippy::imprecise_flops,
|
||||
clippy::inefficient_to_string,
|
||||
clippy::invalid_upcast_comparisons,
|
||||
clippy::large_types_passed_by_value,
|
||||
clippy::let_unit_value,
|
||||
clippy::linkedlist,
|
||||
clippy::lossy_float_literal,
|
||||
clippy::macro_use_imports,
|
||||
clippy::manual_ok_or,
|
||||
clippy::map_err_ignore,
|
||||
clippy::map_flatten,
|
||||
clippy::map_unwrap_or,
|
||||
@ -44,26 +53,34 @@
|
||||
clippy::match_wildcard_for_single_variants,
|
||||
clippy::mem_forget,
|
||||
clippy::mismatched_target_os,
|
||||
clippy::mut_mut,
|
||||
clippy::mutex_integer,
|
||||
clippy::needless_borrow,
|
||||
clippy::needless_continue,
|
||||
clippy::option_option,
|
||||
clippy::pub_enum_variant_names,
|
||||
clippy::path_buf_push_overwrite,
|
||||
clippy::ptr_as_ptr,
|
||||
clippy::ref_option_ref,
|
||||
clippy::rest_pat_in_fully_bound_structs,
|
||||
clippy::same_functions_in_if_condition,
|
||||
clippy::semicolon_if_nothing_returned,
|
||||
clippy::string_add_assign,
|
||||
clippy::string_add,
|
||||
clippy::string_lit_as_bytes,
|
||||
clippy::string_to_string,
|
||||
clippy::suboptimal_flops,
|
||||
clippy::todo,
|
||||
clippy::trait_duplication_in_bounds,
|
||||
clippy::unimplemented,
|
||||
clippy::unnested_or_patterns,
|
||||
clippy::unused_self,
|
||||
clippy::useless_transmute,
|
||||
clippy::verbose_file_reads,
|
||||
clippy::zero_sized_map_values,
|
||||
future_incompatible,
|
||||
nonstandard_style,
|
||||
rust_2018_idioms
|
||||
)]
|
||||
// END - Embark standard lints v0.3
|
||||
// END - Embark standard lints v0.4
|
||||
// crate-specific exceptions:
|
||||
#![allow(
|
||||
// Needed for `asm!`.
|
||||
|
@ -1,46 +1,74 @@
|
||||
// standard Embark lints
|
||||
// BEGIN - Embark standard lints v0.4
|
||||
// do not change or add/remove here, but one can add exceptions after this section
|
||||
// for more info see: <https://github.com/EmbarkStudios/rust-ecosystem/issues/59>
|
||||
//#![deny(unsafe_code)] // impractical in this crate dealing with unsafe `ash`
|
||||
#![warn(
|
||||
clippy::all,
|
||||
clippy::await_holding_lock,
|
||||
clippy::char_lit_as_u8,
|
||||
clippy::checked_conversions,
|
||||
clippy::dbg_macro,
|
||||
clippy::debug_assert_with_mut_call,
|
||||
clippy::doc_markdown,
|
||||
clippy::empty_enum,
|
||||
clippy::enum_glob_use,
|
||||
clippy::exit,
|
||||
clippy::expl_impl_clone_on_copy,
|
||||
clippy::explicit_deref_methods,
|
||||
clippy::explicit_into_iter_loop,
|
||||
clippy::fallible_impl_from,
|
||||
clippy::filter_map_next,
|
||||
clippy::float_cmp_const,
|
||||
clippy::fn_params_excessive_bools,
|
||||
clippy::if_let_mutex,
|
||||
clippy::implicit_clone,
|
||||
clippy::imprecise_flops,
|
||||
clippy::inefficient_to_string,
|
||||
clippy::invalid_upcast_comparisons,
|
||||
clippy::large_types_passed_by_value,
|
||||
clippy::let_unit_value,
|
||||
clippy::linkedlist,
|
||||
clippy::lossy_float_literal,
|
||||
clippy::macro_use_imports,
|
||||
clippy::manual_ok_or,
|
||||
clippy::map_err_ignore,
|
||||
clippy::map_flatten,
|
||||
clippy::map_unwrap_or,
|
||||
clippy::match_on_vec_items,
|
||||
clippy::match_same_arms,
|
||||
clippy::match_wildcard_for_single_variants,
|
||||
clippy::mem_forget,
|
||||
clippy::mismatched_target_os,
|
||||
clippy::mut_mut,
|
||||
clippy::mutex_integer,
|
||||
clippy::needless_borrow,
|
||||
clippy::needless_continue,
|
||||
clippy::option_option,
|
||||
clippy::pub_enum_variant_names,
|
||||
clippy::path_buf_push_overwrite,
|
||||
clippy::ptr_as_ptr,
|
||||
clippy::ref_option_ref,
|
||||
clippy::rest_pat_in_fully_bound_structs,
|
||||
clippy::same_functions_in_if_condition,
|
||||
clippy::semicolon_if_nothing_returned,
|
||||
clippy::string_add_assign,
|
||||
clippy::string_add,
|
||||
clippy::string_lit_as_bytes,
|
||||
clippy::string_to_string,
|
||||
clippy::suboptimal_flops,
|
||||
clippy::todo,
|
||||
clippy::trait_duplication_in_bounds,
|
||||
clippy::unimplemented,
|
||||
clippy::unnested_or_patterns,
|
||||
clippy::unused_self,
|
||||
clippy::useless_transmute,
|
||||
clippy::verbose_file_reads,
|
||||
clippy::zero_sized_map_values,
|
||||
future_incompatible,
|
||||
nonstandard_style,
|
||||
rust_2018_idioms
|
||||
)]
|
||||
// END - Embark standard lints v0.4
|
||||
// crate-specific exceptions:
|
||||
#![allow()]
|
||||
|
||||
use ash::{
|
||||
extensions::{ext, khr},
|
||||
@ -127,7 +155,7 @@ pub fn main() {
|
||||
ctx.render();
|
||||
}
|
||||
} else {
|
||||
ctx.render()
|
||||
ctx.render();
|
||||
}
|
||||
}
|
||||
Ok(new_shaders) => {
|
||||
@ -138,7 +166,7 @@ pub fn main() {
|
||||
ctx.rebuild_pipelines(vk::PipelineCache::null());
|
||||
}
|
||||
Err(TryRecvError::Disconnected) => {
|
||||
panic!("compiler reciever disconnected unexpectedly")
|
||||
panic!("compiler reciever disconnected unexpectedly");
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -186,7 +214,7 @@ pub fn compile_shaders() -> Vec<SpvFile> {
|
||||
spv_files.push(SpvFile {
|
||||
name: path.file_stem().unwrap().to_str().unwrap().to_owned(),
|
||||
data: read_spv(&mut File::open(path).unwrap()).unwrap(),
|
||||
})
|
||||
});
|
||||
}
|
||||
spv_files
|
||||
}
|
||||
@ -770,7 +798,9 @@ impl RenderCtx {
|
||||
.expect("Shader module error")
|
||||
};
|
||||
if let Some(old_module) = self.shader_modules.insert(name, shader_module) {
|
||||
unsafe { self.base.device.destroy_shader_module(old_module, None) }
|
||||
unsafe {
|
||||
self.base.device.destroy_shader_module(old_module, None);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@ -780,7 +810,7 @@ impl RenderCtx {
|
||||
self.base.device.device_wait_idle().unwrap();
|
||||
// framebuffers
|
||||
for framebuffer in self.framebuffers.drain(..) {
|
||||
self.base.device.destroy_framebuffer(framebuffer, None)
|
||||
self.base.device.destroy_framebuffer(framebuffer, None);
|
||||
}
|
||||
// image views
|
||||
for image_view in self.image_views.drain(..) {
|
||||
@ -801,7 +831,7 @@ impl RenderCtx {
|
||||
self.rendering_paused = true;
|
||||
return;
|
||||
} else if self.rendering_paused {
|
||||
self.rendering_paused = false
|
||||
self.rendering_paused = false;
|
||||
};
|
||||
|
||||
self.cleanup_swapchain();
|
||||
@ -1026,7 +1056,7 @@ impl Drop for RenderCtx {
|
||||
.device
|
||||
.destroy_command_pool(self.commands.pool, None);
|
||||
for (_, shader_module) in self.shader_modules.drain() {
|
||||
self.base.device.destroy_shader_module(shader_module, None)
|
||||
self.base.device.destroy_shader_module(shader_module, None);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1210,7 +1240,7 @@ pub struct FragmentShaderEntryPoint {
|
||||
}
|
||||
|
||||
unsafe fn any_as_u8_slice<T: Sized>(p: &T) -> &[u8] {
|
||||
::std::slice::from_raw_parts((p as *const T) as *const u8, ::std::mem::size_of::<T>())
|
||||
::std::slice::from_raw_parts((p as *const T).cast::<u8>(), ::std::mem::size_of::<T>())
|
||||
}
|
||||
|
||||
unsafe extern "system" fn vulkan_debug_callback(
|
||||
|
@ -1,46 +1,74 @@
|
||||
// standard Embark lints
|
||||
// BEGIN - Embark standard lints v0.4
|
||||
// do not change or add/remove here, but one can add exceptions after this section
|
||||
// for more info see: <https://github.com/EmbarkStudios/rust-ecosystem/issues/59>
|
||||
#![deny(unsafe_code)]
|
||||
#![warn(
|
||||
clippy::all,
|
||||
clippy::await_holding_lock,
|
||||
clippy::char_lit_as_u8,
|
||||
clippy::checked_conversions,
|
||||
clippy::dbg_macro,
|
||||
clippy::debug_assert_with_mut_call,
|
||||
clippy::doc_markdown,
|
||||
clippy::empty_enum,
|
||||
clippy::enum_glob_use,
|
||||
clippy::exit,
|
||||
clippy::expl_impl_clone_on_copy,
|
||||
clippy::explicit_deref_methods,
|
||||
clippy::explicit_into_iter_loop,
|
||||
clippy::fallible_impl_from,
|
||||
clippy::filter_map_next,
|
||||
clippy::float_cmp_const,
|
||||
clippy::fn_params_excessive_bools,
|
||||
clippy::if_let_mutex,
|
||||
clippy::implicit_clone,
|
||||
clippy::imprecise_flops,
|
||||
clippy::inefficient_to_string,
|
||||
clippy::invalid_upcast_comparisons,
|
||||
clippy::large_types_passed_by_value,
|
||||
clippy::let_unit_value,
|
||||
clippy::linkedlist,
|
||||
clippy::lossy_float_literal,
|
||||
clippy::macro_use_imports,
|
||||
clippy::manual_ok_or,
|
||||
clippy::map_err_ignore,
|
||||
clippy::map_flatten,
|
||||
clippy::map_unwrap_or,
|
||||
clippy::match_on_vec_items,
|
||||
clippy::match_same_arms,
|
||||
clippy::match_wildcard_for_single_variants,
|
||||
clippy::mem_forget,
|
||||
clippy::mismatched_target_os,
|
||||
clippy::mut_mut,
|
||||
clippy::mutex_integer,
|
||||
clippy::needless_borrow,
|
||||
clippy::needless_continue,
|
||||
clippy::option_option,
|
||||
clippy::pub_enum_variant_names,
|
||||
clippy::path_buf_push_overwrite,
|
||||
clippy::ptr_as_ptr,
|
||||
clippy::ref_option_ref,
|
||||
clippy::rest_pat_in_fully_bound_structs,
|
||||
clippy::same_functions_in_if_condition,
|
||||
clippy::semicolon_if_nothing_returned,
|
||||
clippy::string_add_assign,
|
||||
clippy::string_add,
|
||||
clippy::string_lit_as_bytes,
|
||||
clippy::string_to_string,
|
||||
clippy::suboptimal_flops,
|
||||
clippy::todo,
|
||||
clippy::trait_duplication_in_bounds,
|
||||
clippy::unimplemented,
|
||||
clippy::unnested_or_patterns,
|
||||
clippy::unused_self,
|
||||
clippy::useless_transmute,
|
||||
clippy::verbose_file_reads,
|
||||
clippy::zero_sized_map_values,
|
||||
future_incompatible,
|
||||
nonstandard_style,
|
||||
rust_2018_idioms
|
||||
)]
|
||||
// END - Embark standard lints v0.4
|
||||
// crate-specific exceptions:
|
||||
#![allow()]
|
||||
|
||||
use minifb::{Key, Window, WindowOptions};
|
||||
use rayon::prelude::*;
|
||||
|
@ -17,7 +17,7 @@ fn block_on<T>(future: impl Future<Output = T>) -> T {
|
||||
pub fn start(options: &Options) {
|
||||
let shader_binary = crate::maybe_watch(options.shader, None);
|
||||
|
||||
block_on(start_internal(options, shader_binary))
|
||||
block_on(start_internal(options, shader_binary));
|
||||
}
|
||||
|
||||
pub async fn start_internal(
|
||||
|
@ -205,13 +205,10 @@ async fn run(
|
||||
queue.submit(Some(encoder.finish()));
|
||||
}
|
||||
}
|
||||
Event::WindowEvent {
|
||||
event: WindowEvent::CloseRequested,
|
||||
..
|
||||
} => *control_flow = ControlFlow::Exit,
|
||||
Event::WindowEvent {
|
||||
event:
|
||||
WindowEvent::KeyboardInput {
|
||||
WindowEvent::CloseRequested
|
||||
| WindowEvent::KeyboardInput {
|
||||
input:
|
||||
KeyboardInput {
|
||||
virtual_keycode: Some(VirtualKeyCode::Escape),
|
||||
|
@ -1,46 +1,74 @@
|
||||
// standard Embark lints
|
||||
// BEGIN - Embark standard lints v0.4
|
||||
// do not change or add/remove here, but one can add exceptions after this section
|
||||
// for more info see: <https://github.com/EmbarkStudios/rust-ecosystem/issues/59>
|
||||
//#![deny(unsafe_code)] // quite a bit of unsafe with wgpu still, would be nice to remove
|
||||
#![warn(
|
||||
clippy::all,
|
||||
clippy::await_holding_lock,
|
||||
clippy::char_lit_as_u8,
|
||||
clippy::checked_conversions,
|
||||
clippy::dbg_macro,
|
||||
clippy::debug_assert_with_mut_call,
|
||||
clippy::doc_markdown,
|
||||
clippy::empty_enum,
|
||||
clippy::enum_glob_use,
|
||||
clippy::exit,
|
||||
clippy::expl_impl_clone_on_copy,
|
||||
clippy::explicit_deref_methods,
|
||||
clippy::explicit_into_iter_loop,
|
||||
clippy::fallible_impl_from,
|
||||
clippy::filter_map_next,
|
||||
clippy::float_cmp_const,
|
||||
clippy::fn_params_excessive_bools,
|
||||
clippy::if_let_mutex,
|
||||
clippy::implicit_clone,
|
||||
clippy::imprecise_flops,
|
||||
clippy::inefficient_to_string,
|
||||
clippy::invalid_upcast_comparisons,
|
||||
clippy::large_types_passed_by_value,
|
||||
clippy::let_unit_value,
|
||||
clippy::linkedlist,
|
||||
clippy::lossy_float_literal,
|
||||
clippy::macro_use_imports,
|
||||
clippy::manual_ok_or,
|
||||
clippy::map_err_ignore,
|
||||
clippy::map_flatten,
|
||||
clippy::map_unwrap_or,
|
||||
clippy::match_on_vec_items,
|
||||
clippy::match_same_arms,
|
||||
clippy::match_wildcard_for_single_variants,
|
||||
clippy::mem_forget,
|
||||
clippy::mismatched_target_os,
|
||||
clippy::mut_mut,
|
||||
clippy::mutex_integer,
|
||||
clippy::needless_borrow,
|
||||
clippy::needless_continue,
|
||||
clippy::option_option,
|
||||
clippy::pub_enum_variant_names,
|
||||
clippy::path_buf_push_overwrite,
|
||||
clippy::ptr_as_ptr,
|
||||
clippy::ref_option_ref,
|
||||
clippy::rest_pat_in_fully_bound_structs,
|
||||
clippy::same_functions_in_if_condition,
|
||||
clippy::semicolon_if_nothing_returned,
|
||||
clippy::string_add_assign,
|
||||
clippy::string_add,
|
||||
clippy::string_lit_as_bytes,
|
||||
clippy::string_to_string,
|
||||
clippy::suboptimal_flops,
|
||||
clippy::todo,
|
||||
clippy::trait_duplication_in_bounds,
|
||||
clippy::unimplemented,
|
||||
clippy::unnested_or_patterns,
|
||||
clippy::unused_self,
|
||||
clippy::useless_transmute,
|
||||
clippy::verbose_file_reads,
|
||||
clippy::zero_sized_map_values,
|
||||
future_incompatible,
|
||||
nonstandard_style,
|
||||
rust_2018_idioms
|
||||
)]
|
||||
// END - Embark standard lints v0.4
|
||||
// crate-specific exceptions:
|
||||
#![allow()]
|
||||
|
||||
use clap::Clap;
|
||||
use strum::{Display, EnumString};
|
||||
@ -144,7 +172,7 @@ pub fn main() {
|
||||
let options: Options = Options::parse();
|
||||
|
||||
if is_compute_shader(options.shader) {
|
||||
compute::start(&options)
|
||||
compute::start(&options);
|
||||
} else {
|
||||
graphics::start(&options);
|
||||
}
|
||||
|
@ -5,5 +5,5 @@
|
||||
# to the user in the error, instead of "error: invalid channel name '[toolchain]'".
|
||||
|
||||
[toolchain]
|
||||
channel = "nightly-2021-05-24"
|
||||
channel = "nightly-2021-06-09"
|
||||
components = ["rust-src", "rustc-dev", "llvm-tools-preview"]
|
||||
|
@ -179,7 +179,7 @@ fn build_deps(deps_target_dir: &Path, codegen_backend_path: &Path, target: &str)
|
||||
])
|
||||
.arg("--target-dir")
|
||||
.arg(deps_target_dir)
|
||||
.env("RUSTFLAGS", rust_flags(&codegen_backend_path))
|
||||
.env("RUSTFLAGS", rust_flags(codegen_backend_path))
|
||||
.current_dir(old_cargo_resolver_workaround_cwd)
|
||||
.stderr(std::process::Stdio::inherit())
|
||||
.stdout(std::process::Stdio::inherit())
|
||||
|
Loading…
Reference in New Issue
Block a user