Commit graph

180599 commits

Author SHA1 Message Date
Faith Ekstrand
62ac73d5e3 nouveau/parser: Dump SET_STREAM_OUT_CONTROL_* properly
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:13 +00:00
Faith Ekstrand
c2c010055a nak: Handle non-constant I/O offsets
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:13 +00:00
Faith Ekstrand
827dba398d nak: Don't allocate bitsets in liveness data-flow
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:13 +00:00
Faith Ekstrand
04658a2a11 nak/bitset: Add a helper for modifying in-place
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:13 +00:00
Faith Ekstrand
19e0c52837 nak: Run simple liveness data-flow bottom-up
Rookie mistake... The liveness algorithm propagates information from
later blocks to earlier blocks so if you run bottom-up it's exactly two
passes when there aren't loops.  If you run top-down, it's quadratic in
the number of blocks.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:13 +00:00
Faith Ekstrand
046a2d5004 nvk: Set clip/cull_enable for NAK shaders
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:13 +00:00
Faith Ekstrand
a4ff5a9fc6 nak: Simplify I/O gathering
This adds mark_attrs_(read|written)() helpers to VtgIoInfo which take a
range of attribute addresses and mark the range as-needed.  It adds a
similar mark_attr_read() helper to FragmentIoInfo which only marks a
single address and takes a PixelImap.  This gets us down to only needing
to duplicate the address range if ladder twice.  For VTG I/O, having it
take ranges will be more ergonamic when it comes time to handle non-
constant I/O offsets.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:13 +00:00
Faith Ekstrand
32910d3016 nak: rustfmt fixes
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:13 +00:00
Faith Ekstrand
40ec7efa07 nak: Move NIR enum translation out of nak_sph.rs
Better to keep all the NIR stuff together.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:13 +00:00
Mary Guillemard
145213fd2c nak: Restructure ShaderInfo
Signed-off-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:13 +00:00
Mary Guillemard
267a4f07d0 nak: Remove encode_hdr_for_nir
Now unused as nak_sph::encode_header handles it.

Signed-off-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:13 +00:00
Mary Guillemard
a926c67335 nak: Collect information to create SPH
This should cover everything except tesselation.

Signed-off-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:13 +00:00
Mary Guillemard
8d07d033ae nak: Add a complete wrapper around SPH
Signed-off-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:13 +00:00
Faith Ekstrand
97c249a353 nak: Fix printing of OpASt
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:13 +00:00
Faith Ekstrand
a7eb42119a nak: Take component into account in store_output
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:13 +00:00
Faith Ekstrand
330f3e6fa8 nvk: Lower more draw system values
In codegen, these are handled by the backend by passing in cbuf numbers
and offsets.  NAK expects us to lower these in the driver.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:13 +00:00
Faith Ekstrand
263dfd4838 nvk: Add a helper for lowering system values to root table loads
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:13 +00:00
Mary Guillemard
1a2bed819d nak: Fix ALD/AST encoding for vtx and offset
The bit offsets were inverted compared to gv100 codegen.

Signed-off-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:13 +00:00
Faith Ekstrand
66c9c40f68 nak: Handle modifiers in dedup_srcs() in opt_lop()
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:13 +00:00
Faith Ekstrand
1b6962eb7e nak: Provide more detail when printing IR after passes
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:13 +00:00
Faith Ekstrand
5654366a55 nak: Fold source modifiers in legalize
We were smashing them to None later but didn't actually take them into
account in fold_lop_src() to ensure the smash was valid.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:13 +00:00
Faith Ekstrand
6da06bf7d7 nak/nir: Return one sample for gl_SampleMaskIn[0] when sample shading
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:13 +00:00
Faith Ekstrand
0e393f0d58 nak/nir: Interpolate gl_PointCoord
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:13 +00:00
Faith Ekstrand
062735c1cc nak/nir: Add a load_frag_w helper
Also, rework things a bit.  The one functional change is that we now put
1/w in gl_FragCoord.w which should fix a CTS test.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:13 +00:00
Faith Ekstrand
8ec753749a nak/nir: Fix sample vs. pixel input interpolation
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:13 +00:00
Faith Ekstrand
1ab35afc26 nak/nir: Move frag_coord/sample_pos lowering to FS input lowering
It monkeys about with interpolation so it makes more sense to keep all
that stuff together.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:13 +00:00
Faith Ekstrand
460a0d8a4c nak/nir: Plumb the FS key into lower_fs_input_intrin
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:13 +00:00
Mary Guillemard
580b98f353 nak: Gather global memory usage for ShaderInfo
Signed-off-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:13 +00:00
Mary Guillemard
0afc6fa880 nak: Add for_each_instr in Shader
Allows to visit each instructions without remapping every functions.

