mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 11:48:06 +02:00
nir: move nir_load_system_value() to nir_builder.h
To make review easier. Signed-off-by: Rhys Perry <pendingchaos02@gmail.com> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6587>
This commit is contained in:
parent
f8ee599dfb
commit
b3c65f97ad
2 changed files with 18 additions and 18 deletions
|
|
@ -517,6 +517,24 @@ nir_build_alu_src_arr(nir_builder *build, nir_op op, nir_ssa_def **srcs)
|
|||
return nir_builder_alu_instr_finish_and_insert(build, instr);
|
||||
}
|
||||
|
||||
/* Generic builder for system values. */
|
||||
static inline nir_ssa_def *
|
||||
nir_load_system_value(nir_builder *build, nir_intrinsic_op op, int index,
|
||||
unsigned num_components, unsigned bit_size)
|
||||
{
|
||||
nir_intrinsic_instr *load = nir_intrinsic_instr_create(build->shader, op);
|
||||
if (nir_intrinsic_infos[op].dest_components > 0)
|
||||
assert(num_components == nir_intrinsic_infos[op].dest_components);
|
||||
else
|
||||
load->num_components = num_components;
|
||||
load->const_index[0] = index;
|
||||
|
||||
nir_ssa_dest_init(&load->instr, &load->dest,
|
||||
num_components, bit_size, NULL);
|
||||
nir_builder_instr_insert(build, &load->instr);
|
||||
return &load->dest.ssa;
|
||||
}
|
||||
|
||||
#include "nir_builder_opcodes.h"
|
||||
|
||||
static inline nir_ssa_def *
|
||||
|
|
|
|||
|
|
@ -50,24 +50,6 @@ nir_${name}(nir_builder *build, ${src_decl_list(opcode.num_inputs)})
|
|||
}
|
||||
% endfor
|
||||
|
||||
/* Generic builder for system values. */
|
||||
static inline nir_ssa_def *
|
||||
nir_load_system_value(nir_builder *build, nir_intrinsic_op op, int index,
|
||||
unsigned num_components, unsigned bit_size)
|
||||
{
|
||||
nir_intrinsic_instr *load = nir_intrinsic_instr_create(build->shader, op);
|
||||
if (nir_intrinsic_infos[op].dest_components > 0)
|
||||
assert(num_components == nir_intrinsic_infos[op].dest_components);
|
||||
else
|
||||
load->num_components = num_components;
|
||||
load->const_index[0] = index;
|
||||
|
||||
nir_ssa_dest_init(&load->instr, &load->dest,
|
||||
num_components, bit_size, NULL);
|
||||
nir_builder_instr_insert(build, &load->instr);
|
||||
return &load->dest.ssa;
|
||||
}
|
||||
|
||||
<%
|
||||
def sysval_decl_list(opcode):
|
||||
res = ''
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue