From: Dave Airlie Date: Fri, 19 Jun 2020 06:51:50 +0000 (+1000) Subject: gallivm/nir: add load push constant support X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3abf548270bbe92aea17b976397813ba763f4ea0;p=mesa.git gallivm/nir: add load push constant support This convets the push constant load to a ubo load against the 0 constant buffer, which is where the vallium layer will bind things. Reviewed-by: Roland Scheidegger Part-of: --- diff --git a/src/gallium/auxiliary/gallivm/lp_bld_nir.c b/src/gallium/auxiliary/gallivm/lp_bld_nir.c index d2336c17365..702a0bd4ec4 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_nir.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_nir.c @@ -1019,6 +1019,19 @@ static void visit_load_ubo(struct lp_build_nir_context *bld_base, offset_is_uniform, idx, offset, result); } +static void visit_load_push_constant(struct lp_build_nir_context *bld_base, + nir_intrinsic_instr *instr, + LLVMValueRef result[4]) +{ + struct gallivm_state *gallivm = bld_base->base.gallivm; + LLVMValueRef offset = get_src(bld_base, instr->src[0]); + LLVMValueRef idx = lp_build_const_int32(gallivm, 0); + bool offset_is_uniform = nir_src_is_dynamically_uniform(instr->src[0]); + + bld_base->load_ubo(bld_base, nir_dest_num_components(instr->dest), nir_dest_bit_size(instr->dest), + offset_is_uniform, idx, offset, result); +} + static void visit_load_ssbo(struct lp_build_nir_context *bld_base, nir_intrinsic_instr *instr, @@ -1396,6 +1409,9 @@ static void visit_intrinsic(struct lp_build_nir_context *bld_base, case nir_intrinsic_load_ubo: visit_load_ubo(bld_base, instr, result); break; + case nir_intrinsic_load_push_constant: + visit_load_push_constant(bld_base, instr, result); + break; case nir_intrinsic_load_ssbo: visit_load_ssbo(bld_base, instr, result); break;