Jason Ekstrand
28f534350c
nir: Stop assuming shader_info::textures_used is 32-bit
...
This isn't a hot path. We don't need to be manually using the
INSIDE_WORD version which will assert if we ever get a bigger texture
index.
Reviewed-by: Karol Herbst <kherbst@redhat.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15988 >
2022-05-10 11:23:07 -05:00
Jason Ekstrand
625b352f14
nir: Set image_buffers and msaa_images in lower_samplers_as_deref
...
This is where we set images_used so it's less likely that things will
accidentally get out-of-sync.
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15988 >
2022-05-10 11:21:39 -05:00
Jordan Justen
1c3e584dfa
nir/divergence: handle more *_intel intrinsics
...
v2: fix topo/btd (Lionel)
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com >
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Acked-by: Timur Kristóf <timur.kristof@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16421 >
2022-05-10 08:49:58 +00:00
Emma Anholt
f3df3d4c80
glsl: Make all drivers take the GLSLOptimizeConservatively path.
...
Now that all consumers of GLSL use NIR, make the remaining drivers take
the path that relies on NIR to really do optimization.
nouveau steam shader-db runtime -6.69631% +/- 1.29235% (n=12).
No change on shader-db there.
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Reviewed-by: Karol Herbst <kherbst@redhat.com >
Reviewed-by: Rob Clark <robdclark@chromium.org >
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16364 >
2022-05-10 05:03:34 +00:00
Karol Herbst
9c5fd100cc
nir: add a nir_remove_non_entrypoints helper
...
This code just got duplicated a lot. There is still more, but the
remaining instances do a bit more than just removing other functions.
Signed-off-by: Karol Herbst <kherbst@redhat.com >
Reviewed-by: Alyssa Rosenzweig <alyssa@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16348 >
2022-05-10 03:37:44 +00:00
Jason Ekstrand
4b67d70d22
nir: Fix constant folding for non-32-bit ifind_msb and clz
...
Signed-off-by: Karol Herbst <kherbst@redhat.com >
Reviewed-by: Alyssa Rosenzweig <alyssa@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16348 >
2022-05-10 03:37:44 +00:00
Emma Anholt
23cde71bb9
glsl: Stop lowering ir_quadop_vector.
...
Now that everybody goes through NIR, glsl_to_nir is happy to handle the
instruction and turn it into nir_op_vec4 instead of going to a temp
variable and back.
No changes on freedreno shader-db.
Reviewed-by: Rob Clark <robdclark@chromium.org >
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16363 >
2022-05-09 22:13:31 +00:00
Lionel Landwerlin
35d82ecf1e
nir/lower_shader_calls: put inserted instructions into a dummy block
...
When moving code into the main block or loop blocks, put the code into
its own :
if(true) { ... }
block so that we avoid break/continue/return issues.
v2: Also take care of the main block with return instructions
v3: Make deletion more obvious with dummy if blocks (Jason)
v4: Fixup assert for loops (Lionel)
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Fixes: 8dfb240b1f
("nir: Add raytracing shader call lowering pass.")
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16036 >
2022-05-09 08:43:40 +00:00
Lionel Landwerlin
9cf986dcff
nir/lower_shader_calls: don't insert code after break/continue
...
When moving code from below to the insertion cursor point, if the
cursor points to a jump instruction, don't bother inserting the code.
It would break the break/continue assumptions of NIR and would not be
executed anyway.
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Fixes: 8dfb240b1f
("nir: Add raytracing shader call lowering pass.")
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16036 >
2022-05-09 08:43:40 +00:00
Lionel Landwerlin
51dea59eb4
nir/lower_shader_calls: don't use nop instructions as cursors
...
Stop using nop instructions which are causing issues with
break/continue, instead use a nir_cursor (which brings its share of
pain).
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Fixes: 8dfb240b1f
("nir: Add raytracing shader call lowering pass.")
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16036 >
2022-05-09 08:43:40 +00:00
Jason Ekstrand
25661ea028
nir/cf: Return a cursor from nir_cf_extract as well
...
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16036 >
2022-05-09 08:43:40 +00:00
Lionel Landwerlin
d65cf403f3
nir/cf: return cursor after insertion of cf_list
...
This will be useful to cut code from one location and paste it at
another place and later keep pasting after the previous insertions.
v2: update comment (Jason)
deal with stiching 2 empty blocks (Jason)
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16036 >
2022-05-09 08:43:40 +00:00
Icecream95
ad864a7c15
nir/lower_tex: Copy more fields in lower_tex_to_txd and friends
...
Fixes NIR validation errors for OpenMW on Panfrost.
Fixes: 1f97819fbe
("panfrost: Emulate GL_CLAMP on Bifrost")
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com >
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15939 >
2022-05-07 10:51:10 +00:00
Mike Blumenkrantz
5c24eb721a
nir/gather_info: flag fbfetch on subpass image loads
...
might not be able to determine which output is being read, but these
are definitely fbfetch uses (from lavapipe)
Reviewed-by: Dave Airlie <airlied@redhat.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16346 >
2022-05-06 17:04:34 +00:00
Emma Anholt
dd3179aff0
glsl: Remove unused lower_variable_index_to_cond_assign.
...
It's been replaced by nir_lower_indirect_derefs().
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8044 >
2022-05-05 22:25:03 +00:00
Emma Anholt
2529690ee3
glsl: Remove EmitNoLoops and the associated lower_jumps(lower_break=true) code.
...
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8044 >
2022-05-05 22:25:03 +00:00
Emma Anholt
c03cc83ef1
compiler/glsl: Remove the dead parts of build_program_resource_list().
...
These have all moved to NIR linking.
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8044 >
2022-05-05 22:25:03 +00:00
Emma Anholt
3a42e92a4f
glsl: Drop the dead MOD_TO_FLOOR path.
...
It's now called lower_fmod in NIR.
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8044 >
2022-05-05 22:25:03 +00:00
Emma Anholt
7f13763690
glsl: Remove the unused lower_if_to_cond_assign.
...
Now that everything goes through NIR, nir_opt_peephole_select has replaced
it.
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8044 >
2022-05-05 22:25:03 +00:00
Emma Anholt
9617184bc2
glsl: Retire the non-NIR GLSL linking paths.
...
Now that we have only GLSL->NIR as a path in the frontend, we can rely on
the NIR linking support.
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8044 >
2022-05-05 22:25:03 +00:00
Eric Anholt
e566b54a59
glsl: Remove UBO reference lowering.
...
All UBO-supporting drivers now go through the NIR path, which does a
better job of it.
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8044 >
2022-05-05 22:25:03 +00:00
Georg Lehmann
5833fab766
nir/lower_mediump: Add a new pass to fold 16bit image load/store.
...
Signed-off-by: Georg Lehmann <dadschoorse@gmail.com >
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com >
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15179 >
2022-05-04 09:58:03 +00:00
Emma Anholt
695587413b
nir: Don't assert on tg4 offset range.
...
From the GL 4.6 spec: "If the value of any non-ignored component of the
offset vector operand is outside implementation-dependent limits, the
results of the texture lookup are undefined." We shouldn't assertion
fail, then.
GLSL-to-NIR shouldn't be enforcing limits on TG4 offsets, since it doesn't
for non-TG4 tex_src_offset either. Leave it up to the driver to handle
it.
Fixes a crash in a piglit test on nouveau that supplies a negative random
number up to 10,000 as the first coordinate for some reason. Other NIR
drivers lowered TG4 explicit offsets to tex_src_offset, so they weren't
affected.
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16261 >
2022-05-03 21:45:49 +00:00
Alyssa Rosenzweig
ca280b2283
nir: Don't set writes_memory for reading XFB
...
That's a read, not a write. Fixes optimizations getting disabled for fragment
shaders when linked with a shader producing transform feedback varyings.
Fixes: 85a723975b
("nir: add and gather shader_info::writes_memory")
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com >
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com >
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16285 >
2022-05-03 19:02:17 +00:00
Emma Anholt
e3607e96bb
nir: Eliminate out-of-bounds read/writes in local lowering.
...
Avoids nir validation assertion failures, and it's not like backend
drivers would want to see definitely-out-of-bounds read/writes either.
Reviewed-by: Matt Turner <mattst88@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16066 >
2022-05-03 18:32:47 +00:00
Timothy Arceri
180398f785
nir: fix sorting before assigning varying driver locations
...
We need to make sure we also properly sort varyings sharing a single
slot otherwise we can end up assigning earlier components to the next
slot if we have already processed later components.
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6392
Fixes: 1e93b0caa1
("mesa/st: add support for NIR as possible driver IR")
Reviewed-by: Emma Anholt <emma@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16208 >
2022-05-03 00:04:30 +00:00
Karol Herbst
93144175fa
vtn: clamp SpvOpImageQuerySize dest to 32 bit
...
CL image arrays slice is 64 bit for whatever reason...
Signed-off-by: Karol Herbst <kherbst@redhat.com >
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16205 >
2022-04-29 00:01:20 +00:00
Jason Ekstrand
c31db58f65
nir/deref: Add an alu-of-cast optimization
...
Casts shouldn't change the bit pattern of the deref and you have to cast
again after you're done with the ALU anyway so we can ignore casts on
ALU sources. This means we can actually start constant folding NULL
checks even if there are annoying casts in the way.
Reviewed-by: Karol Herbst <kherbst@redhat.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15673 >
2022-04-28 23:05:48 +00:00
Emma Anholt
536c8ee96d
nir/lower_tex: Make the adding a 0 LOD to nir_op_tex in the VS optional.
...
This controls the whole lowering of "make tex ops with implicit
derivatives on non-implicit-derivative stages be tex ops with an explicit
lod of 0 instead", but it's really hard to describe that in a git commit
summary.
All existing callers get it added except:
- nir_to_tgsi which didn't want it.
- nouveau, which didn't want it (fixes regressions in shadowcube and
shadow2darray with NIR, since the shading languages don't expose txl of
those sampler types and thus it's not supported in HW)
- optional lowering passes in mesa/st (lower_rect, YUV lowering, etc)
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16156 >
2022-04-28 21:26:08 +00:00
Karol Herbst
a2c9e1cb50
nir: add 16 and 64 bit fisnormal lowering
...
Signed-off-by: Karol Herbst <kherbst@redhat.com >
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16206 >
2022-04-28 18:36:52 +00:00
Gert Wollny
47d3f7c69f
nir: Don't optimize to 64 bit fsub if the driver doesn't support it
...
Fixes: a4840e15ab
r600: Use nir-to-tgsi instead of TGSI when the NIR debug opt is disabled.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com >
Reviewed-by: Emma Anholt <emma@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16130 >
2022-04-27 00:01:20 +00:00
Jason Ekstrand
e24d8760e9
nir: Constant fold sampler/texture offsets
...
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16171 >
2022-04-26 22:34:39 +00:00
Jason Ekstrand
9332598b26
nir/constant_folding: Break TXB folding into a helper function
...
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16171 >
2022-04-26 22:34:39 +00:00
Yevhenii Kolesnikov
65caf46b3b
nir: Remove single-source phis before opt_if_loop_last_continue
...
We might have some single-source phis leftover after prior optimizations. We
want to get rid of them before merging the blocks.
Fixes: 5921a19d4b
("nir: add if opt opt_if_loop_last_continue()")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6312
Signed-off-by: Yevhenii Kolesnikov <yevhenii.kolesnikov@globallogic.com >
Reviewed-by: Danylo Piliaiev <dpiliaiev@igalia.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16095 >
2022-04-26 17:06:07 +00:00
Jason Ekstrand
ef9d97ec1f
spirv: Handle Op*MulExtended for non-32-bit types
...
Fixes: 58bcebd987
("spirv: Allow [i/u]mulExtended to use new nir opcode")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6306
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16060 >
2022-04-26 15:16:11 +00:00
Alyssa Rosenzweig
94b01ddcdd
nir: Use u_worklist to back nir_block_worklist
...
u_worklist is nir_block_worklist, suitably generalized. All we need to do is
define the macros to translate between the APIs.
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com >
Reviewed-by: Emma Anholt <emma@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16046 >
2022-04-25 23:50:57 +00:00
Jason Ekstrand
1755730362
nir: Lower all bit sizes of usub_borrow
...
It's not clear why this is restricted to 32-bit besides that being the
only bit size where GLSL has an intrinsic for this. All drivers that
set this probably want it lowered for all bit sizes as far as I can
tell.
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6353
Fixes: 8a3e344180
("nir/opt_algebraic: Fix some expressions with ambiguous bit sizes")
Reviewed-by: Emma Anholt <emma@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16146 >
2022-04-25 21:27:09 +00:00
Samuel Pitoiset
4ebb5391ac
nir: mark XFB varyings as unmoveable to prevent them to be remapped
...
XFB varyings are considered as always active IO to prevent them to
be removed or compacted. Though, if the NIR linker doesn't mark XFB
varyings as unmoveable it still possible to remap other varyings to
the same location/component.
Fixes KHR-Single-GL46.enhanced_layouts.xfb_override_qualifiers_with_api
with Zink and a bunch of other dEQP XFB tests.
Cc: mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6301
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16092 >
2022-04-25 07:56:27 +00:00
Samuel Pitoiset
26f74f17d9
nir: fix marking XFB varyings as always active IO
...
Components need to be handled, otherwise if a shader has two XFB
varyings at the same location, only one will be marked as always active.
Cc: mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16092 >
2022-04-25 07:56:27 +00:00
Mike Blumenkrantz
a6a4bf0f1e
glsl/nir: set new_style_shadow for sparse tex ops as necessary
...
this needs the sparse result type, which is not the ir type
Fixes: f4a972b748
("glsl/nir: convert sparse ir_texture to nir")
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Reviewed-by: Qiang Yu <yuq825@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16097 >
2022-04-24 15:56:05 +00:00
Marek Olšák
f7a77ff900
nir: fix an uninitialized variable valgrind warning in nir_group_loads
...
pass_flags is only initialized for grouped loads, so change the order
Fixes: 33b4eb149e
- nir: add new SSA instruction scheduler grouping loads into indirection groups
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16090 >
2022-04-22 18:18:09 +00:00
Lionel Landwerlin
9f44a26462
nir/divergence: handle load_global_block_intel
...
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Fixes: dd39e311b3
("nir: Add nir_intrinsic_{load,store}_deref_block_intel")
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16075 >
2022-04-21 17:41:04 +00:00
Gert Wollny
496fd59d71
nir: Add pass to split 64 bit vec3 and vec4 variable access and phis
...
NTT can't convert local 64 variables of type vec3 or vec4, therefore,
they need to be split into vec2 + double or vec2 + vec2.
At the same time deal splitting the phi nodes.
The pass goes into the global namespace because it is also useful
for r600.
v2: only lower function_temps (Emma) and handle array of arrays (Jason)
v3: - remove bool parameter in function to merge
vec3 and vec4
- simplify load/store_deref_(array|var)
- use a pointer hash table
- simplify PHI splitting (all Emma)
Signed-off-by: Gert Wollny <gert.wollny@collabora.com >
Reviewed-by: Emma Anholt <emma@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15945 >
2022-04-21 16:57:11 +00:00
Erik Faye-Lund
30aab0af07
nir/lower_int64: do not try to clamp floats to int-range
...
The clamping isn't correct, because the exact values ended up getting
rounded off a bit when converting back to floats.
But, converting floats to integers have undefined results when the
float value doesn't fit in the integer. So let's not try to clamp the
value here.
This was caught by digging at a Clang warning, see this thread for
details:
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15547#note_1329769
Acked-by: Boris Brezillon <boris.brezillon@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16022 >
2022-04-21 14:12:34 +00:00
Alexey Bozhenko
25acf1d869
spirv: fix OpBranchConditional when both branches are the same
...
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6246
Signed-off-by: Bozhenko Alexey <oleksii.bozhenko@globallogic.com >
Fixes: 64cb143b92
("spirv: Fix handling of OpBranchConditional with same THEN and ELSE")
Reviewed-by: Caio Oliveira <caio.oliveira@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15929 >
2022-04-21 13:41:24 +00:00
Rhys Perry
dab745f3b4
nir/copy_prop_vars: fix non-vector shader call payloads
...
Fixes RADV+Q2RTX.
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com >
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com >
Fixes: ff05137c2d
("nir: introduce and use nir_component_mask")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16029 >
2022-04-20 21:03:03 +00:00
Jason Ekstrand
1b8a43a0ba
util: Remove util_cpu_detect
...
util_cpu_detect is an anti-pattern: it relies on callers high up in the call
chain initializing a local implementation detail. As a real example, I added:
...a Mali compiler unit test
...that called bi_imm_f16() to construct an FP16 immediate
...that calls _mesa_float_to_half internally
...that calls util_get_cpu_caps internally, but only on x86_64!
...that relies on util_cpu_detect having been called before.
As a consequence, this unit test:
...crashes on x86_64 with USE_X86_64_ASM set
...passes on every other architecture
...works on my local arm64 workstation and on my test board
...failed CI which runs on x86_64
...needed to have a random util_cpu_detect() call sprinkled in.
This is a bad design decision. It pollutes the tree with magic, it causes
mysterious CI failures especially for non-x86_64 developers, and it is not
justified by a micro-optimization.
Instead, let's call util_cpu_detect directly from util_get_cpu_caps, avoiding
the footgun where it fails to be called. This cleans up Mesa's design,
simplifies the tree, and avoids a class of a (possibly platform-specific)
failures. To mitigate the added overhead, wrap it all in a (fast) atomic
load check and declare the whole thing as ATTRIBUTE_CONST so the
compiler will CSE calls to util_cpu_detect.
Co-authored-by: Alyssa Rosenzweig <alyssa@collabora.com >
Reviewed-by: Marek Olšák <maraeo@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15580 >
2022-04-20 18:44:35 +00:00
Daniel Schürmann
90a0675989
nir/lower_alu_to_scalar: don't set the nir_builder cursor
...
This ensures recursive lowering in a single pass.
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15977 >
2022-04-20 17:53:48 +00:00
Mike Blumenkrantz
27a43b531b
nir/fold_16bit_sampler_conversions: add a mask for supported sampler dims
...
AMD might not support cubes, but that doesn't mean cubes can't be used
on other drivers
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15852 >
2022-04-20 12:12:36 +00:00
Erik Faye-Lund
ff05137c2d
nir: introduce and use nir_component_mask
...
The BITFIELD_MASK() macro is intended for using with actual bitfields,
not with nir_component_mask_t. This means we do some extra work to
handle values that are invalid for nir_component_mask_t in the first
place.
This eliminates some warnings on Clang, where the compiler complains
about casting UINT32_MAX to UINT16_MAX.
Reviewed-by: Alyssa Rosenzweig <alyssa@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15547 >
2022-04-19 06:54:47 +00:00