llvmpipe: asst. clean-ups in lp_state_setup.c

Signed-off-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17561>
This commit is contained in:
Brian Paul 2022-06-22 12:41:18 -06:00 committed by Marge Bot
parent fc2f57ed76
commit 1f96c24465
1 changed files with 11 additions and 22 deletions

View File

@ -86,7 +86,7 @@ struct lp_setup_args
static void static void
store_coef(struct gallivm_state *gallivm, store_coef(struct gallivm_state *gallivm,
struct lp_setup_args *args, const struct lp_setup_args *args,
unsigned slot, unsigned slot,
LLVMValueRef a0, LLVMValueRef a0,
LLVMValueRef dadx, LLVMValueRef dadx,
@ -111,7 +111,7 @@ store_coef(struct gallivm_state *gallivm,
static void static void
emit_constant_coef4(struct gallivm_state *gallivm, emit_constant_coef4(struct gallivm_state *gallivm,
struct lp_setup_args *args, const struct lp_setup_args *args,
unsigned slot, unsigned slot,
LLVMValueRef vert) LLVMValueRef vert)
{ {
@ -315,8 +315,7 @@ lp_do_offset_tri(struct gallivm_state *gallivm,
zoffset = lp_build_min(&flt_scalar_bld, zoffset = lp_build_min(&flt_scalar_bld,
lp_build_const_float(gallivm, key->pgon_offset_clamp), lp_build_const_float(gallivm, key->pgon_offset_clamp),
zoffset); zoffset);
} } else if (key->pgon_offset_clamp < 0) {
else if (key->pgon_offset_clamp < 0) {
zoffset = lp_build_max(&flt_scalar_bld, zoffset = lp_build_max(&flt_scalar_bld,
lp_build_const_float(gallivm, key->pgon_offset_clamp), lp_build_const_float(gallivm, key->pgon_offset_clamp),
zoffset); zoffset);
@ -431,11 +430,7 @@ emit_linear_coef(struct gallivm_state *gallivm,
LLVMValueRef attribv[3]) LLVMValueRef attribv[3])
{ {
/* nothing to do anymore */ /* nothing to do anymore */
emit_coef4(gallivm, emit_coef4(gallivm, args, slot, attribv[0], attribv[1], attribv[2]);
args, slot,
attribv[0],
attribv[1],
attribv[2]);
} }
@ -487,8 +482,7 @@ emit_tri_coef(struct gallivm_state *gallivm,
load_attribute(gallivm, args, key, key->inputs[slot].src_index, attribs); load_attribute(gallivm, args, key, key->inputs[slot].src_index, attribs);
if (key->flatshade_first) { if (key->flatshade_first) {
emit_constant_coef4(gallivm, args, slot+1, attribs[0]); emit_constant_coef4(gallivm, args, slot+1, attribs[0]);
} } else {
else {
emit_constant_coef4(gallivm, args, slot+1, attribs[2]); emit_constant_coef4(gallivm, args, slot+1, attribs[2]);
} }
break; break;
@ -611,9 +605,7 @@ init_args(struct gallivm_state *gallivm,
args->y0_center = lp_build_extract_broadcast(gallivm, typef4, typef4, xy0_center, onei); args->y0_center = lp_build_extract_broadcast(gallivm, typef4, typef4, xy0_center, onei);
LLVMValueRef coeffs[3]; LLVMValueRef coeffs[3];
calc_coef4(gallivm, args, calc_coef4(gallivm, args, attr_pos[0], attr_pos[1], attr_pos[2], coeffs);
attr_pos[0], attr_pos[1], attr_pos[2],
coeffs);
/* This is a bit sneaky: /* This is a bit sneaky:
* Because we observe that the X component of A0 is otherwise unused, * Because we observe that the X component of A0 is otherwise unused,
@ -624,8 +616,7 @@ init_args(struct gallivm_state *gallivm,
coeffs[0] = LLVMBuildInsertElement(b, coeffs[0], polygon_offset, coeffs[0] = LLVMBuildInsertElement(b, coeffs[0], polygon_offset,
lp_build_const_int32(gallivm, 0), ""); lp_build_const_int32(gallivm, 0), "");
store_coef(gallivm, args, 0, store_coef(gallivm, args, 0, coeffs[0], coeffs[1], coeffs[2]);
coeffs[0], coeffs[1], coeffs[2]);
} }
@ -762,7 +753,7 @@ fail:
static void static void
lp_make_setup_variant_key(struct llvmpipe_context *lp, lp_make_setup_variant_key(const struct llvmpipe_context *lp,
struct lp_setup_variant_key *key) struct lp_setup_variant_key *key)
{ {
const struct lp_fragment_shader *fs = lp->fs; const struct lp_fragment_shader *fs = lp->fs;
@ -774,8 +765,7 @@ lp_make_setup_variant_key(struct llvmpipe_context *lp,
key->pixel_center_half = lp->rasterizer->half_pixel_center; key->pixel_center_half = lp->rasterizer->half_pixel_center;
key->multisample = lp->rasterizer->multisample; key->multisample = lp->rasterizer->multisample;
key->twoside = lp->rasterizer->light_twoside; key->twoside = lp->rasterizer->light_twoside;
key->size = Offset(struct lp_setup_variant_key, key->size = Offset(struct lp_setup_variant_key, inputs[key->num_inputs]);
inputs[key->num_inputs]);
key->color_slot = lp->color_slot[0]; key->color_slot = lp->color_slot[0];
key->bcolor_slot = lp->bcolor_slot[0]; key->bcolor_slot = lp->bcolor_slot[0];
@ -880,7 +870,7 @@ llvmpipe_update_setup(struct llvmpipe_context *lp)
lp_make_setup_variant_key(lp, key); lp_make_setup_variant_key(lp, key);
LIST_FOR_EACH_ENTRY(li, &lp->setup_variants_list.list, list) { LIST_FOR_EACH_ENTRY(li, &lp->setup_variants_list.list, list) {
if(li->base->key.size == key->size && if (li->base->key.size == key->size &&
memcmp(&li->base->key, key, key->size) == 0) { memcmp(&li->base->key, key, key->size) == 0) {
variant = li->base; variant = li->base;
break; break;
@ -889,8 +879,7 @@ llvmpipe_update_setup(struct llvmpipe_context *lp)
if (variant) { if (variant) {
list_move_to(&variant->list_item_global.list, &lp->setup_variants_list.list); list_move_to(&variant->list_item_global.list, &lp->setup_variants_list.list);
} } else {
else {
if (lp->nr_setup_variants >= LP_MAX_SETUP_VARIANTS) { if (lp->nr_setup_variants >= LP_MAX_SETUP_VARIANTS) {
cull_setup_variants(lp); cull_setup_variants(lp);
} }