[Mesa-dev] [PATCH 11/11] swr: [rasterizer core] Faster modulo operator in ProcessVerts

Tim Rowley timothy.o.rowley at intel.com
Tue May 3 16:13:33 UTC 2016


Avoid % operator, since we know that curVertex is always incrementing.
---
 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--;
         }
 
-- 
1.9.1



More information about the mesa-dev mailing list