9643 Commits

Author SHA1 Message Date
Jamie Nicol
2c6f06a82b [naga msl-out] Implement support for external textures
This adds MSL backend support for `ImageClass::External`. (ie WGSL's
`external_texture` texture type). This is implemented very similarily
to the HLSL implementation in #7826.

Each external texture global variable is lowered to 3 `texture2d`s and
a buffer of type NagaExternalTextureParams. As usual in Naga's MSL
backend, these are passed as arguments to the entry point. The
bindings for each of these arguments are provided via the usual
binding map, using a new `BindExternalTextureTarget` variant of
`BindTarget`.

Unlike HLSL, MSL allows textures to be used as fields in structs. We
therefore immediately wrap these variables in a
`NagaExternalTextureWrapper` struct. This wrapper can then
conveniently be passed to either user-defined functions or builtin
implementations that accept an external texture.

The WGSL builtins `textureDimensions()`, `textureLoad()`, and
`textureSampleBaseClampToEdge()` are implemented using wrapper
functions using the regular `write_wrapped_functions()` machinery.
2025-08-21 12:35:19 +01:00
Jamie Nicol
2cada72dfb [naga] Make external texture snapshot test call textureLoad() with both vec2<i32> and vec2<i32> coordinates
The HLSL external texture implementation didn't have to do anything in
particular to handle both coordinate types, as int2 automatically gets
promoted to uint2. But in MSL this is not the case, and it is
therefore important to test that we correctly handle both coordinate
types.
2025-08-21 12:35:19 +01:00
Jamie Nicol
bb21da3014 [naga msl-out] Split up write_wrapped_functions()
It was getting unwieldy, and upcoming commits are going to add
additional functions that will be wrapped.
2025-08-21 12:35:19 +01:00
cryvosh
4b5e38ab49
[naga spv-out] Add f16 io polyfill (#7884) 2025-08-21 10:50:32 +02:00
Andy Leiserson
2996c926d4
[docs] Security policy (#8006)
---------
Co-authored-by: Kevin Reid <kpreid@switchb.org>
2025-08-20 19:20:22 -07:00
Andy Leiserson
8897c9e93f
[deno] Enable additional vertex formats (#8095) 2025-08-20 15:35:42 -07:00
Andy Leiserson
e7a99be058
[deno] Fix some problems in the handling of device limits (#8085)
* Correct error type when a requested limit is too high
* Clamp requested limits to the WebGPU defaults

Fixes #8084
2025-08-20 14:58:56 -07:00
Connor Fitzgerald
fe86710af7
Properly enable getrandom in nanorand (#8098) 2025-08-20 17:16:58 -04:00
Magnus
17a17f716a
Initial precompiled shaders implementation (#7834)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2025-08-20 16:20:59 -04:00
Jamie Nicol
eb9b2e9c9b
Add changelog entry for external texture support (#8123) 2025-08-20 11:35:47 -04:00
renovate[bot]
6a4eaa9293
chore(deps): update cargo.lock (#8116)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-08-20 11:32:22 -04:00
Erich Gubler
57d89b4a4f
docs(vulkan): clarify safety contract for DeviceShared::set_object_name (#8055)
* docs(vulkan): clarify safety contract for `DeviceShared::set_object_name`
2025-08-20 08:22:35 -07:00
Jamie Nicol
9aaed2c0cc
[naga] Ensure validation rejects invalid sample operations of ImageClass::External images. (#8121)
textureSampleBaseClampToEdge() is valid when called on a
`texture_external` texture, but all other sample operations are
invalid. Previously validation was succeeding for these operations on
an external texture in cases where the same operation on a
`texture_2d<f32>` would be allowed. We must therefore explicitly check
for ImageClass::External and disallow invalid sample operations.
2025-08-20 08:30:54 +01:00
renovate[bot]
875250348c
chore(deps): update crate-ci/typos action to v1.35.5 (#8114)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-08-18 20:30:42 -04:00
renovate[bot]
7bd005531e
chore(deps): update actions/checkout action to v5 (#8115)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-08-18 20:30:21 -04:00
renovate[bot]
21497a5322
chore(deps): update cts digest to 94f4ce1 (#8113)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-08-18 10:18:46 -07:00
Andy Leiserson
576210214d
Fix minimal versions CI failure (#8112) 2025-08-17 16:23:08 -04:00
SupaMaggie70Incorporated
0c0df249cf
Only commit hopefully (#8101) 2025-08-14 09:03:06 -04:00
renovate[bot]
dd93ed5975
chore(deps): update cargo.lock (#8079)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-08-13 23:07:26 +00:00
Vecvec
54be6a2b5b
Fix empty ifs causing errors on spirv 1.6 (#7883) 2025-08-13 15:27:51 +00:00
Kevin Reid
2d835bf3b4 Call uncaptured error handler without the lock held.
This prevents a possible deadlock if the callback itself calls wgpu
operations.
2025-08-13 16:26:46 +01:00
Kevin Reid
ea8315e28e Change uncaptured error handler pointer type from Box to Arc.
This will be necessary for the next change.
2025-08-13 16:26:46 +01:00
Kevin Reid
2e8a600e35 Add Sync bound to uncaptured error handler.
It makes sense for a function to be `FnMut + Send`, or `Fn + Send + Sync`,
but not `Fn + Send` because that is overly restrictive for the caller and
the callee.
2025-08-13 16:26:46 +01:00
Jamie Nicol
486c151772
[dx12,vulkan] Add support for P010 texture format (#8086)
P010 is a 4:2:0 chroma subsampled planar format, similar to NV12. Each
component uses 16 bits of storage, of which only the high 10 bits are
used. On DX12 this maps to DXGI_FORMAT_P010, and on Vulkan this maps to
G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16.

The existing "nv12" gpu test module has been renamed to
"planar_texture", and a new test P010_TEXTURE_CREATION_SAMPLING has
been added similar to the existing NV12_TEXTURE_CREATION_SAMPLING. The
remaining tests in this module have been converted to validation tests,
and now test both NV12 and P010 formats.
2025-08-13 15:35:20 +02:00
Jim Blandy
01b3204e7f
[hal] Minor doc clarification. (#8087)
Don't use the term "single-threaded", since it's confusing. Just say
what you mean.
2025-08-12 12:54:04 -04:00
Jim Blandy
a96a6cd63b
Update to slab 0.4.11. (#8088) 2025-08-12 18:49:16 +02:00
Erich Gubler
445ecb3fee
Update backport label ref. in release-checklist.md & style fixes (#8081)
* docs(release-checklist): sync backporting label name with current one

* style(release-checklist): run `prettier`
2025-08-11 17:10:26 -04:00
Andy Leiserson
e7dad314ed
Accept configuration from the environment for the trace player (#8083) 2025-08-11 22:04:53 +02:00
Andy Leiserson
0cc8c11afe
Escape control chars in source when printing diagnostics (#8049) 2025-08-11 12:16:46 -07:00
Erich Gubler
f9df2b5442 docs(CHANGELOG): move #7345's entry to Unreleased 2025-08-11 09:35:02 -04:00
Erich Gubler
d17228fda8 docs(CHANGELOG): port 26.0.{3,4} release notes 2025-08-11 09:35:02 -04:00
Erich Gubler
02636cd940 style(CHANGELOG): trim extra whitespace 2025-08-11 09:35:02 -04:00
renovate[bot]
505d721674
chore(deps): update rust crate ctor to 0.5 (#8078)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-08-11 11:20:14 +02:00
renovate[bot]
0990ecd574
chore(deps): update crate-ci/typos action to v1.35.3 (#8077)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-08-11 11:16:35 +02:00
Marc Pabst
e7cdfc436a
Allow disabling waiting for latency waitable object (#7400) 2025-08-10 10:01:25 +00:00
sagudev
f04b3b020f
Remove lifetime from BufferSlice, BufferView, BufferViewMut (#8046) 2025-08-10 11:15:36 +02:00
Erich Gubler
b9f66e77e5
docs(release-checklist): include This release includes crate, … in the CHANGELOG, too (#8063) 2025-08-10 11:10:10 +02:00
Lisitsa Nikita
1b948fbf42
Fix 'Read-only attachment with load' error message (#8068) 2025-08-09 17:58:32 +02:00
Lisitsa Nikita
b1bf444b7a
Fix error message when render pipeline vertex attribute location is greater or equal to the maximum number of vertex attributes (fixes #8064) (#8065) 2025-08-09 17:48:11 +02:00
Erich Gubler
f6a3af1f1d refactor(deno_webgpu): remove unused allow(dead_code) on GPUError::Internal 2025-08-09 07:50:51 -04:00
Erich Gubler
495df81f14 fix(deno_webgpu): expose GPUUncapturedErrorEvent in bootstrap.js 2025-08-09 07:50:51 -04:00
Erich Gubler
1241bb0384 fix(deno_webgpu): expose GPUInternalError in bootstrap.js 2025-08-09 07:50:51 -04:00
Bot-Kerem
e990388af9
Update README.md (#8069) 2025-08-08 23:58:57 +01:00
Andy Leiserson
605f40d866 Vendor web-sys 2025-08-08 23:58:25 +01:00
Andy Leiserson
7816390566 Make vendor-web-sys xtask accept a SHA
Also, update wasm-bindgen URLs
2025-08-08 23:58:25 +01:00
Erich Gubler
0c30efe857
docs(release-checklist): sync backporting label name with current one (#8062) 2025-08-08 23:50:26 +01:00
Andy Leiserson
24a05fefdf
Update CHANGELOG (#8050) 2025-08-07 18:01:45 -07:00
Jamie Nicol
1bf1671ed8 [test] Add external texture GPU tests
These tests cover the external texture binding resource. They ensure
the WGSL functions `textureDimensions()`, `textureLoad()`, and
`textureSampleBaseClampToEdge()` work as expected for both
`TextureView`s and `ExternalTexture`s bound to external texture
resource bindings.

For external textures, they ensure multiplanar YUV formats work as
expected including handling color space transformation. And that the
provided sample and load transforms correctly handle cropping,
flipping, and rotation.
2025-08-06 17:31:50 +02:00
Jamie Nicol
bd85c9a99a [test] Rename existing external_texture tests to external_image_copy
These existing tests cover `Queue::copy_external_image_to_texture()`
which, despite the similar name, is unrelated to the external texture
binding resource.

The following patch is going to add some tests for the latter, so we
are taking this opportunity to rename the former to help avoid
confusion.
2025-08-06 17:31:50 +02:00
Jamie Nicol
b3a3dc33b6 [dx12] Support external textures on DX12
This implements the DX12 HAL part of external texture support, which is
the final piece of the puzzle for external textures on DirectX 12.

When creating a pipeline layout, HAL is responsible for mapping a
single BindingType::ExternalTexture bind group entry to multiple
descriptor ranges in the root signature it creates: 3 SRVs (one for
each texture plane) and a CBV for the parameters buffer. Additionally
we must expose the additional bindings to the Naga backend via the
`external_texture_binding_map`. Lastly, when creating a bind group we
write the descriptors for each of these bindings to the heap.

And with that, we can finally enable the `EXTERNAL_TEXTURE` feature
for the dx12 backend.
2025-08-06 17:31:50 +02:00