Commit Graph
190 Commits
Author SHA1 Message Date
Teodor Tanasoaia e114d2f0a7 Add support for gaps in bind group layouts & update relevant validation (#9034)
* [wgpu-core] add support for optional BG & BGL entries

* [wgpu] allow gaps in bind group layouts

And allow unbinding in the web backend.

* adapt tests

* add changelog entry

* [wgpu] remove generic from `PipelineLayoutDescriptor`
2026-02-25 19:47:36 +01:00
Erich Gubler 9bc127f128 chore: update CORE_MSRV to 1.90 (#8943)
New cases for some Clippy lints pop up as part of this upgrade that
cannot be done before, listed below. Yuck!

- `clippy::manual_is_multiple_of`
- `clippy::missing_const_for_fn`
- `clippy::useless_nonzero_new_unchecked`
2026-01-27 19:37:10 -05:00
Vecvec f1b79b1c30 Correct alignment if a buffer is an acceleration structure scratch buffer (#8745) 2025-12-17 00:02:38 -05:00
Luo Zhihao bec772bdbd hal/vulkan: Fix multi draw indirect emulating and respect maxDrawIndirectCount (#8665) 2025-12-16 00:31:03 -05:00
David Duarte ea361fc114 hal/vulkan: Replace gpu-alloc by gpu-allocator (#8158) 2025-12-12 19:10:42 +00:00
Jim Blandy 39f6596588 [hal] Minor doc fixes for Vulkan texture memory changes. (#8703) 2025-12-10 17:04:58 -05:00
s-ol 2a7e8700ad unify vk_hal::Texture::{block, external_memory} in enum TextureMemory (#8521) 2025-12-03 17:21:54 +01:00
ad0f3111b7 Add multiview limits and tests (#8206)
Co-authored-by: Andreas Reich <r_andreas2@web.de>
Co-authored-by: Magnus <85136135+SupaMaggie70Incorporated@users.noreply.github.com>
2025-11-01 12:08:15 +00:00
Connor Fitzgerald ef1d31955a Factor out swapchain to abstracted interface (#8356) 2025-10-26 22:02:40 -04:00
Connor Fitzgerald b3d94317d4 [hal/vulkan] Wait for fence signalled in vkAcquireNextImage (#8420) 2025-10-22 23:16:09 -04:00
Jerzy Wilczek a70b8336c0 fix: Move DropGuards to the end of their parent structs. (#8353) 2025-10-16 15:58:18 -04:00
Inner Daemons 70e2302ace Made conv public (#8364) 2025-10-16 04:07:12 +00:00
Andreas Reich 00ea850d79 Allow timeouting on poll (#8282) 2025-10-01 07:19:24 +00:00
Xiaopeng Li 990aef977e Expose external memory of vulkan texture (#8257) 2025-09-25 08:27:54 -04:00
Jay McCarthyandConnor Fitzgerald 6ef8e1f103 Expose raw handles (#8174)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2025-09-24 21:16:47 +00:00
Jamie Nicol ba0b6b9b0e [vulkan, naga spv-out] Remap resource bindings
In order to support external textures, we must be able to map a single
external texture resource binding to multiple Vulkan descriptors. This
means we must be able to override the `Binding` and `DescriptorSet`
values for global variables when generating SPIR-V, rather than simply
passing through the group and binding values from Naga IR.

This patch extends the existing SPIR-V Naga backend's `BindingMap` to
contain a descriptor set and binding value in addition to the existing
array size. When creating BindGroupLayouts/BindGroups we use a
sequentially incrementing value for each entry's binding value,
continuing to just use the bind group index as the descriptor set
value.

The Naga backend looks up each resource in the map when emitting its
`Binding` and `DescriptorSet` decorations. If the entry cannot be
found in the map, it will either error or emit fake bindings based on
its configuration.
2025-09-24 17:55:35 +02:00
Jamie Nicol 725549363b [vulkan] Use corresponding bind group layout entries when creating bind groups, rather than list of vk::DescriptorType
This is a refactoring of Vulkan BindGroupLayout and BindGroup creation
in preparation for implementing external texture support.

Currently when creating a BindGroupLayout the Vulkan backend creates a
list of the vk::DescriptorType for each entry, as well as the count, for
binding arrays. Then when creating the BindGroup, it iterates through
this list and does whatever it needs to do for each entry based on these
values.

In order to support external textures, we will have to create multiple
descriptors for each BindingType::ExternalTexture. This means we cannot
map each binding type to a single Vulkan descriptor type. Instead, store
the list of BindGroupLayoutEntries on the BindGroupLayout and use those
when creating the BindGroup, using the same "layout_and_entry_iter"
idiom used by other backends. In subsequent patches this will allow us
to create multiple descriptors for a single resource binding.
2025-09-24 17:55:35 +02:00
Connor Fitzgerald 2ff46cd7cd Remove MULTI_DRAW_INDIRECT feature (#8162) 2025-08-28 12:00:14 -04: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 1ed61877b5 Remove wgpu_core::hal_api::HalApi 2025-07-16 15:10:00 -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
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
Jim Blandy 41616d9ddf wgpu_hal::vulkan: Introduce SemaphoreList helper type. (#7749) 2025-06-11 21:01:57 +00:00
Hubert Głuchowski a9e04f88af wgpu-hal: Expose vulkan::PhysicalDeviceFeatures (#7682) 2025-05-30 12:32:24 -04:00
Robert Bamler ff291654b3 [wgpu-hal] Add PrivateCapabilities::shader_int8 on Vulkan
This allows declaring the SPIR-V capability "Int8", which allows us to
generate faster code for `[un]pack4x{I, U}8[Clamp]`.
2025-05-23 16:08:26 +02:00
Robert Bamler 0d06284d96 Allow wgpu-core to use new naga optimizations for dot4{I, U}8Packed (#7595)
* [wgpu-hal] Use highest available SPIR-V version

* [wgpu-hal] Expose capabilities `DotProductInput*`

* Introduce `{PhysicalDeviceFeatures, PrivateCapabilities}::shader_integer_dot_product`
2025-04-30 11:07:20 +00:00
teoxoy d14849df48 [vk] add support for rendering to slices of 3D textures 2025-04-25 12:39:45 +02:00
teoxoy f728a92366 [vk] add TextureView::raw_format 2025-04-25 12:39:45 +02:00
teoxoy 2d73eb3967 [vk] move framebuffer cache into CommandEncoder
This makes texture view destruction cheap since users of wgpu-hal are required to keep resources referenced by encoders alive for at least as long as the encoder is alive.

This is also a prerequisite to implement rendering to slices of 3D textures (by creating temporary texture views).

On the other hand the cache won't be as effective but that is probably ok, we can reevaluate the implementation if it turns out to be a problem.
2025-04-25 12:39:45 +02:00
teoxoy da8ff2a0d5 [vk] fix raw_pass not being part of FramebufferKey 2025-04-25 12:39:45 +02:00
teoxoy d4b46d6099 [vk] remove usage of imageless framebuffers
Imageless framebuffers are not needed, we know which views will be attached to the render pass already. Even if we wanted to more aggressively cache imageless framebuffers that wouldn't be possible since they still require specifiying view usage, texture usage and view formats.

Removing usage of imageless framebuffers simplifies the code substantially.
2025-04-25 12:39:45 +02:00
teoxoy 2bb8325f85 [vk] require VK_KHR_maintenance1 (in preparation for creating 2D texture views from slices of 3D textures) 2025-04-25 12:39:45 +02:00
Zachary Harrold c63cfd86ae Remove exceptions for x_instead_of_y lints (#7592) 2025-04-22 11:12:53 -04:00
teoxoy 3b72d59a3c make memory pressure detection optional and configurable 2025-04-22 09:21:27 +02:00
teoxoy e78bc98d1b remove oom_panic feature 2025-04-22 09:21:27 +02:00
Connor Fitzgerald 4687973c9a Use bytemuck instead of slice::from_raw_parts for transmutes (#7376) 2025-03-19 22:05:21 -04:00
Marc PabstandMarc Pabst 38f3c47a46 Add as_hal for Queue (#7182)
* add as_hal for Queue

* add as_raw for dx12 queue

* return Mutex + add as_raw for Vulkan

* return reference

* restore Cargo.lock

* fix  Cargo.lock

---------

Co-authored-by: Marc Pabst <“marcpabst@users.noreply.github.com”>
2025-03-04 21:24:06 +00:00
Matilde Morrone 7eb69f43b6 Add DRM support to Vulkan backend (#7212)
* Add basic drm support to vulkan backend

* Move vulkan drm implementation to its own module

* Properly feature gate drm support and add safety docs

* Disable drm on wasm targets

* Remove old fixme comment from vulkan drm backend

* Move cfg check inside drm module

* Use expect instead of allow for create_surface_from_drm

* Document that drm is not available on apple platforms
2025-03-04 20:53:38 +00:00
SupaMaggie70IncorporatedandConnor Fitzgerald a6109bf69b Mesh shaders - initial wgpu hal changes (#7089)
* Initial(untested commit), vulkan and gles only supported

* Maybe fixed compiles for metal and dx12

* Hopefully fixed compiles for other backends and updated to functional(?) vulkan thing

* Fixed the clippy warning

* Fixed silly documentation mistake

* Fixed issue with multiview feature

* Dummy commit for dummy CI

The CI pooped itself, hopefully this fixes that. Will probably be undone either way.

* Re trigger CI checks, to avoid #7126

* Changes based on code review

* Fixed clippy warning, broken cargo.lock

* Unfucked cargo.lock for real this time

* Switched match to if-let in accordance with review

* Updated changelog

* Fix CI error

Done from web out of impatience

* CI is very angry 😡

Made CI less angry by fixing formatting(hopefully). This commit was also done from GitHub web.

* Removed comment in following request

* Update wgpu-hal/src/vulkan/adapter.rs

---------

Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2025-03-04 00:12:38 +00:00
Kevin Reid bea4fb9e2d wgpu-hal: Adjust imports to eventually allow no_std.
We need `core::error::Error` (Rust 1.81) to make it a reality.
2025-02-21 08:47:16 +01:00
Vecvec 3a4a40aae4 [wgpu-hal] Blas compaction (#7101) 2025-02-12 13:19:07 +00:00
Vecvec d34707ec3f Rename instance_id & instance_custom_index to instance_index & instance_custom_data (#6780) 2025-02-05 18:23:22 +01:00
@brody4hire - C. Jonathan BrodyandConnor Fitzgerald df54acc05d use hashbrown in more crates (etc.) (#6938)
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2025-01-27 11:50:33 -05:00
0fc0b35899 Transition resources (#6678)
* WIP

* Fix typo

* WIP: Implement structure of  command_encoder_transition_resources

* WIP

* More work

* Clippy

* Fix web build

* Use new types for API, more docs

* Add very basic test

* Try to fix test cfg

* Fix merge

* Missed commit

* Use wgt types instead of hal types

* Implement `Clone` for `ShaderModule` (#6939)

* Move to dispatch trait, move more things to wgt

* Move existing code to use new wgt types

* Fixes

* Format import

* Format another file

* Fixes

* Make module private

* Fix imports

* Fix test imports

* Rexport types

* Fix imports

* Fix import

---------

Co-authored-by: Alphyr <47725341+a1phyr@users.noreply.github.com>
Co-authored-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2025-01-24 00:54:19 -05:00
sotaroikedaandSotaro Ikeda 3d13cc1bbe Add a way to notify with Queue::submit() to Vulkan's vk::Semaphore allocated outside of wgpu (#6813)
Co-authored-by: Sotaro Ikeda <you@example.com>
2025-01-17 11:18:17 -05:00
@brodycj - C. Jonathan Brody 623f143a82 Start using hashbrown (#6925) 2025-01-16 14:53:36 +01:00
Connor Fitzgerald cb6dbb897f Vulkan Sampler Cache (#6847) 2025-01-06 19:17:17 -05:00
Xiaopeng Li 15a77b525c expose VULKAN_EXTERNAL_MEMORY_WIN32 feature (#6825) 2025-01-02 19:48:54 -05:00