Commit graph

1408 commits

Author SHA1 Message Date
Faith Ekstrand
978415e7a2 vulkan/meta: Use the new NIR texture helpers
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:04 +00:00
Faith Ekstrand
74e8be6545 vulkan/meta: Insert a geometry shader when needed
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:03 +00:00
Faith Ekstrand
1a94c55632 vulkan/meta: Add support for MSAA resolves
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:01 +00:00
Faith Ekstrand
57314fcdc6 vulkan/meta: Rename vk_meta_blit.c to vk_meta_blit_resolve.c
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:01 +00:00
Faith Ekstrand
d813fe50a4 vulkan/meta: Support writing stencil as iterative discard
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:01 +00:00
Faith Ekstrand
c184b54ef9 vulkan/meta: Break the guts of blit into a helper
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:01 +00:00
Faith Ekstrand
266a472b28 vulkan/meta: Add a helper for building texture ops
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:01 +00:00
Faith Ekstrand
996844f884 vulkan/meta: Bind whole LODs of 3D blit destinations
Instead of only binding the layers we need, bind the whole LOD.  In
particular, we now set a layer range of [0, 1] when creating the image
view but a layerCount of minify(depth, level) in VkRenderingInfo.  While
still a bit out of spec, this is more in line with how 3D image views
typically work for sampled and storage images and allows us to avoid
creating 2D images views which would require 2D_ARRAY_COMPATIBLE_BIT.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:01 +00:00
Faith Ekstrand
39958c9e9d vulkan: Add a helper for swizzling color values
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:01 +00:00
Faith Ekstrand
32f2317223 nvk: Use meta for doing blits with the 3D hardware
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:00 +00:00
Faith Ekstrand
cda469428d vulkan/meta: Implement vkCmdBlitImage()
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:00 +00:00
Faith Ekstrand
98867ad976 vulkan/meta: Fixes for clear
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:00 +00:00
Faith Ekstrand
edef53c337 vulkan/meta: Add a create_sampler helper
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:00 +00:00
Faith Ekstrand
c13c6d04d7 vulkan/meta: Add a helper for image view types
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:00 +00:00
Faith Ekstrand
ecf5c5c46d vulkan/meta: Add key types
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:00 +00:00
Mauro Rossi
4d02d9d796 vulkan/meta: fix gnu-empty-initializer build error
Fixes the following building error:

../src/vulkan/runtime/vk_meta_clear.c:213:42: error: use of GNU empty initializer extension [-Werror,-Wgnu-empty-initializer]
   struct vk_meta_clear_push_data push = { };
                                         ^
1 error generated.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:31:58 +00:00
Faith Ekstrand
90b94828dd vulkan/meta: Make stencil reference dynamic for clears
We call CmdSetStencilReference() but don't set it to dynamic in the
pipeline.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:31:57 +00:00
Faith Ekstrand
e1b12b49e6 vulkan: Allow scissors or viewports to be set without counts
This is unlikely but can happen if you have the following sequence:

 1. vkCmdSetScissors()
 2. No pipeline bind
 3. vkCmdClearImage() which causes a meta save
 4. Meta restore with vk_cmd_set_dynamic_graphics_state()

In that case, we don't have scissor counts but need to restore the
scissors set with `vkCmdSetScissors()` before the meta save.  We can
safely copy all of them, it's just more memory traffic than maybe we'd
like.  Fortunately, this can only happen at the start of a command
buffer and only with a fairly silly sequence of commands.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:31:57 +00:00
Faith Ekstrand
8cc9c91f67 vulkan/meta_clear: Populate VkRenderingInfo::renderArea
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:31:57 +00:00
Faith Ekstrand
b07e2a1049 vulkan/meta: Add implementations of Clear*Image
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:31:57 +00:00
Faith Ekstrand
6a25cba792 vulkan/meta: Implement start-of-rendering clears
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:31:57 +00:00
Faith Ekstrand
daa4485ecf vulkan/meta: Implement attachment clears
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:31:57 +00:00
Faith Ekstrand
514c10344e vulkan/meta: Add a concept of rect pipelines
Most hardware supports some sort of rectangle primitive.  This adds a
new VK_PRIMITIVE_TOPOLOGY_RECT_LIST_MESA which will be used by the vast
majority of (if not all) meta commands.  Drivers can key off of of this
to build pipelines differently and implement their own cmd_draw_rects
and cmd_draw_volume hooks or they can map it to TRIANGLE_LIST and use
the provided helpers.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:31:57 +00:00
Faith Ekstrand
8418d6c97a vulkan/meta: Add an object tracking list
This will let us create objects which get held onto by the command
buffer until it's reset or destroyed.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:31:57 +00:00
Faith Ekstrand
54366ea922 vulkan/meta: Add the start of a meta framework
For now, this just adds some basic object caching.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:31:57 +00:00
Faith Ekstrand
9359ff9c2d vulkan: Use VkBufferUsageFlags2 in vk_buffer
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24497>
2023-08-04 16:03:16 +00:00
Samuel Pitoiset
23082347bd vulkan/format: add VK_FORMAT_{A8_UNORM,A1B5G5R5_UNORM_PACK16}_KHR
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24365>
2023-08-04 13:55:11 +00:00
Samuel Pitoiset
fb8ba9d3b9 vulkan/runtime: add common implementation for GetImageSubresourceLayout()
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24365>
2023-08-04 13:55:11 +00:00
Lionel Landwerlin
3651eb0be8 vulkan/runtime: add a layered implementation of vkCmdBindIndexBuffer
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24365>
2023-08-04 13:55:11 +00:00
Samuel Pitoiset
db6ba033c1 vulkan: bump header register to 1.3.261
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24365>
2023-08-04 13:55:11 +00:00
Lionel Landwerlin
48b5353ac3 vulkan: skip non required extension structures
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24365>
2023-08-04 13:55:11 +00:00
Alyssa Rosenzweig
5fead24365 treewide: Drop is_ssa asserts
We only see SSA now.

Via Coccinelle patch:

    @@
    expression x;
    @@

    -assert(x.is_ssa);

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Acked-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24432>
2023-08-03 22:40:28 +00:00
Faith Ekstrand
f2930ec5dd vulkan: Add init/finish helpers for vk_query_pool
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24409>
2023-08-01 19:17:05 +00:00
Danylo Piliaiev
555a1a3be1 vulkan/nir: Add common helper to check if output is XFB
It was not taken into account that without Offset decoration
the output is not written into XFB.

Aside from eliminating more outputs this change prevents gl_PerVertex
builtins generated by glslang from being kept alive in case when XFB
is enabled. Keeping such outputs alive may upset a driver.

VUID-StandaloneSpirv-Offset-04716:
    "Only variables or block members in the output interface decorated
    with Offset can be captured for transform feedback, and those
    variables or block members must also be decorated with XfbBuffer
    and XfbStride, or inherit XfbBuffer and XfbStride decorations from
    a block containing them"