Signed-off-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:13 +00:00
Faith Ekstrand
e9bad677af nak: Plumb uses_kill through from nak_from_nir
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:13 +00:00
Faith Ekstrand
274d521c22 nak: Take components into account in load_*input
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:13 +00:00
Faith Ekstrand
543eebb272 nak: Handle interpolate_at_offset
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:13 +00:00
Faith Ekstrand
f5c41151f2 nak/nir: Use nir_shader_intrinsics_pass for FS inputs
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:13 +00:00
Mary Guillemard
04911df940 nak: Add support for fddx and fddy
This uses SHFL in combination with FSWZADD.

Signed-off-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:13 +00:00
Faith Ekstrand
e174fc9ab3 nak/nir: Fix helper invocations
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:13 +00:00
Faith Ekstrand
4e14cefa70 nak: Add support for gl_FrontFace
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:12 +00:00
Faith Ekstrand
2c91587ac5 nak: Saturate depth writes
Otherwise, they get may clipped away.  This seems wrong in light of
unrestricted depth but it fixes a bunch of CTS tests for now so let's go
with it.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:12 +00:00
Faith Ekstrand
6abbef04b0 nvk/nak: Translate our new FS flags from NAK to nvk_shader
Eventually, we want to drop all this garbage from nvk_shader and just
use nak_shader_info directly but, for now, it's less disruptive to just
translate from new to old.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:12 +00:00
Faith Ekstrand
34cc225070 nak: Plumb more FS info through to the C API
These are needed for state setup, not the shader header so we have to
plumb them all the way through to the driver.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:12 +00:00
Faith Ekstrand
0ec283083c nak: Re-plumb compute shader info
Put the stuff in nak_shader_info in nak.h into a union so we can have
other stage info exported as well.  Then plumb local_size and smem_size
through ShaderInfo like we do for a bunch of the FS things.  While we're
shuffling things around, pull nak_shader_info::cs into a union.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:12 +00:00
Faith Ekstrand
9eeda9dd6d nak: Rework FS outputs again
This time we map them to a consistent output address space like we do
for all other I/O and system values and do the remap in nak_from_nir.
This lets us know very precise usage information and more robustly build
the OMask in the shader header.  We also handle location_frac now.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:12 +00:00
Faith Ekstrand
7ce8470bd4 nak: Stash a ShaderInfo in ShaderFromNir
We're going to want to gather data into this struct as we go.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:12 +00:00
Faith Ekstrand
3cdc26c157 nak: Pull sm, num_gprs, and tls_size into a ShaderInfo struct
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:12 +00:00
Faith Ekstrand
141137ad14 nak: Use count_attribute_slots for FS input var sizes
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:12 +00:00
Faith Ekstrand
64168e58cd nvk,nak: Plumb through the zs_self_dep key bit
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:12 +00:00
Faith Ekstrand
c54f622a93 nak: Set TLS size properly in the shader header
We were only accounting for load/store_scratch before, not spilling.
Pull the value from the Shader, that one's accurate.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:12 +00:00
Faith Ekstrand
cbb05f0e6b nak: Implement discard and demote
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:12 +00:00
Faith Ekstrand
24c2728ca5 nak: Implement load_sample_id and load_sample_mask_in
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:12 +00:00
Faith Ekstrand
595f03957c nak/nir: Several FS output fixes
1. Lower arrays to elements
 2. Multiply locations by 4 to get GPR numbers
 3. Fix dual-src blend
 4. Sample mask and depth both consume slots if either is used

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:12 +00:00
Faith Ekstrand
ea750f1ffd nak: Handle empty OpFSOut
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:12 +00:00