Commit Graph

146 Commits

Author SHA1 Message Date
Hoe Hao Cheng fa86272547 zink: expose PIPE_CAP_ANISOTROPIC_FILTER
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Tested-by: Fabio Pedretti <fabio.ped@libero.it>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8617>
2021-01-22 01:30:50 +00:00
Mike Blumenkrantz 61720098fa zink: set PIPE_CAP_ROBUST_BUFFER_ACCESS_BEHAVIOR
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8631>
2021-01-21 23:14:31 +00:00
Mike Blumenkrantz bcc8222277 zink: set PIPE_CAP_FRAMEBUFFER_NO_ATTACHMENT
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8631>
2021-01-21 23:14:31 +00:00
Mike Blumenkrantz 0ab9114abd zink: force per-sample interpolation
this gives us new rasterizer states when multisample stuff changes instead
of new fs states, which is what we want since these correlate to pipeline
flags, not shader-specific things

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8631>
2021-01-21 23:14:31 +00:00
Mike Blumenkrantz 64f55b82c7 zink: set PIPE_CAP_COPY_BETWEEN_COMPRESSED_AND_PLAIN_FORMATS
ARB_copy_image is already supported

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8625>
2021-01-21 22:29:54 +00:00
Mike Blumenkrantz 099ce1aacc zink: GLSL 420
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8620>
2021-01-21 21:19:12 +00:00
Mike Blumenkrantz 3f9a6d333b zink: export shader image caps using features
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8504>
2021-01-21 19:48:45 +00:00
Mike Blumenkrantz 0daa61553d zink: check if multisample support exists for shader image formats
avoid issues later by checking this now while we're here

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8504>
2021-01-21 19:48:45 +00:00
Mike Blumenkrantz 924d1ba9eb zink: enable WSI-faking for RADV too
temporary until we get real WSI support

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8284>
2021-01-20 16:31:47 +00:00
Hoe Hao Cheng a183ee2ed7 zink: remove excessive checks for loader version
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8521>
2021-01-17 15:24:03 +00:00
Hoe Hao Cheng a454c562d6 zink/codegen: codegen-ize load_instance_extensions()
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8521>
2021-01-17 15:24:03 +00:00
Hoe Hao Cheng c0259e5c6e zink/codegen: enable instance extension unconditionally if promoted
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8521>
2021-01-17 15:24:03 +00:00
Mike Blumenkrantz c27347b2e1 zink: enable PIPE_CAP_CLEAR_TEXTURE
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8512>
2021-01-15 16:38:04 +00:00
Mike Blumenkrantz 322a3d4fb0 zink: partially enable SSBO pipe cap
this enables atomic counters

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8330>
2021-01-14 18:13:28 +00:00
Mike Blumenkrantz 9d651d2a0f zink: clamp sampler+samplerview limits
* struct shader_info provides a 32bit mask for textures_used
* samplers and samplerviews are a 1:1 mapping for shader descriptors
* also according to spec this is always 32 per stage

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8457>
2021-01-13 21:53:56 +00:00
Erik Faye-Lund 6993109713 zink: setup compiler options during init
This avoids duplicating the options just to change a single one.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8402>
2021-01-10 13:06:45 +00:00
Mike Blumenkrantz 4e3e7f35f7 zink: clamp shader input/output max values
some vulkan drivers (e.g., amdvlk) advertise absolutely huge values here,
resulting in bitmask overflows everywhere since gallium assumes a max of
32 for vertex inputs and nir uses 64bit types for others

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8318>
2021-01-08 14:44:31 +00:00
Erik Faye-Lund b49cea2e9a zink: destroy device and instance
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8099>
2021-01-05 15:36:35 +00:00
Erik Faye-Lund bc1593a9cd zink: destroy transfer-helper
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8099>
2021-01-05 15:36:35 +00:00
Mike Blumenkrantz c211f466cc zink: GLSL 410
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8329>
2021-01-05 08:58:27 -05:00
Mike Blumenkrantz ae9d6c5620 zink: GLSL 4.00
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8329>
2021-01-05 08:58:24 -05:00
Mike Blumenkrantz 35e346f428 zink: handle vertex streams
we already support all this, it's just a matter of slapping on some Stream
decoration flex tape

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8204>
2021-01-05 13:30:34 +00:00
Mike Blumenkrantz 68242767d2 zink: enable PIPE_CAP_START_INSTANCE
and add feature

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8313>
2021-01-05 13:24:14 +00:00
Adam Jackson 8ddddfb516 treewide: Disambiguate various variables named "debug_options"
Name them after what they control so 'vi -t' can take you somewhere
useful.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8165>
2021-01-04 20:51:28 +00:00
Mike Blumenkrantz ad68f2c065 zink: set PIPE_CAP_MAX_VIEWPORTS
enables ARB_viewport_array

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8311>
2021-01-04 18:50:29 +00:00
Mike Blumenkrantz c28ca18991 zink: enable PIPE_CAP_MAX_TEXTURE_GATHER_COMPONENTS
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8151>
2021-01-04 15:55:17 +00:00
Mike Blumenkrantz cef876910a zink: enable PIPE_CAP_MULTI_DRAW_INDIRECT(_PARAMS) caps
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8233>
2020-12-31 13:41:30 +00:00
Mike Blumenkrantz 1c01ad1b80 zink: add KHR_draw_indirect_count detection
this is a vk 1.2 feature

Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8233>
2020-12-31 13:41:30 +00:00
Mike Blumenkrantz b9c2a0b4c6 zink: require KHR_maintenance2 for tessellation and set bottom-left origin
this makes tessellation work as expected in apps but has no impact on unit tests

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Witold Baryluk <witold.baryluk@gmail.com>
Tested-by: Witold Baryluk <witold.baryluk@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8274>
2020-12-31 01:28:35 +00:00
Hoe Hao Cheng 5a1518e86b zink: add support for VK_EXT_4444_formats
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8240>
2020-12-28 21:12:53 +00:00
Mike Blumenkrantz 0f5726c503 zink: fix more instance detection stuff
this was broken during the transition to generated code

