Commit graph

223192 commits

Author SHA1 Message Date
Samuel Pitoiset
c98ea7d2c9 util,asahi: move drirc entries with no_fp16 to asahi
Asahi is the only driver using them, also rename to asahi_no_fp16.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41731>
2026-05-28 11:24:47 +00:00
Samuel Pitoiset
7ec22275f9 util,turnip: move drirc entries with vk_dont_care_as_load to Turnip
Turnip is the only driver using them, also rename to
tu_dont_care_as_load.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41731>
2026-05-28 11:24:47 +00:00
Samuel Pitoiset
20c77c8ff0 util: remove useless comments in 00-mesa-defaults.conf
Just make it very simple.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41731>
2026-05-28 11:24:47 +00:00
Samuel Pitoiset
8c89732e5b util: add a separate file for hasvk drirc
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41731>
2026-05-28 11:24:47 +00:00
Samuel Pitoiset
1ecb39ce59 util: add a separate file for v3d drirc
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41731>
2026-05-28 11:24:46 +00:00
Samuel Pitoiset
0de4d3d9c6 util: add a separate file for vmgfx drirc
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41731>
2026-05-28 11:24:46 +00:00
Samuel Pitoiset
e6730910be util: add a separate file for d3d12 drirc
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41731>
2026-05-28 11:24:46 +00:00
Samuel Pitoiset
bbc0762223 util: add a separate file for msm drirc
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41731>
2026-05-28 11:24:46 +00:00
Samuel Pitoiset
88c42258f8 util: add a separate file for r600 drirc
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41731>
2026-05-28 11:24:45 +00:00
Samuel Pitoiset
f67ca9c529 util: add a separate file for virgl drirc
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41731>
2026-05-28 11:24:45 +00:00
Samuel Pitoiset
f7b556cf66 util: add a separate file for dozen drirc
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41731>
2026-05-28 11:24:45 +00:00
Samuel Pitoiset
c2f397c90f util: add a separate file for crocus drirc
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41731>
2026-05-28 11:24:44 +00:00
Samuel Pitoiset
8fb53f47b9 util: add a separate file for panfrost drirc
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41731>
2026-05-28 11:24:44 +00:00
Samuel Pitoiset
87860fca06 util: add a separate file for panvk drirc
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41731>
2026-05-28 11:24:44 +00:00
Samuel Pitoiset
31b7d17da4 util: add a separate file for asahi vulkan drirc
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41731>
2026-05-28 11:24:44 +00:00
Samuel Pitoiset
46d36e8332 util: add a separate file for asahi drirc
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41731>
2026-05-28 11:24:43 +00:00
Samuel Pitoiset
a5984c6731 util: add a separate file for iris drirc
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41731>
2026-05-28 11:24:43 +00:00
Samuel Pitoiset
16f851f71a util: add a separate file for r300 drirc
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41731>
2026-05-28 11:24:43 +00:00
Samuel Pitoiset
7599fa8322 util: add a separate file for NVK drirc
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41731>
2026-05-28 11:24:42 +00:00
Samuel Pitoiset
fc7da599fa util: add a separate file for ANV drirc
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41731>
2026-05-28 11:24:42 +00:00
Samuel Pitoiset
85ac866f5e util: add a separate file for turnip drirc
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41731>
2026-05-28 11:24:42 +00:00
Samuel Pitoiset
aba4094636 util: add a separate file for RadeonSI drirc
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41731>
2026-05-28 11:24:41 +00:00
Samuel Pitoiset
c8da45dd99 util: add a separate file for Zink drirc
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41731>
2026-05-28 11:24:41 +00:00
Samuel Pitoiset
a33f1dfd2c util: share the DOCTYPE for all driconf files
We can just pass it to xmllint.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41731>
2026-05-28 11:24:41 +00:00
Pavel Ondračka
d3f9543f2a r300: drop more dead ntr code
This includes some remnants from the regaloc, stale ntr_compile fields,
stale comments, unused helpers and one virgl if workaround.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41577>
2026-05-28 11:07:08 +00:00
Pavel Ondračka
bc89b448c9 r300: use RC registers directly in nir_to_rc
Remove the temporary ntr_src/ntr_dst representation by translating NIR
sources and destinations straight to backend rc_src_register and
rc_dst_register values.

