9435 Commits

Author SHA1 Message Date
Mendy Berger
4c08c37a46
Expose raw_factory (#7827)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2025-06-25 19:43:23 +00:00
Erich Gubler
df272d3cfc
chore(CHANGELOG): merge Unreleased/New features/Naga sections (#7802) 2025-06-25 15:02:56 -04:00
Vecvec
dc0d457a9a
Add limits for acceleration structures (#7845) 2025-06-25 14:49:55 -04:00
Erich Gubler
9d14871f01
Fix OpenBSD compilation of wgpu_hal::vulkan::drm (#7810) 2025-06-25 18:02:35 +00:00
Andy Leiserson
402a479027
[metal] Retain references with command buffers (#7842) 2025-06-25 11:40:25 -04:00
atlv
0c05dbf5c9
fix(webgpu): set_unclipped_depth (#7841) 2025-06-24 15:12:47 +02:00
renovate[bot]
440b33f4c6
Update Cargo.lock (#7839)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-06-23 10:47:28 -04:00
Jim Blandy
3f96ba2980 Skip wgpu_gpu::oom::query_set_oom_test on Vulkan.
Vulkan's `VK_EXT_memory_budget` extension doesn't cover query sets, so
`wgpu_hal::vulkan::Device::error_if_would_oom_on_resource_allocation`'s
tactic doesn't work to anticipate OOM errors from the Vulkan driver
when creating query sets.

Without these checks, `wgpu_gpu::oom::query_set_oom_test` actually
consumes a significant amount of memory and attracts the attention of
the system's OOM killer. While it does get killed, the situation tends
to adversely affect the stability of the rest of the system, and thus
is not a friendly thing for a test run to do (#7817).

This change can be reverted once a suitable accounting method for
query sets has been implemented on Vulkan.
2025-06-18 08:21:13 -07:00
Andy Leiserson
3a5d0f2747 Deferred error reporting for other command encoder operations
* clear commands
* query set functions
* command_encoder_as_hal_mut
* ray_tracing
2025-06-17 16:17:43 -07:00
Andy Leiserson
e702d1c116 Deferred error reporting for transfer commands 2025-06-17 16:00:49 -07:00
Jamie Nicol
8cdbcc1755 Add ExternalTexture BindingType behind new Feature flag
Adds a new feature flag, `EXTERNAL_TEXTURE`, indicating device support
for our implementation of WebGPU's `GPUExternalTexture` [1] which will
land in upcoming patches. Conceptually this would make more sense as a
downlevel flag, as it is a core part of the WebGPU spec which we do not
yet support. We do not want, however, to cause applications to reject
adapters because we have not finished implementing this, so for now we
are making it an opt-in feature.

As an initial step towards supporting this feature, this patch adds a
new `BindingType` corresponding to WebGPU's
`GPUExternalTextureBindingLayout` [2]. This binding type dictates that
when creating a bind group the corresponding entry must be either an
external texture or a texture view with certain additional requirements
[3].

As of yet wgpu has no concept of an external texture (that will follow
in later patches) but for now this patch ensures that texture views
corresponding to an external texture binding type are validated
correctly. Note that as the feature flag is not yet supported on any
real backends, bind group layout creation will fail before getting the
chance to attempt to create a bind group. But in the added tests using
the noop backend we can see this validation taking place.

[1] https://www.w3.org/TR/webgpu/#gpuexternaltexture
[1] https://www.w3.org/TR/webgpu/#dictdef-gpuexternaltexturebindinglayout
[2] https://gpuweb.github.io/gpuweb/#bind-group-creation
2025-06-17 15:00:29 -07:00
Jamie Nicol
111a95b822 [cts_runner] Add texture2d<f32> textureSampleBaseClampToEdge() shader execution tests to CTS test list 2025-06-17 14:27:18 -07:00
Jamie Nicol
55a2c3095d [naga] Support textureSampleBaseClampToEdge() for texture2d
Adds a new flag to the IR indicating when image sample coordinates are
to be clamped. Adds wgsl-in support for parsing and lowering to
IR. Validation ensures this flag is only used when sampling a 2D
non-arrayed sampled texture, without offset, gather, or depth
comparison. This matches the WGSL requirements, with the exception of
supporting `texture_external` textures, which will follow in a later
patch.

SPIRV, HLSL, and Metal backends are supported so far, with GLSL left
for a follow up. (In GLSL the texture will simply be sampled without
the coordinates being clamped.)

It may seem unfortunate to have to handle this separately for each
backend, and indeed it would have been possible to implement this simply
in the WGSL frontend. However, future patches will add support for using
textureSampleBaseClampToEdge() with external textures, which will
actually have to be handled by each backend. This patch is laying the
groundwork for that.
2025-06-17 14:27:18 -07:00
Jamie Nicol
a5f328613d [cts_runner] Run some textureSample CTS shader execution tests
Limit to the `sampled_1d_coords` subtests for now as otherwise the tests
take a very long time to execute, and there are also some failures with
certain texture formats that are used in higher dimensions.
2025-06-17 20:20:25 +01:00
Jamie Nicol
d811258424 [naga msl-out] Add padding to end of structs if required 2025-06-17 20:20:25 +01:00
Jamie Nicol
5f8d408fb8 [deno_webgpu] Add stub GPUExternalTexture implementation
This doesn't do anything yet, but unblocks running some CTS tests.
2025-06-17 20:20:25 +01:00
Jim Blandy
48eae68156 [naga spv-in] Lay out entry point output structs correctly.
In the SPIR-V front end, when generating Naga IR `Struct` types to
represent a SPIR-V entry point's `Output` variables, instead of saying
"0xFFFF, // shouldn't matter", follow the usual rules in assigning
struct member offsets and computing an overall
size (`TypeInner::Struct::span`) for the resulting struct type.
2025-06-17 09:56:57 -07:00
Jamie Nicol
0aa1baface [CI] Install WARP for CTS run
This means we use a reliable version rather than depending on whatever
the worker has installed.
2025-06-17 09:14:44 -04:00
Jamie Nicol
3ba583cd61 [CI] Refactor DXC and WARP installation steps to composite actions
This avoids having to duplicate the steps and version numbers across
mutiple workflows.
2025-06-17 09:14:44 -04:00
Jamie Nicol
ad4286102a [dx12] Return OOM error when GetResourceAllocationInfo() returns SizeInBytes == 0
Some versions of WARP return an allocation info with SizeInBytes == 0
for very large allocations. Proceeding to attempt to allocate a zero-
sized resource results in a device lost error. It's preferable to
instead return an out of memory error.
2025-06-17 09:14:44 -04:00
Jamie Nicol
aeb2c3e6c7 chore(cts): Fix parsing of Git for Windows version string
Git for Windows adds an extra suffix to the version string. This is a
follow up to #7800 that ensures we parse such git versions correctly
rather than returning an error.
2025-06-17 21:27:25 +09:00
Andy Leiserson
45ebc73610 [naga] Always compact the module in process_overrides
Fixes #7638
2025-06-16 16:42:02 -07:00
Andy Leiserson
afa0f71736
[deno] Fix dropping of command encoders/buffers, and an enum typo (#7808)
Fixes #7797
2025-06-16 10:50:19 -07:00
Erich Gubler
371c8fd1db
chore(cts): clone CTS only shallowly (#7800) 2025-06-16 10:39:35 -07:00
renovate[bot]
70368feeb0
Update Cargo.lock (#7809)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-06-16 09:40:57 -04:00
Vecvec
03775c54fe
Prevent naga crashing on an aliased ray query. (#7759) 2025-06-16 08:45:39 +00:00
Dmitry Zamkov
bbb7cc79ef
Implement clip-distances extension for GL and Vulkan backends (#7730)
* Basic implementation of `clip_distances` for Vulkan and GL backends

* Added GPU test for `clip-distances`

* Update feature array size

* Add changelog entry

* Validate `clip_distances` array size

* Check for `clip_distances` enable directive

* Consolidate code for generating `enable` directives in WGSL backend and add `clip_distances`.
2025-06-16 10:33:31 +02:00
Phena Ildanach
486a77d682 [naga glsl-out] Split writes for memory/control barriers 2025-06-16 10:22:46 +02:00
Phena Ildanach
dd273fd7e2 [naga spv] Split workgroup and subgroup memory semantics in Control Barriers 2025-06-16 10:22:46 +02:00
Phena Ildanach
1e031e7a02 [naga spv-in] Add support for Memory Barriers 2025-06-16 10:22:46 +02:00
Xiaopeng Li
65337894f6
Fix texture_from_d3d11_shared_handle compatibility on AMD/Nvidia GPUs (#7782)
* wrapper dedicated allocate info

* comment on why p_next is set manually
2025-06-13 14:48:56 -04:00
Erich Gubler
f96ac55aa4
fix(naga): don't panic on f16s in pipeline constants (#7801) 2025-06-13 10:41:19 -07:00
Andy Leiserson
620c9d1e8b
Deferred error reporting for debug commands (#7789) 2025-06-12 11:53:32 -07:00
Erich Gubler
cf83de3a5d
chore!: remove deprecated type aliases for idents. in 2024-08 spec. rename (#7790)
This backs out commit 9436d56271c6f3141ee5da882355ea45784c446c.
2025-06-12 09:55:00 -04:00
Andy Leiserson
82fa8e2a94 [naga] Remove non-essential override references via compaction
Adds a mode to compaction that removes unused functions, global
variables, and named types and overrides. This mode is used
everywhere except the compaction at the end of lowering, where
it is important to preserve unused items for type checking and
other validation of the module.

Pruning all but the active entry point and then compacting makes
`process_overrides` tolerant of missing values for overrides that are
not used by the active entry point.

Fixes #5885
2025-06-12 14:22:18 +09:00
Andy Leiserson
096f1f1f6d [naga] Remove the compact feature 2025-06-12 14:22:18 +09:00
Andy Leiserson
611a2bbede [naga] Create a helper for adjust_doc_comments 2025-06-12 14:22:18 +09:00
Vecvec
aa427de4ea
Remove unsafe acceleration structure build (#7513) 2025-06-12 00:43:03 -04:00
atlv
645354a528
Make naga span methods take path as generic AsRef Path (#7643)
Co-authored-by: Erich Gubler <erichdongubler@gmail.com>
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2025-06-12 01:55:25 +00:00
Vecvec
73eb83ded1
[wgpu] Blas compaction (#7285)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2025-06-11 21:40:10 -04:00
Vecvec
efbac5dfba
Add extra acceleration structure vertex formats. (#7580) 2025-06-11 18:17:14 -04:00
Jim Blandy
41616d9ddf
wgpu_hal::vulkan: Introduce SemaphoreList helper type. (#7749) 2025-06-11 21:01:57 +00:00
Andy Leiserson
ce89c916f8
Add storage for an error in CommandEncoderStatus (#7785) 2025-06-11 09:56:14 -07:00
Erich Gubler
9659838a1b
refactor(naga): resolve!(…): de-dupe $expr usage (#7787) 2025-06-11 11:33:37 -04:00
renovate[bot]
5a7af54619
chore(deps): update rust crate cargo_metadata to 0.20 (#7744)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Andreas Reich <r_andreas2@web.de>
2025-06-11 11:24:33 -04:00
Erich Gubler
db3c35db90 fix(naga): properly impl. auto. type conv. for select 2025-06-11 21:55:02 +09:00
Erich Gubler
3c0803d1cc refactor(wgsl-in): make Scalar::concretize pub(in crate::front::wgsl) 2025-06-11 21:55:02 +09:00
Erich Gubler
77def411c4
fix(const_eval): allow casts from AbstractInt to itself (#7657) 2025-06-11 09:06:20 +00:00
Jim Blandy
9046b439d7
Add more logging to Instance::device_request_adapter. (#7786) 2025-06-11 08:36:15 +00:00
Nico Burns
630905134b
Make strum a dev-only dependency (#7776) 2025-06-11 04:32:11 -04:00