Commit Graph
2323 Commits
Author SHA1 Message Date
atlv ddcd89fd69 Implement shader barycentrics (#8320) 2025-10-29 13:15:21 -04:00
Erich Gubler 54beef8aca typo: TransferError:InvalidMipLevel: s/does no/does not/ (#8437) 2025-10-28 21:11:17 +01:00
charlotte 🌸 0810110bd7 Add pci bus and device uuid to AdapterInfo (#8290) 2025-10-24 11:53:44 -04:00
Erich Gubler e65468ec6a chore: s/allow/expect for clippy::collapsible_if (#8425) 2025-10-23 18:34:41 -04:00
Andy Leiserson 3ca6a1c0df Defer some bind group processing until draw/dispatch
This allows us to save some work when a bind group is replaced,
although WebGPU still requires us to fail a submission if any
resource in any bind group that was ever referenced during
encoding is destroyed.

Fixes #8399
2025-10-23 14:59:25 +02:00
Andy Leiserson e8dfc72d04 Small refactors related to bind group tracking for compute passes
* Don't remove resources from the usage scope, it is not necessary, and
  not useful, since we don't verify the scope is empty afterwards.
* Avoid some unnecessary `unsafe`.
2025-10-23 14:59:25 +02:00
Andy Leiserson 7f644452f0 Check for attachment overlap using textures, not views (#8402) 2025-10-22 17:37:38 +02:00
Andy Leiserson d575c0234b Disallow mixing the raw encoding API with the wgpu API (#8373) 2025-10-22 11:34:40 -04:00
OpsticandConnor Fitzgerald f0209e3db8 Add support for transient textures on Vulkan and Metal (#8247)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2025-10-16 19:50:01 +00:00
Connor Fitzgerald 7fdc5f1086 Improve various TextureView error messages (#8323) 2025-10-16 15:07:12 -04:00
Erich Gubler e2f70c2481 refactor: satisfy mismatched_lifetime_syntaxes lint (#8350) 2025-10-16 11:30:30 -04:00
Andy Leiserson 3f7dae1a30 Additional api_logging for passes (#8326) 2025-10-13 13:19:29 -04:00
Jim Blandy 1cbebdcffe [core] Don't skip binding index checks for derived layouts. (#8325)
When deriving a bind group layout for a pipeline, bother to enforce
`wgpu_types::Limits::max_bindings_per_bind_group`. Move the check:

- from `wgpu_core::device::bgl::EntryMap::from_entries`, which is only used
  for explicit bind group creation

- into `wgpu_core::device::Device::create_bind_group_layout`, which is used
  for all bind group layout creation.
2025-10-10 16:38:35 +00:00
Andy Leiserson 3958790a85 refactor: Split finish between Global and CommandEncoder (#8288) 2025-10-09 15:13:45 +02:00
Erich Gubler adf4b2f2de fix: reject fragment shader output locations > max_color_attachments limit 2025-10-08 16:34:43 -04:00
Erich Gubler 1f91bfe465 refactor: check_stage: convert if to match for I/O checks 2025-10-08 16:34:43 -04:00
Erich Gubler 93692470ab refactor: Interface::check_stage: use concat!(…) for non-invariant @builtin(position) warning 2025-10-08 16:34:43 -04:00
Sam a8f51f8fd1 Split MipmapFilterMode from FilterMode (#8314) 2025-10-08 18:06:33 +02:00
renovate[bot]andAndreas Reich 854664a90d chore(deps): update crate-ci/typos action to v1.37.3 (#8306)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Andreas Reich <r_andreas2@web.de>
2025-10-06 19:32:39 +00:00
Connor Fitzgerald e73d0558f0 Fix docs.rs build (#8292) 2025-10-06 13:11:48 -04:00
Andy Leiserson 334170b21e Block creating mesh shader pipelines when the feature is not available (#8298) 2025-10-04 03:12:52 -04:00
Connor Fitzgerald 482a983e10 Release v27 (#8287) 2025-10-01 19:36:18 -04:00
Andreas Reich 333f811e9c Rework wgpu::PollType to only two enum variants (#8285) 2025-10-01 18:08:07 -04:00
Andreas Reich 00ea850d79 Allow timeouting on poll (#8282) 2025-10-01 07:19:24 +00:00
Andy LeisersonandAndreas Reich 1967900565 Encode commands on finish (#8220)
Co-authored-by: Andreas Reich <r_andreas2@web.de>
2025-09-25 14:22:51 -04:00
Andie Bradley f6005a16c8 Include FreeBSD in conditional compile attributes (#8246) 2025-09-20 22:46:46 -04:00
Andy Leiserson 04a3401638 Extract command encoding to free functions (#8210) 2025-09-11 15:15:33 -04:00
Andy Leiserson 67bdd80a38 Add cbindgen:ignore directives (#8212) 2025-09-11 19:10:05 +00:00
Andy Leiserson aaf52e93d9 Move some *Copy*Info types out of wgpu_core::command::transfer
In the future `transfer` will want to use the `Arc` versions of these
types. I have exported them from `wgpu_core::command::ffi`, to document
that these are used for FFI purposes, and from `wgpu_core::command`, for
backwards compatibility, although I also change the in-tree uses to
use them from `wgpu_types` instead of from `wgpu_core::command`.
2025-09-11 10:20:03 -07:00
Andy Leiserson d79a49a060 Rename commands to trace_commands 2025-09-11 10:20:03 -07:00
Andy Leiserson 718497356c Move enum Command from device::trace to command::encoder_command. 2025-09-11 10:20:03 -07:00
Andy Leiserson c0c16078e9 Rename and relocate ID resolution helpers 2025-09-11 10:20:03 -07:00
Andy Leiserson 885845087f Extract the parts of PassState that apply to the base encoder
And rename a few things.
2025-09-11 10:20:03 -07:00
Andy Leiserson 1791064a30 Update comments on IdentityValues (#8183) 2025-09-09 11:14:41 -07:00
Andy Leiserson a9638c8e3a Remove pending_query_resets from CommandBufferMutable (#8187)
It is emptied by `reset_queries` at the end of every render pass, so
it's just keeping an allocation alive, not holding any state. It seems
unlikely that there is sufficient performance gain from reusing the
memory allocation to justify the complexity of additional state at
higher layers.
2025-09-09 13:03:12 -04:00
Andy Leiserson 4853133eaa Fix buffer initialization tracking for some buffer-texture copies (#8099)
Fixes #7947
Fixes #8021
Fixes #8097
2025-09-04 14:15:31 -07:00
Andy Leiserson 989d48ccb6 Tweak the bytes_per_row alignment check
Previously, the check was skipped if the copy was a single row, which is
not correct. The check should be made whenever bytes_per_row is
specified. It is permissible not to specify bytes_per_row if the copy is
a single row, but if it is specified, it must be aligned.

Also removes a redundant check of the `offset` alignment.

Since the offset and bytesPerRow alignment checks are not part of
"validating linear texture data", I chose to remove that instance of
them. These checks are now in `validate_texture_buffer_copy`, which
does not correspond 1:1 with the spec, but has a comment explaining how
it does correspond.
2025-09-04 14:15:31 -07:00
Connor Fitzgerald 8d1f4bb5f2 Require token for experimental features (#8163) 2025-08-29 15:43:27 -04:00
Lucas Abel 5d4cf56689 [api] expose invalid submission index to PollError (#8169) 2025-08-29 12:30:55 -04:00
Matthias Reitinger 80a742094c [wgpu-core] Improve errors for forbidden texture copy formats (#8156)
TransferError now has separate variants for texture copy formats that
are only forbidden in combination with specific aspects
(CopyFrom/ToForbiddenTextureFormatAspect), and texture copy formats that
are always forbidden, irrespective of the aspect
(CopyFrom/ToForbiddenTextureFormat).

This produces a less confusing error message by not mentioning the
aspect it is not relevant.
2025-08-29 10:03:35 +00:00
Andy LeisersonandErich Gubler 4a7b6abb19 Add F16_IN_F32 downlevel flag for pack/unpack/quantize f16 (#8130)
Although the operation of these functions is defined in terms of f16
semantics, the input/output types are not f16, and they are generally
available even when native `f16` support is not. But in at least one
case, they are only available with `f16` support, so add a new downlevel
flag that is cleared when these functions are not available.

Add some infrastructure to simplify testing of missing
capabilities/extensions, and add tests for a few more kinds of f16
usage.

Co-authored-by: Erich Gubler <erichdongubler@gmail.com>
2025-08-28 13:58:36 -07:00
Connor Fitzgerald 2ff46cd7cd Remove MULTI_DRAW_INDIRECT feature (#8162) 2025-08-28 12:00:14 -04:00
Connor Fitzgerald 884cea5ad9 Narrow locks in queue::write_buffer (#8146) 2025-08-25 11:54:30 -04:00
Vecvec c4a834e4f9 Make the compacted hal acceleration structure inherit a label from the base BLAS. #8103 2025-08-24 09:11:13 +00:00
Jamie Nicol 167ff7b952 [metal] Implement support for external textures
This contains the Metal HAL changes required to support external
textures. When creating a bind group we create resource bindings for
each of the 3 textures and parameters buffer that the external texture
has been lowered to. When creating the pipeline layout we fill the
`BindTarget` accordingly, so that the Naga MSL backend can bind each
of the global variables to which the the external texture has been
lowered to each of these resources.

We must also ensure the size of the buffer bound to the parameters
global matches the size of the MSL type, else metal validation
complains. We do this by adding a padding field to the rust-side
ExternalTextureParams struct, the size of which is used as the size of
the buffer to allocate.

Lastly we enable `Features::EXTERNAL_TEXTURE` on the Metal backend.
2025-08-21 12:35:19 +01:00
MagnusandConnor Fitzgerald 17a17f716a Initial precompiled shaders implementation (#7834)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2025-08-20 16:20:59 -04: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
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 b5385225ab fix(core): validate effective buf. binding size is aligned to 4 (#8041)
The WebGPU spec. `createBindGroup` [states][spec-ref] (emphasis mine):

> Device timeline initialization steps:
>
> …
>
> 2. If any of the following conditions are unsatisfied generate a
>    validation error, invalidate _bindGroup_ and return.
>
>    …
>
>    For each `GPUBindGroupEntry` _bindingDescriptor_ in
>    _descriptor_.`entries`:
>
>    - …
>
>    - If the defined binding member for _layoutBinding_ is:
>
>      - …
>
>      - `buffer`
>
>        - …
>
>        - If _layoutBinding_.`buffer`.`type` is
>
>          - …
>
>          - `"storage"` or `"read-only-storage"`
>
>            - …
>
>            - effective buffer binding size(_bufferBinding_) is a multiple of 4.

[spec-ref]: https://www.w3.org/TR/webgpu/#dom-gpudevice-createbindgroup

We were not implementing this check of effective buffer binding size.
Check that it's a multiple of 4, including
`webgpu:api,validation,createBindGroup:buffer,effective_buffer_binding_size:*`
that this is now implemented as intended.
2025-08-06 16:19:08 +02:00