Commit Graph
269 Commits
Author SHA1 Message Date
atlv ddcd89fd69 Implement shader barycentrics (#8320) 2025-10-29 13:15:21 -04: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
Erich Gubler 54ded60d8e fix(dx12): align tex. <-> buf. copies via intermediate buffer if !UnrestrictedBufferTextureCopyPitchSupported 2025-10-14 09:39:56 -04:00
Erich Gubler adf4b2f2de fix: reject fragment shader output locations > max_color_attachments limit 2025-10-08 16:34:43 -04:00
Sam a8f51f8fd1 Split MipmapFilterMode from FilterMode (#8314) 2025-10-08 18:06:33 +02:00
Andy Leiserson 334170b21e Block creating mesh shader pipelines when the feature is not available (#8298) 2025-10-04 03:12:52 -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
Teodor Tanasoaia ce96254f4f [msl] fix vertex pulling with a stride of 0 (#8265) 2025-09-26 13:37:37 -04:00
Teodor Tanasoaia 3375284f16 [D3D12] fix setting vertex buffer array stride if 0 (#8260) 2025-09-26 11:45:37 +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
05cc6dca82 [hal/dx12] Mesh Shaders (#8110)
* Features and draw commands added

* Tried to implement the pipeline creation (completely untested)

* Fixed clippy issues

* Fixed something I think

* A little bit of work on the mesh shader example (currently doesn't work on dx12)

* Reached a new kind of error state

* Fixed an alignment issue

* DirectX 12 mesh shaders working :party:

* Removed stupid change and updated changelog

* Fixed typo

* Added backends option to example framework

* Removed silly no write fragment shader from tests to see if anything breaks

* Tried to make mesh shader tests run elsewhere too

* Removed printlns and checked that dx12 mesh shader tests run

* Documented very strange issue

* I'm so lost

* Fixed stupid typos

* Fixed all issues

* Removed unnecessary example stuff, updated tests

* Updated typos.toml

* Updated limits

* Apply suggestion from @cwfitzgerald

Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>

* Apply suggestion from @cwfitzgerald

Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>

* Removed supported backends, made example & tests always pass the filename to shader compilers

* Removed excessive bools in test params

* Added new tests to the list

* I'm a sinner for this one (unused import)

* Replaced random stuff with test params hashing

* Updated typos.toml

* Updated -Fo typo thing

* Actually fixed typo issue this time

* Update CHANGELOG.md

Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>

* Update tests/tests/wgpu-gpu/mesh_shader/mod.rs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update wgpu-hal/src/dx12/mod.rs

Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>

* Addressed comments

* Lmao

---------

Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-09-25 03:24:56 +00:00
Connor FitzgeraldandKevin Reid fb28da16c1 [wgpu] add convience functions for deferring mapping/callbacks
Co-authored-by: Kevin Reid <kpreid@switchb.org>
2025-09-07 09:42:57 +02:00
Connor FitzgeraldandAndreas Reich c488bbe604 [wgpu] Improve buffer mapping errors and allow multiple immutable borrows (#8150)
Co-authored-by: Andreas Reich <r_andreas2@web.de>
2025-09-02 12:21:16 -04:00
Connor Fitzgerald 8d1f4bb5f2 Require token for experimental features (#8163) 2025-08-29 15:43:27 -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
Connor Fitzgerald 2ff46cd7cd Remove MULTI_DRAW_INDIRECT feature (#8162) 2025-08-28 12:00:14 -04: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
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
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
sagudev f04b3b020f Remove lifetime from BufferSlice, BufferView, BufferViewMut (#8046) 2025-08-10 11:15:36 +02: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 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
Vecvec a1168613d2 Prevent resources for acceleration structures being created if they are not enabled (#8036)
* Prevent resources for acceleration structures being created if acceleration structures aren't supported.
2025-08-04 09:37:09 -07:00
Connor Fitzgerald 3e153fb8ec Label no-op supporting tests 2025-08-01 01:54:01 -04:00
Connor Fitzgerald 09d0c94576 Use explicit test enumeration 2025-08-01 01:54:01 -04:00
Connor Fitzgerald df40889e1b Prepare for miri 2025-08-01 01:54:01 -04:00
Andy Leiserson 1583c2481a Another fix for texture copy validation (#8019) 2025-07-28 22:19:17 -04:00
SupaMaggie70Incorporated 074c0e7191 Add mesh shading api to wgpu & wgpu-core (#7345) 2025-07-24 20:58:56 -04:00
Jamie Nicol f8756a6e1b [wgpu] Add external texture validation tests
Adds validation tests using the noop backend covering creation of
external textures, and creation of bind groups containing external
textures.
2025-07-22 15:38:15 -07:00
teoxoy 63f3df86c8 [wgpu-core] split command encoders from command buffers 2025-07-22 16:19:18 +02:00
Andy Leiserson 5d14f33259 Test for use of staging buffer in writeTexture (#7963) 2025-07-17 18:52:51 -04:00
Connor Fitzgerald ff0de91ad7 Bump REPO_MSRV to 1.88 (#7960) 2025-07-17 13:00:40 -04: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
Connor Fitzgerald a851eba5f6 Add TextureView::texture (#7907) 2025-07-09 19:53:55 -04:00
teoxoy fc6c529fa8 Adjust DEVICE_DESTROY_THEN_MORE test for spec compliance 2025-07-02 11:11:37 +02:00
Andy Leiserson 86e6b1835b Tolerate destruction of textures used in immediate queue operations prior to submit 2025-06-30 10:29:50 -07:00
Erich Gubler cc0f4ac4bf refactor(wgpu)!: use WebGpuError for error classification 2025-06-30 10:58:56 -04:00
Andy LeisersonandNicolas Silva d13e9f5ebf [tests] Test destruction of a used resource before submission (#7853)
* [tests] Test destruction of a used resource before submission

Fixes #5031

---------

Co-authored-by: Nicolas Silva <nical@fastmail.com>
2025-06-27 10:54:19 -07:00
Andy Leiserson 41badaedfb Update tests and changelog for deferred error reporting 2025-06-26 15:39:53 -07:00
Vecvec dc0d457a9a Add limits for acceleration structures (#7845) 2025-06-25 14:49:55 -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 d811258424 [naga msl-out] Add padding to end of structs if required 2025-06-17 20:20:25 +01:00