Commit Graph

248 Commits

Author SHA1 Message Date
Mike Blumenkrantz 575756274a zink: handle dual blending override from driconf
when this is enabled, we need to push gl_FragData[1] to location 0 and
index 1 so that it gets blended like the application expects

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9095>
2021-02-18 00:02:17 +00:00
Eric Anholt 175c827e72 gallium: Flip the default value of PIPE_CAP_SHAREABLE_SHADERS.
We should be exposing it in every driver, since it's required eventually
to reduce jank.  Make drivers have to explicitly opt out instead of opt
in.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9088>
2021-02-17 19:31:07 +00:00
Mike Blumenkrantz c4cc3d915b zink: add a disk cache for pipeline objects
this writes the pipeline cache to disk on shutdown

ideally we'd rather write this incrementally any time we make a new pipeline,
but that ends up breaking the disk cache infrastructure since we're always writing
to the same file, so this is the best we can do for now

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9094>
2021-02-17 02:59:52 +00:00
Mike Blumenkrantz eb3cb170fc zink: create a VkPipelineCache object on the screen and use it
this enables reuse of shaders across pipelines

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9094>
2021-02-17 02:59:52 +00:00
Mike Blumenkrantz 0960938d86 zink: GLSL 460
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9072>
2021-02-16 01:16:30 +00:00
Mike Blumenkrantz efc219f1c4 zink: PIPE_CAP_GL_SPIRV
still needs a bunch of fixing, but 75% of tests pass

Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9072>
2021-02-16 01:16:29 +00:00
Mike Blumenkrantz cb5957e13d zink: enable pipeline statistics cap
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9072>
2021-02-16 01:16:29 +00:00
Mike Blumenkrantz 5a4f5d1bb5 zink: enable PIPE_CAP_QUERY_SO_OVERFLOW
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9072>
2021-02-16 01:16:29 +00:00
Mike Blumenkrantz 3d7d55c2cf zink: enable PIPE_CAP_POLYGON_OFFSET_CLAMP
this is already handled

Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9072>
2021-02-16 01:16:29 +00:00
Mike Blumenkrantz 670b79ffd5 zink: enable PIPE_CAP_DRAW_PARAMETERS
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9072>
2021-02-16 01:16:29 +00:00
Mike Blumenkrantz 75baabf9fb zink: enable PIPE_CAP_TGSI_VOTE
ARB_shader_group_vote

Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9072>
2021-02-16 01:16:29 +00:00
Hoe Hao Cheng 93ff47eb19 zink: enable KHR_shader_draw_parameters on Vulkan <1.2
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9021>
2021-02-12 21:04:24 +00:00
Hoe Hao Cheng 04df0cb4ae zink: VK_KHR_draw_indirect_count is a device extension
this fixes some testcases on CI.