Fixes: fe669ff4a0 ("zink: replace old code with generated zink_instance")

Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8250>
2020-12-28 16:01:02 -05:00
Mike Blumenkrantz 2f8237754b zink: fix debug utils init
this was moved to a different struct without being updated

Fixes: fe669ff4a0 ("zink: replace old code with generated zink_instance")

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8220>
2020-12-24 01:49:00 +00:00
Mike Blumenkrantz f815b87e18 zink: export tess shader pipe caps
Reviewed-by: Erik Faye-Lund <kusmabite@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8152>
2020-12-22 13:46:38 +00:00
Mike Blumenkrantz 55e2d836f3 zink: enable 64bit pipe caps
Reviewed-by: Erik Faye-Lund <kusmabite@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7654>
2020-12-18 01:07:01 +00:00
Erik Faye-Lund 123f3d0d64 zink: make zink_format all about raw format-translation
This moves the parts of zink_format.c that also operates on zink_screen
into zink_screen.c. This has the benefit that we can start testing the
enum-translation code separately from the state.

This will make the next commit a bit cleaner.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7982>
2020-12-16 20:51:33 +00:00
Adam Jackson 78c7edf962 zink: Simplify MoltenVK support a bit
There's no harm in checking for the extension on non-macOS, just do it.
Nor can I see any point in checking for both the layer and the
extension, since you're never going to see the extension if the layer
isn't available, so just check for the extension instead of the reduced
boolean. Simplify some variable naming while we're at it.

Acked-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8019>
2020-12-15 17:20:13 +00:00
Adam Jackson 0781808935 zink: Factor out zink_create_logical_device
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8019>
2020-12-15 17:20:13 +00:00
Adam Jackson aa93673d9d zink: Factor out zink_get_loader_version()
This result isn't actually used within zink_create_instance, so don't do
it there.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8019>
2020-12-15 17:20:13 +00:00
Adam Jackson 5f7a8f6fc1 zink: Factor out winsys awareness from zink_internal_create_screen
Magic parameters are gross, this makes zink_internal_create_screen a bit
more reusable.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8019>
2020-12-15 17:20:13 +00:00
Vinson Lee c0f2a19aee zink: Fix typos.
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8071>
2020-12-14 20:13:47 -08:00
Jesse Natalie 9ac8f8f490 gallium: Add optional pipe_context to flush_frontbuffer
It's hooked up in all the pipe wrapper drivers, and all the
frontends except a couple places in glx/xlib.

