Mesa (master): swr: [rasterizer core] Faster modulo operator in ProcessVerts

Tim Rowley torowley at kemper.freedesktop.org
Thu May 5 19:55:47 UTC 2016


Module: Mesa
Branch: master
Commit: ff8c0c9a35458532519721ced82bc8d4b1ed8cac
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=ff8c0c9a35458532519721ced82bc8d4b1ed8cac

Author: Tim Rowley <timothy.o.rowley at intel.com>
Date:   Mon May  2 14:09:39 2016 -0600

swr: [rasterizer core] Faster modulo operator in ProcessVerts

Avoid % operator, since we know that curVertex is always incrementing.

Reviewed-by: Bruce Cherniak <bruce.cherniak at intel.com>

---

 src/gallium/drivers/swr/rasterizer/core/pa.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/swr/rasterizer/core/pa.h b/src/gallium/drivers/swr/rasterizer/core/pa.h
index d3ed279..eb8403c 100644
--- a/src/gallium/drivers/swr/rasterizer/core/pa.h
+++ b/src/gallium/drivers/swr/rasterizer/core/pa.h
@@ -508,7 +508,10 @@ struct PA_STATE_CUT : public PA_STATE
                 (this->*pfnPa)(this->curVertex, false);
             }
 
-            this->curVertex = (this->curVertex + 1) % this->numVerts;
+	    this->curVertex++;
+	    if (this->curVertex >= this->numVerts) {
+		this->curVertex = 0;
+	    }
             this->numRemainingVerts--;
         }
 




More information about the mesa-commit mailing list