Skip to content

Commit 2de9a82

Browse files
WIP
1 parent b1042b5 commit 2de9a82

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

naga/src/proc/overloads/select.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,6 @@ impl TryToWgsl for WgslSymbol {
3838

3939
impl core::fmt::Debug for WgslSymbol {
4040
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
41-
f.write_str(Self::DESCRIPTION)
41+
f.write_str("Select")
4242
}
4343
}

naga/src/valid/expression.rs

+13-8
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1-
use alloc::{format, string::String};
1+
use alloc::{
2+
format,
3+
string::{String, ToString},
4+
};
5+
use core::format_args;
26

37
use super::{compose::validate_compose, FunctionInfo, ModuleInfo, ShaderStages, TypeFlags};
48
use crate::arena::UniqueArena;
59
use crate::{
610
arena::Handle,
11+
common::wgsl::ToWgsl as _,
712
proc,
813
proc::OverloadSet,
914
proc::{IndexableLengthError, ResolveError},
@@ -130,7 +135,7 @@ pub enum ExpressionError {
130135
InvalidCastArgument,
131136
#[error("Invalid argument count for {0}")]
132137
WrongArgumentCount(String),
133-
#[error("Argument [{1}] to {0:?} as expression {2:?} has an invalid type.")]
138+
#[error("Argument [{1}] to `{0}` as expression {2:?} has an invalid type.")]
134139
InvalidArgumentType(String, u32, Handle<crate::Expression>),
135140
#[error(
136141
"workgroupUniformLoad result type can't be {0:?}. It can only be a constructible type."
@@ -245,14 +250,14 @@ impl super::Validator {
245250
actuals: A,
246251
) -> Result<(), ExpressionError>
247252
where
248-
F: core::fmt::Debug + Copy,
253+
F: core::fmt::Display + Copy,
249254
O: OverloadSet,
250255
A: Iterator<Item = (Handle<crate::Expression>, &'a crate::TypeInner)> + ExactSizeIterator,
251256
{
252257
// Start with the set of all overloads available for `fun`.
253258
let mut overloads = overloads;
254259
log::debug!(
255-
"initial overloads for {:?}: {:#?}",
260+
"initial overloads for {}: {:#?}",
256261
fun,
257262
overloads.for_debug(&module.types)
258263
);
@@ -278,15 +283,15 @@ impl super::Validator {
278283
if overloads.is_empty() {
279284
log::debug!("all overloads eliminated");
280285
return Err(ExpressionError::InvalidArgumentType(
281-
format!("{fun:?}"),
286+
fun.to_string(),
282287
i as u32,
283288
expr,
284289
));
285290
}
286291
}
287292

288293
if actuals_len < overloads.min_arguments() {
289-
return Err(ExpressionError::WrongArgumentCount(format!("{fun:?}")));
294+
return Err(ExpressionError::WrongArgumentCount(fun.to_string()));
290295
}
291296

292297
Ok(())
@@ -978,7 +983,7 @@ impl super::Validator {
978983
} => {
979984
self.validate_func_call_with_overloads(
980985
module,
981-
proc::select::WgslSymbol,
986+
format_args!("`{}`", proc::select::WgslSymbol.to_wgsl()),
982987
proc::select::overloads(),
983988
[reject, accept, condition]
984989
.iter()
@@ -1057,7 +1062,7 @@ impl super::Validator {
10571062

10581063
self.validate_func_call_with_overloads(
10591064
module,
1060-
fun,
1065+
format_args!("{fun:?}"),
10611066
fun.overloads(),
10621067
actuals
10631068
.iter()

0 commit comments

Comments
 (0)