gallivm/nir: split load_const out into backend helper.
This just makes adding aos support easier. Acked-by: Jose Fonseca <jfonseca@vmware.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15140>
This commit is contained in:
@@ -1145,10 +1145,7 @@ static void visit_load_const(struct lp_build_nir_context *bld_base,
|
||||
const nir_load_const_instr *instr)
|
||||
{
|
||||
LLVMValueRef result[NIR_MAX_VEC_COMPONENTS];
|
||||
struct lp_build_context *int_bld = get_int_bld(bld_base, true, instr->def.bit_size);
|
||||
for (unsigned i = 0; i < instr->def.num_components; i++)
|
||||
result[i] = lp_build_const_int_vec(bld_base->base.gallivm, int_bld->type, instr->def.bit_size == 32 ? instr->value[i].u32 : instr->value[i].u64);
|
||||
memset(&result[instr->def.num_components], 0, NIR_MAX_VEC_COMPONENTS - instr->def.num_components);
|
||||
bld_base->load_const(bld_base, instr, result);
|
||||
assign_ssa_dest(bld_base, &instr->def, result);
|
||||
}
|
||||
|
||||
|
||||
@@ -121,6 +121,9 @@ struct lp_build_nir_context
|
||||
LLVMValueRef (*get_ssbo_size)(struct lp_build_nir_context *bld_base,
|
||||
LLVMValueRef index);
|
||||
|
||||
void (*load_const)(struct lp_build_nir_context *bld_base,
|
||||
const nir_load_const_instr *instr,
|
||||
LLVMValueRef result[NIR_MAX_VEC_COMPONENTS]);
|
||||
void (*load_var)(struct lp_build_nir_context *bld_base,
|
||||
nir_variable_mode deref_mode,
|
||||
unsigned num_components,
|
||||
|
||||
@@ -1028,6 +1028,17 @@ static void emit_load_ubo(struct lp_build_nir_context *bld_base,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
emit_load_const(struct lp_build_nir_context *bld_base,
|
||||
const nir_load_const_instr *instr,
|
||||
LLVMValueRef outval[NIR_MAX_VEC_COMPONENTS])
|
||||
{
|
||||
struct lp_build_context *int_bld = get_int_bld(bld_base, true, instr->def.bit_size);
|
||||
for (unsigned i = 0; i < instr->def.num_components; i++)
|
||||
outval[i] = lp_build_const_int_vec(bld_base->base.gallivm, int_bld->type, instr->def.bit_size == 32 ? instr->value[i].u32 : instr->value[i].u64);
|
||||
memset(&outval[instr->def.num_components], 0, NIR_MAX_VEC_COMPONENTS - instr->def.num_components);
|
||||
}
|
||||
|
||||
|
||||
static void emit_load_mem(struct lp_build_nir_context *bld_base,
|
||||
unsigned nc,
|
||||
@@ -2506,6 +2517,7 @@ void lp_build_nir_soa(struct gallivm_state *gallivm,
|
||||
bld.bld_base.interp_at = emit_interp_at;
|
||||
bld.bld_base.load_scratch = emit_load_scratch;
|
||||
bld.bld_base.store_scratch = emit_store_scratch;
|
||||
bld.bld_base.load_const = emit_load_const;
|
||||
|
||||
bld.mask = params->mask;
|
||||
bld.inputs = params->inputs;
|
||||
|
||||
Reference in New Issue
Block a user