Commit graph

480 commits

Author SHA1 Message Date
Romaric Jodin
c8b10b4512 meson: add vk_enum_defines.h to idep_vulkan_util_headers
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Adding vk_enum_defines.h to idep_vulkan_util_headers to help
ninja-to-soong generate correct rules for the Android build system.

Without it, ninja-to-soong is not able to figure out that this file is
needed by targets depending on idep_vulkan_util_headers, leading to
build errors with the file missing.

Ref #14072

Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37789>
2025-10-09 14:47:11 +00:00
Romaric Jodin
cb86341829 meson: remove '--outdir' argument in script
Usage of '--outdir' argument in python scripts makes it very
complicated for tools like ninja-to-soong to generate the Android
equivalent build file.
This is because the option is less clear on what will be generated.

Instead, change it for '--out' where we give the full path of the file
to generate. This has the good point of deduplicating the locations of
the file name to have it only in 'meson.build'.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37741>
2025-10-08 20:51:20 +00:00
Konstantin Seurer
dca33aa0a0 vulkan/vk_cmd_queue: Clone VkSampleLocationsInfoEXT extending VkRenderingInfo
This is used by the renderpass implementation but the Vulkan spec does
not say that VkSampleLocationsInfoEXT can extend VkRenderingInfo.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37603>
2025-09-30 01:13:29 +00:00
Konstantin Seurer
9094b404d5 vulkan/cmd_queue: Handle struct arrays with pNext
Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37416>
2025-09-26 17:27:32 +00:00
Konstantin Seurer
c76da351b0 vulkan/cmd_queue: Handle internal structs
Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37416>
2025-09-26 17:27:32 +00:00
Konstantin Seurer
b02ef48e9d vulkan/cmd_queue: Remove unused variable
Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37416>
2025-09-26 17:27:31 +00:00
Yiwei Zhang
2ea551e85a vulkan/util: drop workaround for ANB struct
VkPhysicalDevicePresentationPropertiesANDROID now properly extends
VkPhysicalDeviceProperties2.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37590>
2025-09-26 14:02:53 +00:00
Frank Binns
692893705f pvr: support VK_FORMAT_R8G8_SSCALED for vertex attribs
Signed-off-by: Frank Binns <frank.binns@imgtec.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36412>
2025-09-16 18:26:31 +00:00
David Rosca
a758273231 vulkan/format: Map VK_EXT_ycbcr_2plane_444_formats to pipe format
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37174>
2025-09-08 11:59:36 +00:00
Karol Herbst
083a3dc545 util: move typed_memcpy into macros.h
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37135>
2025-09-05 20:01:00 +00:00
Olivia Lee
5faa62f91e vulkan/util: add vk_topology_to_mesa helper function
Something like this already exists in a few drivers, move it to common
code. This specific version was pulled from honeykrisp, which is the
only one that handles META_RECT_LIST_MESA.

Signed-off-by: Olivia Lee <olivia.lee@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37038>
2025-09-03 22:04:14 -07:00
Yiwei Zhang
ee7666e3df vulkan/util: drop unused vk_select_android_external_format
Acked-by: Connor Abbott <cwabbott0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37099>
2025-09-04 02:29:32 +00:00
Olivia Lee
564b6fd7f4 vulkan: move internal vulkan pseudo-extensions to a common file
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
This makes it easier to see what all of the assigned values are to check
for collisions, and allows using them in vulkan/util.

Signed-off-by: Olivia Lee <olivia.lee@collabora.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37045>
2025-09-01 03:50:12 +00:00
Yiwei Zhang
1abe0d38d1 vulkan/util: update common properties code gen to use platform guard
Similar to the prior feature code gen update. This one here also absorbs
the Android private ANB struct.

Reviewed-by: Lucas Fryzek <lfryzek@igalia.com>
Acked-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36702>
2025-08-12 18:12:50 +00:00
Yiwei Zhang
9999cd3967 vulkan/util: no need to hide ANB property itself behind Android
Property members are never going to use platform specific struct.
Getting rid of the guard around sharedImage propperty simplifies driver
side setting the prop.

Reviewed-by: Lucas Fryzek <lfryzek@igalia.com>
Acked-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36702>
2025-08-12 18:12:50 +00:00
Yiwei Zhang
567cff487c vulkan/util: add missing vulkan header
Unlike features, property members do need Vulkan header. Currently it
relies on the fact that vk_physical_device.h has included some other
headers that include vulkan.h before this.

Cc: mesa-stable
Reviewed-by: Lucas Fryzek <lfryzek@igalia.com>
Acked-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36702>
2025-08-12 18:12:50 +00:00
Lucas Fryzek
23d7c3fbd5 vulkan/util: update pd feature codegen to use platform guards
If a given physical device feature needs a platform specific define
guard, generate the appropriate one instead of just ignoring it.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36702>
2025-08-12 18:12:50 +00:00
llyyr
dbb779967c vulkan: Update enum_to_str conversion to handle AMDX enum names
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Without this, mesa fails to build with:
src/vulkan/util/vk_enum_to_str.c:684:14: error:
‘VK_COMPRESSED_TRIANGLE_FORMAT_AMDX_MAX_ENUM’ undeclared (first use in
this function); did you mean
‘VK_COMPRESSED_TRIANGLE_FORMAT_MAX_ENUM_AMDX’?

