Commit Graph

358 Commits

Author SHA1 Message Date
Mike Blumenkrantz cca616ebd5 zink: export PIPE_CAP_SAMPLER_REDUCTION_MINMAX_ARB
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10248>
2021-04-15 12:35:09 +00:00
Mike Blumenkrantz 22e1ed5722 zink: support format queries for VK_EXT_sampler_filter_minmax
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10248>
2021-04-15 12:35:09 +00:00
Marek Olšák d7250b0b08 gallium: add PIPE_SHADER_CAP_FP16_CONST_BUFFERS for FP16 uniforms
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9050>
2021-04-13 05:07:42 +00:00
Erik Faye-Lund e7bece080f zink: fix typo in function name
Suggested-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10127>
2021-04-10 09:48:38 +00:00
Erik Faye-Lund 6940d3ba05 zink: document scalarBlockLayout requirement
We're currently using uint arrays instead of uvec4 arrays for UBOs and
SSBOs, which requires scalarBlockLayout. Fixing this is a lot of work,
so let's just document it for now.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10127>
2021-04-10 09:48:38 +00:00
Mike Blumenkrantz fa36a16c68 zink: make timeline semaphores per-screen
I misread the spec, and it turns out timeline ids can't be reused across
semaphores. This is obvious in retrospect, but what can be done?

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Tested-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10115>
2021-04-09 13:31:55 +00:00
Mike Blumenkrantz f5ca29b430 zink: fix CI flakiness in glx-multithread-clearbuffer
unsetting zink from GALLIUM_DRIVER is required in order for lavapipe to
work, but setting it back is totally broken in the case where an app
creates a ton of screens simultaneously

instead, just leave it set to llvmpipe, and if a race condition occurs,
at least llvmpipe isn't going to fail a test that zink passes

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10120>
2021-04-08 20:55:20 -04:00
Mike Blumenkrantz 7580a69844 zink: hook up EXT_fragment_shader_interlock
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10013>
2021-04-08 04:13:14 +00:00
Mike Blumenkrantz f19946ca6e zink: stop unmapping resources
it turns out there's not actually a requirement that resources be unmapped,
which means that a ton of overhead can be saved both in the unmap codepath
(the cpu overhead here is pretty insane) and then also when mapping cached
resource memory, as the map can now be added to the cache for immediate reuse

as seen in radeonsi

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9980>
2021-04-08 03:34:49 +00:00
Mike Blumenkrantz 15f2c1f661 zink: add env var to force uniform inlining
this is great for debugging/testing, but there's no great heuristics
for using it yet

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9888>
2021-04-08 03:00:48 +00:00
Mike Blumenkrantz 7f28775edc zink: implement uniform inlining
this lets us inline away our problems

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9888>
2021-04-08 03:00:48 +00:00
Mike Blumenkrantz b47815c772 zink: add a pipe_screen::finalize_nir hook
moves some of the always-run passes into the base nir

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9888>
2021-04-08 03:00:47 +00:00
Mike Blumenkrantz e1ba6158c0 zink: export PIPE_CAP_PREFER_BLIT_BASED_TEXTURE_TRANSFER
avoids memcpy slowpath

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9733>
2021-04-07 20:19:59 +00:00
Mike Blumenkrantz e4426d7828 zink: split total_mem off to total_video_mem, use total_mem for tc
tc needs the total host memory available, not the total video memory

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10006>
2021-04-05 22:45:52 +00:00
Mike Blumenkrantz 733e07565f zink: use vkGetPhysicalDeviceFormatProperties2 when available
technically shouldn't matter but whatever

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9984>
2021-04-05 22:14:26 +00:00
Mike Blumenkrantz 9490c1ca92 zink: enable PIPE_CAP_TGSI_TES_LAYER_VIEWPORT
should've done this when PIPE_CAP_TGSI_VS_LAYER_VIEWPORT was enabled

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10025>
2021-04-05 00:19:23 +00:00
Mike Blumenkrantz 9a13add12e zink: hook up timeline semaphore signalling during batch submission
just basic parts, no waiting on semaphores yet

Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9963>
2021-04-01 13:25:51 +00:00
Mike Blumenkrantz d179c5d28e zink: implement threaded context
this includes:
* async buffer mapping/replacement
* async queue submission
* async (threaded) gallium flush handling