Fixes: 1c01ad1b80 ("zink: add KHR_draw_indirect_count detection")
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8991>
2021-02-12 18:27:25 +00:00
Erik Faye-Lund 5159f406d8 zink: use gallium api to copy to display-target
This allows us to avoid us to avoid forcing linear and host-visible
display-targets.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8858>
2021-02-12 11:24:50 +00:00
Mike Blumenkrantz 989731bbe2 zink: GLSL 450
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8989>
2021-02-11 11:50:41 -05:00
Mike Blumenkrantz c2e67f679c zink: enable PIPE_CAP_TEXTURE_BARRIER
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8989>
2021-02-11 11:19:07 -05:00
Mike Blumenkrantz c94819286e zink: enable PIPE_CAP_TGSI_TXQS
aka ARB_shader_texture_image_samples

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8989>
2021-02-11 11:19:04 -05:00
Mike Blumenkrantz faa7393a6a zink: enable PIPE_CAP_CLIP_HALFZ
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8989>
2021-02-11 11:19:01 -05:00
Mike Blumenkrantz 8d9d7f15b9 zink: enable PIPE_CAP_CONDITIONAL_RENDER_INVERTED
this was already handled

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8989>
2021-02-11 11:18:58 -05:00
Mike Blumenkrantz e88a6d1c7b zink: GLSL 440
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8989>
2021-02-11 11:18:53 -05:00
Mike Blumenkrantz 6f7430dd50 zink: enable PIPE_CAP_QUERY_BUFFER_OBJECT
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8989>
2021-02-11 11:18:49 -05:00
Mike Blumenkrantz 90e8543da0 zink: enable PIPE_CAP_TGSI_ARRAY_COMPONENTS
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8989>
2021-02-11 11:18:46 -05:00
Adam Jackson f2573760b4 zink: Factor out instance setup a bit more
The VkInstance is really display state not screen state, as is the
loader version. Factor this out a bit further so that
zink_create_instance fills in a zink_instance_info. The latter struct
still lives in the zink_screen for now but that'll move soon.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8968>
2021-02-10 20:31:42 +00:00
Mike Blumenkrantz f88d9c9d7c zink: use better mapping for PIPE_FORMAT_X24S8_UINT
this needs to be unconditionally supported in some way, and it also
needs to use a more compatible fallback format if the base format is unavailable

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8959>
2021-02-10 20:20:38 +00:00
Michel Zou aea36ee05e zink: Fix win32 build
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8957>
2021-02-10 18:19:43 +00:00
Mike Blumenkrantz b20e08fadd zink: enable PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8942>
2021-02-10 13:28:10 +00:00
Mike Blumenkrantz cb80609bb0 zink: GLSL 430
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8941>
2021-02-09 19:25:53 -05:00
Mike Blumenkrantz 7909c642b1 zink: enable compute
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8781>
2021-02-10 00:19:39 +00:00
Mike Blumenkrantz c5cf5ad6f0 zink: export compute-specific shader/compute caps
this doesn't enable the compute cap itself, it just handles all the other
caps

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8781>
2021-02-10 00:19:39 +00:00
Mike Blumenkrantz 84821964eb zink: force 4 component formats for samplerview/render textures
this fixes a bunch of issues with 3-component formats, which aren't supported
for various operations on certain drivers

Reviewed-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/8697>
2021-02-07 23:16:27 +00:00
Erik Faye-Lund 3824c06aff zink: support using lavapipe
This is really nasty, and shouldn't really be needed, but we have a
problem where both Zink and Lavapipe checks $GALLIUM_DRIVER, meaning that
Zink tries to use Lavapipe, and Lavapipe tries to use Zink.

This patch side-steps that by temporarily setting $GALLIUM_DRIVER to
"llvmpipe", giving Lavapipe a chance to succeed.

This is not great at all. The most obvious problem is that this is super
thread-unsafe, effectively modifying global state without any care. In
reality, we'd only want the pipe-loader in the *same thread* to ignore
Zink, but it's not so obvious how to do that without introducing lots of
ugly zink-specific cruft.

People shouldn't be using Zink if they don't have a GPU, it's going to
be much better to use LLVMpipe in that case. So let's not worry too much
about this case, and instead guard this dangerous logic with an
ZINK_USE_LAVAPIPE environment variable. This means this behavior only
happens if people opt in to it.

With this in place, we can start using Zink + Lavapipe on CI.

In the longer run, it might be better to use Adam Jackson's copper
loader instead, and drop exposing Zink as a software rasterizer
entirely. But that's something for the great future where we have flying
cars and all.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7881>
2021-02-05 16:45:43 +00:00
Erik Faye-Lund 3adf6da4c1 zink: explicitly check for VK_NULL_HANDLE
This seems a bit less like magic to me.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7881>
2021-02-05 16:45:43 +00:00
Erik Faye-Lund 6b38b1ccaf zink: check for error when calling vkEnumeratePhysicalDevices
It seems it's possible for Lavapipe to fail to enumerate the physical
devices, so let's handle that and fail all the way up here.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7881>
2021-02-05 16:45:43 +00:00
Mike Blumenkrantz 50bac9f3fb zink: move maintenance2 extension to right file
Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8862>
2021-02-04 19:23:20 +00:00
Dave Airlie e41b0202c9 zink: don't pick a cpu device ever.
This goes down the list and picks the first non-cpu device, when
we merge the CI patch we should add a forcing env var in here.

