Commit graph

1013 commits

Author SHA1 Message Date
Lionel Landwerlin
3ffca66b3c vulkan/runtime: fix invalid address flags value for CmdCopyBufferToImage2
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: a8e49be9d9 ("vulkan/runtime: add implementation of older entrypoints using KHR_DAC")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40387>
2026-05-07 15:49:19 +00:00
Samuel Pitoiset
8a1c9a614f vulkan: stop forcing independent sets for shader object
VK_KHR_maintenance11 added a new flag for ESO, forcing it shouldn't
be required anymore.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41377>
2026-05-06 10:43:56 +00:00
Samuel Pitoiset
9764225ff1 vulkan: replace VK_SHADER_CREATE_INDEPENDENT_SETS_BIT_MESA with the maint11 flag
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41377>
2026-05-06 10:43:56 +00:00
Lionel Landwerlin
c6dc2df9e5 vulkan: add pipeline helper to retrieve scratch-size/ray-queries
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31384>
2026-05-06 09:49:45 +00:00
Konstantin Seurer
c432ffc5ce vulkan: Implement 64-bit morton codes
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41300>
2026-05-04 20:42:50 +00:00
Konstantin Seurer
74e21c2c59 vulkan: Rename key_id_pair to key32_id_pair
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41300>
2026-05-04 20:42:49 +00:00
Konstantin Seurer
04463fe91e vulkan: Rename radix_sort to radix_sort_u64
Preparation for optionally building with 96bit radix sort.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41300>
2026-05-04 20:42:49 +00:00
Konstantin Seurer
a1c2b96cd1 vulkan/radix_sort: Add support for 96-bit keys
64-bit morton codes are required for decent lbvh tlas builds since the
scene bounds are usually much bigger than the area that is actually
important.

The changes were done without understanding the code but they seem to
work.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41300>
2026-05-04 20:42:49 +00:00
Connor Abbott
7171c3dd71 tu: Optimize sync2 event handling in the non-asymmetric case
Before we were falling back to always emitting a pipeline barrier, which
effectively kills any point of having the event. But with sync2 and the
guarantee that src/dst dependency infos match, we can instead emit the
flushes before writing the event and actually use the event as intended.
As a bonus, this also allows the BV to run ahead of the BR.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40552>
2026-05-01 11:47:18 +00:00
Allen Ballway
b64cd520f7 vulkan/android: Set COLOR_ATTACHMENT_BIT for external format resolve
When using ANDROID_external_format_resolve if a valid
colorAttachmentFormat is returned by
VkAndroidHardwareBufferFormatResolvePropertiesAndroid, the
formatFeatures should include VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT so
strict applications can use the buffer as a render target.

Signed-off-by: Allen Ballway <ballway@chromium.org>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Lucas Fryzek <lfryzek@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41142>
2026-04-30 19:56:26 +00:00
Samuel Pitoiset
ce60e18bce vulkan: add missing VkMemoryRangeBarriersInfoKHR support
This has been introduced by VK_KHR_device_address_commands and we
missed it completely.

Backport-to: 26.1
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41198>
2026-04-28 16:39:26 +00:00
Jaishankar Rajendran
cd941d3970 vulkan/runtime: enable parametrization of ASTC software decode
Enable the driver to select :
  - LUT allocation alignment
  - LUT memory flags selection

Signed-off-by: Prakhar Vishwakarma <prakhar.vishwakarma@intel.com>
Signed-off-by: Jaishankar Rajendran <jaishankar.rajendran@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41205>
2026-04-27 15:17:04 +00:00
Valentine Burley
5fb560688b vulkan: Query memory requirements in vk_android_import_anb_memory
Based on 752ea7f6df ("panvk: resolve ANB (pre spec v8)").

Replace the hardcoded memoryTypeIndex 0 and lseek-based allocationSize
with proper GetImageMemoryRequirements and GetMemoryFdPropertiesKHR
queries.

Also fix a missing error check on os_dupfd_cloexec().

Signed-off-by: Valentine Burley <valentine.burley@collabora.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40635>
2026-04-23 21:21:31 +00:00
Valentine Burley
e0965d82b7 vulkan/android: Add vk_android_import_anb_memory helper
Extract the AllocateMemory/import-FD portion of vk_android_import_anb()
into vk_android_import_anb_memory(). This lets drivers with deferred
image creation import ANB memory without triggering BindImageMemory2.

Signed-off-by: Valentine Burley <valentine.burley@collabora.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40635>
2026-04-23 21:21:31 +00:00
Valentine Burley
013dee3b8f vulkan/android: Add deferred image helper
Add a new helper based on panvk's implementation added in
075d78115e ("panvk: implement deferred image creation").

