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
707dc04b78
zink: no-op descriptor updating for draws without descriptors
...
this is a valid case that we can trivially shortcut to cut down on calls
Reviewed-by: Dave Airlie <airlied@redhat.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9155 >
2021-02-24 22:44:50 +00:00
Mike Blumenkrantz
eb7ec9ae70
zink: support gl_LocalGroupSize
...
this requires setting up a spec constant on the pipeline state which can
then propagate to the shader and be used like a regular constant
all ARB_compute_variable_group_size should pass now
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9242 >
2021-02-24 17:02:45 +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
Mike Blumenkrantz
a0911f825d
zink: add a vs shader key for rewriting gl_DrawID
...
if we get a direct draw, we have to rewrite the drawid for it to work as expected
Reviewed-by: Dave Airlie <airlied@redhat.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8971 >
2021-02-16 00:52:32 +00:00
Mike Blumenkrantz
165a940fc2
zink: add a draw_id param to vs push constants
...
gallium always gives us multidraws as individual draws, so we need to feed
this through to the shader
Reviewed-by: Dave Airlie <airlied@redhat.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8971 >
2021-02-16 00:52:32 +00:00
Mike Blumenkrantz
bf4fac51ee
zink: add push constant value to indicate whether the current draw is indexed
...
due to semantic differences between gl and vk variables, this is going to be
necessary for gl_BaseVertex
Reviewed-by: Dave Airlie <airlied@redhat.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8971 >
2021-02-16 00:52:32 +00:00
Mike Blumenkrantz
942ba4e341
zink: unset generated TCS if its parent TESS is unset
...
ensure this doesn't get pulled in during the next program update
Fixes: 334759d850
("zink: implement passthrough tcs shader injection")
Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9057 >
2021-02-15 20:03:23 +00:00
Mike Blumenkrantz
8721a6cbf2
zink: fix streamout for tess stage
...
the tess shader needs to actually emit xfb stuff in order for it to work
Fixes: 2891e0b74e
("zink: pull xfb info from tess shader when applicable")
Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9013 >
2021-02-12 18:03:22 +00:00
Mike Blumenkrantz
b2247a3724
zink: add compute programs and pipelines
...
these are similar to the gfx variants, but mostly smaller
some things are implemented as placeholders for now to make the code
similar to gfx programs/pipelines and thus easier to read/review
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8781 >
2021-02-10 00:19:38 +00:00
Mike Blumenkrantz
6c50b12b9e
zink: rename pipeline_cache_entry -> gfx_pipeline_cache_entry
...
prep for compute pipelines
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8781 >
2021-02-10 00:19:38 +00:00
Mike Blumenkrantz
26b009b054
zink: move tess/geom shader info to vs shader key
...
now that there exists a shader key for vertex stages, we can stop modifying
the zink_shader values and instead use this as a more reliable method of detecting
the state
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8682 >
2021-01-29 15:38:06 +00:00
Mike Blumenkrantz
03971d8ddc
zink: add shader key for vs shaders
...
we're reusing these for tes/gs for now too
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8682 >
2021-01-29 15:38:06 +00:00
Mike Blumenkrantz
079f348a5c
zink: flag previous vertex stages as dirty when toggling a later stage
...
this ensures that the correct variant is used for streamout and halfz
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8682 >
2021-01-29 15:38:06 +00:00
Mike Blumenkrantz
c6741f52bd
zink: remove renderpass refcounting
...
this is useless because we never destroy renderpasses during the lifetime
of a process and don't want to do so
Reviewed-by: Adam Jackson <ajax@redhat.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8227 >
2021-01-14 22:11:42 +00:00
Mike Blumenkrantz
9c18491e41
zink: handle dynamic sampler array indexing for arb_gpu_shader5
...
this requires that arrays of samplers be declared as single variables with
a single binding point, which is then propagated through to the descriptor
set updates
constant sampler array indexing is now un-lowered during access so we can
construct an access chain for both constant and dynamic offset paths
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8155 >
2021-01-04 15:01:59 +00:00
Mike Blumenkrantz
2f5f542460
zink: avoid replacing valid tcs with injected one
...
need to check both arrays here since we only want to use an injected shader
if we don't have a real one, not just if the real one isn't being updated
Fixes: 334759d850
("zink: implement passthrough tcs shader injection")
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8271 >
2020-12-30 16:02:10 +00:00
Mike Blumenkrantz
2472f52e73
zink: handle 0 as valid pipeline hash value
...
xxhash can return 0 as a valid hash so it needs to be handled
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8201 >
2020-12-24 12:49:56 +00:00
Mike Blumenkrantz
334759d850
zink: implement passthrough tcs shader injection
...
GL allows the pipeline to "infer" a tcs shader if a tes shader is bound using
API-specified default values for gl_TessLevelOuter and gl_TessLevelInner,
but VK requires that both shaders be explicitly present
to handle this, create a generic tcs which translates all vs outputs to
invocation-based arrays and copy the appropriate value to the expected tes
input array location. also emit the default inner/outer values as push constants
so we don't have to recompile the shaders whenever the api calls occur
Reviewed-by: Dave Airlie <airlied@redhat.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8152 >
2020-12-22 13:46:38 +00:00
Mike Blumenkrantz
5b2c397c54
zink: add handling for tcs and tes shader states
...
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
536520d056
zink: support PIPE_PRIM_PATCHES
...
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
2891e0b74e
zink: pull xfb info from tess shader when applicable
...
if it's the last vertex stage then it does the xfb
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
0ce792b2e2
zink: change a memcmp==0 to !memcmp
...
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7801 >
2020-12-08 17:35:48 +00:00
Mike Blumenkrantz
b47407269d
zink: initial shader key implementation
...
this is a squashed version of a previously-reviewed series
ref https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7193
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7801 >
2020-12-08 17:35:48 +00:00
Erik Faye-Lund
37a706ad5d
Revert "zink: initial implementation of shader keys"
...
This reverts commit 2be2a500a3
.
Fixes: 2be2a500a3
("zink: initial implementation of shader keys")
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7754 >
2020-11-24 21:51:34 +00:00
Erik Faye-Lund
06cb6c6063
Revert "zink: refcount the shader cache"
...
This reverts commit b9fdc21bba
.
Fixes: b9fdc21bba
("zink: refcount the shader cache")
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7754 >
2020-11-24 21:51:34 +00:00
Erik Faye-Lund
a4d03aa2b1
Revert "zink: fill in params for fs shader keys and flag shader for rebuild"
...
This reverts commit 9aa08221fa
.
Fixes: 9aa08221fa
("zink: fill in params for fs shader keys and flag shader for rebuild")
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7754 >
2020-11-24 21:51:34 +00:00
Erik Faye-Lund
469c59f8ea
Revert "zink: update shader modules in gfx program when flagged dirty"
...
This reverts commit e96afeeb7b
.
Fixes: e96afeeb7b
("zink: update shader modules in gfx program when flagged dirty")
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7754 >
2020-11-24 21:51:34 +00:00
Mike Blumenkrantz
e96afeeb7b
zink: update shader modules in gfx program when flagged dirty
...
for shader keys to work right, these need to actually update the shader
module that's being used
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7193 >
2020-11-13 14:40:33 +00:00
Mike Blumenkrantz
9aa08221fa
zink: fill in params for fs shader keys and flag shader for rebuild
...
we need to check for rebuild any time fb samples becomes 0 in order to remove
any writes to gl_SampleMask
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7193 >
2020-11-13 14:40:33 +00:00
Mike Blumenkrantz
b9fdc21bba
zink: refcount the shader cache
...
we want to be able to reuse this between programs with matching slot
maps, and refcounting allows that without having to copy the table
also add some docs about all the different shader caching structs
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7193 >
2020-11-13 14:40:33 +00:00
Mike Blumenkrantz
2be2a500a3
zink: initial implementation of shader keys
...
these are cached per-program for now since we have to ensure that the slot map
always matches up between shader states
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7193 >
2020-11-13 14:40:33 +00:00
Mike Blumenkrantz
758e932ad2
zink: use same function for all pipe_context::delete_*_state shader methods
...
we don't currently do anything special with any of these, so it'd be better
to not have the same code copy/pasted around
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7485 >
2020-11-08 13:57:38 +00:00
Mike Blumenkrantz
4c734da7de
zink: add gallium handling for geometry shaders
...
this is the create/bind/destroy hooks as well as the u_blitter shader
save during blit setup
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7139 >
2020-10-16 09:15:32 -04:00
Mike Blumenkrantz
d656c600a3
zink: add handling for gs in ntv
...
this hooks up execution modes and the gs-specific instructions
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7139 >
2020-10-16 09:15:26 -04:00
Mike Blumenkrantz
f85488ab82
zink: redo slot mapping again for the last time really I mean it
...
now that shader compiling is happening all at once, we can store the slot
map on zink_gfx_program directly and reserve it dynamically in order to
use up only the slots that are actually being used across all shader stages
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7100 >
2020-10-14 13:46:05 +00:00
Mike Blumenkrantz
61042b1bdb
zink: handle more draw modes
...
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6269 >
2020-08-12 14:52:26 +00:00
Mike Blumenkrantz
ced9e6e3e5
zink: change pipeline hashes to index based on vk primitive type
...
this is a bit more convenient since we always support vk types but not
necessarily gallium types
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6269 >
2020-08-12 14:52:26 +00:00
Antonio Caggiano
1185b3f32d
zink: pre-hash gfx-pipeline-state
...
Store a hash in `zink_gfx_pipeline_state` to keep track of state
changes and avoid to recompute it when the state has not changed.
Signed-off-by: Antonio Caggiano <antonio.caggiano@collabora.com >
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com >
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6061 >
2020-08-07 15:57:59 +02:00
Mike Blumenkrantz
7be12df5e6
zink: rename zink_gfx_program::stages to 'modules'
...
we've been confusing 'stages' and 'shaders' over and over for a long time,
so maybe having a totally different name will help here
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5970 >
2020-08-07 12:36:59 +00:00
Mike Blumenkrantz
6196f2aa93
zink: always compile shaders in pipeline order
...
in order to accurately perform slot/location mapping that's consistent across
stages, we need to go through the stages in order so that we can pass each successive
slot map allocation along to the next compiled stage
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5970 >
2020-08-07 12:36:59 +00:00
Mike Blumenkrantz
c312299316
zink: start using per-stage flags for new shaders, refcount shader modules
...
we don't want to recompile shaders if we don't have to, so we can set bitflags
upon receiving new shader states and then compile only the stages that have
changed while refcounting the unchanged stages
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5970 >
2020-08-07 12:36:59 +00:00
Mike Blumenkrantz
76d3645dd2
zink: use ZINK_SHADER_COUNT instead of PIPE_SHADER_TYPES - 1 everywhere
...
this is just for convenience and consistency
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5970 >
2020-08-07 12:36:59 +00:00
Mike Blumenkrantz
0f059d550b
zink: split up creating zink_shader objects and VkShaderModule objects
...
the actual VkShaderModule is only needed when we're creating a program to
draw with, so this can be split off for "uncompiled" and "compiled" shader
objects which will facilitate implementing shader keys
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5970 >
2020-08-07 12:36:59 +00:00
Mike Blumenkrantz
a03d17ede7
zink: refcount zink_gfx_program objects
...
now that we're tracking these by shader, we want to ensure that they live through
each render pass successfully if there's no flush regardless of the timing when the
shader objects are destroyed. this becomes useful when we split up shader create and compile
functionality in future patches, at which point program refcounts can be changed
during successive draw calls, potentially resulting in a program being destroyed at that
point when it shouldn't be
with this patch, each shader used by the program gets a reference, with the renderpass
batch itself becoming the owner of the program such that it will be deleted
when the draw state gets invalidated and a new program is created
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5970 >
2020-08-07 12:36:58 +00:00
Mike Blumenkrantz
e481d3e2ed
zink: move shader state methods for pipe_context into zink_program.c
...
just moving these so all the shader code can be in one place
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5970 >
2020-08-07 12:36:58 +00:00
Mike Blumenkrantz
adc4f3896a
zink: free pipeline cache during program destroy
...
more leaks
Reviewed-by: Antonio Caggiano <antonio.caggiano@collabora.com >
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5887 >
2020-07-18 07:51:37 +00:00
Mike Blumenkrantz
7116decfce
zink: destroy gfx program when a shader is freed
...
there's no sense in having these objects sitting around when they can
never be used again
requires adding a zink_context* pointer to each program in order to prune
the hash table entry
Reviewed-by: Antonio Caggiano <antonio.caggiano@collabora.com >
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5887 >
2020-07-18 07:51:37 +00:00
Mike Blumenkrantz
ad8e61621b
zink: track program usages for each shader
...
when shaders are created and destroyed in large numbers, the same pointers
get reused for different shaders, which can lead to bad lookups in the
program_cache hash table.
now each shader tracks its program usage to automatically remove itself from
that program in order to avoid hash collisions
fixes mesa/mesa#3053
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5315 >
2020-06-09 20:30:25 +00:00
Erik Faye-Lund
bda64440e4
zink: avoid NULL-deref
...
zink_render_pass_reference will dereference the memory 'dst' points at,
which can't really go well. All we want to do here is to increase the
reference-count, so let's use a different helper for that instead.
CoverityID: 1455200
Reviewed-by: Dave Airlie <airlied@redhat.com >
2019-11-29 09:54:25 +01:00