Mesa (10.6): t_dd_dmatmp: Use addition instead of subtraction in loop bounds

Emil Velikov evelikov at kemper.freedesktop.org
Thu Oct 1 09:28:56 UTC 2015


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

Author: Ian Romanick <ian.d.romanick at intel.com>
Date:   Mon Sep 14 11:59:22 2015 -0700

t_dd_dmatmp: Use addition instead of subtraction in loop bounds

This is used everywhere else in this file because it avoids problems
when count is zero (due to trimming).

No piglit regressions on i915 (G33) or radeon (Radeon 7500).

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=38109
Reviewed-by: Brian Paul <brianp at vmware.com>
Cc: Marius Predut <marius.predut at intel.com>
Cc: "10.6 11.0" <mesa-stable at lists.freedesktop.org>
(cherry picked from commit 25543d8ec506ef32599af6f5e0dd735e01b39909)

---

 src/mesa/tnl_dd/t_dd_dmatmp.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/tnl_dd/t_dd_dmatmp.h b/src/mesa/tnl_dd/t_dd_dmatmp.h
index dea9546..ef2991a 100644
--- a/src/mesa/tnl_dd/t_dd_dmatmp.h
+++ b/src/mesa/tnl_dd/t_dd_dmatmp.h
@@ -623,7 +623,7 @@ static void TAG(render_quads_verts)( struct gl_context *ctx,
 
       INIT(GL_TRIANGLES);
 
-      for (j = 0; j < count-3; j += 4) {
+      for (j = 0; j + 3 < count; j += 4) {
 	 void *tmp = ALLOC_VERTS( 6 );
 	 /* Send v0, v1, v3
 	  */




More information about the mesa-commit mailing list