Commit Graph

114 Commits

Author SHA1 Message Date
Erik Faye-Lund
80285db9ef zink: lower smooth-lines if not supported
This implements line-smoothing the same way as the draw-module does,
except using a geometry shader instead of a CPU pass.

Ideally, this should be enabled either by checking for the various
smooth-line caps, or by a DRIconf setting.

Unfortunately, RADV doesn't support he smooth-lines features, and we
don't want to force it down a pessimistic shader-key code-path. So that
plan is out the window for now.

While DRIconf is also neat, it's a bit of work to wire up, and we don't
really know of any real-world applications who would need this yet. So,
for now, let's just unconditionally enable is on the IMG proprietary
driver, which is going to need this for sure.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19847>
2022-12-16 13:57:19 +00:00
Erik Faye-Lund
66b438dca1 zink: do not complain about missing line-stipple support
We can lower this now, so let's not complain about it...

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19117>
2022-12-01 10:21:02 +00:00
Erik Faye-Lund
9f67e72e84 zink: setup driver-workaround for missing linestipple
This is not ideal, but at least it should work. In the long run, we
might want to store a bit per mode we're missing, so we can do this
conditionally. But that's quite a bit more complicated, so let's go with
this for now.

The line-stippling logic needs non-optimal shader-keys. So let's drop
some perf on the floor here.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19117>
2022-12-01 10:21:02 +00:00
Erik Faye-Lund
0ebd6f52a2 zink: reuse rast_prim for line-rasterization check
The check_warn variable is true a bit too often; in realtity it's not
*either* of these conditions that makes things lines, it's the last one
in the pipeline. But we already have a state for this, so let's reuse
that instead of recomputing.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19048>
2022-10-24 16:41:48 +00:00
Mike Blumenkrantz
5aa437a9f1 zink: fix ds3 line stipple enable handling
ds3 can be used without line stipple enable if the driver doesn't support
line stipple, so this needs special-casing

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19204>
2022-10-21 21:27:13 +00:00
Mike Blumenkrantz
12fded5965 zink: fix duplicate VK_DYNAMIC_STATE_LINE_STIPPLE_EXT setting
if ds3 is used, this is already set above

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19204>
2022-10-21 21:27:13 +00:00
Mike Blumenkrantz
b38cb40fdb zink: allow creating full pipelines unoptimized
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18961>
2022-10-11 17:02:14 +00:00
Mike Blumenkrantz
0b81ff0193 zink: set depth clamp
this is correct according to spec

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18911>
2022-10-01 02:18:39 +00:00
Mike Blumenkrantz
11c4d79709 zink: use an extra pipeline state bit to track coherent fbfetch usage for gpl outputs
bringing parity to non-gpl codepath

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18911>
2022-10-01 02:18:39 +00:00
Mike Blumenkrantz
617ee2855b zink: don't deref prog->shaders during pipeline construction
this may or may not be valid depending on (upcoming) threading changes,
and the nir pointers are all readily available

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18911>
2022-10-01 02:18:39 +00:00
Mike Blumenkrantz
dd9e5fea20 zink: add param to disable optimization when combining pipeline libraries
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18911>
2022-10-01 02:18:39 +00:00
Mike Blumenkrantz
53a5291803 zink: set VK_PIPELINE_CREATE_RETAIN_LINK_TIME_OPTIMIZATION_INFO_BIT_EXT
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18911>
2022-10-01 02:18:39 +00:00
Mike Blumenkrantz
4c228f00a2 zink: don't access prog->shaders array during pipeline compile
this may or may not have valid data

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18911>
2022-10-01 02:18:39 +00:00
Mike Blumenkrantz
a5b8466e4a zink: use more dynamic state3 when available
this is an all-or-nothing type of thing, where either all the blend/ms
states are available or they aren't

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18890>
2022-09-30 23:17:25 +00:00
Mike Blumenkrantz
c7f46d2ad6 zink: use dynamic state3 rasterization states when available
this massively reduces the number of pipelines required

also temporarily disable GPL until a few more patches land since something's
weird and broken

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18890>
2022-09-30 23:17:25 +00:00
Mike Blumenkrantz
56fb258064 zink: replace mixed_zs with zs feedback loops
this is the more technically correct way to handle such things

SoroushIMG <soroush.kashani@imgtec.com>

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18855>
2022-09-29 15:29:51 +00:00
Mike Blumenkrantz
97c7eaf17f zink: use feedback loop layout to correctly handle implicit feedback loops
an implicit feedback loop occurs when an app happens to bind the same image
as both a framebuffer attachment and a sampler for the same draw

