8984 Commits

Author SHA1 Message Date
dependabot[bot]
0386211b75
chore(deps): bump crate-ci/typos from 1.30.0 to 1.30.1 (#7308)
Bumps [crate-ci/typos](https://github.com/crate-ci/typos) from 1.30.0 to 1.30.1.
- [Release notes](https://github.com/crate-ci/typos/releases)
- [Changelog](https://github.com/crate-ci/typos/blob/master/CHANGELOG.md)
- [Commits](https://github.com/crate-ci/typos/compare/v1.30.0...v1.30.1)

---
updated-dependencies:
- dependency-name: crate-ci/typos
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-09 23:30:30 -04:00
dependabot[bot]
fda1975d9c
chore(deps): bump the patch-updates group with 25 updates (#7307)
Bumps the patch-updates group with 25 updates:

| Package | From | To |
| --- | --- | --- |
| [anyhow](https://github.com/dtolnay/anyhow) | `1.0.96` | `1.0.97` |
| [bytemuck](https://github.com/Lokathor/bytemuck) | `1.21.0` | `1.22.0` |
| [serde_json](https://github.com/serde-rs/json) | `1.0.139` | `1.0.140` |
| [serde](https://github.com/serde-rs/serde) | `1.0.218` | `1.0.219` |
| [trybuild](https://github.com/dtolnay/trybuild) | `1.0.103` | `1.0.104` |
| [thiserror](https://github.com/dtolnay/thiserror) | `2.0.11` | `2.0.12` |
| [tokio](https://github.com/tokio-rs/tokio) | `1.43.0` | `1.44.0` |
| [unicode-ident](https://github.com/dtolnay/unicode-ident) | `1.0.17` | `1.0.18` |
| [quote](https://github.com/dtolnay/quote) | `1.0.38` | `1.0.39` |
| [syn](https://github.com/dtolnay/syn) | `2.0.98` | `2.0.100` |
| [async-trait](https://github.com/dtolnay/async-trait) | `0.1.86` | `0.1.87` |
| [bytes](https://github.com/tokio-rs/bytes) | `1.10.0` | `1.10.1` |
| [either](https://github.com/rayon-rs/either) | `1.14.0` | `1.15.0` |
| [is-terminal](https://github.com/sunfishcode/is-terminal) | `0.4.15` | `0.4.16` |
| [itoa](https://github.com/dtolnay/itoa) | `1.0.14` | `1.0.15` |
| oorandom | `11.1.4` | `11.1.5` |
| [pin-project](https://github.com/taiki-e/pin-project) | `1.1.9` | `1.1.10` |
| [pin-project-internal](https://github.com/taiki-e/pin-project) | `1.1.9` | `1.1.10` |
| [pkg-config](https://github.com/rust-lang/pkg-config-rs) | `0.3.31` | `0.3.32` |
| [prettyplease](https://github.com/dtolnay/prettyplease) | `0.2.29` | `0.2.30` |
| [proc-macro-crate](https://github.com/bkchr/proc-macro-crate) | `3.2.0` | `3.3.0` |
| [proc-macro2](https://github.com/dtolnay/proc-macro2) | `1.0.93` | `1.0.94` |
| [rustversion](https://github.com/dtolnay/rustversion) | `1.0.19` | `1.0.20` |
| [ryu](https://github.com/dtolnay/ryu) | `1.0.19` | `1.0.20` |
| [serde_derive](https://github.com/serde-rs/serde) | `1.0.218` | `1.0.219` |


Updates `anyhow` from 1.0.96 to 1.0.97
- [Release notes](https://github.com/dtolnay/anyhow/releases)
- [Commits](https://github.com/dtolnay/anyhow/compare/1.0.96...1.0.97)

Updates `bytemuck` from 1.21.0 to 1.22.0
- [Changelog](https://github.com/Lokathor/bytemuck/blob/main/changelog.md)
- [Commits](https://github.com/Lokathor/bytemuck/compare/v1.21.0...v1.22.0)

Updates `serde_json` from 1.0.139 to 1.0.140
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.139...v1.0.140)

Updates `serde` from 1.0.218 to 1.0.219
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.218...v1.0.219)

Updates `trybuild` from 1.0.103 to 1.0.104
- [Release notes](https://github.com/dtolnay/trybuild/releases)
- [Commits](https://github.com/dtolnay/trybuild/compare/1.0.103...1.0.104)

Updates `thiserror` from 2.0.11 to 2.0.12
- [Release notes](https://github.com/dtolnay/thiserror/releases)
- [Commits](https://github.com/dtolnay/thiserror/compare/2.0.11...2.0.12)

Updates `tokio` from 1.43.0 to 1.44.0
- [Release notes](https://github.com/tokio-rs/tokio/releases)
- [Commits](https://github.com/tokio-rs/tokio/compare/tokio-1.43.0...tokio-1.44.0)

Updates `unicode-ident` from 1.0.17 to 1.0.18
- [Release notes](https://github.com/dtolnay/unicode-ident/releases)
- [Commits](https://github.com/dtolnay/unicode-ident/compare/1.0.17...1.0.18)

Updates `quote` from 1.0.38 to 1.0.39
- [Release notes](https://github.com/dtolnay/quote/releases)
- [Commits](https://github.com/dtolnay/quote/compare/1.0.38...1.0.39)

Updates `syn` from 2.0.98 to 2.0.100
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/2.0.98...2.0.100)

Updates `async-trait` from 0.1.86 to 0.1.87
- [Release notes](https://github.com/dtolnay/async-trait/releases)
- [Commits](https://github.com/dtolnay/async-trait/compare/0.1.86...0.1.87)

Updates `bytes` from 1.10.0 to 1.10.1
- [Release notes](https://github.com/tokio-rs/bytes/releases)
- [Changelog](https://github.com/tokio-rs/bytes/blob/master/CHANGELOG.md)
- [Commits](https://github.com/tokio-rs/bytes/compare/v1.10.0...v1.10.1)

Updates `either` from 1.14.0 to 1.15.0
- [Commits](https://github.com/rayon-rs/either/compare/1.14.0...1.15.0)

Updates `is-terminal` from 0.4.15 to 0.4.16
- [Commits](https://github.com/sunfishcode/is-terminal/compare/v0.4.15...v0.4.16)

Updates `itoa` from 1.0.14 to 1.0.15
- [Release notes](https://github.com/dtolnay/itoa/releases)
- [Commits](https://github.com/dtolnay/itoa/compare/1.0.14...1.0.15)

Updates `oorandom` from 11.1.4 to 11.1.5

Updates `pin-project` from 1.1.9 to 1.1.10
- [Release notes](https://github.com/taiki-e/pin-project/releases)
- [Changelog](https://github.com/taiki-e/pin-project/blob/main/CHANGELOG.md)
- [Commits](https://github.com/taiki-e/pin-project/compare/v1.1.9...v1.1.10)

Updates `pin-project-internal` from 1.1.9 to 1.1.10
- [Release notes](https://github.com/taiki-e/pin-project/releases)
- [Changelog](https://github.com/taiki-e/pin-project/blob/main/CHANGELOG.md)
- [Commits](https://github.com/taiki-e/pin-project/compare/v1.1.9...v1.1.10)

Updates `pkg-config` from 0.3.31 to 0.3.32
- [Changelog](https://github.com/rust-lang/pkg-config-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/pkg-config-rs/compare/0.3.31...0.3.32)

Updates `prettyplease` from 0.2.29 to 0.2.30
- [Release notes](https://github.com/dtolnay/prettyplease/releases)
- [Commits](https://github.com/dtolnay/prettyplease/compare/0.2.29...0.2.30)

Updates `proc-macro-crate` from 3.2.0 to 3.3.0
- [Release notes](https://github.com/bkchr/proc-macro-crate/releases)
- [Commits](https://github.com/bkchr/proc-macro-crate/compare/v3.2.0...v3.3.0)

Updates `proc-macro2` from 1.0.93 to 1.0.94
- [Release notes](https://github.com/dtolnay/proc-macro2/releases)
- [Commits](https://github.com/dtolnay/proc-macro2/compare/1.0.93...1.0.94)

Updates `rustversion` from 1.0.19 to 1.0.20
- [Release notes](https://github.com/dtolnay/rustversion/releases)
- [Commits](https://github.com/dtolnay/rustversion/compare/1.0.19...1.0.20)

Updates `ryu` from 1.0.19 to 1.0.20
- [Release notes](https://github.com/dtolnay/ryu/releases)
- [Commits](https://github.com/dtolnay/ryu/compare/1.0.19...1.0.20)

Updates `serde_derive` from 1.0.218 to 1.0.219
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.218...v1.0.219)

---
updated-dependencies:
- dependency-name: anyhow
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: bytemuck
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: patch-updates
- dependency-name: serde_json
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: trybuild
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: thiserror
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: tokio
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: patch-updates
- dependency-name: unicode-ident
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: quote
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: syn
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: async-trait
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: bytes
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: either
  dependency-type: indirect
  update-type: version-update:semver-minor
  dependency-group: patch-updates
- dependency-name: is-terminal
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: itoa
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: oorandom
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: pin-project
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: pin-project-internal
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: pkg-config
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: prettyplease
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: proc-macro-crate
  dependency-type: indirect
  update-type: version-update:semver-minor
  dependency-group: patch-updates
- dependency-name: proc-macro2
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: rustversion
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: ryu
  dependency-type: indirect
  update-type: version-update:semver-patch
  dependency-group: patch-updates
- dependency-name: serde_derive
  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-03-09 23:30:11 -04:00
Samson
4c3845d910
Read ImageSample.offset as expr (#7297)
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2025-03-09 15:42:16 -04:00
Andreas Reich
fedc80eb80
[wgsl-in, wgsl-out, glsl-in] WebGPU compliant dual source blending feature (#7146)
Makes the dual source implementation in wgpu WebGPU spec compliant.
Furthermore, makes the dual source blending extension available when targeting WebGPU.
2025-03-08 21:07:37 +01:00
Andreas Reich
79741da259
Add exception for RUSTSEC-2024-0436 (paste being unmaintained) (#7301) 2025-03-08 18:44:43 +00:00
Andy Leiserson
cd1e7e26c1
Waive the failures tracked by #7287 (#7289)
* Waive the failures tracked by #7287

* Use full link to issue
2025-03-07 16:37:11 -05:00
Samson
424fde1622
[naga] Support local const in ImageSample.offset (#7213)
* [naga] Support local const in ImageSample.offset

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* Update test expect

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* Update test

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* Update test expect

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

* Remove docs about ImageSample.offset refering to global expr

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>

---------

Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2025-03-07 19:56:08 +01:00
Matilde Morrone
12ce4e2861
Better handling of drm extensions (#7295) 2025-03-07 13:50:32 -05:00
Erich Gubler
faea4e8717
test(android): add ARMv7 and x86-64 architectures as tier 2 (#7291)
* test(android): add ARMv7 and x86-64 architectures

* fixup! test(android): add ARMv7 and x86-64 architectures

* fixup! test(android): add ARMv7 and x86-64 architectures
2025-03-06 23:10:31 -05:00
Jamie Nicol
6a61e62f55
[naga wgsl-in] Handle automatic type conversions for switch selector and case expressions (#7250)
This allows abstract-typed expressions to be used for some or all of
the switch selector and case selectors. If these are all not
convertible to the same concrete scalar integer type we return an
error. If all the selector expressions are abstract then they are
concretized to i32.

The note previously provided by the relevant error message, suggesting
adding or removing the `u` suffix from case values, has been
removed. While useful for simple literal values, it was comically
incorrect for more complex case expressions. The error message should
still be useful enough to allow the user to easily identify the
problem.
2025-03-07 03:50:36 +00:00
Erich Gubler
61eda14256 fix(android,vulkan): forcibly convert to u64 in *devid checks 2025-03-06 22:33:08 -05:00
Erich Gubler
6f65d3db2a refactor(vulkan): use slice::contains for st_rdv comparison 2025-03-06 22:33:08 -05:00
Jim Blandy
6dafe9c8fc
[naga wgsl-in] Remove to_wgsl method on StorageFormat. (#7288)
Delete `StorageFormat::to_wgsl`, and use `StorageFormat`'s
`common::wgsl::ToWgsl` implementation instead.
2025-03-06 20:09:29 -05:00
Kent Slaney
2fac7fa954 [naga] Correct override resolution in array lengths.
When the user provides values for a module's overrides, rather than
replacing override-sized array types with ordinary array types (which
could require adjusting type handles throughout the module), instead
edit all overrides to have initializers that are fully-evaluated
constant expressions. Then, change all backends to handle
override-sized arrays by retrieving their overrides' values.

For arrays whose sizes are override expressions, not simple references
to a specific override's value, let front ends built array types that
refer to anonymous overrides whose initializers are the necessary
expression.

This means that all arrays whose sizes are override expressions are
references to some `Override`. Remove `naga::PendingArraySize`, and
let `ArraySize::Pending` hold a `Handle<Override>` in all cases.

Expand `tests/gpu-tests/shader/array_size_overrides.rs` to include the
test case that motivated this approach.
2025-03-06 14:21:40 -08:00
Andy Leiserson
4e14f2032e [naga wgsl-in] Parse LHS expressions as such, not as generic expressions
Fixes #4383
2025-03-06 11:55:54 -08:00
Kevin Reid
7319512778
Additional documentation for buffer mapping, types, and constants. (#7283)
* Additional documentation for buffer mapping, types, and constants.

* Clarify `Snorm` texture format conversion.

* Fix typo.
2025-03-06 19:08:34 +00:00
Kevin Reid
16d41cfaf3
Make std usage optional for wgpu-core. (#7279)
* Make `wgpu_core::snatch::LockTrace` fully instead of partially conditional.

Now, when `cfg(not(debug_assertions))`, there is no `SNATCH_LOCK_TRACE`
thread local, and `LockTrace` has no data fields.

* Make `std` usage optional for `wgpu-core`.

Adds a `std` feature, enabled by default, to `wgpu-core`. When that
feature is disabled, the following functionality is not available:

* `Send + Sync` for resources.
* `trace` feature.
* `observe_locks` feature.
* Snatch lock recursive locking assertion.
2025-03-06 14:07:38 -05:00
Jim Blandy
1b09a44af5 [naga spv-out] Avoid duplicating SPIR-V OpTypePointer instructions.
Simplify `naga:🔙:spv::LocalType` to have only one variant for
representing pointers, and use the SPIR-V type as the base type, so
that `LocalType` values are equal when the SPIR-V pointer types they
map to would be equal as well.

This avoids emitting multiple `OpTypePointer` instructions, which
SPIR-V would interpret as distinct types, for equivalent Naga IR
pointer types.

Change the `get_pointer_type_id` utility function accordingly, and
adjust its callers.

Change `LocalType::from_inner` into `Writer::localtype_from_inner`, so
that it can call `Writer` methods to build base types. Adjust users.
2025-03-06 09:58:25 -08:00
Jim Blandy
b0e53c6357 [naga spv-out] Introduce helper BlockContext::get_numeric_type_id.
Forward `back::spv::Writer::get_numeric_type_id` to `BlockContext`,
and use where appropriate.
2025-03-06 09:42:45 -08:00
Jim Blandy
f803e55d37 [naga spv-out] Define get_numeric_type_id, and use appropriately.
Introduce a new helper function, `Writer::get_numeric_type_id`, and
use it to simplify existing calls to `get_type_id`.
2025-03-06 09:42:45 -08:00
Jim Blandy
553b78d8df [naga spv-out] Use type lookup utility functions where appropriate.
Replace uses of `get_type_id` with more specific helper functions like
`get_f32_pointer_type_id` or `get_pointer_type_id`. No change in
behavior.
2025-03-06 09:42:45 -08:00
Jim Blandy
e84c9da5b7 [naga spv-out] Introduce get_handle_type_id helper function.
Introduce a new helper function on `back::spv::Writer` and
`BlockContext` that looks up the SPIR-V type id corresponding to a
Naga IR `Handle<Type>`. Use it where appropriate.
2025-03-06 09:42:45 -08:00
Jim Blandy
77265d38cd [naga spv-out] Rename get_pointer_id to get_pointer_type_id. 2025-03-06 09:42:45 -08:00
Jim Blandy
0cb8e26922 [naga spv-out] Rename type lookup utilities to be more WGSL-ish.
Rename utility functions on `back::spv::Writer` for looking up SPIR-V
type ids for common types to better match WGSL precedent. Use lexemes
like `u32` and `vec3u` (the official WGSL abbreviation), rather than
`float` and `uint2` (which I think are GLSL?).
2025-03-06 09:42:45 -08:00
Bruce Mitchener
e446551b27
docs: Improve linking, backticks (#7281) 2025-03-06 12:37:19 -05:00
SupaMaggie70Incorporated
20bad46d40
Add multiview mesh shaders to wgpu-hal (#7278) 2025-03-06 12:25:55 -05:00
Jamie Nicol
7df6e477cf [naga wgsl-in] Do not eagerly concretize local const declarations of abstract types
Instead allow the const to be converted each time it is const
evaluated as part of another expression. This allows an abstract const
to be used as a different type depending on the context.

As a result, abstract types may now find their way in to the IR, which
we don't want. This occurs because the compact pass treats named
expressions as used, mostly so that our snapshot tests are more
useful, and therefore does not remove them. To prevent this, we avoid
adding abstract-typed local consts to the named expressions list. This
will have no functional effect on any shaders produced by the
backends, but some unused local const declarations will no longer be
present.
2025-03-05 20:39:48 -08:00
SupaMaggie70Incorporated
cc1e26a799
Fixed DRM(hopefully) (#7277) 2025-03-06 03:36:21 +00:00
Andreas Reich
f884a4148a docs(CHANGELOG): move Features split entry to Major Features
This entry is backwards-compatible, so it can be "promoted" from
`Changes` to "just" a highlight. 🙂
2025-03-05 22:31:02 -05:00
Andreas Reich
3b84750413 docs(CHANGELOG): remove no_std trace path entry
This isn't user-facing, so there doesn't seem to be a real reason to
keep this here.
2025-03-05 22:31:02 -05:00
Erich Gubler
b9328673c6
refactor: impl From<ImplementedEnableExtension> for EnableExtension (#7275)
Co-authored-by: Andreas Reich <r_andreas2@web.de>
2025-03-05 22:29:35 -05:00
Erich Gubler
f4fbc4b4bc
docs(wgsl): use correct links to standard enable extensions (#7276) 2025-03-05 22:29:13 -05:00
Jamie Nicol
9853f5988d
[naga wgsl-in] Concretize LHS of bitshift operations if RHS is not a const-expression (#7270)
Naga currently trips up on shaders containing a bitshift where the
left operand is an AbstractInt and the right operand is *not* a const
expression. This is due to the fact that resulting type of
`AbstractInt << u32` is abstract, and we are unable to evaluate it
away during const evaluation. This results in abstract-typed
expressions in our IR, which causes various issues.

For other binary operations, the type of the left and right operands
would be related, therefore the presence of a concrete right operand
would tell us which type to convert the left operand to. But for shift
operations the right operand's scalar type is always a u32, and does
not influence the left operand's type.

Luckily the WGSL spec[1] tells us how to avoid this problem:

  6.1.3. Overload Resolution

  2. Eliminate any candidate where one of its subexpressions resolves
     to an abstract type after feasible automatic conversions, but
     another of the candidate’s subexpressions is not a
     const-expression.

This, for example, specifies we eliminate the `AbstractInt << u32:
AbstractInt` overload candidate, leaving `i32 << u32: i32` as the
remaining candidate with the lowest conversion rank. The equivalent
also applies for right-bitshifts, and for `vecN<AbstractInt>`
operands.

[1] https://www.w3.org/TR/WGSL/#overload-resolution-section
2025-03-05 20:30:12 -05:00
Jim Blandy
fc83073905 [naga] Move back::wgsl::address_space_str to common::wgsl.
Move `back::wgsl::address_space_str` to `common::wgsl`, so that the
front end can use it too. This commit is code motion and `use`
adjustment only; there should be no change in behavior.
2025-03-05 11:22:05 -08:00
Jim Blandy
567a2c027f [naga] Implement ToWgsl for ImageDimension, and use as needed.
Replace `naga:🔙:wgsl::writer::image_dimension_str` with a
`ToWgsl` implementation for `ImageDimension` in `common::wgsl`. Use
this where needed in the WGSL backend.
2025-03-05 11:22:05 -08:00
Jim Blandy
8ec2e751b4 [naga] Implement TryToWgsl for Scalar, and use as appropriate.
Replace `naga:🔙:wgsl::writer::scalar_kind_str` with a `TryToWgsl`
implementation for `Scalar` in `common::wgsl`. Use this where needed
in the WGSL backend.
2025-03-05 11:22:05 -08:00
Jim Blandy
d923efa56b [naga] Move back::vector_size_str to common.
Move `back::vector_size_str` to `common`, so that front ends can use
it too. This commit is code motion and `use` adjustment only, there
should be no change in behavior.
2025-03-05 11:22:05 -08:00
Jim Blandy
34ffbee1b7 [naga wgsl] Define ToWgsl and TryToWgsl traits.
Define new traits in `common::wgsl`, `ToWgsl` and `TryToWgsl`, for
getting the WGSL representation of some Naga IR types as `&'static
str` values:

- `MathFunction`
- `BuiltIn`
- `Interpolation`
- `Sampling`
- `StorageFormat`

Use these functions in the WGSL backend, taking advantage of
`TryToWgsl` to consolidate error reporting.
2025-03-05 11:22:05 -08:00
Jim Blandy
2a364d2bfa [naga wgsl-out] Consolidate unsupported Naga IR feature errors.
Introduce a new variant of `naga:🔙:wgsl::Error`, `Unsupported`,
and let it subsume `UnsupportedMathFunction` and various uses of
`Custom`.

Introduce a helper function, `Error::unsupported`, for building these
errors.
2025-03-05 11:22:05 -08:00
Kevin Reid
289d0e5c5a Allow the "gles" backend to (theoretically) compile on no_std targets.
This entirely consists of conditionally replacing `Mutex` with `RefCell`,
then making sure that this doesn’t accidentally happen if we are also
exposing `Send + Sync`.
2025-03-05 11:48:42 +01:00
Kevin Reid
67f1554e77
Fix build of wgpu-hal on macOS with features = ["gles"]. (#7266)
Without this change, `cargo build -p wgpu-hal --features=gles` will fail
if `target_os = "macos"`.
2025-03-05 00:12:43 -05:00
Jim Blandy
f59b034153 [naga] Centralize naming of anonymous entry point return types.
When an entry point's return type is anonymous, have
`naga::proc::Namer` assign it a name based on its shader stage.

Remove bespoke logic for this from the WGSL backend.

Fixes #7263.
2025-03-04 17:46:30 -08:00
Marc Pabst
38f3c47a46
Add as_hal for Queue (#7182)
* add as_hal for Queue

* add as_raw for dx12 queue

* return Mutex + add as_raw for Vulkan

* return reference

* restore Cargo.lock

* fix  Cargo.lock

---------

Co-authored-by: Marc Pabst <“marcpabst@users.noreply.github.com”>
2025-03-04 21:24:06 +00:00
Samson
7e66495049
Support extern context impl (#6658)
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
2025-03-04 16:07:03 -05:00
Matilde Morrone
7eb69f43b6
Add DRM support to Vulkan backend (#7212)
* Add basic drm support to vulkan backend

* Move vulkan drm implementation to its own module

* Properly feature gate drm support and add safety docs

* Disable drm on wasm targets

* Remove old fixme comment from vulkan drm backend

* Move cfg check inside drm module

* Use expect instead of allow for create_surface_from_drm

* Document that drm is not available on apple platforms
2025-03-04 20:53:38 +00:00
Vecvec
5b3266db23
Support getting hit vertex positions (#7183) 2025-03-04 20:06:44 +01:00
SupaMaggie70Incorporated
a6109bf69b
Mesh shaders - initial wgpu hal changes (#7089)
* Initial(untested commit), vulkan and gles only supported

* Maybe fixed compiles for metal and dx12

* Hopefully fixed compiles for other backends and updated to functional(?) vulkan thing

* Fixed the clippy warning

* Fixed silly documentation mistake

* Fixed issue with multiview feature

* Dummy commit for dummy CI

The CI pooped itself, hopefully this fixes that. Will probably be undone either way.

* Re trigger CI checks, to avoid #7126

* Changes based on code review

* Fixed clippy warning, broken cargo.lock

* Unfucked cargo.lock for real this time

* Switched match to if-let in accordance with review

* Updated changelog

* Fix CI error

Done from web out of impatience

* CI is very angry 😡

Made CI less angry by fixing formatting(hopefully). This commit was also done from GitHub web.

* Removed comment in following request

* Update wgpu-hal/src/vulkan/adapter.rs

---------

Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2025-03-04 00:12:38 +00:00
dependabot[bot]
8394b10e6b
chore(deps): bump crate-ci/typos from 1.29.9 to 1.30.0 (#7259)
* chore(deps): bump crate-ci/typos from 1.29.9 to 1.30.0

Bumps [crate-ci/typos](https://github.com/crate-ci/typos) from 1.29.9 to 1.30.0.
- [Release notes](https://github.com/crate-ci/typos/releases)
- [Changelog](https://github.com/crate-ci/typos/blob/master/CHANGELOG.md)
- [Commits](https://github.com/crate-ci/typos/compare/v1.29.9...v1.30.0)

---
updated-dependencies:
- dependency-name: crate-ci/typos
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Fix small typo

Signed-off-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2025-03-03 23:09:41 +00:00
Zachary Harrold
e4cc5cb9ad
Use core and alloc instead of std in naga (#7256)
* Use `core` and `alloc` instead of `std` in `naga`

* Update CHANGELOG.md

* `taplo fmt`

* Fix documentation links to refer to `hashbrown::HashMap`
2025-03-03 16:44:53 -05:00
Jamie Nicol
7b54f9dfd2
[naga wgsl-in] Concretize base type prior to non-constant indexed access (#7260)
Parsing currently fails for shaders that attempt to dynamically index
an abstract-typed array (or vector, etc), like so:

    var x = array(1, 2, 3)[i];

This is caused by attempting to concretize the Expression::Access
expression, which the ConstantEvaluator fails to do so due to the
presence of a non-constant expression.

To solve this, this patch concretizes the base type *prior* to
indexing it (for non-constant indices), meaning the constant evaluator
never sees any non-constant expressions. This matches the WGSL
specification:

    When an abstract array value e is indexed by an expression that is
    not a const-expression, then the array is concretized before the
    index is applied.

(Similar applies for both vectors and matrices, too.)

This may be somewhat non-optimal in that if there are multiple
accesses of the same abstract expression, we will produce duplicated
concretized versions of that expression. This seems unlikely to be a
major issue in practice, and we can always improve this if and when we
encounter a real issue caused by it.
2025-03-03 09:33:08 -05:00