Keep the NIR translator instruction state in backend rc_sub_instruction
form as well, so this path no longer has to stage ureg-shaped registers
before emitting backend instructions.

The only slightly ugly part is saturate, since in the backend its not a
dst parameter, but it rather belongs to the instruction.

Assisted-by: Codex (GPT-5.5)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41577>
2026-05-28 11:07:08 +00:00
Pavel Ondračka
2b417a0183 r300: get rid of the precise modifier
Nothing in the backed actually uses this

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41577>
2026-05-28 11:07:07 +00:00
Pavel Ondračka
1cbe2e0d07 r300: get rid of ntr_emit_load_output
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41577>
2026-05-28 11:07:07 +00:00
Pavel Ondračka
565fe8b58e r300: get rid of ureg_src_undef in ntr
Assisted-by: Codex (GPT-5.5)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41577>
2026-05-28 11:07:06 +00:00
Pavel Ondračka
d3ca1c6e5d r300: get rid of ureg_program in ntr
Assisted-by: Codex (GPT-5.5)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41577>
2026-05-28 11:07:06 +00:00
Pavel Ondračka
c0f4b711e5 r300: stop using ureg_dst_undef in ntr
Assisted-by: Codex (GPT-5.5)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41577>
2026-05-28 11:07:06 +00:00
Pavel Ondračka
d4a52c27ea r300: get rid of user_src and ureg_dst
Just use the backend src/dst structs directly

Assisted-by: Codex (GPT-5.5)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41577>
2026-05-28 11:07:06 +00:00
Pavel Ondračka
a9a2256dc5 r300: drop ureg_DECL_address
ureg_DECL_address just allocates the next sequential TGSI_FILE_ADDRESS
index and returns a ureg_dst.  Also backend's dataflow analysis only
ever marks RC_FILE_ADDRESS[0].x as used (see radeon_dataflow.c and
radeon_optimize.c), so any extra address registers were ignored anyway.

Assisted-by: Codex (GPT-5.5)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41577>
2026-05-28 11:07:05 +00:00
Pavel Ondračka
57c2b0634f r300: drop dead tg4_offsets and query_levels paths in ntr
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41577>
2026-05-28 11:07:05 +00:00
Pavel Ondračka
ec920d947c r300: drop ureg_DECL_vs_input in ntr
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41577>
2026-05-28 11:07:05 +00:00
Pavel Ondračka
e3136a8eba r300: drop ureg_DECL_temporary in ntr
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41577>
2026-05-28 11:07:04 +00:00
Pavel Ondračka
303cea1217 r300: drop ureg shader properties in ntr
Unused by the backend.

Assisted-by: Codex (GPT-5.5)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41577>
2026-05-28 11:07:04 +00:00
Pavel Ondračka
44bd7c63a8 r300: use backend texture targets directly in ntr
Assisted-by: Codex (GPT-5.5)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41577>
2026-05-28 11:07:04 +00:00
Pavel Ondračka
ff9247b781 r300: lower sysvals to varyings
Assisted-by: Codex (GPT-5.5)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41577>
2026-05-28 11:07:03 +00:00
Pavel Ondračka
1306c80016 r300: stop declaring samplers with ureg in ntr
The backend doesn't need/use this.

Assisted-by: Codex (GPT-5.5)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41577>
2026-05-28 11:07:03 +00:00
Pavel Ondračka
335234f4aa r300: use NIR varying locations directly in ntr
Assisted-by: Codex (GPT-5.5)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41577>
2026-05-28 11:07:03 +00:00
Pavel Ondračka
94fa3bcb8c r300: allocate FS outputs from NIR locations
Stop using tgsi_get_gl_frag_result_semantic for fragment outputs. The
direct RC path only needs stable output register indices plus the
OutputColor/OutputDepth mappings, so use NIR gl_frag_result locations
instead.