Fixes: c74ad9f142 ("vulkan: Update headers/xml for 1.4.325")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36693>
2025-08-09 01:24:10 +00:00
Caio Oliveira
c00b167d16 vulkan: Update enum_to_str conversion to handle ARM enum names
Next Vulkan update will have
VK_DATA_GRAPH_PIPELINE_PROPERTY_MAX_ENUM_ARM and similar names,
so apply the same rule for ARM prefix.

Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36681>
2025-08-08 22:41:14 +00:00
Qiang Yu
196569b1a4 all: rename gl_shader_stage to mesa_shader_stage
It's not only for GL, change to a generic name.

Use command:
  find . -type f -not -path '*/.git/*' -exec sed -i 's/\bgl_shader_stage\b/mesa_shader_stage/g' {} +

Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Acked-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36569>
2025-08-06 10:28:40 +08:00
Ernst Persson
2bdbc72d27 vulkan/util: Use str.removeprefix() from Python 3.9
Signed-off-by: Ernst Persson <ernstp@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36398>
2025-08-05 21:39:58 +00:00
Antonio Ospite
ddf2aa3a4d build: avoid redefining unreachable() which is standard in C23
In the C23 standard unreachable() is now a predefined function-like
macro in <stddef.h>

See https://android.googlesource.com/platform/bionic/+/HEAD/docs/c23.md#is-now-a-predefined-function_like-macro-in

And this causes build errors when building for C23:

-----------------------------------------------------------------------
In file included from ../src/util/log.h:30,
                 from ../src/util/log.c:30:
../src/util/macros.h:123:9: warning: "unreachable" redefined
  123 | #define unreachable(str)    \
      |         ^~~~~~~~~~~
In file included from ../src/util/macros.h:31:
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:456:9: note: this is the location of the previous definition
  456 | #define unreachable() (__builtin_unreachable ())
      |         ^~~~~~~~~~~
-----------------------------------------------------------------------

So don't redefine it with the same name, but use the name UNREACHABLE()
to also signify it's a macro.

Using a different name also makes sense because the behavior of the
macro was extending the one of __builtin_unreachable() anyway, and it
also had a different signature, accepting one argument, compared to the
standard unreachable() with no arguments.

This change improves the chances of building mesa with the C23 standard,
which for instance is the default in recent AOSP versions.

All the instances of the macro, including the definition, were updated
with the following command line:

  git grep -l '[^_]unreachable(' -- "src/**" | sort | uniq | \
  while read file; \
  do \
    sed -e 's/\([^_]\)unreachable(/\1UNREACHABLE(/g' -i "$file"; \
  done && \
  sed -e 's/#undef unreachable/#undef UNREACHABLE/g' -i src/intel/isl/isl_aux_info.c

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36437>
2025-07-31 17:49:42 +00:00
Konstantin Seurer
656acb96b0 vulkan/cmd_queue: Reorder memcpy in get_struct_copy
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Using the temporary variable for the memcpy makes sure they are always
used so the "(void)tmp_src123" can be removed.

Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36331>
2025-07-31 08:13:59 +00:00
Konstantin Seurer
d29f446aa3 vulkan/cmd_queue: Clean up generating copies
Using the builder makes it much easier to see what is happening and
fixes indentation in the process.

Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36331>
2025-07-31 08:13:58 +00:00
Konstantin Seurer
d824525a01 vulkan/cmd_queue: Recursively free struct members
Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36331>
2025-07-31 08:13:58 +00:00
Konstantin Seurer
ea7a2f9834 vulkan/cmd_queue: Improve struct free code indentation
It also cleans up the way the string is generated because using large templates was a mess.

Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36331>
2025-07-31 08:13:58 +00:00
Konstantin Seurer
c29db0965c vulkan/cmd_queue: Do not free if driver_free_cb is provided
Avoids crashes when the custom implementation allocates differently.

Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36331>
2025-07-31 08:13:58 +00:00
Mike Blumenkrantz
05cc38bb68 vulkan: silence typed_memcpy -Waddress warnings
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36413>
2025-07-28 17:31:54 +00:00
Mike Blumenkrantz
0f5c663513 vulkan/cmd_queue: don't null deref when freeing pNext
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36004>
2025-07-09 05:48:22 +00:00
Luigi Santivetti
0eb67508bd vulkan/util: add vk_realloc2
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: Luigi Santivetti <luigi.santivetti@imgtec.com>
Reviewed-by: Karmjit Mahil <karmjit.mahil@igalia.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35998>
2025-07-08 20:22:13 +00:00
Konstantin Seurer
975f1f3c4b vulkan/cmd_queue: Free pNext
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26282>
2025-07-07 23:05:11 +00:00
Konstantin Seurer
b52351c857 vulkan/cmd_queue: Fix indentation a bit
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26282>
2025-07-07 23:05:11 +00:00
Matt Turner
7d329d615a vulkan: Generate files with newline at end
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
These generator scripts use the `write` function that, unlike `print`,
doesn't print a trailing newline. So let's add one to the template.

Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35697>
2025-06-24 14:01:04 +00:00
Mel Henning
f7aa6ba906 vulkan: Specify library_arch in ICD files
This should help vk-icd-loader skip libraries of the wrong bit width.