the main churn here is from handling async gallium flushes, which involves
creating multiple gallium fences (zink_tc_fence) for each zink fence (zink_fence).
a tc fence may begin waiting for completion at any time, even before the zink_fence
has had its cmdbuf(s) submitted, so handling this type of desync ends up needing
almost a complete rewrite of the existing queue architecture

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9935>
2021-03-31 20:16:05 -04:00
Erik Faye-Lund 2de07d1ad2 zink: check base-requirements
This one is a bit of a tough nut to deal with gracefully. Zink has a set
of base-requirements that we always require. There's no Gallium caps to
report these missing features, so we're essentially left with two options:

1. Fail to create the screen.
2. Ignore the missing fetures.

Solution 1 will lead to difficulties bringing up a new Vulkan driver on
Zink, and solution 2 will lead to mis-rendering.

Since Zink is mostly an opt-in driver to use when there's no OpenGL driver
available, we should probably do 2 for now. It seems better to have some
mis-rendering than no rendering at all.

But let's at least check, and print a warning. That way people get to
know what's up.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9925>
2021-03-31 08:19:24 +00:00
Mike Blumenkrantz c452c82b98 zink: manually invoke cpu detection during screen init
ensure this gets populated before using it

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9885>
2021-03-30 15:12:58 +00:00
Mike Blumenkrantz cde60ab179 zink: fix format support detection for storage texel buffers and shader images
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9788>
2021-03-28 22:17:56 -04:00
Erik Faye-Lund a95912e9af zink: check for mirror-clamp extension
This cap depends on a device extension.

Fixes: b59d98ae5f ("zink: enable PIPE_CAP_TEXTURE_MIRROR_CLAMP_TO_EDGE")
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9803>
2021-03-24 21:12:00 +00:00
Erik Faye-Lund a466c2a783 zink: check for stores and atomics features
These limits depens on feature-bits.

Fixes: 322a3d4fb0 ("zink: partially enable SSBO pipe cap")
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9803>
2021-03-24 21:12:00 +00:00
Erik Faye-Lund 215ff8246f zink: check for depth-bias-clamp feature
This cap depends on a feature-bit.

Fixes: 3d7d55c2cf ("zink: enable PIPE_CAP_POLYGON_OFFSET_CLAMP")
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9803>
2021-03-24 21:12:00 +00:00
Erik Faye-Lund f6f2cbeb44 zink: check for pipeline statistics feature
This cap depends on a feature-bit.

Fixes: cb5957e13d ("zink: enable pipeline statistics cap")
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9803>
2021-03-24 21:12:00 +00:00
Mike Blumenkrantz 9ea9b852a2 zink: emulate PIPE_FORMAT_R8G8B8X8_UNORM
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9607>
2021-03-23 15:55:20 +00:00
Mike Blumenkrantz 92a5ea13fc zink: implement a global framebuffer cache
this uses the same mechanics as surface caching, but it
also requires that surfaces keep refs of the framebuffers they're
attached to so that they can invalidate the fb object upon destruction,
as, similar to program objects, the fb objects are "owned" by their attachments

loosely based on patches by Antonio Caggiano

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9665>
2021-03-22 08:49:26 -04:00
Mike Blumenkrantz a1d80c6d96 zink: more accurately check samplecount caps for shader images
lavapipe can only do up to 4bits, so this isn't just a binary check

Fixes: 0daa61553d ("zink: check if multisample support exists for shader image formats")

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9713>
2021-03-21 10:15:13 -04:00
Adam Jackson 3c72c86742 zink: Wire up ARB_post_depth_coverage
Just a matter of passing the bits through in the right place.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9637>
2021-03-17 23:15:12 +00:00
Erik Faye-Lund d4bcb58caf zink: fix free of ralloced pointer
When we alloc with ralloc, we also need to free with it.

But let's take a step back here; we don't just need to use ralloc, we
also need to destroy all other screen-resources. So let's call the
destructor here instead.