Additional info about glslang behavior could be found at:
 https://github.com/KhronosGroup/glslang/issues/1526

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24318>
2023-08-01 10:30:59 +02:00
Faith Ekstrand
8de38aded5 vulkan: Add a core vk_sampler struct
Unlike some other core structs, I didn't bother to copy the entire
VkSamplerCreateInfo into the sampler.  There isn't typcially a lot of
pre-processing we can or need to do here and we may as well keep the
struct small for now.  It does, however, handle most things involving
chain-in structs.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24335>
2023-07-31 17:01:42 +00:00
Faith Ekstrand
6ff0b430d5 vulkan/format: Add the remaining 1-plane YCbCr formats
Each of these are just themselves in a single plane.  This is copied
from the 8888 version, these are just the 10, 12, and 16-bit versions.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24335>
2023-07-31 17:01:41 +00:00
Faith Ekstrand
829b3c0106 vulkan: Add common vkCmdBegin/EndQuery wrappers
These are identical to the IndexedEXT versions with index == 0.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24335>
2023-07-31 17:01:41 +00:00
Faith Ekstrand
f7e5e2cc4f vulkan: Add a vk_query_pool base object
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24335>
2023-07-31 17:01:41 +00:00
Faith Ekstrand
25b1e349c6 vulkan: Add a more direct way to use a NIR shader
This follows the pipeline libraries method of including SPIR-V and lets
you provide the NIR shader without wrapping it in a VkShaderModule.

Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24335>
2023-07-31 17:01:41 +00:00
Faith Ekstrand
b083f44303 vulkan: Add a core vk_buffer_view struct
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24335>
2023-07-31 17:01:41 +00:00
Rebecca Mckeever
87109c3e1b vulkan/runtime: Add helper functions for VK_EXT_host_image_copy
Add helper functions vk_memory_to_image_copy_layout() and
vk_image_to_memory_copy_layout(), which will be useful in
VK_EXT_host_image_copy implementations.

vk_memory_to_image_copy_layout() is similar to
vk_image_buffer_copy_layout(), except the second parameter is
VkMemoryToImageCopyEXT instead of VkBufferImageCopy2.

vk_image_to_memory_copy_layout() is similar to
vk_image_buffer_copy_layout(), except the second parameter is
VkImageToMemoryCopyEXT instead of VkBufferImageCopy2.

Signed-off-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24290>
2023-07-25 23:34:02 +00:00
Lionel Landwerlin
1f3e320d15 vulkan: bump header register to 1.3.258
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Acked-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24279>
2023-07-21 16:36:26 +00:00
Alyssa Rosenzweig
31001c6184 vulkan: Add helpers for blend enum translation
Vulkan drivers that use nir_lower_blend need to translate Vulkan enums to the
common (non-Vulkan) versions used in nir_lower_blend. We don't need to duplicate
that boilerplate in every VK driver that uses nir_lower_blend, move panvk's
versions to common code so we can use them in agxv. I suspect powervr wants this
too.

It might be useful to also share the logic to translate vk_color_blend_state
to nir_lower_blend_options wholesale, but panvk wouldn't use it and agxv is
downstream so it wouldn't have any in-tree users. So I'll keep that part
vendored (for now). For now, let's share the easy win of the enum translation.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Italo Nicola <italonicola@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24076>
2023-07-13 21:03:32 +00:00
Mohamed Ahmed
c4c258e19e vulkan/util: Use ycbcr_info for multiplane helpers in vk_format.c
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Acked-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24096>
2023-07-12 21:39:41 +00:00
Mohamed Ahmed
d5b6edec0f vulkan/util: Support VK_EXT_ycbcr_2plane_444_formats color formats in vk_format.c
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Acked-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24096>
2023-07-12 21:39:41 +00:00
Mohamed Ahmed
c263e5307f vulkan/util: Support 10-bit and 12-bit color formats in ycbcr_info in vk_format.c
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Acked-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24096>
2023-07-12 21:39:41 +00:00
Daniel Schürmann
2efa5ad0f6 vulkan/pipeline_cache: add 'skip_disk_cache' option
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23909>
2023-07-11 07:36:53 +00:00
Erik Faye-Lund
b0bbd9c0d3 nir: do not needlessly rely on optimizations
We're going to do this rewrite once we get to nir_opt_algebraic anyway,
so let's save a little bit of needless work here.

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24004>
2023-07-10 16:06:40 +02:00
Alyssa Rosenzweig
b733fcb337 vulkan: Add vk_index_type_to_bytes helper
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24017>
2023-07-07 07:22:26 -04:00
Mike Blumenkrantz
1c29200a15 vk/wsi: add error logging for syncfile import/export failures
these are otherwise pretty obscure

Acked-by: Daniel Stone <daniels@collabora.com>

Reviewed-by: Joshua Ashton <joshua@froggi.es>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23835>
2023-07-06 14:17:02 +00:00