r600/sfn: factor out adding an input in GS

This is a preparation for the next patch that will fix
indirect access using the second index of load_per_vertex_input

Fixes: 37ae4df3e4 ("glsl: remove most IO optimizations that are replaced by nir_opt_varyings")

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36488>
(cherry picked from commit 9c8d8cfa07)
This commit is contained in:
Gert Wollny 2025-07-31 15:19:20 +02:00 committed by Eric Engestrom
parent 5e992e8969
commit 986396a147
3 changed files with 17 additions and 9 deletions

View file

@ -3634,7 +3634,7 @@
"description": "r600/sfn: factor out adding an input in GS",
"nominated": true,
"nomination_type": 2,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "37ae4df3e4d90a2a474e313d4a563a0bb4c00cfe",
"notes": null

View file

@ -103,19 +103,26 @@ GeometryShader::process_load_input(nir_intrinsic_instr *instr)
(location >= VARYING_SLOT_VAR0 && location <= VARYING_SLOT_VAR31) ||
(location >= VARYING_SLOT_TEX0 && location <= VARYING_SLOT_TEX7)) {
uint64_t bit = 1ull << location;
if (!(bit & m_input_mask)) {
ShaderInput input(driver_location, location);
input.set_ring_offset(16 * driver_location);
add_input(input);
m_next_input_ring_offset += 16;
m_input_mask |= bit;
}
add_input_at(location, driver_location);
return true;
}
return false;
}
void
GeometryShader::add_input_at(gl_varying_slot location, unsigned driver_location)
{
uint64_t bit = 1ull << location;
if (!(bit & m_input_mask)) {
ShaderInput input(driver_location, location);
input.set_ring_offset(16 * driver_location);
add_input(input);
m_next_input_ring_offset += 16;
m_input_mask |= bit;
}
}
int
GeometryShader::do_allocate_reserved_registers()
{

View file

@ -24,6 +24,7 @@ private:
bool process_store_output(nir_intrinsic_instr *intr);
bool process_load_input(nir_intrinsic_instr *intr);
void add_input_at(gl_varying_slot location, unsigned driver_location);
void do_finalize() override;