Reviewed-by: Eric Engestrom <eric@igalia.com>
Acked-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Acked-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Acked-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35567>
2025-06-19 17:30:24 +00:00
Lionel Landwerlin
9c0ff88e8d vulkan: dump headers/registry to 1.4.317
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35382>
2025-06-06 14:38:17 +00:00
Erik Faye-Lund
a271b9a9a3 vulkan/format: map ASTC HDR formats
Because the ASTC HDR formats are extension formats, we need to convert
it manually in vk_format_to_pipe_format() instead of using the table.
Otherwise, the compiler tries to create a gigantic array and ends up
dying.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34828>
2025-06-06 06:40:59 +00:00
Mike Blumenkrantz
9082715ab0 vk/cmd_queue: generate copies for string struct members
this includes e.g., debug labels, which previously was garbage data

Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34534>
2025-04-30 15:01:35 +00:00
Mike Blumenkrantz
26cdd7ebd6 vk/cmd_queue: generate copies for struct-ptr members
this includes e.g., VkCommandBufferBeginInfo::pInheritanceInfo,
which previously was garbage data

Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34534>
2025-04-30 15:01:35 +00:00
Mike Blumenkrantz
a7edaaacce vk/cmd_queue: stop generating weird casts for free functions
these are unnecessary and error-prone

Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34534>
2025-04-30 15:01:35 +00:00
Mike Blumenkrantz
c3b6122cdf vk/cmd_queue: try to fix some indentation
still not perfect, but at least somewhat readable now

Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34534>
2025-04-30 15:01:35 +00:00
Lionel Landwerlin
294aa72449 vulkan: add helper for color/depth-stencil capable formats
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
Acked-by: Ivan Briano <ivan.briano@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31983>
2025-03-25 08:01:15 +00:00
Yiwei Zhang
04e9431f4f vulkan: update ALLOWED_ANDROID_VERSION for api level 35
Reviewed-by: Juston Li <justonli@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34030>
2025-03-14 18:39:07 +00:00
Yiwei Zhang
a0ea025314 vulkan: update ALLOWED_ANDROID_VERSION for api level 34
Reviewed-by: Juston Li <justonli@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34030>
2025-03-14 18:39:07 +00:00
Alyssa Rosenzweig
2a44266d57 vulkan: add helpers to work with executable statistics
this is a lot of boilerplate in each driver. add helpers for it instead. the
common framework will use these internally, but drivers that don't want the
framework for whatever reason could use these themselves too.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33814>
2025-03-05 20:50:17 +00:00
Alyssa Rosenzweig
e331efd4fe vulkan: add common VK_PRINT_STR/VK_COPY_STR macros
every vk driver wants these macros for executable statistics, so make them
common. there are two variants floating in-tree, a pure copy (radv) and a
formatted print (everyone else). we add both variants and then convert most
prints to copies where formatting isn't actually used. that has the benefit of
cleaning up trivial "%s" format strings in a bunch of places.

I didn't bother cleaning up the formatting in non-automatic-formatted drivers
because it's tedious and I'm planning to delete a lot of this driver code with
upcoming runtime work anyway. This is a step towards those runtime improvements.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
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/33826>
2025-03-01 20:27:26 +00:00
Yiwei Zhang
f3da8167d6 vulkan/util: clean up copy_property and fix for setter
For setters, e.g. vk_set_physical_device_properties_struct used by venus
to fill all props, the out array storage comes from the driver, so we'd
assign directly. This change also fixes the template indent and drops an
unused arg.

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33757>
2025-02-26 19:16:48 +00:00
Samuel Pitoiset
c58655b999 vulkan: filter duplicate pNext struct at device creation
Recently, Indiana Jones and The Great Circle messed up this by adding
duplicates and this was causing the game to crash at launch.

Of course, this was an application bug that VVL was also able to catch
but I think maybe Mesa should ignore those instead of failing to create
the logical device.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33705>
2025-02-25 16:55:03 +00:00
Matt Turner
06d8afff64 vulkan: Fix typos
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33556>
2025-02-15 17:43:44 +00:00
Konstantin Seurer
c387699c7b vulkan/cmd_queue: Add VK_CMD_TYPE_COUNT
Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31426>
2025-02-15 09:55:52 +00:00
Konstantin Seurer
5543272ceb vulkan/cmd_queue: Simplify freeing cmd_queue entries
Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31426>
2025-02-15 09:55:52 +00:00