Commit Graph
1188 Commits
Author SHA1 Message Date
Andy Leiserson aee8cd1650 Lazy-load the dcomp library (#8216) 2025-09-15 11:48:28 -07: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
Lucas Abel e58223bedf [metal] allow access to command buffer (#8166) 2025-08-29 12:32:34 -04:00
Lucas AbelandAndreas Reich cd14b194a4 [egl] get rid of unwrap where possible (#8024)
Co-authored-by: Andreas Reich <r_andreas2@web.de>
2025-08-28 21:59:54 +00:00
Andy Leiserson 0aacfeadff fix(hal): adjust the conditions when F16_IN_F32 is available 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
David Duarte 780bdfc909 hal/vulkan: Increment counter for intermediate shaders (#8066) 2025-08-27 16:26:18 -04:00
Magnus 24a31c494a Only commit hopefully (#8140) 2025-08-24 17:23:21 -04:00
Connor Fitzgerald 37c4c88138 Fix RT validation error (#8132) 2025-08-24 07:09:25 +12: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
cryvosh 4b5e38ab49 [naga spv-out] Add f16 io polyfill (#7884) 2025-08-21 10:50:32 +02: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
Erich Gubler 57d89b4a4f docs(vulkan): clarify safety contract for DeviceShared::set_object_name (#8055)
* docs(vulkan): clarify safety contract for `DeviceShared::set_object_name`
2025-08-20 08:22:35 -07:00
SupaMaggie70Incorporated 0c0df249cf Only commit hopefully (#8101) 2025-08-14 09:03:06 -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
Jim Blandy 01b3204e7f [hal] Minor doc clarification. (#8087)
Don't use the term "single-threaded", since it's confusing. Just say
what you mean.
2025-08-12 12:54:04 -04: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
atlvandErich Gubler 7cb642eba7 fix STATUS_HEAP_CORRUPTION crash in create_sampler (#8043)
Co-authored-by: Erich Gubler <erichdongubler@gmail.com>
2025-08-05 14:43:54 +00:00
Connor Fitzgerald 86d5211f84 Add support for running tests on the noop backend 2025-08-01 01:54:01 -04:00
Connor Fitzgerald 58b6135872 hal/vulkan: Clear framebuffer cache during command buffer reset (#8031) 2025-07-30 19:58:08 -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
Andy Leiserson bf86ac3489 Two small vulkan changes (#8001) 2025-07-25 11:16:57 -07:00
SupaMaggie70Incorporated 074c0e7191 Add mesh shading api to wgpu & wgpu-core (#7345) 2025-07-24 20:58:56 -04:00
Florian Denis 68a10a01d9 [egl] Fix robust context creation failing on some devices (#7952) 2025-07-24 18:31:36 -04:00
Jamie Nicol 7087f0c01f [wgpu-core] Allow creation of bind groups containing external textures
Adds a `BindingResource` variant for external textures. In core's
create_bind_group() implementation, allow binding either external
textures or texture views to `BindingType::ExternalTexture` layout
entries.

In either case, provide HAL with a `hal::ExternalTextureBinding`,
consisting of 3 `hal::TextureBinding`s and a `hal::BufferBinding`. In
the texture view case we use the device's default params buffer for
the buffer. When there are fewer than 3 planes we can simply repeat an
existing plane multiple times - the contents of the params buffer will
ensure the shader only accesses the correct number of planes anyway.

Track the view or external texture in `BindGroupStates` to ensure they
remain alive whilst required.

And finally, add the corresponding API to wgpu, with an implementation
for the wgpu-core backend.
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
Connor Fitzgerald 83badd52ab hal/vulkan: use different indexes for acquire and present 2025-07-22 09:39:06 -04:00
Connor Fitzgerald c5efc89b08 hal/vulkan: add debug names to all swapchain semaphores 2025-07-22 09:39:06 -04:00
Connor Fitzgerald 979487024e hal/vulkan: generate separate hash identity for Texture/TextureViews (#7972) 2025-07-21 13:48:37 +02:00
Connor Fitzgerald ff0de91ad7 Bump REPO_MSRV to 1.88 (#7960) 2025-07-17 13:00:40 -04:00
Erich Gubler 76dba55e8d style(vulkan): no trailing space after raytrace cap. negotiation (#7954) 2025-07-16 17:16:29 -04:00
Connor Fitzgerald 49b773fde2 Add some documentation to wgpu-hal types 2025-07-16 15:10:00 -04:00
Connor Fitzgerald 1ed61877b5 Remove wgpu_core::hal_api::HalApi 2025-07-16 15:10:00 -04:00
Connor Fitzgerald 0dbe5fb28e Add annotations for the types hal types return 2025-07-16 15:10:00 -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
Andy Leiserson dc924bc715 Remove unsafe from hal::BufferBinding::new_unchecked 2025-07-10 09:52:20 -07: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 9834d9a446 Revert "Validate binding ranges against buffer size"
This reverts commit ef428fcab8.
2025-07-09 16:29:41 -04:00
Andy Leiserson b0527800a1 Revert "Restore unintentional support for zero-size buffers"
This reverts commit c0a580d6f0.
2025-07-09 16:29:41 -04:00
SupaMaggie70IncorporatedandConnor Fitzgerald 18691f5730 Rework of wgpu_hal vulkan buffer importing (#7824)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2025-07-09 15:19:37 -04:00
Andy Leiserson c0a580d6f0 Restore unintentional support for zero-size buffers 2025-07-08 14:45:12 -07:00
Andy Leiserson ef428fcab8 Validate binding ranges against buffer size 2025-07-08 14:45:12 -07:00
teoxoy e10e17907f remove DeviceError::ResourceCreationFailed 2025-07-02 11:11:37 +02:00
Andy Leiserson 768d5f4879 [metal] Increase MAX_COMMAND_BUFFERS (#7858) 2025-06-27 14:18:40 -04:00
Zachary HarroldandConnor Fitzgerald 4c39227510 Allow Naga spv-in and spv-out in no_std (#7760)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2025-06-26 16:45:47 -04:00
VecvecandConnor Fitzgerald 0d61648eeb Allow enabling additional vulkan extensions in Adapter::open and Instance::init (#7829)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2025-06-26 20:39:41 +00:00
Simon Hausmann 208fe4c23d Expose the DxgiAdapter in the Hal adapter (#7852) 2025-06-26 16:34:59 -04:00