Eric Engestrom
96a79a5f3a
vk/util: simplify extensions gen code
...
Signed-off-by: Eric Engestrom <eric@igalia.com >
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17713 >
2022-07-22 15:56:28 +00:00
Eric Engestrom
e4199322ee
vk/util: handful of pythonic cleanups
...
No functional changes.
Signed-off-by: Eric Engestrom <eric@igalia.com >
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17713 >
2022-07-22 15:56:28 +00:00
Jason Ekstrand
a5952c362e
vulkan: Don't assert VkGraphicsPipelineLibraryCreateInfoEXT::Flags == 0
...
There are VUs that imply that this is a requirement but the CTS seems to
ignore it.
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17696 >
2022-07-22 02:36:17 +00:00
Jason Ekstrand
0415d66c97
vulkan: Input assembly and depth/stencil can also be fully dynamic
...
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17696 >
2022-07-22 02:36:17 +00:00
Jason Ekstrand
ceccbc01f5
vulkan: Fix pipeline libraries with dynamic-only VI or FSR state
...
When we initialize the graphics pipeline state, we skip VI and FSR state
if they're 100% dynamic. We need to do this if the current set of
dynamic things contains VI/FSR or if the set of dynamic state already in
the vk_graphics_pipeline_state has them dynamic. Look state->dynamic
after we've merged instead of just looking at the dynamic set from the
VkGraphicsPipelineCreateInfo we were passed.
Also, when we validate, we need to assume that VI and FSR exist or else
we'll assert if dynamic VI or FSR are set.
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17696 >
2022-07-22 02:36:17 +00:00
Jason Ekstrand
e5e828e91d
vulkan: Add a fully_dynamic_state_groups() helper
...
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17696 >
2022-07-22 02:36:17 +00:00
Jason Ekstrand
00269c09d6
vulkan: Depth/stencil isn't fragment output state but multisample is
...
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17696 >
2022-07-22 02:36:17 +00:00
Jason Ekstrand
cc84d4ca66
vulkan: Multisample state isn't always included in fragment shader state
...
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17696 >
2022-07-22 02:36:17 +00:00
Jason Ekstrand
50411bd786
vulkan: Record shader stages in vk_graphics_pipeline_state
...
Some of our asserts and other checks depend on the total set of stages,
not just the stages set in the current pCreateInfo. Recording the stage
mask lets us combine them in vk_graphics_pipeline_state_merge().
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17696 >
2022-07-22 02:36:17 +00:00
Jason Ekstrand
eb1f00aaac
vulkan: Allow up to 12 pointers in multialloc
...
vk_graphics_pipeline_state_init() may allocate up to 12 things so expand
vk_multialloc accordingly.
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17696 >
2022-07-22 02:36:17 +00:00
Jason Ekstrand
8e99a7f5e3
vulkan: Call gather_xfb_info in vk_spirv_to_nir
...
In particular, we now call it before running dead variables so we get
the XFB info even for things which are never written. This fixes a 102
Vulkan CTS tests on ANV and probably turnip as well.
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com >
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17644 >
2022-07-21 21:18:48 +00:00
Jason Ekstrand
bd93d6f693
vulkan/nir: Don't remove dead XFB outputs
...
Fixes: 21b405fbbc ("vulkan: Add a vk_shader_module_to_nir() helper")
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com >
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17644 >
2022-07-21 21:18:48 +00:00
Jason Ekstrand
87ab287436
vulkan: Call lower_clip_cull_distance_arrays in vk_spirv_to_nir
...
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com >
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com >
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17644 >
2022-07-21 21:18:48 +00:00
Mike Blumenkrantz
6139493ae3
vulkan/wsi: return VK_SUBOPTIMAL_KHR for sw/x11 on window resize
...
the other codepaths all end up checking geometry in one way or another
in order to validate the extents, so add a check here to do the same
fixes #6893
Reviewed-by: Adam Jackson <ajax@redhat.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17638 >
2022-07-20 21:37:02 +00:00
Mike Blumenkrantz
a884d1eb0e
vulkan/wsi: fix multiple acquires for sw without mit-shm
...
in this case, lying about having multiple images and then returning the
same image every time doesn't work, so use the busy flag
and return an available image when possible
Reviewed-by: Dave Airlie <airlied@redhat.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17590 >
2022-07-20 15:10:15 +00:00
Ricardo Garcia
4058984b63
vulkan: allow null descriptor set layouts in pipeline layouts
...
VK_NULL_HANDLE descriptor set layouts are allowed when creating pipeline
layouts without VK_PIPELINE_LAYOUT_CREATE_INDEPENDENT_SETS_BIT_EXT.
From VUID-VkPipelineLayoutCreateInfo-graphicsPipelineLibrary-06753:
> If graphicsPipelineLibrary is not enabled, elements of pSetLayouts
> must be valid VkDescriptorSetLayout objects
From VUID-VkPipelineLayoutCreateInfo-pSetLayouts-parameter:
> If setLayoutCount is not 0, pSetLayouts must be a valid pointer to an
> array of setLayoutCount valid or VK_NULL_HANDLE VkDescriptorSetLayout
> handles
Signed-off-by: Ricardo Garcia <rgarcia@igalia.com >
Acked-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com >
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17629 >
2022-07-20 10:59:56 +00:00
Jason Ekstrand
07f5f15963
vulkan/graphics_state: Improve the depth/stencil optimization code
...
We now disable stencil writes when the stencil test is disabled or when
both stencil write masks are zero.
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17564 >
2022-07-19 23:16:45 +00:00
Jason Ekstrand
3f19a60869
vulkan: Detect pNext chain loops in vk_foreach_struct() (v2)
...
This implements the "tortoise and the hare" algorithm for detecting
cycles in graphs. We use the caller's iterator as the hare and our own
internal copy as the tortoise. Conveniently, VkBaseOutStructure (and
VkBaseInStructure which is identical except the pointer type on pNext)
have a pointer we can use for the tortoise and an sType which we can use
for a counter to ensure we only increment the tortose every other loop
iteration.
There are more efficient algorithms than tortoise and hare but they
require allocating memory for something like a hash set of seen nodes.
Since this for debug purposes only, it's ok for it to be a bit
inefficient in the case where it hits the assert. In the usual case of
no loops, it's the same runtime efficiency as the unchecked version
except that it does a tiny bit of math and 50% more pointer chases.
Version 1 worked fine with clang and with GCC 12.1 with -O0 but not with
optimizations. See https://gitlab.freedesktop.org/mesa/mesa/-/issues/6895 .
Unfortunately, the first version required modifying a temporary declared
const inside the for loop and that seems to have been the problem. This
version instead has an iterator struct which is managed by an outer for
loop and the inner for loop exists to declare the user's requested
iteration variable and manage the actual iteration. Because the outer
for loop is effectively `for (bool done = false; !done; done = true)`,
it will execute exactly once, regardless of the inner loop, so break and
continue inside the inner loop should work the same as if it's a single
for loop.
The other major difference with the new version is that the code is the
same for debug and release except the half_iter and loop check are gone.
I've verified by hand that this produces virtually identical code to the
old simple iterators on both GCC andl clang with an optimized build.
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17630 >
2022-07-19 19:55:17 +00:00
Jason Ekstrand
b510ee0d22
Use vk_foreach_struct_const where needed
...
We're about to make it so that the compiler warns/errors if you use the
wrong iterator macro. Fix up a bunch of places where someone used the
wrong one before we break anything.
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17630 >
2022-07-19 19:55:17 +00:00
Jason Ekstrand
9066cc86bb
vulkan: Copy the depth/stencil state optimization code from ANV
...
Instead of having stencil writes as an out parameter of the optimization
function, we add a new write_enable field for stencil that's equivalent
to the similarly named field for depth. This doesn't mean drivers must
actually support disabling stencil writes independently but the
information may be helpful on some hardware.
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17328 >
2022-07-19 19:19:34 +00:00
Jason Ekstrand
4ad149a8fc
vulkan: Add a common implementation of vkCmdSet*
...
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17328 >
2022-07-19 19:19:34 +00:00
Jason Ekstrand
fcedb1250b
vulkan: Add a common data structure for dynamic states
...
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17328 >
2022-07-19 19:19:34 +00:00
Jason Ekstrand
7ca8dcb05f
vulkan: Add data structures to store all graphics state
...
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17328 >
2022-07-19 19:19:33 +00:00
Jason Ekstrand
fed81dc306
vulkan: Add standard sample locations
...
This looks a bit funny because we define the struct in the .c file but
that will be fixed in the next commit.
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17328 >
2022-07-19 19:19:33 +00:00
Jason Ekstrand
fb3f9c0aac
vulkan: Add an enum for all dynamic graphics states
...
Also, add a helper function to turn VkPipelineDynamicStateCreateInfo
into a bitset.
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17328 >
2022-07-19 19:19:33 +00:00
Jason Ekstrand
6b6c1a7ddd
vulkan: Add a vk_limits.h file for runtime limits
...
Individual driver limits may be smaller than these.
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17328 >
2022-07-19 19:19:33 +00:00
Jason Ekstrand
669daa37b1
Revert "vulkan: Detect pNext chain loops in vk_foreach_struct()"
...
This reverts commit 4c56b535f5 .
2022-07-18 23:48:59 -05:00
Jason Ekstrand
4c56b535f5
vulkan: Detect pNext chain loops in vk_foreach_struct()
...
This implements the "tortoise and the hare" algorithm for detecting
cycles in graphs. We use the caller's iterator as the hare and our own
internal copy as the tortoise. Conveniently, VkBaseOutStructure (and
VkBaseInStructure which is identical except the pointer type on pNext)
have a pointer we can use for the tortoise and an sType which we can use
for a counter to ensure we only increment the tortose every other loop
iteration.
There are more efficient algorithms than tortoise and hare but they
require allocating memory for something like a hash set of seen nodes.
Since this for debug purposes only, it's ok for it to be a bit
inefficient in the case where it hits the assert. In the usual case of
no loops, it's the same runtime efficiency as the unchecked version
except that it does a tiny bit of math and 50% more pointer chases.
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17596 >
2022-07-19 02:11:07 +00:00
Konstantin Seurer
fc26fbde3d
vulkan: Common vk_format_get_component_bits
...
RADV and PowerVR use the same implementation.
Turnip does use a slightly modified version but the helper only has one
use -> just inline it and get rid of turnip's vk_format.h.
Signed-off-by: Konstantin Seurer <konstantin.seurer@gmail.com >
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com >
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Reviewed-by: Emma Anholt <emma@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17515 >
2022-07-18 22:14:06 +00:00
Eric Engestrom
75938f9d1f
venus: use updated tokens from vk.xml
...
Signed-off-by: Eric Engestrom <eric@igalia.com >
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org >
Acked-by: Jason Ekstrand <jason.ekstrand@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17342 >
2022-07-12 15:53:11 +00:00
Eric Engestrom
9035408d62
radv: use updated tokens from vk.xml
...
Signed-off-by: Eric Engestrom <eric@igalia.com >
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Acked-by: Jason Ekstrand <jason.ekstrand@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17342 >
2022-07-12 15:53:11 +00:00
Eric Engestrom
e706a915b0
vulkan: use updated tokens from vk.xml
...
Signed-off-by: Eric Engestrom <eric@igalia.com >
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17342 >
2022-07-12 15:53:11 +00:00
Eric Engestrom
c3d8395a14
vulkan/runtime: use updated tokens from vk.xml
...
Signed-off-by: Eric Engestrom <eric@igalia.com >
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17342 >
2022-07-12 15:53:11 +00:00
Eric Engestrom
66af355a00
vulkan: add script to detect & replace identifiers that have been renamed
...
Signed-off-by: Eric Engestrom <eric@engestrom.ch >
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17342 >
2022-07-12 15:53:11 +00:00
Jason Ekstrand
af6f6ce065
vulkan/wsi: Add debug variables to force the SW and PRIME buffer blit paths
...
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17436 >
2022-07-12 14:14:01 +00:00
Jason Ekstrand
3ff7494a97
vulkan/wsi/wayland: Add a BUFFER_TYPE flag
...
This makes all the different ways of presenting a bit more clear.
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17436 >
2022-07-12 14:14:01 +00:00
Jason Ekstrand
c5af8bcc37
vulkan: Add a vk_pipeline_shader_stage_is_null() helper
...
Reviewed-by: Caio Oliveira <caio.oliveira@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17337 >
2022-07-08 22:47:22 +00:00
Jason Ekstrand
8851f50753
spirv,vulkan: Set shader_info::subgroup_size
...
Reviewed-by: Caio Oliveira <caio.oliveira@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17337 >
2022-07-08 22:47:22 +00:00
Jason Ekstrand
beb5b17d82
vulkan: Constify vk_spirv_version
...
Reviewed-by: Caio Oliveira <caio.oliveira@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17337 >
2022-07-08 22:47:22 +00:00
Jason Ekstrand
a73c4d5098
vulkan: Re-order pipeline hashing
...
Match the order in vkPipelineShaderStageCreateInfo
Reviewed-by: Caio Oliveira <caio.oliveira@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17337 >
2022-07-08 22:47:22 +00:00
Jason Ekstrand
048435b44c
vulkan/wsi: Fix structure chaining in wsi_create_buffer_image_mem
...
First, because we're using __vk_append_struct which attacks it on the
end, memory_wsi_info is modified even though it's const. Make things
non-const so we aren't silently violating assumptions. Also, we set a
pNext in memory_export_info which causes a loop in the pNext chain in
the handle_types != 0 case.
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6826
Fixes: 124848bf9e ("vulkan/wsi: Support tiled CPU images")
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17434 >
2022-07-08 21:50:55 +00:00
Jason Ekstrand
a084ee7209
vulkan/wsi/wayland: Only memcpy if the swapchain is actually software
...
Otherwise, we'll segfault. :-(
Fixes: aca545d616 ("vulkan/wsi/wayland: Use host pointer import when available")
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17434 >
2022-07-08 21:50:55 +00:00
Pierre-Eric Pelloux-Prayer
835364ea0c
vulkan/wsi: define pWaitDstStageMask in the blit submission
...
Otherwise we get a crash in vk_common_QueueSubmit when doing:
.stageMask = pSubmits[s].pWaitDstStageMask[i],
cc: mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6712
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17310 >
2022-07-07 21:49:39 +00:00
Jesse Natalie
8faf3781c8
vulkan/wsi/win32: Use the new helpers and persistent map
...
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17388 >
2022-07-07 11:44:19 -05:00
Jason Ekstrand
aca545d616
vulkan/wsi/wayland: Use host pointer import when available
...
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17388 >
2022-07-07 11:44:19 -05:00
Jason Ekstrand
54fa5ff406
vulkan/wsi/x11: Only use MIT_SHM if the device supports EXT_external_memory_host
...
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17388 >
2022-07-07 11:44:19 -05:00
Jason Ekstrand
5abc05f1df
vulkan/wsi/x11: Don't leak shm_reply if we don't have dri3 or present
...
Fixes: b5c390c113 ("vulkan/wsi: add support for detecting mit-shm pixmaps.")
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17388 >
2022-07-07 11:44:19 -05:00
Jason Ekstrand
124848bf9e
vulkan/wsi: Support tiled CPU images
...
Some drivers such as lavapipe are 100% fine with using linear for WSI
images. Most HW drivers, however, would rather render tiled and eat a
blit.
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17388 >
2022-07-07 11:44:19 -05:00
Jason Ekstrand
83fb6fe569
vulkan/wsi: Align buffer image strides to optimalBufferCopyRowPitchAlignment
...
This isn't a big deal for the current buffer paths because the required
alignment for PRIME is already higher than any driver advertises.
However, the SW path we're about to add won't have the PRIME requirement.
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17388 >
2022-07-07 11:44:17 -05:00
Jason Ekstrand
13148b9c68
vulkan/wsi: Compute stride and size in configure_buffer_image
...
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17388 >
2022-07-07 11:44:10 -05:00