8871 Commits

Author SHA1 Message Date
Erich Gubler
d5241dd675
refactor(ci): regulate titles in CI step names (#7172) 2025-02-21 19:39:48 +00:00
Connor Fitzgerald
4d24df2b3b
Fix enumeration of wgpu example shaders in example_wgsl test (#7191)
Co-authored-by: Erich Gubler <erichdongubler@gmail.com>
2025-02-21 19:31:30 +00:00
Erich Gubler
143ad278f2
typo: s/viritualization/virtualization (#7192) 2025-02-21 17:06:42 +00:00
Connor Fitzgerald
f44ecda16b
Fix Execution of Benchmarks (#7190) 2025-02-21 11:43:50 -05:00
Connor Fitzgerald
1ec34839ee
Improve Validation Errors with Naga Validator (#7185) 2025-02-21 10:57:59 -05:00
Kevin Reid
12ec5fd16f wgpu: Make macros usable from no_std and use strictly $crate paths. 2025-02-21 08:47:16 +01:00
Kevin Reid
b3b54b6941 wgpu: Adjust imports to allow no_std.
Remaining uses of `std`:
* `trace_path` / `trace_dir`
* `std::error::Error` (waiting for Rust 1.81)
* `std::ffi::c_void`
* Various uses in `util`
2025-02-21 08:47:16 +01:00
Kevin Reid
7bcbfe0712 wgpu-core: Adjust imports to allow no_std.
Dependencies on `std` that still exist:
* Locks
* `std::error::Error` (waiting for Rust 1.81)
* `std::os::raw::c_char` for FFI
* `thread_local` and `Backtrace` in `snatch`
2025-02-21 08:47:16 +01:00
Kevin Reid
bea4fb9e2d wgpu-hal: Adjust imports to eventually allow no_std.
We need `core::error::Error` (Rust 1.81) to make it a reality.
2025-02-21 08:47:16 +01:00
Mads Marquart
7b00140b16
Add layer observer based on raw-window-metal (#7026)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2025-02-20 21:30:58 +00:00
Connor Fitzgerald
48e2298ed9
Fix wgpu-info's use of DXC (#7184) 2025-02-20 17:17:50 +00:00
Kevin Reid
9c0fa2975f
Use BufferSlice in StagingBelt::allocate(). (#7179)
* Use `BufferSlice` in `StagingBelt::allocate()`.

* Make `StagingBelt::allocate()` return just the slice.
2025-02-20 10:05:30 +01:00
Christian Thackston
14bb855a27
Fix logo positioning in README (#7187) 2025-02-20 05:21:46 +00:00
Jim Blandy
5dad2c4cd4
[naga] Apply module compaction to GLSL tests. (#7186) 2025-02-19 20:59:06 -05:00
Jamie Nicol
7e42040fa5
Add validation tests ensuring destroyed textures and buffers cause submission to fail (#7181) 2025-02-19 10:09:17 -05:00
Teodor Tanasoaia
b5e32cec58
add max_shader_model to Dx12Compiler (#7167) 2025-02-18 13:44:23 +01:00
Connor Fitzgerald
e590555a8c
test: use spirv-as instead of pre-assembled SPIR-V (#7157) 2025-02-17 14:48:09 -05:00
Samson
7240c18554
fix(naga): Forbid negative indexing in const expressions (#7155)
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2025-02-17 14:38:00 -05:00
Jamie Nicol
d625d083c3
[naga wgsl-in] Implement any() and all() during const evaluation (#7166) 2025-02-17 14:13:49 -05:00
dependabot[bot]
c03176f3eb
chore(deps): bump the patch-updates group across 1 directory with 7 updates (#7168)
Bumps the patch-updates group with 6 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [document-features](https://github.com/slint-ui/document-features) | `0.2.10` | `0.2.11` |
| [smallvec](https://github.com/servo/rust-smallvec) | `1.13.2` | `1.14.0` |
| [cc](https://github.com/rust-lang/cc-rs) | `1.2.13` | `1.2.14` |
| [clap](https://github.com/clap-rs/clap) | `4.5.28` | `4.5.29` |
| [equivalent](https://github.com/indexmap-rs/equivalent) | `1.0.1` | `1.0.2` |
| [toml_edit](https://github.com/toml-rs/toml) | `0.22.23` | `0.22.24` |



Updates `document-features` from 0.2.10 to 0.2.11
- [Release notes](https://github.com/slint-ui/document-features/releases)
- [Changelog](https://github.com/slint-ui/document-features/blob/master/CHANGELOG.md)
- [Commits](https://github.com/slint-ui/document-features/commits)

Updates `smallvec` from 1.13.2 to 1.14.0
- [Release notes](https://github.com/servo/rust-smallvec/releases)
- [Commits](https://github.com/servo/rust-smallvec/compare/v1.13.2...v1.14.0)

Updates `cc` from 1.2.13 to 1.2.14
- [Release notes](https://github.com/rust-lang/cc-rs/releases)
- [Changelog](https://github.com/rust-lang/cc-rs/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/cc-rs/compare/cc-v1.2.13...cc-v1.2.14)

Updates `clap` from 4.5.28 to 4.5.29
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/clap_complete-v4.5.28...clap_complete-v4.5.29)

Updates `clap_builder` from 4.5.27 to 4.5.29
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/v4.5.27...v4.5.29)

Updates `equivalent` from 1.0.1 to 1.0.2
- [Commits](https://github.com/indexmap-rs/equivalent/compare/v1.0.1...v1.0.2)

Updates `toml_edit` from 0.22.23 to 0.22.24
- [Commits](https://github.com/toml-rs/toml/compare/v0.22.23...v0.22.24)

---
updated-dependencies:
- dependency-name: document-features
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: smallvec
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: patch-updates
- dependency-name: cc
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: clap
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: clap_builder
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: equivalent
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: toml_edit
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-17 18:20:29 +00:00
Erich Gubler
6a01091397 move(core): s/create_compute_pass/begin_compute_pass/ 2025-02-17 12:42:10 -05:00
Erich Gubler
25a51606d1 move(core): s/create_render_pass/begin_render_pass/ 2025-02-17 12:42:10 -05:00
Connor Fitzgerald
194d4b1f36
New Binding Array Limit (#6952) 2025-02-17 09:22:24 -05:00
Kevin Reid
9da04c2b0b
Add getters and From implementations to BufferSlice. (#7148)
* Add getters to `BufferSlice` to obtain its parts.

* Add conversions from `BufferSlice` to `BufferBinding` and `BindingResource`.
2025-02-17 11:06:13 +01:00
dependabot[bot]
16977225d1
chore(deps): bump crate-ci/typos from 1.29.5 to 1.29.7 (#7158)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-17 02:52:31 +00:00
Junjun Dong
98649a79a0
feat: update naga:🔙:spv::Function::to_words (#7156) 2025-02-16 21:43:24 -05:00
Connor Fitzgerald
d8833d0798
Use Update After Bind Descriptors for Bind Groups With Binding Arrays (#6815)
* Use Update After Bind Descriptors for Bind Groups With Binding Arrays

Update After Bind

x

* Comments

* Fix URL
2025-02-15 12:02:27 -05:00
CrazyboyQCD
a45e2db43a
[Naga] replace unicode-xid with unicode-ident (#7135) 2025-02-14 20:58:17 -05:00
Sludge
723abcb1d3
Move changelog entry to the right version (#7145) 2025-02-14 23:38:55 +00:00
Connor Fitzgerald
7e119968ce
Properly Deal with Timeouts (#7030) 2025-02-14 23:19:51 +00:00
Jim Blandy
f90f19c7e8 [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.
2025-02-14 15:17:40 -08:00
Jamie Nicol
cb9666c6a7 [naga hlsl-out] Document the need for wrapper functions for integer division, modulo, abs(), and unary negation
Explain we need the wrapper functions not just to avoid undefined
behaviour, but also to ensure we adhere to the WGSL spec. Additionally
link to issue #7109 in cases where our workaround needs follow-up work
for non-32-bit integer types.
2025-02-14 15:17:40 -08:00
Jamie Nicol
b3b40c03d4 [naga msl-out] Document the need for wrapper functions for integer division, modulo, abs(), and unary negation
Explain we need the wrapper functions not just to avoid undefined
behaviour (or unspecified in the case of division), but also to ensure
we adhere to the WGSL spec.
2025-02-14 15:17:40 -08:00
Jim Blandy
96de35aac1 [hlsl-out] Clarify comment on HLSL floating-point divide by zero.
Replace the link to the resolved WGSL spec issue about floating-point
division by zero (gpuweb/gpuweb#2798) with links to the Direct3D 11
functional specification (which Direct3D 12 inherits) and the DXIL
specification, explaining that HLSL does what WGSL wants here.
2025-02-14 15:17:40 -08:00
Jim Blandy
bafeee6680 [hlsl-out] Clean up repetition in write_mapped_math_functions.
Since every `match` arm ends up looking up the type of the operation's
first argument, just do that once. This avoids a repetitive lookup for
`Abs`.
2025-02-14 15:17:40 -08:00
Jim Blandy
a25098f5ec [naga hlsl-out] Use Scalar associated constants in patterns. 2025-02-14 15:17:40 -08:00
Jamie Nicol
6cf4b710b8 [naga spv-out] Avoid undefined behaviour for integer division and modulo
Integer division or modulo is undefined behaviour in SPIR-V when the
divisor is zero, or when the dividend is the most negative number
representable by the result type and the divisor is negative one.

This patch makes us avoid this undefined behaviour and instead ensures
we adhere to the WGSL spec in these cases: for divisions the
expression evaluates to the value of the dividend, and for modulos the
expression evaluates to zero.

Similarily to how we handle these cases for the MSL and HLSL backends,
prior to emitting each function we emit code for any helper functions
required by that function's expressions. In this case that is helper
functions for integer division and modulo. Then, when emitting the
actual function's body, if we encounter an expression which needs
wrapped we instead emit a function call to the helper.
2025-02-14 15:17:40 -08:00
Jamie Nicol
b6186ba332 [naga hlsl-out] Avoid undefined behaviour for integer division, modulo, negation, and abs
Emit helper functions for MathFunction::Abs and UnaryOperator::Negate
with a signed integer scalar or vector operand. And for
BinaryOperator::Divide and BinaryOperator::Modulo with signed or
unsigned integer scalar or vector operands.

Abs and Negate are written to avoid signed integer overflow when the
operand equals INT_MIN. This is achieved by bitcasting the value to
unsigned, using the negation operator, then bitcasting the result back
to signed. As HLSL's bitcast functions asint() and asuint() only work
for 32-bit types, we only use this workaround in such cases.

Division and Modulo avoid undefined behaviour for INT_MIN / -1 and
divide-by-zero by using 1 for the divisor instead. Additionally we
avoid undefined behaviour when using the modulo operator on operands
of mixed signedness by using the equation from the WGSL spec, using
division, subtraction and multiplication, rather than HLSL's modulus
operator.
2025-02-14 15:17:40 -08:00
Jamie Nicol
88f6e9b8f8 [naga hlsl-out] Avoid undefined behaviour for signed integer addition, subtraction, and multiplication
Though not explicitly specified one way or the other, we have been
informed by DirectX engineers that signed integer overflow may be
undefined behaviour in some cases. To avoid this, we therefore bitcast
signed operands to unsigned prior to performing addition, subtraction,
or multiplication, then bitcast the result back to signed. As signed
types are represented as two's complement, this gives the correct
result whilst avoid any potential undefined behaviour.

Unfortunately HLSL's bitcast functions asint() and asuint() only work
for the 32-bit int and uint types. We therefore only apply this
workaround for 32-bit signed arithmetic. Support for other bit widths
could be added in the future, but extra care must be taken when
converting from unsigned to signed to avoid undefined or
implemented-defined behaviour.
2025-02-14 15:17:40 -08:00
Jamie Nicol
30363ef493 [naga hlsl-out] Wrap int literals in constructor-style cast
There is no literal suffix in HLSL for the integer type. We can,
however, wrap integer literals in a constructor style cast. This
avoids ambiguity when passing literals to overloaded functions, which
we'll make use of in the subsequent patch in this PR.
2025-02-14 15:17:40 -08:00
Jamie Nicol
8807c83363 [naga msl-out] Avoid undefined behaviour for integer division, modulo, negation, and abs
Adds infrastructure to the MSL backend for emitting helper functions,
based upon the existing HLSL backend equivalent. Emit helper functions
for MathFunction::Abs and UnaryOperator::Negate with a signed integer
scalar or vector operand. And for BinaryOperator::Divide and
BinaryOperator::Modulo with signed or unsigned integer scalar or
vector operands.

Abs and Negate are written to avoid signed integer overflow when the
operand equals INT_MIN. This is achieved by bitcasting the value to
unsigned and using the negation operator, then bitcasting the result
back to signed.

Division and Modulo avoid undefined bevaviour for INT_MIN / -1 and
divide-by-zero by using 1 for the divisor instead. Additionally we
avoid undefined behaviour when using the modulo operator when either
or both operands are negative by using the equation from the WGSL
spec, using division, subtraction and multiplication, rather than
MSL's modulus operator.

Lastly, as the usage of the wrapper function for unary integer
negation makes the negation_avoids_prefix_decrement() testcase less
interesting, we extend it to additionally test negating floats.
2025-02-14 15:17:40 -08:00
Connor Fitzgerald
106b709798
Remove HashMaps from wgpu API (#7133)
* Remove HashMaps from Surface API

* Fix Comments and Errors
2025-02-14 14:36:22 -05:00
Jamie Nicol
4bb09e1d3c
[naga wgsl-in] Ensure constant evaluation correctly handles Composes of vector ZeroValues (#7138) 2025-02-14 13:18:12 -05:00
Erich Gubler
eea3dde67e fix: use separate pub consts for FeaturesWebGPU 2025-02-14 12:18:41 -05:00
Erich Gubler
b05e9705bf fix: add cbindgen:ignore on const with the same ident. 2025-02-14 12:18:41 -05:00
Erich Gubler
7510d7b929 fix: add cbindgen:ignore on conflicting monomorphizations 2025-02-14 12:18:41 -05:00
Erich Gubler
a7a5784156 refactor: use match instead of if let for Features::from_bits 2025-02-14 12:18:41 -05:00
Erich Gubler
8ecafe2750 refactor: use match, instead of if, for Features::from_name 2025-02-14 12:18:41 -05:00
Erich Gubler
e8e09d059f fix: use same visibility for Features fields as itself 2025-02-14 12:18:41 -05:00
Erich Gubler
26eded137a fix: allow(missing_docs) on Features fields 2025-02-14 12:18:41 -05:00