Commit Graph
9434 Commits
Author SHA1 Message Date
Andy Leiserson 663c32cf86 Remove unsafe from hal::BufferBinding::new_unchecked
(cherry picked from commit dc924bc715)
2025-07-10 16:11:08 -07:00
Andy Leiserson 7808356b29 Restore plumbing of implicit remainder-of-buffer size to backends
(cherry picked from commit 468632f207)
2025-07-10 16:11:08 -07:00
Andy Leiserson a419177ed7 Fix calculation error
(cherry picked from commit 00406a75a4)
2025-07-10 16:11:08 -07:00
Andy Leiserson 9b18084399 [deno] Implement nullable vertex buffer layouts
(cherry picked from commit 2db1d71f1b)
2025-07-10 16:11:08 -07:00
Andy Leiserson aaca95f2a3 Restore unintentional support for zero-size buffers
(cherry picked from commit c0a580d6f0)
2025-07-09 11:12:13 -07:00
Andy Leiserson a8cbe9f633 Validate binding ranges against buffer size
(cherry picked from commit ef428fcab8)
2025-07-09 11:12:13 -07:00
Andy Leiserson f1ea3eae1c Check the math for buffer-texture copies
(cherry picked from commit 3d0fe3a003)
2025-07-09 11:12: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 9436d56271.
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
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
VecvecandConnor Fitzgerald 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]andAndreas Reich 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
Andy Leiserson e9af205c71 [deno] Implement ShaderModule.getCompilationInfo (#7736) 2025-06-11 03:49:39 -04:00