Commit Graph

173846 Commits

Author SHA1 Message Date
QwertyChouskie
a57dc77482 docs/features.txt(fix): mark VK_EXT_pipeline_robustness as supported on radv
This was implemented in https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23912

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24013>
2023-07-06 05:53:32 +00:00
Marek Olšák
7b10877078 vbo: correctly restore _VaryingInputs for display list fast path
Fixes: 3a294ff0 - mesa: move the _mesa_set_varying_vp_inputs call to where the state changes
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9007

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23796>
2023-07-06 04:01:50 +00:00
Timothy Arceri
5c1d91d5da st/glsl: merge st_glsl_to_ir.cpp with st_glsl_to_nir.cpp
There is no longer any other IR so lets finally merge these together
to make the code easier to follow.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22846>
2023-07-06 01:21:07 +00:00
Timothy Arceri
c6fe8b7cba st/glsl: merge st_link_glsl_to_nir() into st_link_nir()
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22846>
2023-07-06 01:21:07 +00:00
Timothy Arceri
692c97c70a st/glsl: merge link_shader() into st_link_nir()
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22846>
2023-07-06 01:21:07 +00:00
Timothy Arceri
ac2b3cf7ef glsl: remove glsl ir optimisation loop from linker
We no longer need to call this here and can depend on the glsl_to_nir
pass to call it and clean up anything it cannot handle. Everything
else can now depend on the nir optimisation passes.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22846>
2023-07-06 01:21:07 +00:00
Timothy Arceri
ed3fe89562 glsl: move store_fragdepth_layout() to nir linker
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22846>
2023-07-06 01:21:07 +00:00
Timothy Arceri
e8c2c59372 glsl: drop link_invalidate_variable_locations()
All this code does is reinitialise the values to what the original
ir_variable() call already set them too. This code is very old dating
to the initial glsl compiler support, it has probably been unrequired
for a long time now.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22846>
2023-07-06 01:21:07 +00:00
Timothy Arceri
ee68c633e9 glsl: set last_vert_prog in the nir linker
Another step to removing the GLSL IR linker

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22846>
2023-07-06 01:21:07 +00:00
Timothy Arceri
0d7b5f8b30 glsl: inline link_varyings()
Most code has already been moved to the NIR linker.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22846>
2023-07-06 01:21:06 +00:00
Timothy Arceri
bc66c2588a glsl: remove the always_active_io flag from GLSL IR
No longer used.

Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22846>
2023-07-06 01:21:06 +00:00
Timothy Arceri
06f3988c58 glsl: move disable_varying_optimizations_for_sso() to NIR linker
Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22846>
2023-07-06 01:21:06 +00:00
Timothy Arceri
7cff8d85c0 nir/glsl: add nir_var_declared_implicitly enum
This will be used in the following patch.

Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22846>
2023-07-06 01:21:06 +00:00
Timothy Arceri
a8534c7b4c glsl: drop the dce of global vars from GLSL IR linker
All this does is compilcate things such as forcing us to set
var->data.always_active_io in the glsl linker. Just let NIR clean
these up for us instead.