vk_android_init_deferred_image  deep-copies and sanitizes a
VkImageCreateInfo chain for deferred Android native buffer (ANB)
alias image creation.

Signed-off-by: Valentine Burley <valentine.burley@collabora.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40635>
2026-04-23 21:21:31 +00:00
Lionel Landwerlin
a4737d0430 vulkan: add tracking for VK_EXT_primitive_restart_index
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40776>
2026-04-22 08:52:57 +00:00
Samuel Pitoiset
9d17a7bdb4 spirv,treewide: rework specialization constant
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
With SPV_KHR_constant_data, it's allowed to specialize array of
constants.

RustiCL changes are from Karol Herbst <kherbst@redhat.com>.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41046>
2026-04-22 06:57:55 +00:00
Samuel Pitoiset
ebf2797da2 vulkan,treewide: stop passing vk_device to vk_pipeline_robustness_state_fill()
This will be helpful for RADV.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41029>
2026-04-21 17:29:04 +00:00
Samuel Pitoiset
b7a8b09b21 vulkan: pre-compute the default robustness state in the device
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41029>
2026-04-21 17:29:04 +00:00
Samuel Pitoiset
5828ebeb70 vulkan: refactor vk_pipeline_robustness_state_fill() slightly
Overwrite the default device state only when requested.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41029>
2026-04-21 17:29:04 +00:00
Stéphane Cerveau
242130fde5 vulkan/video: Reject interlaced picture layout for H.264 baseline profile
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
The H.264 baseline profile does not support interlaced content. Return
VK_ERROR_VIDEO_PICTURE_LAYOUT_NOT_SUPPORTED_KHR when a non-progressive
picture layout is requested with a baseline profile.

Reviewed-by: Hyunjun Ko <zzoon@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40942>
2026-04-17 14:16:13 +00:00
Samuel Pitoiset
8e2869fa41 vulkan: add an option to lower SHADER_RECORD_INDEX to non-uniform
Applications are required to set NonUniform if the resource is arrayed,
but with VK_DESCRIPTOR_MAPPING_SOURCE_HEAP_WITH_SHADER_RECORD_INDEX_EXT,
the resource is non-arrayed in the shader. So, it's technically not
required to set it. Although, the offset can vary per-lane and
NonUniform is implicit.

Backport-to: 26.1
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40953>
2026-04-16 08:21:28 +02:00
Samuel Pitoiset
1950b6c1a7 vulkan: mark RP attachments as invalid when no rendering create info
VkPipelineRenderingCreateInfo is only required in the fragment output
interface lib. For pre-rasterization shaders and fragment shader state
libs, only the view mask is used but it's optional.

If the attachments info isn't marked invalid merging renderpass info
during lib imports wouldn't work because it would assume that the first
lib has attachment info (eg. the pre-rasterization lib).

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/work_items/15241
Cc: mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40870>
2026-04-13 21:01:43 +00:00
Mike Blumenkrantz
4b3bd6b0b5 vulkan/runtime: handle null pCounterBuffers with xfb binds
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
this is legal

cc: mesa-stable

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40892>
2026-04-13 14:59:55 +00:00
Konstantin Seurer
01156c0697 vulkan: Init all update scratch at once
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Reviewed-by: Natalie Vock <natalie.vock@gmx.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39752>
2026-04-11 13:04:39 +00:00
Konstantin Seurer
411e23d389 vulkan: Remove bvh_state
This will allow passing the whole array to the driver.

Reviewed-by: Natalie Vock <natalie.vock@gmx.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39752>
2026-04-11 13:04:39 +00:00
Konstantin Seurer
50b1becdde vulkan: move internal_node_count to vk_acceleration_structure_build_state
Reviewed-by: Natalie Vock <natalie.vock@gmx.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39752>
2026-04-11 13:04:38 +00:00
Konstantin Seurer
63daa4e731 vulkan: Request less scratch space for lbvh
It is fine if prior passes write to the region so the memory can be
reused.

Reviewed-by: Natalie Vock <natalie.vock@gmx.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39752>
2026-04-11 13:04:38 +00:00
Konstantin Seurer
4ab113b7eb vulkan: Add helper for dispatching BVH build stages
The number of flag combination grows exponentially.

Reviewed-by: Natalie Vock <natalie.vock@gmx.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39752>
2026-04-11 13:04:38 +00:00
Samuel Pitoiset
78a1e44e97 vulkan: stop emitting global_addr_to_descriptor
This is unnecessary because it's BDA, so making a descriptor from it
doesn't make sense.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40826>
2026-04-08 09:46:01 +00:00
Samuel Pitoiset
d2b9ccf20b vulkan: adjust lowering of descriptor heaps
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40768>
2026-04-07 18:55:49 +00:00
Mauro Rossi
1f6f978323 vulkan/runtime: Fix gnu-empty-initializer error in vk_shader.c
Fixes the following building error happening with clang:

