Skip to content

Commit f7ed1ba

Browse files
committed
Rely on libm for a no_std alternative to round_ties_even
Update comments around `no_std` CI task
1 parent 850c3d4 commit f7ed1ba

File tree

6 files changed

+19
-4
lines changed

6 files changed

+19
-4
lines changed

.github/workflows/ci.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ jobs:
292292
cargo clippy --target ${{ matrix.target }} ${{ matrix.extra-flags }} -p wgpu-hal --all-features
293293
cargo clippy --target ${{ matrix.target }} ${{ matrix.extra-flags }} -p wgpu --all-features
294294
295-
# Building for no_std platforms where every feature is enabled except "std".
295+
# Building for no_std platforms.
296296
- name: Check `no_std`
297297
if: matrix.kind == 'no_std'
298298
shell: bash
@@ -301,9 +301,11 @@ jobs:
301301
302302
# check with no features
303303
cargo clippy --target ${{ matrix.target }} ${{ matrix.extra-flags }} -p wgpu-types --no-default-features
304+
cargo clippy --target ${{ matrix.target }} ${{ matrix.extra-flags }} -p naga --no-default-features
304305
305-
# Check with all features except "std".
306+
# Check with all compatible features
306307
cargo clippy --target ${{ matrix.target }} ${{ matrix.extra-flags }} -p wgpu-types --no-default-features --features strict_asserts,fragile-send-sync-non-atomic-wasm,serde,counters
308+
cargo clippy --target ${{ matrix.target }} ${{ matrix.extra-flags }} -p naga --no-default-features --features dot-out,compact
307309
308310
# Building for native platforms with standard tests.
309311
- name: Check native

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ Bottom level categories:
4242

4343
### New Features
4444

45+
#### Naga
46+
47+
- Added `no_std` support with default features disabled. By @Bushrat011899 in [#7585](https://github.com/gfx-rs/wgpu/pull/7585).
48+
4549
#### General
4650

4751
- Add support for rendering to slices of 3D texture views and single layered 2D-Array texture views (this requires `VK_KHR_maintenance1` which should be widely available on newer drivers). By @teoxoy in [#7596](https://github.com/gfx-rs/wgpu/pull/7596)

Cargo.lock

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

naga/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ hashbrown.workspace = true
9191
half = { workspace = true, features = ["num-traits"] }
9292
rustc-hash.workspace = true
9393
indexmap.workspace = true
94+
libm = { version = "0.2", default-features = false }
9495
log.workspace = true
9596
num-traits.workspace = true
9697
once_cell = { workspace = true, features = ["alloc", "race"] }

naga/src/back/mod.rs

+7
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@ pub type NeedBakeExpressions = crate::FastHashSet<crate::Handle<crate::Expressio
4646
///
4747
/// [`Expression`]: crate::Expression
4848
/// [`Handle`]: crate::Handle
49+
#[cfg_attr(
50+
not(any(glsl_out, hlsl_out, msl_out, wgsl_out)),
51+
allow(
52+
dead_code,
53+
reason = "shared helpers can be dead if none of the enabled backends need it"
54+
)
55+
)]
4956
struct Baked(crate::Handle<crate::Expression>);
5057

5158
impl core::fmt::Display for Baked {

naga/src/proc/constant_evaluator.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1172,8 +1172,8 @@ impl<'a> ConstantEvaluator<'a> {
11721172
}
11731173
crate::MathFunction::Round => {
11741174
component_wise_float(self, span, [arg], |e| match e {
1175-
Float::Abstract([e]) => Ok(Float::Abstract([e.round_ties_even()])),
1176-
Float::F32([e]) => Ok(Float::F32([e.round_ties_even()])),
1175+
Float::Abstract([e]) => Ok(Float::Abstract([libm::rint(e)])),
1176+
Float::F32([e]) => Ok(Float::F32([libm::rintf(e)])),
11771177
Float::F16([e]) => {
11781178
// TODO: `round_ties_even` is not available on `half::f16` yet.
11791179
//

0 commit comments

Comments
 (0)