Commit Graph
699 Commits
Author SHA1 Message Date
atlv ddcd89fd69 Implement shader barycentrics (#8320) 2025-10-29 13:15:21 -04:00
charlotte 🌸 0810110bd7 Add pci bus and device uuid to AdapterInfo (#8290) 2025-10-24 11:53:44 -04:00
Kevin Reid f366e9615f [types] Replace conditional derive(thiserror::Error) with unconditional impl. (#8384) 2025-10-20 22:27:57 +02: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
Kanashimia 2ed308a76a docs(types): swap Higher and Lower for *_subgroup_size (#8344) 2025-10-14 09:03:55 -04:00
Sam a8f51f8fd1 Split MipmapFilterMode from FilterMode (#8314) 2025-10-08 18:06:33 +02:00
Connor Fitzgerald e73d0558f0 Fix docs.rs build (#8292) 2025-10-06 13:11:48 -04:00
Clar Fon 790235717e Make include_spirv actually work statically (#8250) 2025-10-04 09:50:52 +02: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
Andy Leiserson d31d944ed5 Clarify the effect of the SUBGROUP features and capabilities (#8203) 2025-09-10 20:53:56 -04:00
3902b0c11c Add support for builtin DComp swapchains (#7550)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
Co-authored-by: Marijn Suijten <marijns95@gmail.com>
2025-09-11 00:19:42 +00:00
Connor Fitzgerald 8d1f4bb5f2 Require token for experimental features (#8163) 2025-08-29 15:43:27 -04:00
Alphyr 5a24e2474d wgpu-types: Do not depend on "bitflags/serde" if feature "serde" is not enabled (#8170) 2025-08-29 12:31:31 -04:00
Lucas Abel 5d4cf56689 [api] expose invalid submission index to PollError (#8169) 2025-08-29 12:30:55 -04:00
Andy Leiserson 7933dd78aa docs(types): note intent to move EXTERNAL_TEXTURE to a downlevel flag 2025-08-28 13:58:36 -07: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 97ba77d668 We're just lowercase bro (#8160) 2025-08-28 11:09:07 -04:00
Kevin Reid c1254b4c80 Add more overview documentation to Buffer and usages. 2025-08-24 17:30:48 -04: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
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
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
Marc Pabst e7cdfc436a Allow disabling waiting for latency waitable object (#7400) 2025-08-10 10:01:25 +00: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
Jamie Nicol 8cd4bd602f [naga hlsl-out] Handle external texture color space conversion
This adds several fields to `ExternalTextureDescriptor`, specifying
how to handle color space conversion for an external texture. These
fields consist of transfer functions for the source and destination
color spaces, and a matrix for converting between gamuts. This allows
`ImageSample` and `ImageLoad` operations on external textures to
return values in a desired destination color space rather than the
source color space of the underlying planes.

These fields are plumbed through to the `ExternalTextureParams`
uniform buffer from which they are exposed to the shader. Following
conversion from YUV to RGB after sampling/loading from the external
texture planes, the shader uses them to gamma decode to linear RGB in
the source color space, convert from source to destination gamut, then
finally gamma encode to non-linear RGB in the destination color space.
2025-08-06 11:18:42 +01:00
sagudev 45e96e593f docs: Fix comment in COPY_BYTES_PER_ROW_ALIGNMENT to include copy_texture_to_buffer (#8029) 2025-07-31 16:05:05 -04:00
Jamie Nicol e1ccb6632c [naga hlsl-out] Implement external texture support
This adds HLSL backend support for `ImageClass::External` (ie WGSL's
`external_texture` texture type).

For each external texture global variable in the IR, we declare 3
`Texture2D` globals as well as a `cbuffer` for the params. The
additional bindings required by these are found in the newly added
`external_texture_binding_map`. Unique names for each can be obtained
using `NameKey::ExternalTextureGlobalVariable`.

For functions that contain ImageQuery::Size, ImageLoad, or ImageSample
expressions for external textures, ensure we have generated wrapper
functions for those expressions. When emitting code for the
expressions themselves, simply insert a call to the wrapper function.

For size queries, we return the value provided in the params
struct. If that value is [0, 0] then we query the size of the plane 0
texture and return that.

For load and sample, we sample the textures based on the number of
planes specified in the params struct. If there is more than one plane
we additionally perform YUV to RGB conversion using the provided
matrix.

Unfortunately HLSL does not allow structs to contain textures, meaning
we are unable to wrap the 3 textures and params struct variables in a
single variable that can be passed around.

For our wrapper functions we therefore ensure they take the three
textures and the params as consecutive arguments. Likewise, when
declaring user-defined functions with external texture arguments, we
expand the single external texture argument into 4 consecutive
arguments. (Using NameKey::ExternalTextureFunctionArgument to ensure
unique names for each.)

Thankfully external textures can only be used as either global
variables or function arguments. This means we only have to handle the
`Expression::GlobalVariable` and `Expression::FunctionArgument` cases
of `write_expr()`. Since in both cases we know the external texture
can only be an argument to either a user-defined function or one of
our wrapper functions, we can simply emit the names of the variables
for each three textures and the params struct in a comma-separated
list.
2025-07-30 14:33:00 -07:00
SupaMaggie70IncorporatedandAndy Leiserson d8b7e81a02 Updated mesh shader limits to be llvmpipe compatible (#8004)
Co-authored-by: Andy Leiserson <aleiserson@mozilla.com>
2025-07-25 00:05:12 -04:00
SupaMaggie70Incorporated 074c0e7191 Add mesh shading api to wgpu & wgpu-core (#7345) 2025-07-24 20:58:56 -04:00
Andy Leiserson 1c43ac2c42 Additional validation of buffer-texture copies (#7948)
* Additional validation of buffer-texture copies

Fixes #7936, but leaves a TODO for #7947

* Skip tests failing on dx12

* Update comments and change unwrap_or to expect
2025-07-23 17:39:42 +02:00
Jamie Nicol acfa8c5776 [wgpu-core] Add ExternalTexture type to wgpu-core
`ExternalTexture` will form the basis of wgpu's implementation of
WebGPU's `GPUExternalTexture`. [1]

The application will be responsible for creating `Texture`(s) and
`TextureView`(s) from the external texture source and managing their
lifecycle. It may have a single RGBA texture, or it may have multiple
textures for separate Y and Cb/Cr planes. It can then create an external
texture by calling `create_external_texture()`, providing the texture
views and a descriptor. The descriptor provides the following required
information:

  * Whether the texture data is RGBA, or multiplanar or interleaved
    YCbCr.
  * The purpoted size of the external texture, which may not match the
    actual size of the underlying textures.
  * A matrix for converting from YCbCr to RGBA, if required.
  * A transform to apply to texture sample coordinates, allowing for
    rotation and crop rects.

The external texture stores a reference to the provided texture views,
and additionally owns a `Buffer`. This buffer holds data of the type
`ExternalTextureParams`, and will be provided as a uniform buffer to
shaders containing external textures. This contains information that
will be required by the shaders to handle external textures correctly.

Note that attempting to create an external texture will fail unless the
`Feature::EXTERNAL_TEXTURE` feature is enabled, which as of yet is not
supported by any HAL backends.

Additionally add the relevant API to wgpu, implemented for the
wgpu-core backend. The web and custom backends are unimplemented.

[1] https://www.w3.org/TR/webgpu/#gpuexternaltexture
2025-07-22 15:38:15 -07:00
Connor Fitzgerald ff0de91ad7 Bump REPO_MSRV to 1.88 (#7960) 2025-07-17 13:00:40 -04:00
Connor Fitzgerald e5b10e07e8 Adjust InstanceDescriptor docs 2025-07-16 15:10:00 -04:00
Jim Blandy c51fe577dc Improve docs for wgpu_types::InstanceFlags::VALIDATION. (#7939) 2025-07-13 01:04:19 -04:00
Andy Leiserson c868142709 Validate vertex and index buffer alignment (#7929) 2025-07-11 14:43:03 -07:00
VecvecandConnor Fitzgerald 4844fa6b5e Merge acceleration structure feature and ray query feature. (#7913)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2025-07-10 19:53:32 +00:00
Andy Leiserson 468632f207 Restore plumbing of implicit remainder-of-buffer size to backends 2025-07-10 09:52:20 -07:00
Andy Leiserson 27e7408f16 Restore the buffer size changes 2025-07-10 09:52:20 -07:00
Andy Leiserson b0527800a1 Revert "Restore unintentional support for zero-size buffers"
This reverts commit c0a580d6f0.
2025-07-09 16:29:41 -04:00
Andy Leiserson c0a580d6f0 Restore unintentional support for zero-size buffers 2025-07-08 14:45:12 -07:00
Andy Leiserson 3d0fe3a003 Check the math for buffer-texture copies 2025-07-08 12:11:56 -07:00
Andy Leiserson b695317a9b Rg11b10ufloat should be resolvable when it is renderable (#7878) 2025-07-03 17:51:48 -04:00
teoxoy 918fdc98b5 remove reason from ErrorType::DeviceLost since it's always "unknown" and users should register the lost callback instead 2025-07-02 11:11:37 +02:00
Erich Gubler 7ff0bd784e fix!: remove WebGpuError impl. for Request{Adapter,Device}Error 2025-06-30 10:58:56 -04:00
Erich Gubler 964c5bbf4c feat(core): impl WebGpuError for API errors 2025-06-30 10:58:56 -04:00
Erich Gubler c8752e5118 feat(types): add error::{ErrorType, WebGpuError} APIs 2025-06-30 10:58:56 -04:00