This enables a more efficient path for drivers which use
swrast's Present, but hardware rendering (e.g. d3d12, zink).

Reviewed-by: Dave Airlie <airlied@redhat.com>
Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8045>
2020-12-14 23:31:37 +00:00
Hoe Hao Cheng fe669ff4a0 zink: replace old code with generated zink_instance
Acked-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7800>
2020-12-11 12:07:13 +00:00
Adam Jackson 12656de341 zink: factor out GET_PROC_ADDR and friends to zink_screen.h
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7800>
2020-12-11 12:07:13 +00:00
Hoe Hao Cheng 3f1d4de25b zink: move blend_operation_advanced conditions to zink_device_info.py
Acked-by: Adam Jackson <ajax@redhat.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7756>
2020-12-10 12:40:59 +00:00
Witold Baryluk e2b4247e40 zink: Cap PIPE_SHADER_CAP_MAX_CONST_BUFFERS to 32
PIPE_MAX_CONSTANT_BUFFERS is 32, however many Vulkan implementations
has maxPerStageDescriptorUniformBuffers that exceeds it, for example:

radv 8388606,
anv 64
nvidia 1048580 for RTX 2000 and up.

and, together with the current zink logic, the returned value
will exceed the maximum allowed value for the cap.

This causes cso_destroy_context to pass big values back to zink
(via zink_set_constant_buffer), resulting in access beyond end of
allocated buffer for all UBOs.

Cap the cap to PIPE_MAX_CONSTANT_BUFFERS (32), not INT_MAX.

Add an assert to verify future drivers.

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Fixes: daaf5f1d18 ("gallium: Fix leak of currently bound UBOs at CSO context destruction.")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7976>
2020-12-07 21:19:13 +00:00
Duncan Hopkins 5bcefcc91a zink. Fixing vkGetPhysicalDeviceProperties2 and vkGetPhysicalDeviceFeatures2 for Vk 1.1 and VK_KHR_get_physical_device_properties2.
MoltenVK does not export the vkGetPhysical*2() functionns, even in Vulkan 1.2.154.0 where the instance version moves from 1.0 to 1.1.
If the extension is present and used the KHR versions of the functions can be used.
From the spec the vkGetPhysicalDevice*2() functions should be avaiable from Vk 1.1 loaders and devices. Which implies MoltenVK might be misbehaving.
This change allows the extension to be used, if present, before the Vk 1.1 version check.

Fixes: 752f6d80 ("zink: setup version dependent VkPhysicalDeviceVulkan*Features and VkPhysicalDeviceVulkan*Properties.")
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7960>
2020-12-07 11:06:17 +00:00
Duncan Hopkins 19a9f22501 zink: moved vkEnumerateInstanceVersion to create_instance
Moved the call to vkEnumerateInstanceVersion() into the create_instance() function,
so the result can be passed into the application apiVersion.
Will stop drivers from limiting a devices supported api version.

Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7533>
2020-12-02 13:27:29 +00:00
Iago Toral Quiroga 46d2f2224f zink: only add MESA WSI structs for specific devices
Some drivers will drop warnings about seeing these structs in the
pNext chain and not handling them. This change makes it so we
only include the structs with Vulkan drivers that are known to
require them for proper behavior (v3dv only for now) to avoid the
warnings.

It should be noted that here we are only supressing the messages
from Zink. Since the Mesa Vulkan WSI code will include these structs,
when native Vulkan Mesa drivers are used without Zink they might
still dump these messages.

Requested by Mike Blumenkrantz.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7523>
2020-11-11 08:16:32 +01:00
Duncan Hopkins d377d84496 zink: make physical device functions use a dynamic function pointers.
vkGetPhysicalDeviceFeatures2 and vkGetPhysicalDeviceProperties2 are not present on some MoltenVK versions.
VK_KHR_get_physical_device_properties2 exposes the KHR versions of the same functions.
These cannot be used via static linking, so we have to dynamically detect the loader version and then the extension
to work out which pointers to use.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7447>
2020-11-08 06:09:16 +00:00
Mike Blumenkrantz 0bc222706d zink: implement ARB_texture_query_lod
just needed hooking up the spirv function to the tex op

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7484>
2020-11-06 18:10:04 -05:00