Faith Ekstrand
b9e514d25b
nir/propagate_invariant: Stop passing around nir_dest
...
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24674 >
2023-08-14 21:22:53 +00:00
Faith Ekstrand
c69eb8dfd7
nir/dce: Stop passing around nir_dest
...
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24674 >
2023-08-14 21:22:53 +00:00
Faith Ekstrand
cced401b0f
nir/gather_types: Stop passing around nir_dest
...
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24674 >
2023-08-14 21:22:53 +00:00
Faith Ekstrand
9b4677981f
nir,ntt,a2xx,lima: Stop using nir_dest directly
...
We want to get rid of nir_dest so back-ends need to stop storing it
in structs and passing it through helpers.
Acked-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24674 >
2023-08-14 21:22:53 +00:00
Alyssa Rosenzweig
6b01d6a6b8
nir: Drop nir_dest_init
...
Unused.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24674 >
2023-08-14 21:22:53 +00:00
Konstantin Seurer
7cf9ff304e
nir/from_ssa: Don't insert store_reg instructions before phis
...
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9528
Fixes: ae0408b ("nir/from_ssa: Support register intrinsics")
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24647 >
2023-08-14 19:27:19 +00:00
Karol Herbst
e1c278ae82
clc: use CLANG_RESOURCE_DIR for clang's resource path
...
With certain build configuration that value can be a non empty string and
needs to be used.
This will also require distributions to rebuild mesa if and only if
CLANG_RESOURCE_DIR changes between clang rebuilds or updates.
Signed-off-by: Karol Herbst <git@karolherbst.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23981 >
2023-08-14 10:50:25 +00:00
Faith Ekstrand
65cda2c0e1
nir: Drop nir_foreach_dest()
...
This requires an annoying bit of shuffling into nir_inline_helpers.h but
it's not horrible.
Acked-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24658 >
2023-08-13 17:12:52 +00:00
Faith Ekstrand
95a3c1325d
nir/from_ssa: Use nir_foreach_def() instead of nir_foreach_dest()
...
Acked-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24658 >
2023-08-13 17:12:52 +00:00
Faith Ekstrand
6203750d78
nir: nir_foreach_ssa_def() -> nir_foreach_def()
...
s/nir_foreach_ssa_def/nir_foreach_def/g
followed by
ninja -C _build clang-format
and a little hand clean-up in nir.c.
Acked-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24658 >
2023-08-13 17:12:52 +00:00
Faith Ekstrand
0ec7b8455e
nir: Drop nir_ssa_dest_init_for_type()
...
Replace it with a new nir_def_init_for_type()
Acked-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24658 >
2023-08-13 17:12:52 +00:00
Faith Ekstrand
6914272c30
nir: Drop nir_ssa_dest_init()
...
Acked-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24658 >
2023-08-13 17:12:52 +00:00
Faith Ekstrand
174a75631f
nir/serialize: [De]serialize nir_def nor nir_dest
...
This both gets rid of its use of nir_ssa_dest_init() but also will make
it easier to mechanically remove nir_dest entirely later.
Acked-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24658 >
2023-08-13 17:12:52 +00:00
Faith Ekstrand
9cd9115d87
nir/clone: Clone nir_def nor nir_dest
...
This both gets rid of its use of nir_ssa_dest_init() but also will make
it easier to mechanically remove nir_dest entirely later.
Acked-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24658 >
2023-08-13 17:12:52 +00:00
Faith Ekstrand
d2c4749986
nir: Drop more instances of nir_ssa_dest_init()
...
Catching the cases that Coccinelle missed. Mostly in C++ files using
gtest which causes Coccinelle to just give up and walk away.
Acked-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24658 >
2023-08-13 17:12:52 +00:00
Faith Ekstrand
ed9affa02f
nir: Drop most instances of nir_ssa_dest_init()
...
Generated using the following two semantic patches:
@@
expression I, J, NC, BS;
@@
-nir_ssa_dest_init(I, &J->dest, NC, BS);
+nir_def_init(I, &J->dest.ssa, NC, BS);
@@
expression I, J, NC, BS;
@@
-nir_ssa_dest_init(I, &J->dest.dest, NC, BS);
+nir_def_init(I, &J->dest.dest.ssa, NC, BS);
Acked-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24658 >
2023-08-13 17:12:52 +00:00
Konstantin Seurer
e2a02f3910
clang-format: Disable formatting by default
...
This should make `git clang-format` usable for patches that modify
clang formatted and manually formatted code.
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9492
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24645 >
2023-08-13 16:48:49 +02:00
Alyssa Rosenzweig
09d31922de
nir: Drop "SSA" from NIR language
...
Everything is SSA now.
sed -e 's/nir_ssa_def/nir_def/g' \
-e 's/nir_ssa_undef/nir_undef/g' \
-e 's/nir_ssa_scalar/nir_scalar/g' \
-e 's/nir_src_rewrite_ssa/nir_src_rewrite/g' \
-e 's/nir_gather_ssa_types/nir_gather_types/g' \
-i $(git grep -l nir | grep -v relnotes)
git mv src/compiler/nir/nir_gather_ssa_types.c \
src/compiler/nir/nir_gather_types.c
ninja -C build/ clang-format
cd src/compiler/nir && find *.c *.h -type f -exec clang-format -i \{} \;
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Acked-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Acked-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24585 >
2023-08-12 16:44:41 -04:00
Faith Ekstrand
777d336b1f
nir: clang-format src/compiler/nir/*.[ch]
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24382 >
2023-08-12 19:27:28 +00:00
Faith Ekstrand
6fb63f369c
nir: Add a .clang-format file
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24382 >
2023-08-12 19:27:28 +00:00
Faith Ekstrand
0d9254204b
nir: Add a do to the do/while in nir_const_value_t_array()
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24382 >
2023-08-12 19:27:28 +00:00
Faith Ekstrand
bb8f143749
nir: Wrap pass macros in braces
...
This makes clang-format not mess them up so bad. It's also probably a
good idea to make sure anything we declare in the macro is properly
scoped.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24382 >
2023-08-12 19:27:28 +00:00
Faith Ekstrand
7f6112302b
nir: Pretty format type mapping helpers
...
One of them was even breaking after every return statement. Classy...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24382 >
2023-08-12 19:27:28 +00:00
Faith Ekstrand
59e5b51084
nir: More manual formatting
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24382 >
2023-08-12 19:27:28 +00:00
Faith Ekstrand
57e10f7c93
nir: Don't clang-format debug print setup
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24382 >
2023-08-12 19:27:28 +00:00
Faith Ekstrand
4d54b423e7
nir: Don't clang-format a couple typedefs
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24382 >
2023-08-12 19:27:28 +00:00
Faith Ekstrand
8579224fe1
nir: Don't clang-format const_value helpers
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24382 >
2023-08-12 19:27:28 +00:00
Faith Ekstrand
a89fb36f6b
nir: Re-align a couple enums and add clang-format comments
...
I actually kinda care about the human-readable formatting of these
enums. Keep clang-format from messing them up.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24382 >
2023-08-12 19:27:28 +00:00
antonino
19d318d88a
zink/nir: add a zink specific intrinsic for push constants
...
Push costants in Zink are not flat indexed like in vulkan drivers which
makes the `nir_intrinsic_load_push_constant` intrinsic inappropiate.
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24401 >
2023-08-12 12:20:31 +00:00
Georg Lehmann
9585689839
nir/opt_if: also rewrite uniform uses for read_invocation
...
No Foz-DB changes, but maybe it matters in the future because dxil-spirv
will use read_invocation for WaveReadLaneFirst in fragment shaders.
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24618 >
2023-08-12 07:16:28 +00:00
Alyssa Rosenzweig
10cdc0ad9f
nir: Add load_coefficients_agx intrinsic
...
For lowering interpolation.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24498 >
2023-08-11 09:50:11 +00:00
Mike Blumenkrantz
e9a5da2f4b
nir: add a filter cb to lower_io_to_scalar
...
this is useful for drivers that want to do selective scalarization
of io
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24565 >
2023-08-11 09:02:53 +00:00
Mike Blumenkrantz
550f3dc437
nir/lower_io: add a new doubles-only 64bit lowering option
...
this allows lowering only 64bit float operations for drivers that
support 64bit integers
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24565 >
2023-08-11 09:02:53 +00:00
Mike Blumenkrantz
585f0e8b48
nir: minor fixes for io_to_scalar
...
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24613 >
2023-08-11 05:14:00 +00:00
Iago Toral Quiroga
b2de3f71dc
nir/lower_tex: use a callback to check sampler return size packing
...
The lower_tex_packing pass relies on the sampler index to access packing
information, but this is only valid for tex instructions that have sampler
state (so not txf, etc). Instead, let backends provide a callback to inform
the lowering about the packing used with a given texture instruction which
is more flexible.
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24537 >
2023-08-10 07:10:00 +00:00
Iago Toral Quiroga
374c660582
nir/lower_tex: copy backend_flags field when copying a tex instruction
...
Fixes: 29c4417fb8 ('nir: Add a backend_flags field to nir_tex_instr')
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24537 >
2023-08-10 07:10:00 +00:00
timmac-qmc
ae5a08de67
glsl: fix potential crash with DisableUniformArrayResize
...
We still need to gather information on uniform use when skipping
uniform array resize.
Fixes: ac5af6c0 ("util/driconf: add Dune: Spice Wars workaround")
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24576 >
2023-08-10 01:12:51 +00:00
Georg Lehmann
5c70a55bf3
nir/opt_intrinsics: optimize (exclusive_scan(op, a) op a) to inclusive scan
...
D3D only has exclusive scans so some games use this pattern.
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24557 >
2023-08-09 23:10:13 +00:00
Timothy Arceri
92c5460253
glsl: mark structs containing images as bindless
...
Structs are not allowed to contain an image in regular glsl. The only time
they are intended to be allowed to be declared in a struct is when
they are bindless.
Unfortunately the bindless spec does not meantion this behaviour
explicitly so there is no spec quote to reference but you can see in
the original commit to allow them in mesa that spec clarification was
provided 48b7882200
The spec also states that certain uses are implicitly bindless as per
the following spec quote:
"When used as shader inputs, outputs, uniform block members,
or temporaries, the value of the sampler is a 64-bit unsigned
integer handle and never refers to a texture image unit."
Given images are not allowed in regular glsl for the above types
similair to being forbidden in structs, we can also assume
declarations in structs are implicitly bindless.
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24269 >
2023-08-09 01:27:58 +00:00
Mike Blumenkrantz
f75ba983ca
nir/print: always group variables by type when printing
...
Acked-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23752 >
2023-08-08 13:51:34 +00:00
Mike Blumenkrantz
4a783abd79
nir/print: print location names for (some) tess slots
...
these should be fine to print
Acked-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23752 >
2023-08-08 13:51:34 +00:00
Timothy Arceri
a7850f8cf3
glsl: fix spirv sso validation
...
The api validation calls will segfault without this as it will
try to fallback to string matching names which are NULL. This
would be incorrect behaviour even if the names weren't NULL so
here we correctly set the explicit location flag.
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9483
Fixes: ffdb44d3a0 ("nir/linker: Add inputs/outputs to the program resource list")
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24529 >
2023-08-08 05:36:39 +00:00
Mike Blumenkrantz
ac00f5a361
nir/linking_helpers: force type matching in does_varying_match
...
this otherwise breaks when i/o is scalarized in the producer but not
the consumer
cc: mesa-stable
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24458 >
2023-08-08 03:55:06 +00:00
Mike Blumenkrantz
58ba2bcc8c
nir/lower_io_to_scalar: fix 64bit io splitting
...
this was creating broken 64bit loads/stores using 32bit component
size
cc: mesa-stable
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24458 >
2023-08-08 03:55:06 +00:00
Faith Ekstrand
f2f4e811be
nir/gl: Move glsl_type::sampler_target() into a helper in its one caller
...
The new version also doesn't need to worry about arrays of textures
because the caller already takes care of that.
Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24503 >
2023-08-08 01:50:05 +00:00
Faith Ekstrand
bf6d6a0934
Revert "compiler: Combine duplicated implementation of is_gl_identifier into glsl_types.h"
...
This reverts commit f9860a84b3 . It's a
bit annoying having this scattered around but it's 100% a GLSL thing and
there's no reason why it should go in glsl_types.h. The fact that
glsl_print_type() even uses it is a bit sketchy.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24491 >
2023-08-04 13:14:35 +00:00
Faith Ekstrand
b89a48e00d
Revert "mesa, compiler: Move gl_texture_index to glsl_types.h"
...
This reverts commit 1b836a52ea . This
patch, while claiming to decouple things, actually increases coupling
because it leaks two OpenGL state tracker limits and an OpenGL state
tracker fixed binding enum into the entire compiler. Nothing wants to
know these outside the OpenGL state tracker and the GL-specific compiler
passes. Put them back where they were.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24491 >
2023-08-04 13:14:35 +00:00
Alyssa Rosenzweig
f34bae7d8c
nir: Simplify alu_instr_is_copy
...
mov is considered vec.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24432 >
2023-08-03 22:40:30 +00:00
Alyssa Rosenzweig
3f5e8b85f7
nir: Drop no-op all_srcs_are_ssa
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24432 >
2023-08-03 22:40:30 +00:00
Alyssa Rosenzweig
92e59b5af5
nir: Remove no-op remove_def_cb
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24432 >
2023-08-03 22:40:30 +00:00