Commit graph

2591 commits

Author SHA1 Message Date
Lionel Landwerlin
bfb752c6a3 vulkan/wsi: write VkImageCompressionControlEXT from swapchain to image creation
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40429>
2026-05-08 13:24:28 +03:00
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
Emma Anholt
5674327297 screenshot-layer: Wait on the fence before fallible operations.
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
We want to be sure that the fence isn't destroyed before we've waited on
it, so do that before the fallible fs/png operations.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41299>
2026-05-06 01:10:04 +00:00
Emma Anholt
25b2865146 screenshot-layer: Fix race on writing the .pngs vs device destroy.
The writePNG thread function accessed the VkDevice, but the layer had no
joining of the thread on device destroy.  Instead of rolling our own job
queue for the writePNG job, reuse u_queue, which handles all the hard
stuff for us.

Assisted-by: Claude Opus 4.6
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41299>
2026-05-06 01:10:04 +00:00
Emma Anholt
3512886aa7 screenshot-layer: Clean up the lifetime management of the copyDone fence.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41299>
2026-05-06 01:10:04 +00:00
Emma Anholt
0fc106823c screenshot-layer: Fix rename() to final png before the file is flushed.
If the app exited before the thread was finished, then we might get an
incomplete png at the final filename.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41299>
2026-05-06 01:10:04 +00:00
Emma Anholt
a2f4977e7f screenshot-layer: Fix a bunch of unused variable warnings.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41299>
2026-05-06 01:10:04 +00:00
Emma Anholt
25723e3a37 screenshot-layer: Fix leftover VK queues in the map at DeviceDestroy.
Noticed when the compiler said device_destroy_queues() was unused.

Fixes: 111faf2158 ("vulkan/screenshot-layer: Correct queueFamilyIndex source")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41299>
2026-05-06 01:10:04 +00:00
Vinson Lee
4c46cd8e9d vulkan/screenshot-layer: initialize info to NULL
Initialize 'info' to NULL to avoid use of potentially uninitialized
value at the cleanup label when an earlier error causes a goto before
png_create_info_struct() is reached.

screenshot.cpp:808:9: warning: variable 'info' is used uninitialized whenever 'if'
condition is true [-Wsometimes-uninitialized]
screenshot.cpp:814:9: warning: variable 'info' is used uninitialized whenever 'if'
condition is true [-Wsometimes-uninitialized]

Fixes: eda55c7c2f ("vulkan/screenshot-layer: Add Vulkan screenshot layer")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Casey Bowman <casey.g.bowman@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41325>
2026-05-06 00:39:35 +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
Mike Blumenkrantz
7a56d8112f vulkan: update spec to 1.4.350
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41317>
2026-05-04 19:11:49 +00:00
Mike Blumenkrantz
95954b0981 vk/cmd_queue: always ceil() param lens
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
this avoids rounding errors with pSampleMask for 64bit masks

cc: mesa-stable

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41312>
2026-05-01 22:38:22 +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
Lionel Landwerlin
d595529475 imgui: update copy and port all tools using it
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Felix DeGrood <felix.j.degrood@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41244>
2026-04-30 10:59:45 +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
Christian Gmeiner
9f172ba4da util/format, vulkan: Add PIPE_FORMAT_X6R10X6G10X6B10X6A10_UNORM
The format has 4 x 16-bit words with 10-bit unorm values in bits [15:6]
and 6 padding bits in [5:0]. Since this requires 8 channel slots but the
format system only supports 4, use layout "other" with hand-written
pack/unpack conversion functions.

Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40653>
2026-04-15 12:16:53 +00: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
Yuxuan Shui
4200ab60ff wsi/display: move set atomic cap out of wsi_display_get_connector
In all other cases, we immediately set atomic cap after acquiring a drm
fd:

- wsi_init
- AcquireXlib
- AcquireDrm

wsi_GetDrmDisplayEXT is the only function left where the atomic cap is
set by wsi_display_get_connector. This commit moves the set atomic cap
into wsi_GetDrmDisplayEXT.

Signed-off-by: Yuxuan Shui <yshui@codeweavers.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39166>
2026-04-10 20:29:06 +00:00
Yuxuan Shui
37a1986691 wsi/display: initialize Xlib display connector property IDs in all cases
Usually connector property IDs are acquired in
wsi_display_get_connector, which is called by wsi_get_connectors, and in
turn by vkGetPhysicalDeviceDisplayProperties2KHR and
vkGetPhysicalDeviceDisplayPlanePropertiesKHR. Except if the drm fd is
not available when these functions are called. Which will be the case if
vkAcquireXlibDisplayEXT is not called first.

So it goes like this. First, the display is created in
vkGetRandROutputDisplayEXT. Then it's used in
vkGetPhysicalDeviceDisplayPlanePropertiesKHR, but since the drm fd is
not available at this point, connector property IDs are not initialized.
Later, this display is used in vkAcquireXlibDisplayEXT, which also
doesn't touch the property IDs. Finally in drm_atomic_commit, the
atomic commit fails with EINVAL, specifically because of the
uninitialized ID of the "CRTC_ID" property. Since it's one of the
properties drm_atomic_commit tries to set.

This commit makes sure that find_connector_properties is called in
vkAcquireXlibDisplayEXT to initialize the property IDs.

Fixes: 513ffea1d3 ("wsi/display: use atomic mode setting")
Signed-off-by: Yuxuan Shui <yshui@codeweavers.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39166>
2026-04-10 20:29:05 +00:00
Yuxuan Shui
1e53a7f052 wsi/display: add connectors to connectors list during allocation
All callsites of wsi_display_alloc_connector already do that.

Signed-off-by: Yuxuan Shui <yshui@codeweavers.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39166>
2026-04-10 20:29:05 +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
eff4c00112 vulkan: update spec to 1.4.348
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40774>
2026-04-03 16:03:02 +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