mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-11 16:40:17 +01:00
gallivm: let nir_lower_tex handle projectors
There's no need for us to do this lowering ourselves while emitting code, when there's already a helper that can do this for us that we're even using. Let's just set the right flag, and not worry about projectors any more. Reviewed-by: Roland Scheidegger <sroland@vmware.com> Reviewed-by: Emma Anholt <emma@anholt.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12126>
This commit is contained in:
parent
3914bd457b
commit
175bc33da7
1 changed files with 2 additions and 11 deletions
|
|
@ -1916,7 +1916,7 @@ static void visit_tex(struct lp_build_nir_context *bld_base, nir_tex_instr *inst
|
|||
LLVMBuilderRef builder = gallivm->builder;
|
||||
LLVMValueRef coords[5];
|
||||
LLVMValueRef offsets[3] = { NULL };
|
||||
LLVMValueRef explicit_lod = NULL, projector = NULL, ms_index = NULL;
|
||||
LLVMValueRef explicit_lod = NULL, ms_index = NULL;
|
||||
struct lp_sampler_params params;
|
||||
struct lp_derivatives derivs;
|
||||
unsigned sample_key = 0;
|
||||
|
|
@ -1963,9 +1963,6 @@ static void visit_tex(struct lp_build_nir_context *bld_base, nir_tex_instr *inst
|
|||
case nir_tex_src_sampler_deref:
|
||||
sampler_deref_instr = nir_src_as_deref(instr->src[i].src);
|
||||
break;
|
||||
case nir_tex_src_projector:
|
||||
projector = lp_build_rcp(&bld_base->base, cast_type(bld_base, get_src(bld_base, instr->src[i].src), nir_type_float, 32));
|
||||
break;
|
||||
case nir_tex_src_comparator:
|
||||
sample_key |= LP_SAMPLER_SHADOW;
|
||||
coords[4] = get_src(bld_base, instr->src[i].src);
|
||||
|
|
@ -2066,13 +2063,6 @@ static void visit_tex(struct lp_build_nir_context *bld_base, nir_tex_instr *inst
|
|||
coords[1] = coord_undef;
|
||||
}
|
||||
|
||||
if (projector) {
|
||||
for (unsigned chan = 0; chan < instr->coord_components; ++chan)
|
||||
coords[chan] = lp_build_mul(&bld_base->base, coords[chan], projector);
|
||||
if (sample_key & LP_SAMPLER_SHADOW)
|
||||
coords[4] = lp_build_mul(&bld_base->base, coords[4], projector);
|
||||
}
|
||||
|
||||
uint32_t samp_base_index = 0, tex_base_index = 0;
|
||||
if (!sampler_deref_instr) {
|
||||
int samp_src_index = nir_tex_instr_src_index(instr, nir_tex_src_sampler_handle);
|
||||
|
|
@ -2337,6 +2327,7 @@ void lp_build_opt_nir(struct nir_shader *nir)
|
|||
|
||||
static const struct nir_lower_tex_options lower_tex_options = {
|
||||
.lower_tg4_offsets = true,
|
||||
.lower_txp = ~0u,
|
||||
};
|
||||
NIR_PASS_V(nir, nir_lower_tex, &lower_tex_options);
|
||||
NIR_PASS_V(nir, nir_lower_frexp);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue