Commit Graph

31 Commits

Author SHA1 Message Date
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 00642ab6ed zink: create a struct for tracking push constant layout
it'll be helpful to update this as we add more values here so we can
avoid having to update all the users

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 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 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 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 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 01f04c7760 Revert "zink: move shader key structs into their own header"
This reverts commit ed7a5a5568.

Fixes: ed7a5a5568 ("zink: move shader key structs into their own header")
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 ed7a5a5568 zink: move shader key structs into their own header
this is going to get messy as we fill them out, so at least we can
keep things split up a bit for organizational sake

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 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 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
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 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 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 d9b7d7b051 zink: pool descriptors per batch
Acked-by: Jordan Justen <jordan.l.justen@intel.com>
2019-10-28 08:51:45 +00:00
Erik Faye-Lund 5dfa6be36e zink: keep a reference to used render-passes
Acked-by: Jordan Justen <jordan.l.justen@intel.com>
2019-10-28 08:51:45 +00:00
Erik Faye-Lund 1927d11fc0 zink: pass screen instead of device to program-functions
Acked-by: Jordan Justen <jordan.l.justen@intel.com>
2019-10-28 08:51:45 +00:00
Erik Faye-Lund 8f6449f296 zink: move primitive-topology stuff into program
The primitive topology is a bit of an odd-ball, as it's the only
truly draw-call specific state that needs to be passed to the program to
get a pipeline.

So let's make this a bit more explict, by passing it separately. This
makes the flow of data a bit easier to wrap your head around.

Acked-by: Jordan Justen <jordan.l.justen@intel.com>
2019-10-28 08:51:44 +00:00
Erik Faye-Lund ce66749e0b zink: cache those pipelines
Acked-by: Jordan Justen <jordan.l.justen@intel.com>
2019-10-28 08:51:44 +00:00
Erik Faye-Lund 8d46e35d16 zink: introduce opengl over vulkan
Here's zink, a so far pretty simple vulkan-gallium driver that is able
to translate some applications from OpenGL to Vulkan.

The compiler is quite limited for now, this will be improved on later.

Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Acked-by: Jordan Justen <jordan.l.justen@intel.com>
2019-10-28 08:51:43 +00:00