mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 09:38:07 +02:00
llvmpipe: Always recompute 1/w
The value depends on the tgsi_interpolate_loc which is not constant for
the loop. llvm should be able to cse in cases where they are the same.
cc: mesa-stable
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38197>
(cherry picked from commit aa28fcb610)
This commit is contained in:
parent
f94dcb58dc
commit
c4c051b85e
2 changed files with 17 additions and 20 deletions
|
|
@ -3314,7 +3314,7 @@
|
|||
"description": "llvmpipe: Always recompute 1/w",
|
||||
"nominated": true,
|
||||
"nomination_type": 1,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": null,
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -338,7 +338,6 @@ attribs_update_simple(struct lp_build_interp_soa_context *bld,
|
|||
LLVMBuilderRef builder = gallivm->builder;
|
||||
struct lp_build_context *coeff_bld = &bld->coeff_bld;
|
||||
struct lp_build_context *setup_bld = &bld->setup_bld;
|
||||
LLVMValueRef oow = NULL;
|
||||
LLVMValueRef pixoffx;
|
||||
LLVMValueRef pixoffy;
|
||||
LLVMValueRef ptr;
|
||||
|
|
@ -425,25 +424,23 @@ attribs_update_simple(struct lp_build_interp_soa_context *bld,
|
|||
}
|
||||
|
||||
if (interp == LP_INTERP_PERSPECTIVE) {
|
||||
if (oow == NULL) {
|
||||
LLVMValueRef w;
|
||||
assert(attrib != 0);
|
||||
assert(bld->mask[0] & TGSI_WRITEMASK_W);
|
||||
if (bld->coverage_samples > 1 &&
|
||||
(loc == TGSI_INTERPOLATE_LOC_SAMPLE ||
|
||||
loc == TGSI_INTERPOLATE_LOC_CENTROID)) {
|
||||
/*
|
||||
* We can't use the precalculated 1/w since we didn't know
|
||||
* the actual position yet (we were assuming center).
|
||||
*/
|
||||
LLVMValueRef indexw = lp_build_const_int32(gallivm, 3);
|
||||
w = interp_attrib_linear(bld, 0, indexw, chan_pixoffx, chan_pixoffy);
|
||||
}
|
||||
else {
|
||||
w = bld->attribs[0][3];
|
||||
}
|
||||
oow = lp_build_rcp(coeff_bld, w);
|
||||
LLVMValueRef w;
|
||||
assert(attrib != 0);
|
||||
assert(bld->mask[0] & TGSI_WRITEMASK_W);
|
||||
if (bld->coverage_samples > 1 &&
|
||||
(loc == TGSI_INTERPOLATE_LOC_SAMPLE ||
|
||||
loc == TGSI_INTERPOLATE_LOC_CENTROID)) {
|
||||
/*
|
||||
* We can't use the precalculated 1/w since we didn't know
|
||||
* the actual position yet (we were assuming center).
|
||||
*/
|
||||
LLVMValueRef indexw = lp_build_const_int32(gallivm, 3);
|
||||
w = interp_attrib_linear(bld, 0, indexw, chan_pixoffx, chan_pixoffy);
|
||||
}
|
||||
else {
|
||||
w = bld->attribs[0][3];
|
||||
}
|
||||
LLVMValueRef oow = lp_build_rcp(coeff_bld, w);
|
||||
a = lp_build_mul(coeff_bld, a, oow);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue