Commit Graph

187 Commits

Author SHA1 Message Date
Mike Blumenkrantz
330f728cc4 lavapipe: use the component offset directly for xfb
the mask is only indicative of the components being used, not the offset
from which they start

cc: mesa-stable

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24163>
2023-07-28 13:14:35 +00:00
Mike Blumenkrantz
59396eefe6 nir: fix slot calculations for compact variables with location_frac
a variable with a component offset may span multiple slots, and this cannot
be inferred from its type alone (e.g., compacted clip+cull distances)

cc: mesa-stable

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24163>
2023-07-28 13:14:35 +00:00
Konstantin Seurer
32403c696b lavapipe: Implement samplerYcbcrConversion
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24295>
2023-07-25 08:22:27 +00:00
Konstantin Seurer
8f003569dd lavapipe: Make shader compilation thread safe
Fixes random crashes because the LLVM context is not thread safe.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22828>
2023-06-30 12:56:35 +00:00
Konstantin Seurer
91eb0f5b08 lavapipe: EXT_descriptor_indexing
fails:
dEQP-VK.descriptor_indexing.storage_texel_buffer
dEQP-VK.descriptor_indexing.storage_texel_buffer_after_bind
dEQP-VK.descriptor_indexing.storage_texel_buffer_after_bind_in_loop
dEQP-VK.descriptor_indexing.storage_texel_buffer_in_loop
dEQP-VK.descriptor_indexing.storage_texel_buffer_minNonUniform

They seem to be vertex-shader related.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22828>
2023-06-30 12:56:35 +00:00
Konstantin Seurer
ea848d3721 lavapipe: Lower non uniform access
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22828>
2023-06-30 12:56:35 +00:00
Konstantin Seurer
12a7fc51c7 lavapipe: Rework descriptor handling
Instead of using gallium binding slots for binding descriptors,
descriptor sets have UBOs that contain the llvmpipe descriptors.
Descriptor sets are bound by binding their UBO to the corresponding
slot.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22828>
2023-06-30 12:56:35 +00:00
Konstantin Seurer
9b12e0ec02 lavapipe: Make pipeline_lock generic for accessing the queue
Since we must not access the pipe_context concurrently, it makes sense
to add a lock for all kinds of quere related operations. This way, we
can safely create pipe resources inside Vulkan entry points that can be
used concurrently.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22828>
2023-06-30 12:56:35 +00:00
Konstantin Seurer
001a3769a6 lavapipe: Lower more texture OPs
Tries to reduce the number of textures we need to pre-compile.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22828>
2023-06-30 12:56:35 +00:00
Caio Oliveira
59cc77f0fa compiler: Move from nir_scope to mesa_scope
Just moving the enum and performing renames, no behavior change.

Acked-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23328>
2023-06-19 23:29:26 +00:00
Mike Blumenkrantz
1563aea69f lavapipe: add version uuid to shader binary validation
this ensures compatible shader binaries across versions

cc: mesa-stable

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23636>
2023-06-14 14:32:36 +00:00
Mike Blumenkrantz
976dd26004 lavapipe: NV_device_generated_commands
this adds sufficient handling to pass the vkd3d-proton tests as well
as running cts on zink, which is gonna have to be enough since there's
no vkcts

it works by dynamically generating a vk_cmd_queue list of commands just
like the regular cmd queue would generate, with the minor change that
the final link has a nulled next pointer to correctly handle buffer copies,
where the last link would otherwise have a next pointer pointing to the
original cmd list

Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23394>
2023-06-08 01:22:01 +00:00
Dave Airlie
bfed41d322 lavapipe: don't remove queue family barriers.
This fixes the remaining barrier issues.

Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23453>
2023-06-07 04:21:09 +00:00
Dave Airlie
5c6c226f5a lavapipe: add support for task/mesh shader stages in various places
this bumps the LVP_SHADER_STAGES to allow task/mesh shaders to be used,
and adds them to various state binding and execution places.

Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23066>
2023-06-06 05:01:47 +10:00
Dave Airlie
ccb16259cb lavapipe: handle some mesh shader stage differences.
certain state info is no long required if you using mesh/task in the
pipeline.

Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23066>
2023-06-06 05:01:47 +10:00
Dave Airlie
cbb8632991 lavapipe: fix pipeline sanitizing.
This isn't needed for fragment shader.

Cc: mesa-stable
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23066>
2023-06-06 05:01:46 +10:00
Thomas H.P. Andersen
16fb3995f3 lavapipe: remove unused tgsi includes
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22838>
2023-05-25 08:20:32 +00:00
Dave Airlie
aedbc35857 lvp: use stage iterator macros instead of explicit loops
This cleans up the compute checks

Reviewed-by: Brian Paul <brianp@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23065>
2023-05-23 14:39:33 +00:00
Dave Airlie
2fbe256e82 lvp: explictly skip compute shader stage.
To add mesh/task later we have to loop over more stages the other side
of compute. So explicitly skip compute for now.

This has a couple of subtle bits to it, and I think there might be a bug
in pre rast

Reviewed-by: Brian Paul <brianp@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23065>
2023-05-23 14:39:33 +00:00
Dave Airlie
6046b6ea94 lavapipe: add lavapipe specific shader stages define.
This currently does nothing, but we need to increase this to add
task/mesh later.

Reviewed-by: Brian Paul <brianp@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23065>
2023-05-23 14:39:32 +00:00
Mike Blumenkrantz
fef493f745 lavapipe: more correctly handle null pipeline states
it's not necessary to check whether dynamic states are set before
the null checks since any issues there would be VU errors

Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22236>
2023-05-22 23:51:21 +00:00
Alyssa Rosenzweig
c323762f9f treewide: Stop lowering legacy atomics
There are no more producers of legacy atomics so these calls are inert.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23036>
2023-05-16 22:36:21 +00:00
Alyssa Rosenzweig
969a9fe7f2 lavapipe: Lower legacy atomics sooner
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23036>
2023-05-16 22:36:21 +00:00
Mike Blumenkrantz
de70c0cf88 lavapipe: implement inline variant caching
inlining is great, but it's less great if a new variant must be created
for every draw