A Zink test hits a new assert but this is not a regression it just
uncovers an existing mesa bug.

Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22846>
2023-07-06 01:21:06 +00:00
Timothy Arceri
a8c485efee glsl: remove unused system vars
System vars are added to the resource list as inputs so remove any
dead ones before building the list.

Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22846>
2023-07-06 01:21:06 +00:00
Timothy Arceri
cbff8f8c5c glsl: remove unused buffer objects with packed layout
These are currently removed by the GLSL IR DCE pass but we will
drop that in a following patch. Also there are scenarios where these
might not be detected as unused until the NIR optimisations have
been run so we really need to do it here too anyway.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22846>
2023-07-06 01:21:06 +00:00
Timothy Arceri
fa56e911b8 glsl: call assign_attribute_or_color_locations() in NIR linker
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22846>
2023-07-06 01:21:06 +00:00
Timothy Arceri
f3c6718f73 glsl: port assign location code for VS inputs or FS outputs
Here we port the code to the NIR linker.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22846>
2023-07-06 01:21:06 +00:00
Timothy Arceri
6786a39940 glsl: move lowering linker code out of st
Move all these lowering calls into the linker where they belong. This
makes future changes to the linker more flexible and is needed to
allow some following patches as we need to call things in a specific
order.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22846>
2023-07-06 01:21:06 +00:00
Timothy Arceri
a513107424 glsl: move some compiler code out of st
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22846>
2023-07-06 01:21:06 +00:00
Timothy Arceri
ef58936876 mesa: add some new constants
These will be used by the compiler in a following patch.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22846>
2023-07-06 01:21:06 +00:00
Timothy Arceri
5f26c647fb glsl: add some more c wrappers for string_to_uint_map
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22846>
2023-07-06 01:21:06 +00:00
Iago Toral Quiroga
be91133f87 broadcom/compiler: don't leak v3d_compile when finding a new best strategy
If we had selected a best strategy and find an even better one we need to
make sure we free the previous one.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24001>
2023-07-05 21:52:01 +00:00
Iago Toral Quiroga
dcc6288a13 broadcom/compiler: free defin and defout arrays if they already exist
Just like we do for everything else here, since we are going to realloc
them again right below. Notice this is not exactly a memory leak, since
all these arrays are allocated with ralloc using v3d_compile as context,
so all allocations will be eventually freed when the context is destroyed.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24001>
2023-07-05 21:52:01 +00:00
Danylo Piliaiev
b9de7da421 tu: Add missing dbg reg stomping to tu_CmdBeginRendering
Also we shouldn't stomp PC_DRAW_INDX_BASE - we never use it and
stomping it together with some other reg leads to a fault.

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23993>
2023-07-05 21:24:12 +00:00
Konstantin Seurer
39427352f6 llvmpipe,lavapipe: Relayout lp_descriptor
This is more robust in case of a descriptor type mismatch.

Fixes test_null_descriptor_mismatch_type (vkd3d-proton).

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23996>
2023-07-05 20:52:06 +00:00
Konstantin Seurer
7b1a1e2163 llvmpipe: Allocate more dummy sample functions for FORMAT_NONE
When a null texture is sampled with a non-null sampler, having only one
set of sample functions would lead to an OOB read.

Fixes test_null_srv (vkd3d-proton).

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23996>
2023-07-05 20:52:06 +00:00
Konstantin Seurer
91d090f0e7 llvmpipe: Allow comparison sampling for float formats
Fixes test_gather_c (vkd3d-proton).

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23996>
2023-07-05 20:52:06 +00:00
Konstantin Seurer
9caf625490 lavapipe: Set the descriptor count to what vkd3d-proton requires
vkd3d-proton tries to allocate a maximum size descriptor set. The
previous limits were to high for that to work reliably.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23996>
2023-07-05 20:52:06 +00:00
Konstantin Seurer
f281290005 gallivm: Fix atomic_global types
Passes LLVM validation on the test_mesh_shader_rendering vkd3d-proton
test.

cc: mesa-stable

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23996>
2023-07-05 20:52:06 +00:00
Sviatoslav Peleshko
791785c2b4 glsl: Fix yylloc.source propagation in YYLLOC_DEFAULT
Currently, it's always initialized to 0, but we should take the value from
the grouping passed to the macro. This way parser will have the full
location info, and errors originating from it will show the correct
source file number.

Fixes: a0cfe8c4 ("glsl: Fix missing initialization of yylloc.source")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9229
Signed-off-by: Sviatoslav Peleshko <sviatoslav.peleshko@globallogic.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23966>
2023-07-05 20:22:27 +00:00
Patrick Lerda
80ccc3f822 radeonsi: fix refcnt imbalance related to util_blitter_save_fragment_constant_buffer_slot()
Indeed, util_blitter_clear() requires a call to
util_blitter_save_fragment_constant_buffer_slot(),
but most other blitter functions do not.

