Skip to content

Commit

Permalink
Update pruner to naga 23
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewBrownK committed Jan 2, 2025
1 parent 09e962f commit 991edde
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/compose/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ impl Composer {
auto: &'a mut u32,
}

impl<'a> regex::Replacer for AutoBindingReplacer<'a> {
impl regex::Replacer for AutoBindingReplacer<'_> {
fn replace_append(&mut self, _: &regex::Captures<'_>, dst: &mut String) {
dst.push_str(&format!("@binding({})", self.auto));
*self.auto += 1;
Expand Down
2 changes: 1 addition & 1 deletion src/compose/tokenizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pub enum Token<'a> {
Whitespace(&'a str, usize),
}

impl<'a> Token<'a> {
impl Token<'_> {
pub fn pos(&self) -> usize {
match self {
Token::Identifier(_, pos) | Token::Other(_, pos) | Token::Whitespace(_, pos) => *pos,
Expand Down
2 changes: 1 addition & 1 deletion src/derive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@ impl<'a> DerivedModule<'a> {
}
}

impl<'a> From<DerivedModule<'a>> for naga::Module {
impl From<DerivedModule<'_>> for naga::Module {
fn from(derived: DerivedModule) -> Self {
naga::Module {
types: derived.types,
Expand Down
9 changes: 6 additions & 3 deletions src/prune/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ impl FunctionReq {
pointer: expr_map[pointer],
fun: *fun,
value: expr_map[value],
result: expr_map[result],
result: result.as_ref().map(|it| expr_map[it]),
})
}
(
Expand Down Expand Up @@ -1568,12 +1568,15 @@ impl<'a> Pruner<'a> {
let required_store = self.store_required(context, &var_ref);
debug!("atomic store required: {:?}", required_store);

let required_load = func_req.exprs_required.get(result).cloned();
let required_load = match result {
Some(result) => func_req.exprs_required.get(result).cloned(),
None => None,
};
debug!("atomic load required: {:?}", required_load);

if required_load.is_some() || required_store.is_some() {
// just pass it all through i guess ..?
if let Some(required_load) = required_load {
if let (Some(required_load), Some(result)) = (required_load, result) {
self.add_expression(function, func_req, context, *result, &required_load);
}
if let Some(required_store) = required_store {
Expand Down

0 comments on commit 991edde

Please sign in to comment.