Rhys Perry
495debebad
nir/algebraic: optimize expressions using fmulz/ffmaz
...
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com >
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13436 >
2022-01-20 22:54:42 +00:00
Rhys Perry
14b8227083
nir: add some missing nir_alu_type_get_base_type
...
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com >
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13436 >
2022-01-20 22:54:42 +00:00
Rhys Perry
f2fbba7920
nir/algebraic: optimize open-coded fmulz/ffmaz
...
This pattern will be found in future versions of D3D9 DXVK.
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com >
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13436 >
2022-01-20 22:54:42 +00:00
Rhys Perry
312a284980
nir/algebraic: add ignore_exact() wrapper
...
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com >
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13436 >
2022-01-20 22:54:42 +00:00
Rhys Perry
7f05ea3793
nir: add nir_op_fmulz and nir_op_ffmaz
...
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com >
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13436 >
2022-01-20 22:54:42 +00:00
Dave Airlie
ed0046c5b4
glsl: drop glheader.h include.
...
This is unused.
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14437 >
2022-01-20 00:20:06 +00:00
Dave Airlie
7db6f9b8fc
glsl: drop some more context.h/mtypes.h interactions
...
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14437 >
2022-01-20 00:20:06 +00:00
Dave Airlie
7b7f627600
glsl/fp64: move context.h dependent checks into main.
...
allows dropping context.h include.
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14437 >
2022-01-20 00:20:06 +00:00
Dave Airlie
23b361ae12
glsl: move off mtypes.h in lots of places.
...
This moves to the new split out header files, should mean less recompiling
for unrelated changes.
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14437 >
2022-01-20 00:20:06 +00:00
Dave Airlie
cc38e6e7d3
mtypes: more gl_active_atomic_buffer to shader_types.h
...
allows dropping mtypes.h in glsl compiler
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14437 >
2022-01-20 00:20:06 +00:00
Dave Airlie
fa5788b889
mesa: move ast_to_hir.cpp off mtypes.h
...
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14437 >
2022-01-20 00:20:06 +00:00
Dave Airlie
74fa9c0620
glsl: move ast_function.cpp off mtypes.h
...
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14437 >
2022-01-20 00:20:06 +00:00
Dave Airlie
b4aa10c089
glsl: avoid rebuilding builtin functions on mtypes.h changes.
...
Restrict to when shader types or consts change
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14437 >
2022-01-20 00:20:06 +00:00
Dave Airlie
b40958cbff
glsl: remove some deps on mtypes.h.
...
This should reduce having to rebuild parts of the GLSL compiler
when mtypes.h changes.
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14437 >
2022-01-20 00:20:06 +00:00
Dave Airlie
02bab148f9
mesa/mtypes: move matrix enums to shader_enums.h
...
These are used in the compiler backend also.
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14437 >
2022-01-20 00:20:06 +00:00
Dave Airlie
717a720e9c
mesa: drop unused context parameter to shader program data reference.
...
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14437 >
2022-01-20 00:20:06 +00:00
Dave Airlie
3868b30fc4
glsl/parser: extract consts/exts/api out of context at start.
...
This stores these pointers separately. in theory now gl_context
can be made more opaque later, if we split header files ups.
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14437 >
2022-01-20 00:20:06 +00:00
Emma Anholt
cac6f633b2
nir/opt_offsets: Use nir_ssa_scalar to chase offset additions.
...
For nir_to_tgsi, I want to be able to fold into the base from a vector
load_const, which the ad-hoc scalar chasing couldn't handle.
r300:
total instructions in shared programs: 1278731 -> 1256502 (-1.74%)
instructions in affected programs: 457909 -> 435680 (-4.85%)
total flowcontrol in shared programs: 8316 -> 8313 (-0.04%)
flowcontrol in affected programs: 5 -> 2 (-60.00%)
total temps in shared programs: 213687 -> 213774 (0.04%)
temps in affected programs: 13140 -> 13227 (0.66%)
total consts in shared programs: 952850 -> 949929 (-0.31%)
consts in affected programs: 386352 -> 383431 (-0.76%)
Fixes : #5781
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com >
Acked-by: Matt Turner <mattst88@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14309 >
2022-01-19 22:28:34 +00:00
Emma Anholt
645ca56425
nir/opt_offsets: Also apply the max offset to top-level constant folding.
...
nir_to_tgsi wants this for disabling folding into shared var accesses at
all.
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com >
Reviewed-by: Matt Turner <mattst88@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14309 >
2022-01-19 22:28:34 +00:00
Emma Anholt
ec4b9909f0
nir/opt_offsets: Disable unsigned wrap checks on non-native-integers HW.
...
Since we don't have 32-bit ints, these checks for 32-bit unsigned wrapping
don't help and just reduce optimization opportunities (particularly for
DX9 addressing math).
Doesn't affect any current consumers.
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com >
Reviewed-by: Matt Turner <mattst88@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14309 >
2022-01-19 22:28:34 +00:00
Emma Anholt
700d2fbd0a
nir: Add a .base field to nir_load_ubo_vec4.
...
This lets nir-to-tgsi fold the constant offset of addressing calculations
into the CONST[] reference, which is important for D3D9-era compatibility:
HW of that age has limited uniform space, and if we do the addressing math
as math in the shader for dynamic indexing, the nir_load_consts end up
taking up uniforms we don't have available.
r300:
total instructions in shared programs: 1279699 -> 1279167 (-0.04%)
instructions in affected programs: 134796 -> 134264 (-0.39%)
total instructions in shared programs: 1279699 -> 1279167 (-0.04%)
instructions in affected programs: 134796 -> 134264 (-0.39%)
total temps in shared programs: 213912 -> 213736 (-0.08%)
temps in affected programs: 2166 -> 1990 (-8.13%)
total consts in shared programs: 953237 -> 952973 (-0.03%)
consts in affected programs: 45980 -> 45716 (-0.57%)
Acked-by: Timur Kristóf <timur.kristof@gmail.com >
Reviewed-by: Matt Turner <mattst88@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14309 >
2022-01-19 22:28:34 +00:00
Dave Airlie
ccbf700d6c
nir: remove gl.h include from nir headers.
...
This saves a lot of pointless gl.h includes across the board,
it moves the one place that needs GLenum into a separate file
only used in those passes that require it.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14605 >
2022-01-19 21:54:58 +00:00
Dave Airlie
1352e0ba0c
mesa/*: add a shader primitive type to get away from GL types.
...
This creates an internal shader_prim enum, I've fixed up most
users to use it instead of GL types.
don't store the enum in shader_info as it changes size, and confuses
other things.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14605 >
2022-01-19 21:54:58 +00:00
Dave Airlie
d54c07b4c4
mesa/*: use an internal enum for tessellation primitive types.
...
To avoid dragging gl.h into places it has no business being,
defined tessellation primitive mode to an enum.
This has a lot of fallout all over the place.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14605 >
2022-01-19 21:54:58 +00:00
Connor Abbott
9c9e8c3349
nir: Reorder ffma and fsub combining
...
It's relatively common to do something like "a * b - c", which on most
GPUs can be implemented in a single instruction. Before
opt_algebraic_late this will be something like
"fadd(fmul(a, b), fneg(c))", and we want to turn it info
"ffma(a, b, fneg(c))". But because the fsub pattern was first we
instead turned it into "fsub(fmul(a, b), c)". Fix this by reordering
them.
Selected shader-db results on freedreno:
total instructions in shared programs: 1561330 -> 1551619 (-0.62%)
instructions in affected programs: 780272 -> 770561 (-1.24%)
helped: 1941
HURT: 491
helped stats (abs) min: 1 max: 147 x̄: 7.98 x̃: 4
helped stats (rel) min: 0.07% max: 30.77% x̄: 4.36% x̃: 3.17%
HURT stats (abs) min: 1 max: 307 x̄: 11.76 x̃: 5
HURT stats (rel) min: 0.09% max: 18.71% x̄: 2.26% x̃: 1.38%
95% mean confidence interval for instructions value: -4.57 -3.41
95% mean confidence interval for instructions %-change: -3.21% -2.84%
Instructions are helped.
total nops in shared programs: 358926 -> 356263 (-0.74%)
nops in affected programs: 167116 -> 164453 (-1.59%)
helped: 1395
HURT: 859
helped stats (abs) min: 1 max: 108 x̄: 6.80 x̃: 3
helped stats (rel) min: 0.17% max: 100.00% x̄: 19.15% x̃: 10.57%
HURT stats (abs) min: 1 max: 307 x̄: 7.95 x̃: 3
HURT stats (rel) min: 0.00% max: 381.82% x̄: 20.04% x̃: 10.00%
95% mean confidence interval for nops value: -1.77 -0.59
95% mean confidence interval for nops %-change: -5.55% -2.87%
Nops are helped.
total non-nops in shared programs: 1202404 -> 1195356 (-0.59%)
non-nops in affected programs: 496682 -> 489634 (-1.42%)
helped: 1951
HURT: 265
helped stats (abs) min: 1 max: 39 x̄: 4.02 x̃: 3
helped stats (rel) min: 0.07% max: 15.38% x̄: 2.97% x̃: 1.96%
HURT stats (abs) min: 1 max: 22 x̄: 2.97 x̃: 2
HURT stats (rel) min: 0.05% max: 10.00% x̄: 1.14% x̃: 0.75%
95% mean confidence interval for non-nops value: -3.38 -2.99
95% mean confidence interval for non-nops %-change: -2.60% -2.36%
Non-nops are helped.
total systall in shared programs: 288317 -> 292975 (1.62%)
systall in affected programs: 87876 -> 92534 (5.30%)
helped: 388
HURT: 431
helped stats (abs) min: 1 max: 214 x̄: 14.39 x̃: 8
helped stats (rel) min: 0.25% max: 100.00% x̄: 22.12% x̃: 11.96%
HURT stats (abs) min: 1 max: 232 x̄: 23.77 x̃: 7
HURT stats (rel) min: 0.00% max: 1300.00% x̄: 51.71% x̃: 17.30%
95% mean confidence interval for systall value: 3.07 8.30
95% mean confidence interval for systall %-change: 9.49% 23.97%
Systall are HURT.
(The systall hurt is probably just due to having having fewer
instructions to hide latency with.)
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Acked-by: Daniel Schürmann <daniel@schuermann.dev >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14554 >
2022-01-18 17:44:50 +00:00
Qiang Yu
7d4b0b7789
glsl/nir: convert is_sparse_texels_resident to nir
...
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Signed-off-by: Qiang Yu <yuq825@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14362 >
2022-01-18 16:10:36 +08:00
Qiang Yu
634bb25123
glsl: add sparseTexelsResidentARB builtin function
...
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Signed-off-by: Qiang Yu <yuq825@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14362 >
2022-01-18 16:10:36 +08:00
Qiang Yu
a0b6515ec4
glsl/nir: adjust sparse texture nir_variable
...
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Signed-off-by: Qiang Yu <yuq825@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14362 >
2022-01-18 16:10:36 +08:00
Qiang Yu
3dc950118c
glsl/nir: convert sparse image load to nir
...
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Signed-off-by: Qiang Yu <yuq825@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14362 >
2022-01-18 16:10:36 +08:00
Qiang Yu
f4a972b748
glsl/nir: convert sparse ir_texture to nir
...
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Signed-off-by: Qiang Yu <yuq825@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14362 >
2022-01-18 16:10:35 +08:00
Qiang Yu
f62bbe44c9
glsl: add vec5 glsl types
...
Used by nir_variable holds sparse texture output which is
up to vec5 size.
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Singed-off-by: Qiang Yu <yuq825@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14362 >
2022-01-18 16:10:35 +08:00
Qiang Yu
59d94d8188
glsl: add sparse texture image load builtin functions
...
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Signed-off-by: Qiang Yu <yuq825@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14362 >
2022-01-18 16:10:35 +08:00
Qiang Yu
dcec15d79c
glsl: add _texelFetch related sparse texture builtin function
...
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Signed-off-by: Qiang Yu <yuq825@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14362 >
2022-01-18 16:10:35 +08:00
Qiang Yu
a26dbfc24b
glsl: add _textureCubeArrayShadow related sparse texture builtin func
...
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Signed-off-by: Qiang Yu <yuq825@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14362 >
2022-01-18 16:10:35 +08:00
Qiang Yu
640f909862
glsl: add _texture related sparse texture builtin functions
...
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Signed-off-by: Qiang Yu <yuq825@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14362 >
2022-01-18 16:10:35 +08:00
Qiang Yu
dd84769c55
glsl: ir_texture support sprase texture
...
Sparse ir_texture will set is_sparse and use struct type to
hold both residency code and sampled texel.
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Signed-off-by: Qiang Yu <yuq825@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14362 >
2022-01-18 16:10:35 +08:00
Qiang Yu
67b4c88512
glsl: add ARB_sparse_texture2 extension
...
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Singed-off-by: Qiang Yu <yuq825@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14362 >
2022-01-18 16:10:35 +08:00
Qiang Yu
2cee73f0f7
nir: fix nir_tex_instr hash not count is_sparse field
...
This fixes nir_opt_cse miss replace a non-sparse tex instruction
with a sparse tex instruction and fail the nir_validate_shader().
Fixes: 3a7972f72a ("nir,spirv: add sparse texture fetches")
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Signed-off-by: Qiang Yu <yuq825@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14362 >
2022-01-18 16:10:35 +08:00
Rhys Perry
d95a0b52e4
nir/unsigned_upper_bound: don't follow 64-bit f2u32()
...
Fixes Doom Eternal crash.
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com >
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com >
Fixes: 72ac3f6026 ("nir: add nir_unsigned_upper_bound and nir_addition_might_overflow")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14555 >
2022-01-17 10:59:21 +00:00
Emma Anholt
f6ffefba3e
nir: Apply nir_opt_offsets to nir_intrinsic_load_uniform as well.
...
Doing this for ir3 required adding a struct for limits of how much base to
fold in (which NTT wants as well for its case of shared vars), otherwise
the later work to lower to the 1<<9 word limit would emit more
instructions.
The shader-db results are that sometimes the reduction in NIR instruction
count results in the fewer sampler prefetches due to the shader being
estimated to be shorter (dota2, nexuiz):
total instructions in shared programs: 8996651 -> 8996776 (<.01%)
total cat5 in shared programs: 86561 -> 86577 (0.02%)
Reviewed-by: Rob Clark <robdclark@chromium.org >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14023 >
2022-01-16 19:11:29 +00:00
Emma Anholt
b024102d7c
freedreno/ir3: Use nir_opt_offset for removing constant adds for shared vars.
...
Saves some work in carchase and manhattan31:
instructions in affected programs: 2842 -> 2818 (-0.84%)
nops in affected programs: 1131 -> 1105 (-2.30%)
non-nops in affected programs: 1236 -> 1238 (0.16%)
mov in affected programs: 57 -> 61 (7.02%)
dwords in affected programs: 2144 -> 2150 (0.28%)
cat0 in affected programs: 1195 -> 1169 (-2.18%)
cat1 in affected programs: 151 -> 155 (2.65%)
cat2 in affected programs: 142 -> 140 (-1.41%)
sstall in affected programs: 190 -> 178 (-6.32%)
(ss) in affected programs: 63 -> 63 (0.00%)
systall in affected programs: 532 -> 511 (-3.95%)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14023 >
2022-01-16 19:11:29 +00:00
Jason Ekstrand
8b3d947267
spirv,radv: Fix some GL enum comments
...
GL_LINE_STRIP_ADJACENCY is 0xB. 0xA is GL_LINES_ADJACENCY. While we're
here, drop the ARB prefixes.
Reviewed-by: Caio Oliveira <caio.oliveira@intel.com >
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14157 >
2022-01-14 15:08:09 +00:00
Juan A. Suarez Romero
3b81d2d30d
mesa/st: do not expose ARB_shader_image_load_store if not fully implemented
...
So far we were checking ARB_shader_image_load_store is supported as
requirement to expose GLES 3.1.
But when this extension functionality was added in GLES 3.1 spec, it
was relaxed, and one of its requirements, the support for formatless
writing, was not included.
So this means that a driver that support all the extension
functionality except formatless writing, could expose GLES 3.1, but it
couldn't expose the extension itself (nor GL 4.2, which requires fully
implementation of the extension).
v2:
- Add the same exposure treatment to ARB_shader_image_size (Ilia).
v3:
- Remove dependency for OES_texture_buffer (Ilia).
- Check image resources for GLES 3.1 (Ilia).
v4:
- Check for MaxImageUniforms in compute shader (Ilia).
- Check for max combined image uniforms/ssbo (Ilia).
v5:
- Remove ARB_shader_image_load_store from check (Ilia).
- ARB_shader_image_store and ARB_shader_image required for
ARB_ES3_1_compatibility (Ilia).
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com >
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu >
Reviewed-by: Emma Anholt <emma@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14288 >
2022-01-13 09:12:35 +00:00
Daniel Schürmann
79a987ad2a
nir/opt_if: also merge break statements with ones after the branch
...
This optimizations turns
loop {
...
if (cond1) {
if (cond2) {
do_work_1();
break;
} else {
do_work_2();
}
do_work_3();
break;
} else {
...
}
}
into:
loop {
...
if (cond1) {
if (cond2) {
do_work_1();
} else {
do_work_2();
do_work_3();
}
break;
} else {
...
}
}
As this optimizations moves code into the NIF statement,
it re-iterates on the branch legs in case of success.
Reviewed-by: Emma Anholt <emma@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7587 >
2022-01-13 02:30:32 +00:00
Daniel Schürmann
dad609d152
nir/opt_if: merge two break statements from both branch legs
...
This optimization turns
loop {
...
if (cond) {
do_work_1();
break;
} else {
do_work_2();
break;
}
}
into:
loop {
...
if (cond) {
do_work_1();
} else {
do_work_2();
}
break;
}
Reviewed-by: Emma Anholt <emma@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7587 >
2022-01-13 02:30:32 +00:00
Daniel Schürmann
8a78706643
nir: refactor nir_opt_move
...
This patch is a rewrite of nir_opt_move.
Differently from the previous version, each instruction is checked
if it can be moved downwards and then inserted before the first user
of the definition. The advantage is that less insert operations are
performed, the original order is kept if two movable instructions have
the same first user, and instructions without user in the same block
are moved towards the end.
v2: Only return true if an instruction really changed the position.
Don't care for discards, this will be handled by another MR.
v3: fix self-referring phis and update according to nir_can_move_instr().
v4: use nir_can_move_instr() and nir_instr_ssa_def()
v5: deduplicate some code
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3657 >
2022-01-12 13:41:54 +00:00
Marcin Ślusarz
f286ecf906
nir: handle per-view clip/cull distances
...
Reviewed-by: Caio Oliveira <caio.oliveira@intel.com >
Acked-by: Timur Kristóf <timur.kristof@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14263 >
2022-01-11 22:45:23 +00:00
Marcin Ślusarz
70a9710eee
spirv: mark [Clip|Cull]DistancePerViewNV variables as compact
...
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Reviewed-by: Caio Oliveira <caio.oliveira@intel.com >
Acked-by: Timur Kristóf <timur.kristof@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14263 >
2022-01-11 22:45:23 +00:00
Marcin Ślusarz
0d6f83cbf1
nir: remove invalid assert affecting per-view variables
...
per-view variables can have arbitrary (but > 0) number of array levels
Reviewed-by: Caio Oliveira <caio.oliveira@intel.com >
Acked-by: Timur Kristóf <timur.kristof@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14263 >
2022-01-11 22:45:23 +00:00
Marcin Ślusarz
ce5a8bff77
spirv: handle multiview bits of SPV_NV_mesh_shader
...
Reviewed-by: Caio Oliveira <caio.oliveira@intel.com >
Acked-by: Timur Kristóf <timur.kristof@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14263 >
2022-01-11 22:45:23 +00:00