Skip to content

Commit 8cfa35c

Browse files
jimblandydavnotdev
authored andcommitted
[naga spv-out] Factor out wrapped divide/module generation.
Move the code to generate the definition of an overflow-safe divide/modulo SPIR-V function into its own Rust function, to reduce indentation and clarify influences. This commit isn't intended to cause any change in behavior.
1 parent ac07c46 commit 8cfa35c

File tree

2 files changed

+226
-192
lines changed

2 files changed

+226
-192
lines changed

naga/src/back/spv/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,14 @@ impl NumericType {
303303
}
304304
}
305305

306+
const fn scalar(self) -> crate::Scalar {
307+
match self {
308+
NumericType::Scalar(scalar)
309+
| NumericType::Vector { scalar, .. }
310+
| NumericType::Matrix { scalar, .. } => scalar,
311+
}
312+
}
313+
306314
const fn with_scalar(self, scalar: crate::Scalar) -> Self {
307315
match self {
308316
NumericType::Scalar(_) => NumericType::Scalar(scalar),

0 commit comments

Comments
 (0)