Dylan Baker
f03da01fe3
meson/vulkan: fix linkage on windows
...
The current approach likley breaks icl and clang-cl, but it seems that
the problem isn't even really related to MSVC, but to Meson's Visual
Studio backend, as such, let's use link-whole unless we're using a
Visual Studio backend.
Fixes: 48d31a6280
("meson: link vulkan_util with link_whole on mingw")
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Acked-by: James Park <jpark37@lagfreegames.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10506 >
2021-04-30 18:49:20 +00:00
Rhys Perry
32ebbd8c23
vulkan: fix use-after-free in vk_common_DestroyDebugReportCallbackEXT
...
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com >
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Fixes: bd1705a480 ("vulkan: Make vk_debug_report_callback derive from vk_object_base")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10433 >
2021-04-29 14:06:49 +00:00
Michel Zou
48d31a6280
meson: link vulkan_util with link_whole on mingw
...
It was missing for mingw.
Closes #4633
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Acked-by: James Park <jpark37@lagfreegames.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10276 >
2021-04-19 22:46:30 +00:00
Lionel Landwerlin
f90d625841
vulkan/util: cast enums to int64_t in switch
...
With the new Vulkan Video extensions a bunch of enum values have been
added. The problem is that those are behind #ifdef so our generated
code complains that we using enum values not defined.
Since we're not using enum names but integer values, we can silence
all those by casting the enum type to int64_t.
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10304 >
2021-04-19 06:14:11 +00:00
James Park
d32512effc
vulkan/util: Use util_bitcount
...
__builtin_popcount is not available on all compilers.
Reviewed-by: Alyssa Rosenzweig <alyssa@collabora.com >
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10159 >
2021-04-12 03:25:59 +00:00
Jason Ekstrand
22478bb0e4
vulkan: Add a vk_object_multialloc helper
...
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10123 >
2021-04-10 02:18:02 +00:00
Chad Versace
5e6db19168
anv: Remove vkCreateDmaBufINTEL (v4)
...
Superceded by VK_EXT_image_drm_format_modifier.
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com > (v1)
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net > (v4)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/1466 >
2021-04-08 14:15:55 +00:00
Chad Versace
0845cabc72
vulkan: Track dependencies of Python imports
...
The meson.build was unaware of transitive dependencies introduced by
Python imports.
Android still needs fixing. But I did not update the Android files lest
I break the build.
Ideally, we would fix this by using a Python runner that generates
a depfile, similar to how meson creates depfiles for C files by passing
flags -MD -MQ -MF to gcc. But this patch gets the job done, without
stalling on the ideal general solution, by manually tracking the Python
imports in new 'foo_depend_files' variables.
CC: mesa-stable@lists.freedesktop.org
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/1466 >
2021-04-08 14:15:54 +00:00
Mauro Rossi
1b3a0f8829
vulkan/util: Fix implicit declaration of ffs for Android build
...
Similar to 641320ce02 and 68bb26af63 to avoid Android build errors
Fixes the following building error:
In file included from external/mesa/src/vulkan/util/vk_util.c:28:
external/mesa/src/vulkan/util/vk_util.h:248:30: error: implicit declaration of function 'ffs' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
return (gl_shader_stage) (ffs((uint32_t) vk_stage) - 1);
^
1 error generated.
Fixes: 06ebbde630 ("vulkan: Deduplicate mesa stage conversion")
Acked-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10023 >
2021-04-04 17:04:04 +02:00
Alyssa Rosenzweig
06ebbde630
vulkan: Deduplicate mesa stage conversion
...
Across every driver...
v2: Add casts to appease -fpermissive used on CI.
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com >
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9477 >
2021-04-03 17:34:39 +00:00
Bas Nieuwenhuizen
83c92a48b7
vulkan: Fix descriptor set creation with zero bindings.
...
MAX2(count * struct size, 1) results in 1 for count=0, not the size of a struct.
Since this MAX only seems to exist so we can keep using NULL for error reporting,
just refactor to return a VkResult.
Fixes: ad241b15a9 ("vk: consolidate dynamic descriptor binding sorting")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4522
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com >
Acked-by: Dave Airlie <airlied@redhat.com >
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9880 >
2021-03-29 23:32:50 +00:00
Samuel Pitoiset
0ce6b625a2
vulkan: add common entrypoints for VK_KHR_create_renderpass2
...
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9601 >
2021-03-24 11:21:53 +00:00
Mike Blumenkrantz
ad241b15a9
vk: consolidate dynamic descriptor binding sorting
...
this code was duplicated across several drivers
Reviewed-by: Adam Jackson <ajax@redhat.com >
turnip changes Reviewed-by: Hyunjun Ko <zzoon@igalia.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9480 >
2021-03-22 16:51:55 +00:00
Iago Toral Quiroga
1e4abf1fe3
vulkan/util: call glsl_type_singleton_init_or_ref from vk_instance_init
...
v2: link libvulkan_util with libglsl so it can find the glsl singleton symbols.
v3: link with libcompiler instead of libglsl (Jason)
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Reviewed-by: Dylan Baker <dylan.c.baker@intel.com >
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com > for the v3dv bits.
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com > for the turnip bits.
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com > for the radv bits.
Acked-by: Dave Airlie <airlied@redhat.com > for the lvp bits.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9457 >
2021-03-17 08:15:36 +01:00
Mike Blumenkrantz
a41e98ddca
vk/util: add a util macro for initializing stack vk_shader_module structs
...
radv does a lot of this, so having a central dispatch point will be useful in
case changes are made to this struct in the future
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9508 >
2021-03-15 21:47:44 +00:00
Mike Blumenkrantz
76078ed9fe
vk/util: add unified shader module struct/functions
...
there's some extra logging stuff dumped into here to match functionality,
eventually that should also be consolidated into vk_util.c
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9508 >
2021-03-15 21:47:44 +00:00
Michel Zou
862671369d
vulkan: fix CreateRenderPass prototype
...
Fixes compilation on win32
Fixes: 2523c477 " turnip: Move the CreateRenderPass wrapper..."
Reviewed-by: Dave Airlie <airlied@redhat.com >
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9530 >
2021-03-12 17:37:38 +00:00
Jason Ekstrand
e7e297732e
vulkan/alloc: Use char * for pointer arithmetic
...
MSVC doesn't like arithmetic on void *.
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9511 >
2021-03-10 20:59:59 -06:00
Jason Ekstrand
492b5577f0
vulkan/util: Add a type parameter to vk_multialloc_add
...
We also switch from using __alignof__ to alignof() in util/macros.h
which works on MSVC with the one unfortunate downside of requiring an
actual type and not a value.
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9511 >
2021-03-10 20:59:56 -06:00
Jason Ekstrand
c120edd8e8
vulkan/alloc: Add VK_MULTIALLOC_DECL macros
...
These both declare the variable and add it to the allocator in one go.
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9511 >
2021-03-10 20:59:55 -06:00
Jason Ekstrand
5afdbfe0c8
vk/alloc: Handle zero sizes better in vk_multialloc_add
...
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9511 >
2021-03-10 20:59:53 -06:00
Jason Ekstrand
c22267262e
vulkan: Use ALWAYS_INLINE for multialloc
...
This way it properly compiles on Visual Studio.
Fixes: 145444d265 "anv: Move multialloc to common code"
Acked-by: Daniel Stone <daniels@collabora.com >
Acked-by: Rob Clark <robdclark@chromium.org >
Reviewed-by: Eric Anholt <eric@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9506 >
2021-03-10 23:15:17 +00:00
Jason Ekstrand
b302159b1c
vulkan: Preserve preserve attachments in CreateRenderPass
...
This is trivial so I really don't know why it wasn't handled in the
initial turnip code.
Reviewed-by: Eric Anholt <eric@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8857 >
2021-03-10 18:17:31 +00:00
Jason Ekstrand
147187f754
vulkan: Add some asserts and checks for multiview in CreateRenderPass
...
Reviewed-by: Eric Anholt <eric@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8857 >
2021-03-10 18:17:31 +00:00
Jason Ekstrand
5de355b0f9
vulkan: Use correct aspectMask in CreateRenderPass
...
If a VkRenderPassInputAttachmentAspectCreateInfo is provided, we use the
aspects specified there. Otherwise, we default to every aspect in the
format. For attachments which are not input attachments, aspectMask is
left zero.
Reviewed-by: Eric Anholt <eric@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8857 >
2021-03-10 18:17:31 +00:00
Jason Ekstrand
4fb6c051c9
anv: Move vk_format helpers to common code
...
The Android ones we put in anv_android.c. Maybe one day we'll want a
vk_android.h to put some common Android stuff but, for now, let's keep
it contained to ANV's android code.
Reviewed-by: Eric Anholt <eric@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8857 >
2021-03-10 18:17:31 +00:00
Jason Ekstrand
c7345bd1fb
vulkan: Use VK_MULTIALLOC in CreateRenderPass
...
The variable-length stack allocations are causing issues with ubsan when
the array size is zero. Also, a heap allocation is probably safer.
Reviewed-by: Eric Anholt <eric@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8857 >
2021-03-10 18:17:31 +00:00
Jason Ekstrand
145444d265
anv: Move multialloc to common code
...
Reviewed-by: Eric Anholt <eric@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8857 >
2021-03-10 18:17:31 +00:00
Jason Ekstrand
2523c47720
turnip: Move the CreateRenderPass wrapper to common code
...
Reviewed-by: Eric Anholt <eric@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8857 >
2021-03-10 18:17:31 +00:00
James Park
98c622a96e
vulkan: Update dispatch table gen for Windows
...
Update entry null test to deal with MSVC not supporting weak functions.
Also fix warnings for returning from void functions.
Acked-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9121 >
2021-02-26 04:29:52 +10:00
James Park
10244fe76e
vulkan: Fix source list for vulkan_wsi on Windows
...
I don't think link_whole works right for VS project generation, but MSVC
doesn't support GCC weak functions anyway, so work around it.
Acked-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9121 >
2021-02-26 04:29:52 +10:00
Michel Zou
8af568e4ae
vulkan: implement wsi_win32 backend
...
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7208 >
2021-02-25 03:41:36 +00:00
James Park
9f30370654
vulkan: Use typed outarray API
...
MSVC cannot perform GCC __typeof__ for C code. (C++ has decltype.)
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Reviewed-by: Dave Airlie <airlied@redhat.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9208 >
2021-02-23 17:18:11 +10:00
Dave Airlie
5a340c0929
vulkan/util: add api to reset object magic + private data.
...
This will be used to for reissuing dispatchable objects like
command buffers.
Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9145 >
2021-02-22 09:32:13 +10:00
Michel Zou
6ccbb89207
meson: invalid keyword argument dependencies
...
Fixes: e4cc52c0 (vulkan: Add common extension tables)
Reviewed-by: Dylan Baker <dylan.c.baker@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8821 >
2021-02-16 11:35:32 +00:00
Lionel Landwerlin
3414d4fdc5
vulkan: document flags choice for vkGetDeviceQueue
...
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9053 >
2021-02-15 21:01:28 +02:00
Michel Zou
664a803879
vulkan: Fix windows api conflict
...
It must be undefined in the header too
Fixes: e487ae1b
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8975 >
2021-02-11 17:56:27 +00:00
Michel Zou
e487ae1b99
vulkan: Fix windows api conflict
...
Closes #4247
Acked-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8956 >
2021-02-10 17:10:50 +00:00
Michel Zou
2ef3dca476
vulkan/lavapipe: add missing VKAPI_ATTR/CALL
...
Acked-by: Jose Fonseca <jfonsec@vmware.com >
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8823 >
2021-02-09 19:21:03 +00:00
Jason Ekstrand
2d6de5d227
anv,vulkan: Move anv_icd.py to a common location
...
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl >
Tested-by: Tapani Pälli <tapani.palli@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8792 >
2021-02-04 20:02:12 +00:00
Jason Ekstrand
cf54fc768e
vulkan: Rework extension disabling on Android
...
Instead of building it into the auto-generated condition we use for the
per-driver ${driver}_physical_device_get_supported_extensions()
function, generate a table and handle it inside the various common
extension enumeration and verification routines. This reduces our
reliance on code-gen for extension enables.
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl >
Tested-by: Tapani Pälli <tapani.palli@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8792 >
2021-02-04 20:02:12 +00:00
Jason Ekstrand
0260b4a7e7
vulkan: Add a common helper for enumerating instance extension properties
...
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl >
Tested-by: Tapani Pälli <tapani.palli@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8792 >
2021-02-04 20:02:12 +00:00
Jason Ekstrand
f2545f22f4
vulkan: Drop the type_prefix parameter from gen_extensions
...
Now that all the drivers are converted, it's set to 'vk' by everyone so
there's no point in having the parameter.
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl >
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8676 >
2021-02-01 18:54:25 +00:00
Jason Ekstrand
bafd0c680d
vulkan: Rework vk_device_init and friends
...
Now that all drivers are converted over, we can make a few changes.
First off, vk_device_init no longer takes two separate allocators
because we can assume that the parent instance is non-null and it can
pull the instance allocator from that. Second, dispatch tables and the
instance extension table are no longer optional. We leave the device
extension table optional for now because we don't do any verification at
vk_init_physical_device time and some drivers find it more convenient to
set the extensions later in their own physical_device_init for various
reasons.
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl >
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8676 >
2021-02-01 18:54:25 +00:00
Jason Ekstrand
3a7514ea09
anv,radv: Use common entrypoints for VK_KHR_deferred_operation
...
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8676 >
2021-02-01 18:54:25 +00:00
Jason Ekstrand
23ba48a0c7
vulkan: Make the debug_report implementation internal
...
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8676 >
2021-02-01 18:54:25 +00:00
Jason Ekstrand
41318a5819
vulkan: Use vk_object_base::type for debug_report
...
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8676 >
2021-02-01 18:54:25 +00:00
Jason Ekstrand
bd1705a480
vulkan: Make vk_debug_report_callback derive from vk_object_base
...
Fixes: 51c6bc13ce "anv,vulkan: Implement VK_EXT_private_data"
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8676 >
2021-02-01 18:54:25 +00:00
Jason Ekstrand
3a8060271c
turnip: Drop some legacy wrappers in favor of common code
...
Acked-by: Jonathan Marek <jonathan@marek.ca >
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8676 >
2021-02-01 18:54:24 +00:00
Jason Ekstrand
eef79aab1c
vulkan: Add a truly common VK_EXT_debug_report implementation
...
Now that we've got a common vk_instance, we can put the debug_report
stuff there and make it truly common. For drivers to use this
implementation, they need to delete their own vk_debug_report_instance
and make sure everything references the common one.
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8676 >
2021-02-01 18:54:24 +00:00