Marek Olšák
2c5deaa98b
st/mesa: inline st_finalize_nir_before_variants
...
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33146 >
2025-01-22 02:15:04 +00:00
Marek Olšák
000679b9bf
st/mesa: remove dead/no-op code due to IO being always lowered
...
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33146 >
2025-01-22 02:15:04 +00:00
Marek Olšák
3e32ea3232
st/mesa: assert that all incoming shaders use lowered IO
...
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33146 >
2025-01-22 02:15:04 +00:00
Marek Olšák
3290222a1a
st/mesa: move VS & TES output stores to the end before unlowering IO
...
required by vc4 & vc5
Acked-by: Iago Toral Quiroga <itoral@igalia.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33053 >
2025-01-21 19:38:54 +00:00
Marek Olšák
49897f99d6
st/mesa: recompute IO bases for ARB_vp/fp
...
This is a prerequisite for generating lowered IO for ARB_vp/fp.
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32779 >
2025-01-06 19:09:18 +00:00
Marek Olšák
a408c0aa2b
st/mesa: run DCE before st_unlower_io_to_vars
...
Some lowering passes can leave dead code behind, but dead IO intrinsics
are still counted as enabled IO, which breaks things.
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32779 >
2025-01-06 19:09:18 +00:00
Marek Olšák
3f7911e7d3
st/mesa: fold st_translate_prog_to_nir into prog_to_nir
...
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32779 >
2025-01-06 19:09:18 +00:00
Marek Olšák
dae57e184a
glsl,st/mesa: always lower IO for GLSL, unlower IO for drivers
...
This enables nir_opt_varyings for all gallium drivers.
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31942 >
2024-12-24 05:54:07 -05:00
Marek Olšák
25d4943481
nir: make use_interpolated_input_intrinsics a nir_lower_io parameter
...
This will need to be set to true when the GLSL linker lowers IO, which
can later be unlowered by st/mesa, and then drivers can lower it again
without load_interpolated_input. Therefore, it can't be a global
immutable option.
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32229 >
2024-11-20 02:45:37 +00:00
Marek Olšák
3179c65a5a
st/mesa: add ST_DEBUG=xfb printing xfb info
...
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32175 >
2024-11-18 11:25:18 +00:00
Marek Olšák
b8ee69f7fe
st/mesa: call pipe_screen::finalize_nir outside of st_finalize_nir
...
This is easier to read.
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32175 >
2024-11-18 11:25:18 +00:00
Marek Olšák
a21320ec47
st/mesa: implement key->persample_shading for lowered IO
...
It was only done for variables.
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31994 >
2024-11-06 15:51:51 +00:00
Marek Olšák
09355290d3
st/mesa: fix incorrect types of shader CSOs
...
CSOs are always void *.
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31968 >
2024-11-05 14:13:40 +00:00
Erico Nunes
de9dcea0ca
mesa/st: don't set lower_fdot in draw_nir_options
...
lower_fdot outputs fsum ops like fsum3, which in this stage may
go through nir_to_tgsi paths and tgsi doesn't implement them.
This hits an assert in ntt_emit_alu:
feedback: ../src/gallium/auxiliary/nir/nir_to_tgsi.c:1804:
ntt_emit_alu: Assertion `!"" "Unknown NIR opcode"' failed.
Signed-off-by: Erico Nunes <nunes.erico@gmail.com >
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30079 >
2024-07-10 18:12:20 +00:00
Gert Wollny
7de8a01087
mesa/st: don't use base shader serialization when uniforms are not packed
...
When loading the base shader serialization there is a discrepancy
between the state parameters that may already have been optimized,
because after storing the serialization the shader went through
st_finalize_nir, and _mesa_optimize_state_parameters was run, so
that original state parameters may have been optimized and replaced
by new parameters.
After get_nir_shader is called, the original state parameters are
re-added - in addition to the optimized parameters. This lead to
an bug with the uniform offsets when lowering uniforms to UBOs.
Therefore, as a hotfix for drivers that don't support packed
uniforms, ignore the base serialization and use the
serialization obtained after st_finalize_nir was run. With that
the problem can be avoided.
Fixes: 5eb0136a3c
mesa/st: when creating draw shader variants,
use the base nir and skip driver opts
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10881
v2: reorder conditional evaluation for better readability (zmike)
v3: revert c72bb8de7
("r300: mark new fails") (Pavel Ondračka)
Signed-off-by: Gert Wollny <gert.wollny@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28994 >
2024-05-03 18:41:36 +00:00
Karol Herbst
a2c96b8e7f
mesa/st: lower base invoc and workgroup id
...
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Signed-off-by: Karol Herbst <kherbst@redhat.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26800 >
2024-04-24 20:18:49 +00:00
Mike Blumenkrantz
ef0c9231a7
mesa/st: don't use serialized_nir for cached shaders
...
serialized_nir doesn't exist here, so just use the cached nir
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/11051
Fixes: 5eb0136a3c
("mesa/st: when creating draw shader variants, use the base nir and skip driver opts")
Acked-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28857 >
2024-04-23 21:06:31 +00:00
Mike Blumenkrantz
8d9c5cc6ed
st/program: stop using PIPE_CAP_NIR_COMPACT_ARRAYS and use compact_arrays
...
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28601 >
2024-04-12 18:43:48 +00:00
Mike Blumenkrantz
24453579ad
gallium: rework PIPE_CAP_POINT_SIZE_FIXED
...
this adds modes to the cap which allow drivers to opt out of the
frontend injecting gl_PointSize=1.0 into shaders while still getting
the uniform value uploaded
Reviewed-by: Dave Airlie <airlied@redhat.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28162 >
2024-04-04 11:26:17 +00:00
Mike Blumenkrantz
5eb0136a3c
mesa/st: when creating draw shader variants, use the base nir and skip driver opts
...
draw module shaders are sometimes incompatible with driver-specific
lowering passes, so ensure that the shaders received by draw are as
close to the originating source as possible
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28189 >
2024-03-18 17:05:05 +00:00
Mike Blumenkrantz
1f7a4cf191
mesa/st: add is_draw_shader param to st_finalize_nir
...
this is used for skipping all the driver-specific lowering
it is not currently set
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28189 >
2024-03-18 17:05:05 +00:00
Mike Blumenkrantz
f2f640f3c7
mesa/st: add 'base_serialized_nir'
...
this is the pre-finalize nir which has (ideally) not been mangled
by driver-specific lowering passes
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28189 >
2024-03-18 17:05:05 +00:00
Marek Olšák
1acfc0fc8e
mesa: declare _mesa_HashTable inside structures instead of as a pointer
...
This removes the pointer indirection every time we access the hash table.
Reviewed-by: Adam Jackson <ajax@redhat.com >
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27494 >
2024-02-21 16:04:51 +00:00
Alyssa Rosenzweig
aee66f4c8f
mesa/st: don't use NIR_PASS_V
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26976 >
2024-01-12 01:13:03 +00:00
Alyssa Rosenzweig
76b751c3b1
mesa/st: use pipe_shader_from_nir
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26272 >
2023-11-21 20:14:36 +00:00
Alyssa Rosenzweig
0abf4af443
mesa/st: collapse tgsi deadcode
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26272 >
2023-11-21 20:14:35 +00:00
Alyssa Rosenzweig
002f8b657e
mesa: Convert PTN to register intrinsics
...
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23089 >
2023-07-12 01:34:27 +00:00
Italo Nicola
ec260cb7a2
mesa/main: add PIPE_FORMAT_VYUY and PIPE_FORMAT_B8R8_G8R8
...
Signed-off-by: Italo Nicola <italonicola@collabora.com >
Reviewed-by: Daniel Stone <daniels@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21219 >
2023-07-10 16:29:13 +00:00
Italo Nicola
8c3c9c36f3
mesa/main: add PIPE_FORMAT_YVYU and PIPE_FORMAT_R8B8_R8G8
...
Signed-off-by: Italo Nicola <italonicola@collabora.com >
Reviewed-by: Daniel Stone <daniels@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21219 >
2023-07-10 16:29:13 +00:00
Italo Nicola
26e3be513d
gallium/st: add support for PIPE_FORMAT_NV21 and PIPE_FORMAT_G8_B8R8_420
...
Signed-off-by: Italo Nicola <italonicola@collabora.com >
Reviewed-by: Daniel Stone <daniels@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21219 >
2023-07-10 16:29:13 +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
Yonggang Luo
e53915828f
treewide: Replace the usage of ubyte/ushort with uint8_t/uint16_t
...
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com >
Acked-by: David Heidelberg <david.heidelberg@collabora.com >
Acked-by: Marek Olšák <marek.olsak@amd.com >
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23577 >
2023-06-27 18:18:29 +08:00
Emma Anholt
c52d1acb42
mesa: Drop TGSI token handling
...
Nothing generates TGSI tokens in the frontend any more.
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Acked-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23114 >
2023-06-12 17:37:54 +00:00
Emma Anholt
0ac9541804
gallium: Drop PIPE_SHADER_CAP_PREFERRED_IR.
...
Now everyone's saying NIR, and doing any NTT internally. The only returns
of TGSI were in gallivm_get_shader_param() and
tgsi_exec_get_shader_param(), but the drivers were returning NIR instead
of calling down to them.
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Acked-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23114 >
2023-06-12 17:37:54 +00:00
Emma Anholt
804647acfc
mesa/ati_fs: Move prog->SamplersUsed/TexturesUsed setup to EndFragmentShader.
...
No need to have st_program.c come back into ATI_fs for this when it's a
property of program generation. ARB programs set these up in their
translation, as well.
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23111 >
2023-06-01 23:57:32 +00:00
Emma Anholt
6fde02816d
mesa/ati_fs: Move NIR translation to ATI_fs compile time.
...
Now ati_fs takes the same basic path as prog_to_nir, and we don't have to
think about it so much. Also, the ATI_fs frontend can skip shader info
setup since nir_shader_gather_info does it.
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23111 >
2023-06-01 23:57:32 +00:00
Emma Anholt
a652185696
mesa/ati_fs: Move sampler dim adjustment to a separate NIR pass.
...
This means that the main NIR translation for ATI_fs is now independent of
the fp key, and we could do it earlier in the compile pipeline.
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23111 >
2023-06-01 23:57:32 +00:00
Emma Anholt
00f03a409c
mesa: Move st_prog_to_nir_postprocess out of prog_to_nir.
...
We called it in the else branch, anyway.
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23111 >
2023-06-01 23:57:32 +00:00
Emma Anholt
279403d174
mesa: Move ARB_vp position invariant option handling to NIR.
...
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23111 >
2023-06-01 23:57:32 +00:00
Emma Anholt
66951679f2
mesa: Move ATI_fragment_shader fog code emit to a NIR lowering pass.
...
Now it's implemented as a RMW of the FRAG_RESULT_COLOR output var (or
adjusting the store_output intrinsic's value for lowered i/o), which
should be reusable other places we might want to emit shader code for fog
(ARB_fp, fixed function fragment shaders).
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23111 >
2023-06-01 23:57:32 +00:00
Erik Faye-Lund
5e997beeb7
mesa/st: allow using nir for ff-fragment shaders
...
This is similar to what we do for ff-vertex shaders.
Reviewed-by: Adam Jackson <ajax@redhat.com >
Acked-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/22755 >
2023-05-19 13:51:19 +00:00
Erik Faye-Lund
793840937f
mesa/st: refactor st_translate_fragment_program
...
This makes it look more like st_translate_vertex_program, which is doing
the same thing for vertex-shaders.
Reviewed-by: Adam Jackson <ajax@redhat.com >
Acked-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/22755 >
2023-05-19 13:51:19 +00:00
Emma Anholt
0b22b31190
mesa: Fix precompile of GLSL programs with shadow samplers.
...
Reduces fp variant recompiles on google's CS:GO trace on zink+anv from 115
to 31.
Fixes: 0843d4cbc3
("nir: switch to a normal sampler for ARB program with not depth textures")
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22928 >
2023-05-10 17:55:09 +00:00
Emma Anholt
63f8964d5a
mesa: Fix debug logging of fp compile compare func.
...
When we're doing COMPARE_FUNC_ALWAYS, that's not part of a shader
precompile miss.
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22928 >
2023-05-10 17:55:09 +00:00
Illia Polishchuk
0843d4cbc3
nir: switch to a normal sampler for ARB program with not depth textures
...
It is undefined behavior when an ARB assembly or shadow2d GLSL func
uses SHADOW2D target with a texture in not depth format.
In this case AMD and NVIDIA automatically replaces SHADOW sampler
with a normal sampler and some games like Penumbra Overture which abuses
this UB works fine but breaks with mesa.
Replace the shadow sampler with a normal one here by recompiling
the ARB program variant
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8425
Reviewed-by: Emma Anholt <emma@anholt.net >
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Signed-off-by: Illia Polishchuk <illia.a.polishchuk@globallogic.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22147 >
2023-05-04 15:43:51 +00:00
Erik Faye-Lund
7610747e94
mesa/main: allow passing nir-shaders to st_program_string_notify
...
This will enable us to emit NIR directly for fixed-function vertex
shaders.
Acked-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/22520 >
2023-04-29 12:39:18 +00:00
Rob Clark
f136f89487
mesa/nir: Add some perfetto traces
...
Signed-off-by: Rob Clark <robdclark@chromium.org >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22646 >
2023-04-24 22:42:04 +00:00
Mike Blumenkrantz
a86c710ce5
mesa/st/program: don't init xfb info if there are no outputs
...
this is almost certainly a failure case, but drivers still shouldn't
get xfb info if there are no outputs
affects:
spec@glsl-1.50 @execution@interface-blocks-api-access-members
cc: mesa-stable
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org >
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22448 >
2023-04-14 01:12:08 +00:00
Alyssa Rosenzweig
d998217e17
mesa/st: Set uses_sample_shading when forcing per-sample
...
In addition to requiring per-sample interpolation, sample shading
changes the behaviour of gl_SampleMaskIn, so we need per-sample shading
even if there are no shader-in variables at all. In that case,
uses_sample_shading won't be set by glsl_to_nir. We need to do so here.
Affected dEQP test on asahi:
dEQP-GLES31.functional.shaders.sample_variables.sample_mask_in.bits_unique_per_two_samples.multisample_texture_4
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22402 >
2023-04-11 03:32:41 +00:00
volodymyr.o
47e7b49c61
mesa ctx->API --> _mesa_is_foo(ctx)
...
replaces direct API checks with _mesa_is_...() checks
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8340
Signed-off-by: Volodymyr Obohzyn volodymyr.obozhyn@globallogic.com
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Reviewed-by: Eric Engestrom <eric@igalia.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21556 >
2023-03-20 06:39:57 +00:00