Fixes: 2643f9ed28 ("zink: ralloc screen objects")
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9647>
2021-03-17 13:08:10 +00:00
Mike Blumenkrantz 62d6ec083b zink: enable PIPE_CAP_INVALIDATE_BUFFER
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9546>
2021-03-17 01:40:55 +00:00
Mike Blumenkrantz 23538ed7a8 zink: cache bufferviews
we can cache bufferviews just like we do surfaces, so let's do that

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9543>
2021-03-16 10:45:32 -04:00
Mike Blumenkrantz 545625600b zink: update null descriptor hashes to reflect current descriptor states
also add a bufferview hash since we use these now

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9543>
2021-03-16 10:45:32 -04:00
Mike Blumenkrantz 6fb4e1345d zink: determine whether the vulkan driver requires mesa flush wsi
this is used for ANV's implicit fencing (until we get wsi)

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9290>
2021-03-15 10:58:21 -04:00
Mike Blumenkrantz 38f7faa8a4 zink: implement a surface cache
this is a global cache for all surface objects, enabling some memory
optimizations as well as improved reuse of cached descriptors

loosely based on patches from Antonio Caggiano

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9541>
2021-03-15 09:42:30 -04:00
Mike Blumenkrantz 2643f9ed28 zink: ralloc screen objects
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9541>
2021-03-15 09:42:30 -04:00
Mike Blumenkrantz 980a8b3fc0 zink: implement an extremely dumb resource memory cache
this stores a number (currently 5) of backing allocations for resources
for later reuse when creating matching resources

because this is on the screen object it requires locking, but this is still
far faster than allocating new memory each time

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9540>
2021-03-12 17:21:40 +00:00
Mike Blumenkrantz fa77cc2fbb zink: add a null sampler view descriptor hash to the screen
pre-hashing this saves us time later since we can just reuse it

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9348>
2021-03-12 16:32:53 +00:00
Mike Blumenkrantz 5945d7d2e9 zink: fix instance/device versioning (for real this time)
the maximum allowable runtime version of vk can be computed by MIN(instance_version, device_version)

despite this, instances and devices can be created using the maximum version available
for each respective type. the restriction is applied only at the point of
enabling/applying features and extensions, meaning that to correctly handle this,
zink must:

1. create an instance using the maximum allowable version
2. select a physical device using the instance
3. compute MIN(instance_version, device_version)
4. only now begin to enable/use features requiring vk 1.1+

ref #4392

Reviewed-by: Adam Jackson <ajax@redhat.com>
Acked-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9479>
2021-03-09 18:33:15 +00:00
Mike Blumenkrantz 55b57db84d zink: add vk/spirv caps/extension for shader LAYER variable
this is required if gl_Layer is used outside of GEOMETRY stage

Fixes: c77df59c9e ("zink: export PIPE_CAP_TGSI_VS_LAYER_VIEWPORT")

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9410>
2021-03-05 03:45:51 +00:00
Mike Blumenkrantz 3c20b698e2 zink: rewrite macro for getting KHR device functions
we have the technology. we can improve our our lives with better macros.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9398>
2021-03-03 17:27:22 -05:00
Adam Jackson 69f3d3a29f zink: Enable GL_EXT_depth_bounds_test
Available since Vulkan 1.0, and in fact already wired up, just not
advertised. It looks like we could make this dynamic state but this
works for now.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9371>
2021-03-03 16:17:11 +00:00
Mike Blumenkrantz c77df59c9e zink: export PIPE_CAP_TGSI_VS_LAYER_VIEWPORT
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9283>
2021-03-02 17:42:00 -05:00
Mike Blumenkrantz ffd046cf32 zink: enable PIPE_CAP_CLEAR_SCISSORED
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9283>
2021-03-02 17:42:00 -05:00
Mike Blumenkrantz 6a3e340288 zink: store total memory size on zink_screen
need this for oom handling

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9274>
2021-03-01 19:36:26 +00:00
Mike Blumenkrantz b44c48fd21 zink: use pre-fetched format properties everywhere
this is a noticeable perf improvement

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9293>
2021-02-25 17:58:38 -05:00
Mike Blumenkrantz ee4b844b12 zink: pre-fetch all format properties during screen init
this ends up being a tradeoff where we waste a little startup time and
an extra ~4k memory for the overall screen object in exchange for never having
to fetch format properties again, which is a surprisingly expensive call
to be making as much as we have to make it

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9293>
2021-02-25 17:58:38 -05:00
Mike Blumenkrantz 190b4ad18e zink: relax tessellation shader reqs
vk memory model isn't actually required for tcs io semantics due
to how control barriers are emitted in GL

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9232>
2021-02-25 08:38:56 -05:00
Mike Blumenkrantz 51e527a9ba zink: setup CmdBindVertexBuffers2EXT member in screen for dynamic state
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9272>
2021-02-24 21:41:05 -05:00
Mike Blumenkrantz cf8ca77be1 zink: handle point sprite
this needs custom yinvert handling and also prim mode detection, which
gallium can't do on its own

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9115>
2021-02-24 23:25:01 +00:00
Mike Blumenkrantz 5d503bf783 zink: force 128 fs input components on intel drivers
the hardware supports it, the driver supports it, but the driver reports
a lower value due to subtracting some usage that we shouldn't exceed anyway

Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9198>
2021-02-24 16:49:52 +00:00
Mike Blumenkrantz cdb9a4775b zink: set PIPE_CAP_TEXTURE_BORDER_COLOR_QUIRK
non-intel platforms need border colors pre-swizzled