FAILED: src/vulkan/runtime/libvulkan_runtime.a.p/vk_shader.c.o
...
../src/vulkan/runtime/vk_shader.c:622:63: error: use of GNU empty initializer extension [-Werror,-Wgnu-empty-initializer]
            struct vk_sampler_state_array embedded_samplers = {};
                                                              ^
1 error generated.

Fixes: e8558de1 ("vulkan/shader: Call vk_nir_lower_descriptor_heaps()")
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40772>
2026-04-04 19:33:33 +00:00
Samuel Pitoiset
61c85c8d31 vulkan: fix determining the heap ptr
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40729>
2026-04-01 12:56:43 +00:00
Samuel Pitoiset
521b1c9584 vulkan: remove unused parameters in vk_build_descriptor_heap_address()
Also make it static.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40729>
2026-04-01 12:56:43 +00:00
Lionel Landwerlin
0b1c23103e vulkan/runtime: convert descriptor heap pipeline flag to shader flag
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40729>
2026-04-01 12:56:43 +00:00
Samuel Pitoiset
79e71f5851 vulkan: add DGC support with descriptor heap
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40657>
2026-03-31 10:10:17 +00:00
Samuel Pitoiset
c4e3380187 nir,treewide: add nir_image_intrinsic_type
We have 4 image intrinsic variants now. This enum is useful for
nir_rewrite_image_intrinsic() and it will be used by other NIR passes.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40709>
2026-03-31 09:10:27 +00:00
Faith Ekstrand
d17c79387b vulkan: Add a no-op implementation of [Un]RegisterCustomBorderColor()
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40649>
2026-03-30 06:51:26 +00:00
Faith Ekstrand
191d2b37de vulkan: Add a common implementation of GetPhysicalDeviceDescriptorSizeKHR
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40649>
2026-03-30 06:51:26 +00:00
Faith Ekstrand
2c444c17db vulkan/pipeline: Call vk_nir_lower_descriptor_heaps()
As with vk_shader_object, vk_nir_lower_descriptor_heaps() is called
right after the driver preprocess step.  The resulting mapping and
embedded samplers are then baked into the pre-compile shader.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40649>
2026-03-30 06:51:26 +00:00
Faith Ekstrand
80706130c7 vulkan/pipeline: Reorder vk_pipeline_precomp_shader_deserialize()
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40649>
2026-03-30 06:51:26 +00:00
Faith Ekstrand
978b9f6495 vulkan: Add a vk_hash_descriptor_heap_mappings() helper
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40649>
2026-03-30 06:51:26 +00:00
Faith Ekstrand
e8558de16f vulkan/shader: Call vk_nir_lower_descriptor_heaps()
Embedded samplers (if present) are passed to the driver as part of the
vk_shader_compile_info

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40649>
2026-03-30 06:51:26 +00:00
Faith Ekstrand
f41dd1d157 vulkan/pipeline: Allow compiling compute/rt pipelines with a NULL layout
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40649>
2026-03-30 06:51:26 +00:00
Faith Ekstrand
f0c1b3fe32 vulkan: Support descriptor heaps in vk_nir_convert_ycbcr()
The original version of the pass relied on derefs and passing bindings
and indices to drivers through the callback.  While this works, it's
much more convenient with heaps to just take an index into the embedded
descriptor table.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40649>
2026-03-30 06:51:26 +00:00
Faith Ekstrand
20d11c59a4 vulkan: Add a lowering pass for descriptor heap mappings
Lowers all mappings and embedded samplers to descriptor heaps without
mappings.  This was based on a pass written by Konstantin Seurer and
Mike Blumenkrantz but was basically entirely rewritten and uses
different NIR intrinsics.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40649>
2026-03-30 06:51:26 +00:00
Samuel Pitoiset
f88506172f vulkan/runtime: handle custom border color index with samplers
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40649>
2026-03-30 06:51:26 +00:00
Faith Ekstrand
b42b7c8f60 spirv,vulkan: Implement OpConstantSizeOfKHR
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40649>
2026-03-30 06:51:24 +00:00
Natalie Vock
e713527aa9 vulkan: Bump MAX_ENCODE_PASSES
RADV needs one more encode pass for a bugfix in the next commit.

Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39985>
2026-03-28 16:12:09 +01:00
Natalie Vock
6f80027447 vulkan: Rename {encode,update}_bind_pipeline to {encode,update}_prepare
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39985>
2026-03-28 16:12:09 +01:00