to avoid this, cache inlined variants for reuse

Reviewed-by: Brian Paul <brianp@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22363>
2023-04-11 01:37:05 +00:00
Mike Blumenkrantz
d87756923d lavapipe: refactor/consolidate GPL shader copying
this is easier to read/modify

also add asserts for members that should be null

Reviewed-by: Brian Paul <brianp@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22352>
2023-04-10 21:35:57 +00:00
Mike Blumenkrantz
e33fda3732 lavapipe: copy fragment shader when merging GPL pipelines
this otherwise loses access data and causes flakiness with atomic ops

Fixes: 6e5fe71599 ("lavapipe: split out shader struct members into their own struct")

Reviewed-by: Brian Paul <brianp@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22352>
2023-04-10 21:35:57 +00:00
Mike Blumenkrantz
8b3022c918 lavapipe: implement EXT_shader_object
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22233>
2023-03-31 13:19:27 +00:00
Mike Blumenkrantz
d97d921634 lavapipe: dynamically bind noop fs at draw time when needed
this is simpler than special casing it everywhere

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21866>
2023-03-30 04:50:36 +00:00
Mike Blumenkrantz
3366b4a9b9 lavapipe: unify lvp_pipeline_nir creation
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21866>
2023-03-30 04:50:36 +00:00
Mike Blumenkrantz
5880fc00c2 lavapipe: add a ref for the tess_ccw nir on creation
not sure if it matters but good to be consistent

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21866>
2023-03-30 04:50:36 +00:00
Mike Blumenkrantz
d127c134eb lavapipe: refactor pipeline destroy a bit
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21866>
2023-03-30 04:50:36 +00:00
Mike Blumenkrantz
30db1800e9 lavapipe: delete unused struct member
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21866>
2023-03-30 04:50:36 +00:00
Mike Blumenkrantz
062bf6f455 lavapipe: PIPE_SHADER_ -> MESA_SHADER_
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21866>
2023-03-30 04:50:36 +00:00
Mike Blumenkrantz
771e0e14a8 lavapipe: refactor shader compile functions to not take pipeline params
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21866>
2023-03-30 04:50:35 +00:00
Mike Blumenkrantz
f986f85fdc lavapipe: don't memcpy tess_ccw when copying pipeline library shaders
this gets handled later

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21866>
2023-03-30 04:50:35 +00:00
Mike Blumenkrantz
9193fb2efd lavapipe: always copy streamout info when creating shaders
llvmpipe should be smart enough to figure this out internally

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21866>
2023-03-30 04:50:35 +00:00
Mike Blumenkrantz
7413ce7e0d lavapipe: break out main shader lowering into separate function
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21778>
2023-03-08 18:25:01 +00:00
Mike Blumenkrantz
f2765cd6d6 lavapipe: move uniform inline functions to shader struct
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21778>
2023-03-08 18:25:01 +00:00
Mike Blumenkrantz
990fa82c61 lavapipe: move xfb init to shader struct
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21778>
2023-03-08 18:25:01 +00:00
Mike Blumenkrantz
b221f6c128 lavapipe: more small shader struct usage tweaks
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21778>
2023-03-08 18:25:01 +00:00
Mike Blumenkrantz
a0c9609e59 lavapipe: pass shader struct and layout to scan_pipeline_info()
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21778>
2023-03-08 18:25:01 +00:00
Mike Blumenkrantz
6e5fe71599 lavapipe: split out shader struct members into their own struct
kinda gross but simplifies some code

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21778>
2023-03-08 18:25:01 +00:00
Mike Blumenkrantz
2af3476639 lavapipe: split out spirv compile of shaders
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21778>
2023-03-08 18:25:01 +00:00
Faith Ekstrand
96c832c47e spirv: Always emit deref_buffer_array_length intrinsics
All the drivers have been converted to setting this option now except
imagination and they don't support SSBOs yet.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3993
Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21446>
2023-02-24 20:37:10 +00:00
Faith Ekstrand
1386e1476a lavapipe: Set spirv_options::use_deref_buffer_array_length
It'll get lowered to get_ssbo_size by nir_lower_explicit_io() so the
driver should never notice this change.

Acked-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21446>
2023-02-24 20:37:10 +00:00
Mike Blumenkrantz
fd0562693d lavapipe: try harder to reuse pipeline layouts during merge
the original code was quite conservative and always created a new layout,
but many times this is unnecessary, and the original layout can just be refcounted
since it doesn't need to be merged

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21051>
2023-02-02 04:49:42 +00:00
Mike Blumenkrantz
a1a859328b lavapipe: delete lvp_pipeline::mem_ctx
this is no longer used

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21051>
2023-02-02 04:49:42 +00:00
Mike Blumenkrantz
59af3b4ad4 lavapipe: delete unused pipelines immediately
deferring these can cause memory ballooning and oom

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21051>
2023-02-02 04:49:42 +00:00
Mike Blumenkrantz
408606af02 lavapipe: create gfx gallium csos at pipeline bind
this should minimize pipeline creation time and make fast-linking "fast"

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21051>
2023-02-02 04:49:42 +00:00
Mike Blumenkrantz
6f0303ba76 lavapipe: break out (and slightly refactor) gallium shader cso creation
there's also now a(n unused) flag to indicate that the csos have been created

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21051>
2023-02-02 04:49:42 +00:00