this is an internal khronos spec bug that will (someday) be resolved in
a more detectable manner

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9136>
2021-02-24 16:40:33 +00:00
Erik Faye-Lund dd055f6017 zink: correct inaccurate comment
PIPE_SHADER_CAP_MAX_CONST_BUFFER_SIZE translate into
GL_MAX_*_UNIFORM_COMPONENTS, all of which are allowed to be as
low as 1024 by the GL 4.6 spec.

PIPE_CAP_MAX_SHADER_BUFFER_SIZE translate into
GL_MAX_SHADER_STORAGE_BLOCK_SIZE, which has different minimum values in
different versions of the GL spec. In the GL 4.6 spec for instance, it
is required to be 2^27, the same as what Vulkan requires.

But what these limits are in GL is irrelevant at this level of
abstraction. The OpenGL state-tracker cares, but the Gallium driver
shouldn't have to. So let's just delete those parts of the comments.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9216>
2021-02-24 10:58:15 +00:00
Antonio Caggiano 05a5af02bc zink: support stencil-export
Enable pipe capability of exporting stencil from shader when Vulkan
extension is available.

Signed-off-by: Antonio Caggiano <antonio.caggiano@collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9244>
2021-02-23 22:27:04 -05:00
Erik Faye-Lund ef48d57b77 zink: add X32_S8X24 format
Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Antonio Caggiano <antonio.caggiano@collabora.com>

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9244>
2021-02-23 22:26:55 -05:00
Eric Anholt c80ddf9d74 zink: Remove NULL checks after GET_PROC_ADDR_INSTANCE().
They're already done inside GET_PROC_ADDR*().

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8891>
2021-02-23 18:01:47 +00:00
Dave Airlie 40ea20c5f7 zink: use extensioned draw indirect functions.
The code was using the core versions, but for vulkan 1.0 at
least the extension versions are what is required to be asked for.

This fixes zink loading on lavapipe, and blows up the CI.

v2: Use LOCAL device extension variant (zmike)

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9185>
2021-02-22 21:48:42 +00:00
Mike Blumenkrantz 4d0d678c9f zink: set conformant ubo/ssbo size limits
these caps correspond to descriptor binding limits provided by vulkan drivers

fixes KHR-GL46.shader_storage_buffer_object.basic-max

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9174>
2021-02-22 15:53:30 +00:00
Michel Zou 834b69d1ef zink: fix win32 build
Fixes: 57575627, c4cc3d91

Tested-by: Prodea Alexandru-Liviu <liviuprodea@yahoo.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9126>
2021-02-19 08:49:47 +00:00
Mike Blumenkrantz 0fc146e7da zink: enable GL_CLAMP cap
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8756>
2021-02-18 14:32:05 +00:00
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