summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/llvmpipe
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2010-01-21 16:21:31 -0700
committerBrian Paul <[email protected]>2010-01-21 16:21:33 -0700
commita904a7b99043c19493db5c0945b046795a5932b1 (patch)
treea8c497dd5c10b7a5168a678c61de132dc68760e4 /src/gallium/drivers/llvmpipe
parente5829ccc2b0cb1eed27c89763e8e4c6775dd6d4c (diff)
llvmpipe: manually unroll the inputs.step[] setup code
Good for a few more fps in some tests.
Diffstat (limited to 'src/gallium/drivers/llvmpipe')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup_tri.c49
1 files changed, 31 insertions, 18 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_setup_tri.c b/src/gallium/drivers/llvmpipe/lp_setup_tri.c
index 76ecab76447..dcd849bc856 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup_tri.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup_tri.c
@@ -362,31 +362,44 @@ do_triangle_ccw(struct setup_context *setup,
tri->ei2 = tri->dx23 - tri->dy23 - tri->eo2;
tri->ei3 = tri->dx31 - tri->dy31 - tri->eo3;
+ /* Fill in the inputs.step[][] arrays.
+ * We've manually unrolled some loops here.
+ */
{
const int xstep1 = -tri->dy12;
const int xstep2 = -tri->dy23;
const int xstep3 = -tri->dy31;
-
const int ystep1 = tri->dx12;
const int ystep2 = tri->dx23;
const int ystep3 = tri->dx31;
-
- int qx, qy, ix, iy;
- int i = 0;
-
- for (qy = 0; qy < 2; qy++) {
- for (qx = 0; qx < 2; qx++) {
- for (iy = 0; iy < 2; iy++) {
- for (ix = 0; ix < 2; ix++, i++) {
- int x = qx * 2 + ix;
- int y = qy * 2 + iy;
- tri->inputs.step[0][i] = x * xstep1 + y * ystep1;
- tri->inputs.step[1][i] = x * xstep2 + y * ystep2;
- tri->inputs.step[2][i] = x * xstep3 + y * ystep3;
- }
- }
- }
- }
+
+#define SETUP_STEP(i, x, y) \
+ do { \
+ tri->inputs.step[0][i] = x * xstep1 + y * ystep1; \
+ tri->inputs.step[1][i] = x * xstep2 + y * ystep2; \
+ tri->inputs.step[2][i] = x * xstep3 + y * ystep3; \
+ } while (0)
+
+ SETUP_STEP(0, 0, 0);
+ SETUP_STEP(1, 1, 0);
+ SETUP_STEP(2, 0, 1);
+ SETUP_STEP(3, 1, 1);
+
+ SETUP_STEP(4, 2, 0);
+ SETUP_STEP(5, 3, 0);
+ SETUP_STEP(6, 2, 1);
+ SETUP_STEP(7, 3, 1);
+
+ SETUP_STEP(8, 0, 2);
+ SETUP_STEP(9, 1, 2);
+ SETUP_STEP(10, 0, 3);
+ SETUP_STEP(11, 1, 3);
+
+ SETUP_STEP(12, 2, 2);
+ SETUP_STEP(13, 3, 2);
+ SETUP_STEP(14, 2, 3);
+ SETUP_STEP(15, 3, 3);
+#undef STEP
}
/*