Assisted-by: Codex (GPT-5.5)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41577>
2026-05-28 11:07:02 +00:00
Pavel Ondračka
1a479bff02 r300: drop the TGSI opcode middle step from ntr
Store rc_opcode directly in struct ntr_insn, populate it with
RC_OPCODE_* values throughout (the few mismatched names get
explicit ntr_OP wrappers: KILL -> KILP, KILL_IF -> KIL), and use
rc_get_opcode_info instead of tgsi_get_opcode_info when walking
the list to emit RC instructions.

Assisted-by: Codex (GPT-5.5)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41577>
2026-05-28 11:07:02 +00:00
Pavel Ondračka
bbd9b31eef r300: emit RC instructions directly from nir_to_rc
Instead of going through the ureg / TGSI tokens / r300_tgsi_to_rc
parsing round-trip, walk the ntr_insn list and rc_constants_add /
rc_insert_new_instruction the result straight into the
radeon_compiler that the caller passes in. Translation reuses the
rc_translate_* helpers extracted in the previous commit.

Changes touching the surrounding code:

- nir_to_rc returns void and takes a struct radeon_compiler *.
- ntr_compile tracks immediates and UBO size in its own
  util_dynarray instead of relying on ureg_DECL_immediate /
  ureg_DECL_constant2D's bookkeeping.
- ntr_output_decl tracks the FS output color/depth indices so
  nir_to_rc can populate compiler->OutputColor[] /
  compiler->OutputDepth at the end - find_output_registers is gone.
- r300_translate_{fragment,vertex}_shader drop the tgsi_scan_shader
  + r300_tgsi_to_rc + ttr.error dance and switch to checking
  compiler.Base.Error.
- write_all (gl_FragColor vs gl_FragData[0]) now comes from a NIR
  walk in r300_translate_fragment_shader rather than reading the
  TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS property.
- r300_tgsi_to_rc.{c,h} are deleted, meson.build updated, and the
  obsolete header includes go away in r300_fs.c / r300_vs.c.

Assisted-by: Codex (GPT-5.5)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41577>
2026-05-28 11:07:02 +00:00
Pavel Ondračka
e5a893c3aa r300: extract TGSI->RC translation helpers into nir_to_rc.h
Pull translate_opcode, translate_register_file, translate_saturate
and the texture-target switch out of r300_tgsi_to_rc into
nir_to_rc.h as static inline rc_translate_* helpers. r300_tgsi_to_rc
now uses them and this is preparation for direct RC emission from
nir_to_rc.c

Assisted-by: Codex (GPT-5.5)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41577>
2026-05-28 11:07:02 +00:00
Pavel Ondračka
ebf2ab9d59 r300: move r300_transform_*_trig_input out of nir_to_rc
This was moved from r300_optimize_nir previously because we that was
called in finalize_nir and thus could be called more than once. This is
not the case anymore. Also drop the stale nine optimization.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41577>
2026-05-28 11:07:01 +00:00
Pavel Ondračka
267b6e4bef r300: emit one full vec4 immediate per NIR load_const
Stop relying on ureg_DECL_immediate's "expand" path to fill earlier
TGSI immediates' unused components with values from later load_const
instructions and depend on later backed pass to do it.

Mostly a wash on shader-db: sub-0.1% regressions on inst/cycles/
consts on RV530/RV370/RV410, with one LOST shader on RV370
(trine/fp-17.shader_test FS).

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41577>
2026-05-28 11:07:01 +00:00
Pavel Ondračka
d8d7e2057f r300: build the dummy fragment shader directly as NIR
Drop the TGSI ureg roundtrip in r300_dummy_fragment_shader and
construct the (0, 0, 0, 1) FS straight via nir_builder, matching
the rest of the compile pipeline that already runs on NIR.

Assisted-by: Codex (GPT-5.5)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41577>
2026-05-28 11:07:01 +00:00
Pavel Ondračka
3740d12ba0 r300: fix use-after-free of remap_table in rc_remove_unused_constants
When externals were not remapped, free(s->remap_table) ran before
rc_constants_print. Print the constants first, then free.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41577>
2026-05-28 11:07:01 +00:00
Pavel Ondračka
d68b7e48da r300: move compiler init earlier and to a helper
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41577>
2026-05-28 11:07:01 +00:00