For instance, this issue is triggered with:
"piglit/bin/object-namespace-pollution glDrawPixels buffer -auto -fbo"
while setting GALLIUM_REFCNT_LOG=refcnt.log.

Fixes: 03bc7503d4 ("radeonsi: save the fs constant buffer to the util blitter context")
Signed-off-by: Patrick Lerda <patrick9876@free.fr>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23856>
2023-07-05 20:01:09 +00:00
Dave Airlie
fb5ecbb4fe clc: llvm 17 requires opaque pointers.
You can't turn this off for llvm17+, this at least makes things
run against llvm git now instead of blowing up in clang.

Reviewed-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24000>
2023-07-05 19:21:49 +00:00
Pavel Ondračka
b392d3ac27 r300: assert that every writer has a reader
Dead writes can lead to problems with regalloc, so add a safety assert
to catch such cases in the vertex shaders at least in the meantime.

Additionally we could think there are no readers due to some shortcoming
of out dataflow analysis or some other bug which we would also like to
know about.

Reviewed-by: Filip Gawin <filip.gawin@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23927>
2023-07-05 18:34:37 +00:00
Pavel Ondračka
5716700bbf r300: disable ntt regalloc for vertex shaders
We have much better regalloc in the backend, and additionally having
a close to ssa form means some optimizations can be more effective.

RV370:
total instructions in shared programs: 82500 -> 81645 (-1.04%)
instructions in affected programs: 32147 -> 31292 (-2.66%)
helped: 396
HURT: 1
total temps in shared programs: 12355 -> 12465 (0.89%)
temps in affected programs: 368 -> 478 (29.89%)
helped: 5
HURT: 96

GAINED: shaders/trine/vp-237.shader_test VS
GAINED: shaders/trine/vp-79.shader_test VS

RV530:
total instructions in shared programs: 130706 -> 129684 (-0.78%)
instructions in affected programs: 40902 -> 39880 (-2.50%)
helped: 428
HURT: 1
total temps in shared programs: 16811 -> 16920 (0.65%)
temps in affected programs: 421 -> 530 (25.89%)
helped: 7
HURT: 89

The instruction decrease is from the channel merging pass which can be
much more agressive when we have ssa-like form.

The temp regressions are cases where we merge something like
  3: MAD output[1].xy, const[8].xy__, input[1].ww__, temp[0].xy__;
 ....
 12: MOV output[1].zw, none.__00;

We always merge the first instruction into the second one, which means
the liverange for temp[0] will be unnecessarily extended here.
This can be fixed with the following draft MR
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19790
however if we ever get a VS pair scheduling support this will be solved
as well as a consequence, so let it be for now.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7693
Reviewed-by: Filip Gawin <filip.gawin@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23927>
2023-07-05 18:34:37 +00:00
Pavel Ondračka
7c291fca15 r300: remove most of backend contant folding
This is now done in NIR. The remaining one for ADD + 0 to MOV is kept
until we move some remaining part of FS lowering to NIR.

There single regressions is in one d3d->glsl shader from Wine.
Wine sets invariant for glPosition which translates to exact bit for all
calculations leading to it (or the TGSI PRECISE flag). r300 backend
ignores is completelly, so removing the backend optimizations should
even make us more correct in this regards.

RV530:
total instructions in shared programs: 130705 -> 130706 (<.01%)
instructions in affected programs: 16 -> 17 (6.25%)
helped: 0
HURT: 1

RV370: no change

Reviewed-by: Filip Gawin <filip.gawin@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23927>
2023-07-05 18:34:37 +00:00
Pavel Ondračka
41f1dd89a3 r300: add some early safe bool lowering
This lowers some of the bool-producing comparisons and following bcsels
if the bool comparison results is only used in the bcsel.
This is a temporary solution before we can fork ntt and optimize
the pass sequence there. Right now if we have something like
bcsel(a,b,0.0) we lower it to flrp in nir_lower_bool_to_float. The
flrp goes to backend where it will be lowered to 2 MADs. However in this
case with one of the arguments being a constant one MAD is enough. The
backend can figure this out in the constant folding pass, however this
is actually one of the last things we need it for. So if we do early
translation of the bcsels, than the algebraic pass can clean it up and
we can remove more backend code in the next patch.