Fixes: 8d46e35d1 ("zink: introduce opengl over vulkan")
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8845>
2021-02-03 23:11:19 +00:00
Erik Faye-Lund 36a4b423fe zink: correct return-type for function
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8832>
2021-02-02 16:00:37 +00:00
Erik Faye-Lund 9fbacf5bcf zink: be more careful about limits when unsupported
These limits are dependent on feature caps, so let's try to thread
a bit more carefully when the cap is unsupported.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8832>
2021-02-02 16:00:37 +00:00
Mike Blumenkrantz 514b17235f zink: export ssbo caps
PIPE_CAP_SHADER_BUFFER_OFFSET_ALIGNMENT is needed

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8628>
2021-01-28 14:34:28 +00:00
Mike Blumenkrantz 86ff78e8fe zink: don't export PIPE_CAP_MAX_COMBINED_SHADER_BUFFERS value
gallium automatically sums up the per-stage buffers if this isn't set,
and some drivers (e.g., amdvlk) export UINT_MAX here which breaks the universe

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8742>
2021-01-27 10:44:50 -05:00
Erik Faye-Lund 9052819ebb zink: request texcoord replace lowering
We don't actually support point-sprites by texcoord replacement, so let's
remove that cap. This allows gallium to automatically lower this to the
PNTC varying instead, which we do support.

Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6473>
2021-01-25 17:32:33 +00:00
Mike Blumenkrantz b59d98ae5f zink: enable PIPE_CAP_TEXTURE_MIRROR_CLAMP_TO_EDGE
this was already handled internally

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8688>
2021-01-25 16:59:36 +00:00
Mike Blumenkrantz cacb3e1826 zink: enable PIPE_CAP_SAMPLER_VIEW_TARGET
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8629>
2021-01-22 22:37:46 +00:00
Mike Blumenkrantz 5282210c0b zink: check correct caps for PIPE_CAP_IMAGE_LOAD_FORMATTED
we actually need more features here than just the one which was checked to
enabled this

Fixes: 2f6f4b613c3 ("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/8656>
2021-01-22 19:54:58 +00:00
Erik Faye-Lund 855370bb62 zink: make all xfb caps depend on extension
Without this, we'll expose GL_ARB_transform_feedback2 and
GL_ARB_transform_feedback3 even without VK_EXT_transform_feedback,
because these caps are directly wired up without checking the pervious
extensions.

Fixes: e8ad52f7b0 ("zink: enable xfb extension in screen creation")
Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8640>
2021-01-22 15:39:20 +00:00
Erik Faye-Lund 8c7d971666 zink: require vulkan memory model for tesselation
We enable the KHR_vulkan_memory_model extension whenever we use
tesselation, so right now this is a defacto requirement. So let's make
this requirement explicit.

Fixes: f815b87e18 ("zink: export tess shader pipe caps")
Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8640>
2021-01-22 15:39:20 +00:00
Erik Faye-Lund f95c174927 zink: check for extension instead of function
This shouldn't change any behavior, it just seems a bit more to the
point to check for the extension that decides if these are NULL or not
than to check both of them.

Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8640>
2021-01-22 15:39:20 +00:00
Erik Faye-Lund c9340744a3 zink: respect feature-cap for multi-draw indirect
Even in the presence of VK_KHR_draw_indirect_count, we still technically
need to respect the feature-cap when using a Vk 1.0 core-function.

Fixes: cef876910a ("zink: enable PIPE_CAP_MULTI_DRAW_INDIRECT(_PARAMS) caps")
Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8640>
2021-01-22 15:39:20 +00:00
Erik Faye-Lund 6f6941e2dd zink: respect feature-cap for sample-shading
Vulkan has a cap to enable this, we should check that one rather than
always claiming support.

Fixes: 0c70268ff7 ("zink: mark ARB_sample_shading as supported")
Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8640>
2021-01-22 15:39:20 +00:00
Erik Faye-Lund 612169859a zink: respect feature-cap for independent blending
Vulkan has a cap to enable this, we should check that one rather than
always claiming support.

Fixes: 8d46e35d16 ("zink: introduce opengl over vulkan")
Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8640>
2021-01-22 15:39:20 +00:00
Erik Faye-Lund 831d205513 zink: respect feature-cap for robust buffer access
Vulkan has a cap to enable this, we should check that one rather than
always claiming support.

Fixes: 61720098fa ("zink: set PIPE_CAP_ROBUST_BUFFER_ACCESS_BEHAVIOR")
Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8640>
2021-01-22 15:39:20 +00:00
Erik Faye-Lund b35e11ef95 zink: always expose linear float textures
This is not an optional feature in Vulkan, so we can rely on this being
supported. This has the nice benefit of enabling OpenGL ES 3.0 support
on ANV.

Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8640>
2021-01-22 15:39:20 +00:00
Mike Blumenkrantz 96d7555770 zink: support PIPE_FORMAT_X24S8_UINT
enables ARB_texture_view

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8630>
2021-01-21 22:03:49 -05:00
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