an explicit feedback loop occurs when an app uses fbfetch to read data back
from the framebuffer using input attachments

fbfetch is already handled, but implicit feedback loops require more work:
* detecting them happens on-the-fly
* pipeline variants are required

this handles implicit feedback loops by detecting them at draw time during
barrier updates and then flagging pipeline state change to trigger variant creation.
the bits are then unset when the framebuffer/sampler binds are removed

fixes #7309

fixes (tu):
KHR-GL46.texture_barrier.disjoint-texels
KHR-GL46.texture_barrier.overlapping-texels
KHR-GL46.texture_barrier.same-texel-rw-multipass
KHR-GL46.texture_barrier_ARB.disjoint-texels
KHR-GL46.texture_barrier_ARB.overlapping-texels
KHR-GL46.texture_barrier_ARB.same-texel-rw-multipass

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18787>
2022-09-27 17:32:56 +00:00
Mike Blumenkrantz
93696693b2 zink: remove color_write_missing driver workaround
this is no longer used

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18784>
2022-09-26 21:58:58 +00:00
Mike Blumenkrantz
32f50630d6 zink: move to AoS for gfx program shader modules
this matches up better with the actual usage; the zink_shader_module
is still stored in the shader cache

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18786>
2022-09-26 17:12:31 +00:00
Mike Blumenkrantz
5b1137043c zink: don't always set VK_DYNAMIC_STATE_VERTEX_INPUT_BINDING_STRIDE_EXT with gpl
this is illegal

Fixes: 86e4fcd9a9 ("zink: add a graphics pipeline library implementation")

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18729>
2022-09-22 01:12:01 +00:00
Mike Blumenkrantz
5c6d61635d zink: don't call CmdBindVertexBuffers2EXT with no attributes
cc: mesa-stable

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18729>
2022-09-22 01:12:01 +00:00
SoroushIMG
359713d174 zink: track min_samples state for per sample shading
Vulkan pipeline state sampleShadingEnable and minSampleShading are directly related to GL_SAMPLE_SHADING_ARB.
Track min_samples provided by st and include it in pipeline state.
This was seen as failures in cts cases where per sample shading along with sample interpolation qualifiers are tested:
dEQP-GL45-ES31.functional.shaders.multisample_interpolation.sample_qualifier.*

Cc: mesa-stable
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18314>
2022-09-05 12:45:04 +00:00
Mike Blumenkrantz
e1ad7bf0b7 zink: move compute pipeline cache update to caller
this is more flexible

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18197>
2022-08-30 04:11:16 +00:00
Mike Blumenkrantz
ad96d21239 zink: remove use_local_size from compute pipeline state
this is redundant since pipeline state gets flagged on bind

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18197>
2022-08-30 04:11:16 +00:00
Mike Blumenkrantz
c4f78396d4 zink: support PIPE_CAP_FBFETCH_COHERENT
that's what VK_EXT_rasterization_order_attachment_access is for

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18133>
2022-08-24 12:19:13 +00:00
Mike Blumenkrantz
a4830517c2 zink: use PIPE_CAP_RGB_OVERRIDE_DST_ALPHA_BLEND
this eliminates the bespoke handling I wrote to do the same thing a while ago

cc: mesa-stable

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18135>
2022-08-20 01:27:13 +00:00
Mike Blumenkrantz
62b3e75e4c zink: use a maybe more accurate wild guess for pcp-less gpl
this is only reachable with an env var, so being wrong is still okay,
but maybe be right slightly more often

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17955>
2022-08-15 14:58:37 +00:00
Mike Blumenkrantz
6ac64fcb6b zink: delete zink_shader_stage()
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18051>
2022-08-14 18:38:05 -04:00
Mike Blumenkrantz
b988b8c84b zink: remove all pipe_shader_type usage
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18051>
2022-08-14 18:38:05 -04:00
Mike Blumenkrantz
7040745060 zink: ZINK_SHADER_COUNT -> ZINK_GFX_SHADER_COUNT
more descriptive

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18051>
2022-08-14 18:38:04 -04:00
Mike Blumenkrantz
86e4fcd9a9 zink: add a graphics pipeline library implementation
this is only for driver debugging/validation and will not
activate unless ZINK_PIPELINE_LIBRARY_FORCE=1 is specified since it
can only ever add overhead and slow things down

...for now

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17225>
2022-08-04 02:16:18 +00:00
Mike Blumenkrantz
ae022b784c zink: always set vertex dynamic states
even if there are no bindings, this should be set in order to further
deduplicate the number of pipelines needed

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17225>
2022-08-04 02:16:18 +00:00
TSnake41
a02c026eb7 zink: print result code string on vulkan failure
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17726>
2022-07-28 16:06:50 +00:00
Eric Engestrom
0ab33ec6d4 zink: use updated tokens from vk.xml
Signed-off-by: Eric Engestrom <eric@igalia.com>
Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Acked-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17342>
2022-07-12 15:53:11 +00:00
Mike Blumenkrantz
8f57818ce5 zink: fix-ish depth clipping without VK_EXT_depth_clip_enable
if this extension is unsupported, use the previous behavior and hope for the best

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17237>
2022-06-24 19:54:44 +00:00
Timur Kristóf
21ea19d504 zink: Always enable depth clamping, make depth clipping independent.
Enabling depth clamping ensures that the Vulkan driver respects
the depth range that zink sets on viewport objects in zink_draw.

When depth clipping is required, use VK_EXT_depth_clip_enable to
enable that independently of depth clamping.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16929>
2022-06-21 15:44:54 +00:00
Mike Blumenkrantz
336b5c8823 zink: fix dynamic stride conditional in pipeline creation
if dynamic stride isn't used then this struct member must be filled

cc: mesa-stable

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17010>
2022-06-14 19:21:15 +00:00
Mike Blumenkrantz
7ff3c75ef3 zink: expand patch_vertices pipeline key bitsize
no need to compact the bits anymore, so make this a uint16

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16838>
2022-06-03 01:23:58 +00:00
Mike Blumenkrantz
1c0434dd95 zink: use dynamic patch vertices if available
this one's a little different from other dynamic states in that it
isn't expected to change much, so I've kept it outside of draw handling
since it can be trivially applied elsewhere with no chance of impacting perf

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16838>
2022-06-03 01:23:58 +00:00
Mike Blumenkrantz
7016055c82 zink: use dynamic cull mode
more dynamic states = fewer pipeline cache misses

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16838>
2022-06-03 01:23:58 +00:00
Mike Blumenkrantz
c81cd989c8 zink: use dynamic rendering (most of the time)
this is a simplified version of the renderpass infrastructure which
tracks rendering info on the context and updates it incrementally to
try and reduce cpu overhead

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16476>
2022-05-20 16:42:21 +00:00
Erik Faye-Lund
4654a57bb5 zink: call vk-functions through dispatch-table
This is going to make it possible to avoid linking directly to the
vulkan-loader.

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/11550>
2022-05-13 16:23:41 +00:00
Mike Blumenkrantz
1eada1b02d zink: selectively disable dynamic vertex stride
if the vertex state doesn't meet the requirements to use this feature,
fall back to fully-baked pipelines instead of violating spec

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16018>
2022-04-19 03:44:59 +00:00
Mike Blumenkrantz
8806f444a5 zink: fix extended restart prim types without dynamic state2
these are all allowed with the ext

cc: mesa-stable

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15978>
2022-04-18 22:20:36 +00:00
Mike Blumenkrantz
e96342c531 zink: rework missing feature warnings
the previous methodology triggered warnings any time a rasterizer state
was created with unsupported features without determining whether those
features would actually be used

a more optimal process is to check for missing features at pipeline creation,
as all the necessary info is now available, and spurious warnings can be avoided

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15778>
2022-04-06 22:52:12 +00:00
Mike Blumenkrantz
a489b1d936 zink: add a param to warn_missing_feature() macro
this lets the macro be used more programmatically since the variable
is defined externally

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15778>
2022-04-06 22:52:12 +00:00
Mike Blumenkrantz
206d2f3127 zink: add driver workaround for broken EXT_depth_clip_control
for #6186

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15513>
2022-03-30 03:36:33 +00:00
Tales Lelo da Aparecida
fe66cff411 zink: validate and log errors on vulkan calls
This commit also replaces debug_printf with mesa_loge

Signed-off-by: Tales Lelo da Aparecida <tales.aparecida@gmail.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15601>
2022-03-28 21:46:59 -03:00
Mike Blumenkrantz
f9390dac23 zink: use the current compute shader, not the base one
this is the current variant and the one that should be used

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15501>
2022-03-22 12:54:43 +00:00
Mike Blumenkrantz
447099629e zink: use EXT_color_write_enable when possible
this should only verify that drivers aren't completely broken by
enabling it and have no other changes

Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15392>
2022-03-21 22:58:12 -04:00