Faith Ekstrand
498afcdb88
HACK: Only emit OpBar in compute shaders
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:14 +00:00
Faith Ekstrand
611fe837bb
nak: Fix lowering for patch_vertices_in
...
We have to grab the 2nd byte of the sysval for some reason.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:14 +00:00
Faith Ekstrand
efbbc3ed93
nak: Implement load_tess_coord
...
We could lower this to load_per_vertex_output in NIR but then it
confuses all sorts of NIR passes which assume load_*output only
happens in control shaders. We could also add a magic NIR intrinsic
but it's probably easier to just special-case this one.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:14 +00:00
Faith Ekstrand
b5cb508523
nak,nvk: Plumb through tessellation info
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:14 +00:00
Faith Ekstrand
bd90031b5b
nak/nir: Lower load_primitive_id
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:14 +00:00
Faith Ekstrand
c2768736c9
nak: Implement more attribute I/O
...
This commits implement load/store_per_vertex* and load_output which are
required for tessellation shaders. Because things are getting a bit
complicated, it's easier to combine all the attribute load/store ops in
a single case in the match.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:14 +00:00
Faith Ekstrand
091410c708
nak: Add lowering for per-vertex I/O
...
NVIDIA hardware doesn't take a vertex index for per-vertex I/O.
Instead, it takes an offset into the primitive. This has to be fetched
using a combination of SR_INVOCATION_INFO and the ISBERD instruction.
To keep things simple and allow for maximum CSE, we do the lowering in
NIR and patch the load/store_per_vertex_input/output intrinsic.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:14 +00:00
Faith Ekstrand
aa76c86042
nak: Handle location_frac for FS outputs in nak_from_nir.rs
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:14 +00:00
Faith Ekstrand
1251bb7588
nak: Set per patch attribute count both places in the SPH
...
This is what codegen does and it seems to be required. Maybe it's an
SPH version thing?
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:14 +00:00
Faith Ekstrand
f097303a99
nak: Rework OpALd and OpASt a bit
...
Replace the out_load flag with an output flag which we now require to be
set for OpASt. Also, improve printing so we add .O and .P qualifiers as
needed.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:14 +00:00
Faith Ekstrand
f5805dadab
nak: NVIDIA calls them tessellation init shaders
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:13 +00:00
Faith Ekstrand
dfbc03fa88
spirv: Fix locations for per-patch varyings
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:13 +00:00
Faith Ekstrand
c6c2c1b2b2
nak/nir: Lower tessellation and geometry I/O
...
We also need to call nir_lower_indirect_derefs. Even though we're not
lowering anything away, we need to call it so that it will lower clip
distance arrays. The pass always lowers compact array derfs.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:13 +00:00
Faith Ekstrand
93db2c1254
nak: Plumb clip/cull enables through nak
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:13 +00:00
Faith Ekstrand
d4d7f26151
nak: Add enums for sysvals and attributes
...
It's much nicer to have a canonical place for all these things to live
which gives them actual names.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:13 +00:00
Faith Ekstrand
a4c1ec3892
nak: Implement From for SrcRef for more types
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:13 +00:00
Faith Ekstrand
0d725cccbd
nak: Implement NIR control barriers
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:13 +00:00
Faith Ekstrand
5e6dd0412b
nak/builder: Return the instruction from push_*()
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:13 +00:00
Faith Ekstrand
9b6a4aab8d
nak: Add barrier instructions
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:13 +00:00
Faith Ekstrand
2514058c82
nak: Allow encoding Dst::None
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:13 +00:00
Faith Ekstrand
cc6f26b005
nak: Break indirect offset encoding into a helper
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:13 +00:00
Faith Ekstrand
2a61e59bba
nak: Add OpNop which can have a label
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:13 +00:00
Faith Ekstrand
e3fa6f3557
nak: Add a Label struct for branch targets
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:13 +00:00
Faith Ekstrand
f2e07cbab9
nvk: Plumb through XFB info from NAK
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:13 +00:00
Faith Ekstrand
30f01c47c2
nak: Translate XFB info
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:13 +00:00
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