no significant change with RV370 shader-db:
total instructions in shared programs: 82497 -> 82496 (<.01%)
instructions in affected programs: 1029 -> 1028 (-0.10%)
helped: 4
HURT: 3
total temps in shared programs: 12351 -> 12355 (0.03%)
temps in affected programs: 10 -> 14 (40.00%)
helped: 0
HURT: 4

Reviewed-by: Filip Gawin <filip.gawin@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23927>
2023-07-05 18:34:37 +00:00
Pavel Ondračka
0bf6dcb785 r300: lower undefs to zero
They will get translated to read from random register otherwise, which is
not problematic per se, but they will not be regalloced and if the
initial register index was too high, we can fail the shader compilation
because we think we run out of registers.

Almost no effect with shader-db on RV530:
total instructions in shared programs: 130707 -> 130705 (<.01%)
instructions in affected programs: 1012 -> 1010 (-0.20%)
helped: 2
HURT: 1

Reviewed-by: Filip Gawin <filip.gawin@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23927>
2023-07-05 18:34:37 +00:00
Yonggang Luo
ba83c1e254 radeonsi: Use ALIGN_POT instead ALIGN_TO
ALIGN_POT would be a bit faster as it's have no divide arithmetic

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23987>
2023-07-05 18:04:27 +00:00
Friedrich Vock
4880c827d6 radv: Re-enable RT pipeline capture/replay handles
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23516>
2023-07-05 15:58:25 +00:00
Friedrich Vock
169583a4ad radv/rt: Rework radv_GetRayTracingCaptureReplayShaderGroupHandlesKHR
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23516>
2023-07-05 15:58:25 +00:00
Friedrich Vock
fccf6fbeec radv/rt: Replay shader allocations according to capture/replay handle
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23516>
2023-07-05 15:58:25 +00:00
Friedrich Vock
3e9bd821f1 radv/rt: Associate capture/replay handles with stages
For stages where the capture/replay handle is only known after compiling
and uploading the shader, the shader needs to be relocated to the VA
corresponding to the capture/replay address.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23516>
2023-07-05 15:58:25 +00:00
Friedrich Vock
eee0068943 radv/rt: Only compare the non-recursive capture/replay handle
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23516>
2023-07-05 15:58:25 +00:00
Friedrich Vock
59d269c48e radv: Add radv_rt_capture_replay_handle
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23516>
2023-07-05 15:58:25 +00:00
Friedrich Vock
e3bd54d2a8 radv: Add support for creating capture/replay shaders
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23516>
2023-07-05 15:58:25 +00:00
Friedrich Vock
4f192b9af4 radv: Split up implementation of radv_shader_create
This will make it easy to re-use the split-up parts for creating
replayed shaders.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23516>
2023-07-05 15:58:25 +00:00
Friedrich Vock
51f2fa1a5e radv: Break up radv_shader_nir_to_asm
radv_shader_nir_to_asm actually had 3 functions: compiling the NIR to
asm, uploading the shaders and generating debug info for them.
This reduces the functionality of radv_shader_nir_to_asm to only compile
NIR to asm. Uploading the shader and generating debug info is split into
separate functions.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23516>
2023-07-05 15:58:25 +00:00
Friedrich Vock
878a731c77 radv: Add radv_shader_reupload
Used for relocating RT shaders with capture/replay.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23516>
2023-07-05 15:58:24 +00:00
Friedrich Vock
744357477e radv: Add utilities to serialize and deserialize shader allocation info
Can be used to capture/replay an arbitrary sequence of shader
allocations while preserving VAs.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23516>
2023-07-05 15:58:24 +00:00