Mesa (10.6): t_dd_dmatmp: Pull out common 'count -= count & 3' code

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


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

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

t_dd_dmatmp: Pull out common 'count -= count & 3' code

This was missing in the HAVE_TRIANGLES path, and that could cause
incorrect rendering.

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 c0b3b2f7603eab210acdb2e654e5411fe912ca34)

---

 src/mesa/tnl_dd/t_dd_dmatmp.h |   15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/src/mesa/tnl_dd/t_dd_dmatmp.h b/src/mesa/tnl_dd/t_dd_dmatmp.h
index ac26b15..dea9546 100644
--- a/src/mesa/tnl_dd/t_dd_dmatmp.h
+++ b/src/mesa/tnl_dd/t_dd_dmatmp.h
@@ -542,6 +542,9 @@ static void TAG(render_quads_verts)( struct gl_context *ctx,
 				     GLuint count,
 				     GLuint flags )
 {
+   /* Emit whole number of quads in total. */
+   count -= count & 3;
+
    if (HAVE_QUADS) {
       LOCAL_VARS;
       int dmasz = (GET_SUBSEQUENT_VB_MAX_VERTS()/4) * 4;
@@ -550,11 +553,6 @@ static void TAG(render_quads_verts)( struct gl_context *ctx,
 
       INIT(GL_QUADS);
 
-      /* Emit whole number of quads in total.  dmasz is already a multiple
-       * of 4.
-       */
-      count -= count & 3;
-
       currentsz = (GET_CURRENT_VB_MAX_VERTS()/4) * 4;
       if (currentsz < 8)
          currentsz = dmasz;
@@ -584,7 +582,6 @@ static void TAG(render_quads_verts)( struct gl_context *ctx,
       /* Emit whole number of quads in total, and in each buffer.
        */
       dmasz -= dmasz & 3;
-      count -= count & 3;
       currentsz -= currentsz & 3;
 
       /* Adjust for rendering as triangles:
@@ -1070,6 +1067,9 @@ static void TAG(render_quads_elts)( struct gl_context *ctx,
 				    GLuint count,
 				    GLuint flags )
 {
+   /* Emit whole number of quads in total. */
+   count -= count & 3;
+
    if (HAVE_QUADS) {
       LOCAL_VARS;
       GLuint *elts = TNL_CONTEXT(ctx)->vb.Elts;
@@ -1082,8 +1082,6 @@ static void TAG(render_quads_elts)( struct gl_context *ctx,
 
       currentsz = GET_CURRENT_VB_MAX_ELTS()/4*4;
 
-      count -= count & 3;
-
       if (currentsz < 8)
 	 currentsz = dmasz;
 
@@ -1106,7 +1104,6 @@ static void TAG(render_quads_elts)( struct gl_context *ctx,
       /* Emit whole number of quads in total, and in each buffer.
        */
       dmasz -= dmasz & 3;
-      count -= count & 3;
       currentsz -= currentsz & 3;
 
       /* Adjust for rendering as triangles:




More information about the mesa-commit mailing list