Commit Graph
10383 Commits
Author SHA1 Message Date
atlv 4e7ffe0938 Workaround Metal driver bug with atomic texture writes (#9185) 2026-03-13 11:01:23 -04:00
atlv 9ed77372b4 Add coherent and volatile memory decorations for storage buffers. (#9168) 2026-03-11 19:53:52 -04:00
Kevin Reid a97a49d1d6 Replace &mut [u8] access to mapped buffers with WriteOnly.
When accessing a buffer for writing, do not expose (or internally
create) any `&'a mut [u8]` references to that memory, so as to avoid
exposing write-combining memory that might visibly misbehave in atomic
operations. Instead, expose the new pointer type `WriteOnly<'a, [u8]>`
which offers only write operations. This can be sliced and reborrowed,
allowing it to be used in most ways which `&mut [u8]` would be,
hopefully with near-zero overhead.

This pointer type might also allow users to opt in to uninitialized
memory for performance, while confining the consequences to GPU UB
rather than Rust UB. However, that is a future possibility and is not
implemented in this commit other than as a consideration in defining the
API of the `WriteOnly` type.

This change is not a complete solution to the problem of write-combining
memory because it is still possible to read after writing by calling
`get_mapped_range()` after `get_mapped_range_mut()`. However, that is
solvable separately, perhaps with a barrier or a validation change,
and is not particularly coupled with this part of the solution.
2026-03-11 16:58:48 -04:00
Kevin Reid e6899b5362 Add WriteOnly type.
`WriteOnly<'a, T>` is a custom smart pointer which is stricter than
`&'a mut [T]` in that it only allows writing data and not reading it.
This will be part of the fix for <https://github.com/gfx-rs/wgpu/issues/8897>.

This commit only introduces the public type and does not use it.
2026-03-11 16:58:48 -04:00
Erich Gubler c1f4d0c5db style(core): keep device::resource module's content < 100 columns (#9193) 2026-03-11 13:36:49 -07:00
Erich Gubler e5b0edea79 refactor: break StageError::InvalidWorkgroupSize diag. at 100 columns 2026-03-11 11:33:22 -06:00
Erich Gubler d7d2ede9fb diag!: use clearer field names and order for StageError::InvalidWorkgroupSize 2026-03-11 11:33:22 -06:00
Erich Gubler 46b77dd900 diag: don't add newline and space to StageError::InvalidWorkgroupSize 2026-03-11 11:33:22 -06:00
Erich Gubler 70b8343e06 refactor(core): rename Instance::name to _name (#8957) 2026-03-11 17:29:08 +00:00
Erich Gubler 405fedbb05 refactor: use Iterator::any for max_compute_workgroups_per_dimension check (#9194) 2026-03-11 11:39:05 -04:00
Dzmitry Malyshau da77a43313 Update naga capabilities for TLAS array 2026-03-11 08:18:38 -07:00
Dzmitry Malyshau adc3534f1c Add max_binding_array_acceleration_structure_elements_per_shader_stage limit 2026-03-11 08:18:38 -07:00
Dzmitry Malyshau e39b3aec8e Plumbing and a test for ACCELERATION_STRUCTURE_BINDING_ARRAY 2026-03-11 08:18:38 -07:00
Erich Gubler 43f48b43ee refactor(core): Interface::check_stage consolidate total_invocations checks into invalid_total_invocations 2026-03-10 18:40:02 -06:00
Erich Gubler 5d77bb336f perf(core): Interface::check_stage: just check total_invocations == 0 2026-03-10 18:40:02 -06:00
Erich Gubler ac79412501 refactor(core): Interface::check_stage: use saturating_mul for total_invocations 2026-03-10 18:40:02 -06:00
Erich Gubler 4ae6661898 Fix up various unreleased CHANGELOG bits (#9195)
* style(CHANGELOG): ensure double newline b/w paragraph and fenced code blocks

Regressed by <https://github.com/gfx-rs/wgpu/pull/9180>. I missed this
in review.

* docs(CHANGELOG): fix up formatting for #9141

* docs(CHANGELOG): clarify that `get_current_texture` in a `Surface` method
2026-03-10 17:00:13 -07:00
Andy Leiserson d540c4566e test(cts_runner): Use DXC by default 2026-03-10 16:57:39 -07:00
Andy Leiserson a16ca5cb42 feat(deno): Add DENO_WEBGPU_DX12_COMPILER env var
- Use the env var to select DXC in cts_runner
- Sync a few other env vars from `ci.yml`
2026-03-10 16:57:39 -07:00
Andy Leiserson cca21e665c ci(cts): Set RUSTFLAGS vars in cts.yml 2026-03-10 16:57:39 -07:00
Andy Leiserson c65c2f1aff ci(cts): Rename MSRV to REPO_MSRV in cts.yml 2026-03-10 16:57:39 -07:00
ecoricemon eb3bc87b21 fix(naga): Implement constant matrix add/sub/mul (#9162)
* fix(naga): Implement constant matrix operations

Implement binary operations in naga constant evaluator
- multiplication on vector-matrix, matrix-vector, and matrix-matrix
- addition/subtraction on matrix-matrix

* Related CTS
webgpu:shader,validation,expression,matrix,* : 1678/1881 (89.21%) -> 1737/1881 (92.34%)
> remaining fail : overflow/underflow (126), atomic (18)

* naga snapshots updated automatically

* chore: Update naga snapshots
2026-03-10 22:09:00 +01:00
Marijn Suijten 35db26b2c6 Make HasDisplayHandle optional in WindowHandle (#8782) 2026-03-10 11:36:12 -04:00
Andy Leiserson ce631c139f fix(naga): Evaluate compound assignment LHS before RHS (#9181) 2026-03-09 23:33:27 +00:00
Erich Gubler a18abddd33 refactor: use From or Into for u32 -> u64 casts 2026-03-09 16:49:06 -06:00
Erich Gubler fbc0388b61 refactor: DRY for i32::MAX in wgpu_hal::noop::CAPABILITIES 2026-03-09 16:49:06 -06:00
Genna Wingert ce7dad3026 fix: Change type of max_*_buffer_binding_size to follow spec 2026-03-09 16:49:06 -06:00
Andy Leiserson 0afad95d9b docs: Clarify description of newly-optional fields in DepthStencilState (#9180) 2026-03-09 18:08:11 -04:00
renovate[bot]andErich Gubler bdebd335ee chore(deps): update cargo.lock (#9175)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Erich Gubler <erichdongubler@gmail.com>
2026-03-09 16:53:26 -04:00
renovate[bot] 0832619600 chore(deps): update rust crate glow to 0.17 (#9174)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-03-09 14:41:16 -04:00
renovate[bot] 4b81f35cbe chore(deps): update cts digest to 47c3b4f (#9173)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-03-09 14:40:40 -04:00
Emil Ernerfeldt 12b9d4996b macOS: Fix one-second delay when switching a wgpu app to the foreground (#9141) 2026-03-08 23:17:13 +01:00
TornaxO7 c721b09bb3 feat(TextureFormat): implement channels method (#9167) 2026-03-08 10:05:22 +00:00
John Tur 74baec71b4 Support SSBOs and compute shaders when provided through GL extensions (#9169) 2026-03-07 21:17:12 -05:00
Erich Gubler 0ab6edd6a3 docs(CHANGELOG): add PR link for #8943 entry 2026-03-05 20:14:11 -05:00
Erich Gubler 3133f0e5e1 chore: run prettier on CHANGELOG 2026-03-05 20:14:11 -05:00
Erich Gubler 6b81bddc5c chore: forward-port CHANGELOG entries from v28.0.1 2026-03-05 20:14:11 -05:00
Erich Gubler 477dcb8918 chore: restore correctness commentary removed in #9074 (#9165) 2026-03-05 20:13:48 -05:00
Andy Leiserson 14ea13f11f fix(naga): Reject matrix negation in WGSL (#9157)
* fix(naga): Reject matrix negation

* Polyfill matrix negation for GLSL
2026-03-05 18:12:37 -05:00
Andy Leiserson 7f13acbf82 test(cts): List updates (#9160) 2026-03-04 15:35:24 -08:00
Andy Leiserson 0f6fd0b207 refactor(naga): Consolidate logic for checking enable extensions (#9107) 2026-03-04 18:25:46 -05:00
Andy Leiserson 7a17f66aa5 Tweak some limit reporting (#9118)
* Dummy implementation of max_storage_{buffers,textures}_in_*_stage limits

* hal(vulkan, dx12): Clamp per-stage binding limits at max_bindings_per_bind_group - 1

* Update CHANGELOG

* Allocate per-stage limits out of max_bindings_per_bind_group

* Fix typo and adjust hal's `log` dependency
2026-03-04 18:39:47 +01:00
Andy Leiserson d152e7369b Reduce binary bloat from error vtables (#9149) 2026-03-04 08:52:24 -08:00
ecoricemon 966d5d8e8c fix(naga): Validate invalid binary operations (#9126)
* fix(naga): Validate invalid binary operations

Changes
1. Incompatible Comparison: Added validation to prevent comparisons between different scalar types, such as 42i == 42u.
2. Compose-Scalar Operations: Added checks for unsupported binary operations between compose types and scalars, such as mat2x2f(...) + 1.0f.

CTS change
* webgpu:shader,validation,expression,matrix,*
 - Pass ratio: 1570/1881 (83.47%) -> 1678/1881 (89.21%)
* webgpu:shader,validation,expression,binary,*
 - Pass ratio: 4635/4992 (92.85%) -> 4786/4992 (95.87%)

* refactor: Move bin operand check out of match arms
2026-03-03 18:09:17 +01:00
ecoricemon 0d166c51a8 fix(naga): Allow a trailing comma in WGSL attributes (#9127)
* fix(naga): Allow trailing comma in WGSL attributes

Allow trailing comma token in WGSL attributes such as '@location(1,)'

CTS change
* webgpu:shader,validation,shader_io,*
 - Pass ratio: 2369/2891 (81.94%) -> 2380/2891 (82.32%)

* Update CTS list related to #8892
2026-03-03 18:06:06 +01:00
ecoricemon b6c605603f fix(naga): Validate presence of pipeline constants (#9133)
* fix(naga): validate presence of pipeline constants

Cause an error if a pipeline constant identifier doesn't exist in the shader

CTS change
* webgpu:api,validation,compute_pipeline:overrides,identifier:* : 12/26 (46.15%) -> 26/26 (100%)

* fix: Sort test.lst
2026-03-03 15:25:26 +01:00
Brendon Daugherty 3dc03bc23f fix(naga): Use wrapping arithmetic for dot on concrete ints (#9142) 2026-03-03 15:06:18 +01:00
Andy Leiserson 68b26a65f6 fix(deno): Report the correct type of error for an invalid writeMask (#9144) 2026-03-03 14:42:17 +01:00
Andy Leiserson da1d8c62a3 Avoid excessive ArrayVec monomorphization (#9122) 2026-03-03 14:41:09 +01:00
renovate[bot] c70d4ed332 chore(deps): update cts digest to cdeef99 (#9136)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-03-02 10:33:55 -05:00