libagx: hoist code out of loop

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30382>
This commit is contained in:
Alyssa Rosenzweig
2024-07-18 13:30:11 -04:00
committed by Marge Bot
parent 4e5ce7e759
commit 735c63c75e

View File

@@ -1118,19 +1118,19 @@ libagx_tess_tri(constant struct libagx_tess_args *p, enum libagx_tess_mode mode,
int startPoint = ring;
int endPoint = numPointsForInsideTessFactor - 1 - startPoint;
int perpendicularAxisPoint = startPoint;
FXP fxpPerpParam = PlacePointIn1D(
&insideTessFactorCtx, insideTessFactorOdd, perpendicularAxisPoint);
// Map location to the right size in
// barycentric space. We know this fixed
// point math won't over/underflow
fxpPerpParam *= FXP_TWO_THIRDS;
fxpPerpParam = (fxpPerpParam + FXP_ONE_HALF /*round*/) >>
FXP_FRACTION_BITS; // get back to n.16
for (int edge = 0; edge < TRI_EDGES; edge++) {
int odd = edge & 0x1;
int perpendicularAxisPoint = startPoint;
FXP fxpPerpParam =
PlacePointIn1D(&insideTessFactorCtx, insideTessFactorOdd,
perpendicularAxisPoint);
// Map location to the right size in
// barycentric space. We know this fixed
// point math won't over/underflow
fxpPerpParam *= FXP_TWO_THIRDS;
fxpPerpParam = (fxpPerpParam + FXP_ONE_HALF /*round*/) >>
FXP_FRACTION_BITS; // get back to n.16
// don't include end: next edge starts with it.
for (int p = startPoint; p < endPoint; p++, pointOffset++) {