Rename the various function types in t_context.h to include a tnl_ prefix.
[mesa.git] / src / mesa / tnl_dd / t_dd_dmatmp.h
index 44eaeaf76b004438f4ffd447b9e018b599e2359b..5ba6920804e2a63dd9b28e99036b01a85ebc6f89 100644 (file)
@@ -113,11 +113,12 @@ static void TAG(render_points_verts)( GLcontext *ctx,
    if (HAVE_POINTS) {
       LOCAL_VARS;
       int dmasz = GET_SUBSEQUENT_VB_MAX_VERTS();
-      int currentsz = GET_CURRENT_VB_MAX_VERTS();
+      int currentsz;
       GLuint j, nr;
 
       INIT( GL_POINTS );
 
+      currentsz = GET_CURRENT_VB_MAX_VERTS();
       if (currentsz < 8)
         currentsz = dmasz;
 
@@ -141,7 +142,7 @@ static void TAG(render_lines_verts)( GLcontext *ctx,
    if (HAVE_LINES) {
       LOCAL_VARS;
       int dmasz = GET_SUBSEQUENT_VB_MAX_VERTS();
-      int currentsz = GET_CURRENT_VB_MAX_VERTS();
+      int currentsz;
       GLuint j, nr;
 
       INIT( GL_LINES );
@@ -149,6 +150,7 @@ static void TAG(render_lines_verts)( GLcontext *ctx,
       /* Emit whole number of lines in total and in each buffer:
        */
       count -= (count-start) & 1;
+      currentsz = GET_CURRENT_VB_MAX_VERTS();
       currentsz -= currentsz & 1;
       dmasz -= dmasz & 1;
 
@@ -176,11 +178,12 @@ static void TAG(render_line_strip_verts)( GLcontext *ctx,
    if (HAVE_LINE_STRIPS) {
       LOCAL_VARS;
       int dmasz = GET_SUBSEQUENT_VB_MAX_VERTS();
-      int currentsz = GET_CURRENT_VB_MAX_VERTS();
+      int currentsz;
       GLuint j, nr;
 
       INIT( GL_LINE_STRIP );
 
+      currentsz = GET_CURRENT_VB_MAX_VERTS();
       if (currentsz < 8)
         currentsz = dmasz;
 
@@ -207,7 +210,7 @@ static void TAG(render_line_loop_verts)( GLcontext *ctx,
    if (HAVE_LINE_STRIPS) {
       LOCAL_VARS;
       int dmasz = GET_SUBSEQUENT_VB_MAX_VERTS();
-      int currentsz = GET_CURRENT_VB_MAX_VERTS();
+      int currentsz;
       GLuint j, nr;
 
       INIT( GL_LINE_STRIP );
@@ -219,6 +222,7 @@ static void TAG(render_line_loop_verts)( GLcontext *ctx,
 
       /* Ensure last vertex won't wrap buffers:
        */
+      currentsz = GET_CURRENT_VB_MAX_VERTS();
       currentsz--;
       dmasz--;
 
@@ -269,11 +273,13 @@ static void TAG(render_triangles_verts)( GLcontext *ctx,
 {
    LOCAL_VARS;
    int dmasz = (GET_SUBSEQUENT_VB_MAX_VERTS()/3) * 3;
-   int currentsz = (GET_CURRENT_VB_MAX_VERTS()/3) * 3;
+   int currentsz;
    GLuint j, nr;
 
    INIT(GL_TRIANGLES);
 
+   currentsz = (GET_CURRENT_VB_MAX_VERTS()/3) * 3;
+
    /* Emit whole number of tris in total.  dmasz is already a multiple
     * of 3.
     */
@@ -338,15 +344,16 @@ static void TAG(render_tri_fan_verts)( GLcontext *ctx,
       LOCAL_VARS;
       GLuint j, nr;
       int dmasz = GET_SUBSEQUENT_VB_MAX_VERTS();
-      int currentsz = GET_CURRENT_VB_MAX_VERTS();
+      int currentsz;
 
       INIT(GL_TRIANGLE_FAN);
 
+      currentsz = GET_CURRENT_VB_MAX_VERTS();
       if (currentsz < 8) {
         currentsz = dmasz;
       }
 
-      for (j = start + 1 ; j + 1 < count; j += nr - 1 ) {
+      for (j = start + 1 ; j + 1 < count; j += nr - 2 ) {
         void *tmp;
         nr = MIN2( currentsz, count - j + 1 );
         tmp = ALLOC_VERTS( nr );
@@ -376,15 +383,16 @@ static void TAG(render_poly_verts)( GLcontext *ctx,
       LOCAL_VARS;
       GLuint j, nr;
       int dmasz = GET_SUBSEQUENT_VB_MAX_VERTS();
-      int currentsz = GET_CURRENT_VB_MAX_VERTS();
+      int currentsz;
 
       INIT(GL_POLYGON);
 
+      currentsz = GET_CURRENT_VB_MAX_VERTS();
       if (currentsz < 8) {
         currentsz = dmasz;
       }
 
-      for (j = start + 1 ; j + 1 < count ; j += nr - 1 ) {
+      for (j = start + 1 ; j + 1 < count ; j += nr - 2 ) {
         void *tmp;
         nr = MIN2( currentsz, count - j + 1 );
         tmp = ALLOC_VERTS( nr );
@@ -419,7 +427,6 @@ static void TAG(render_quad_strip_verts)( GLcontext *ctx,
       INIT(GL_QUAD_STRIP);
 
       currentsz = GET_CURRENT_VB_MAX_VERTS();
-
       if (currentsz < 8) {
         currentsz = dmasz;
       }
@@ -495,7 +502,7 @@ static void TAG(render_quad_strip_verts)( GLcontext *ctx,
    else if (HAVE_TRI_STRIPS) {
       LOCAL_VARS;
       int dmasz = GET_SUBSEQUENT_VB_MAX_VERTS();
-      int currentsz = GET_CURRENT_VB_MAX_VERTS();
+      int currentsz;
 
       /* Emit smooth-shaded quadstrips as tristrips:
        */
@@ -505,6 +512,7 @@ static void TAG(render_quad_strip_verts)( GLcontext *ctx,
       /* Emit whole number of quads in total, and in each buffer.
        */
       dmasz -= dmasz & 1;
+      currentsz = GET_CURRENT_VB_MAX_VERTS();
       currentsz -= currentsz & 1;
       count -= (count-start) & 1;
 
@@ -535,7 +543,7 @@ static void TAG(render_quads_verts)( GLcontext *ctx,
    if (HAVE_QUADS) {
       LOCAL_VARS;
       int dmasz = (GET_SUBSEQUENT_VB_MAX_VERTS()/4) * 4;
-      int currentsz = (GET_CURRENT_VB_MAX_VERTS()/4) * 4;
+      int currentsz;
       GLuint j, nr;
 
       INIT(GL_QUADS);
@@ -545,6 +553,7 @@ static void TAG(render_quads_verts)( GLcontext *ctx,
        */
       count -= (count-start)%4;
 
+      currentsz = (GET_CURRENT_VB_MAX_VERTS()/4) * 4;
       if (currentsz < 8)
          currentsz = dmasz;
 
@@ -624,7 +633,7 @@ static void TAG(render_noop)( GLcontext *ctx,
 
 
 
-static render_func TAG(render_tab_verts)[GL_POLYGON+2] =
+static tnl_render_func TAG(render_tab_verts)[GL_POLYGON+2] =
 {
    TAG(render_points_verts),
    TAG(render_lines_verts),
@@ -910,7 +919,7 @@ static void TAG(render_tri_fan_elts)( GLcontext *ctx,
         currentsz = dmasz;
       }
 
-      for (j = start + 1 ; j + 1 < count; j += nr - 1 ) {
+      for (j = start + 1 ; j + 1 < count; j += nr - 2 ) {
         void *tmp;
         nr = MIN2( currentsz, count - j + 1 );
         tmp = ALLOC_ELTS( nr );
@@ -947,7 +956,7 @@ static void TAG(render_poly_elts)( GLcontext *ctx,
         currentsz = dmasz;
       }
 
-      for (j = start + 1 ; j + 1 < count; j += nr - 1 ) {
+      for (j = start + 1 ; j + 1 < count; j += nr - 2 ) {
         void *tmp;
         nr = MIN2( currentsz, count - j + 1 );
         tmp = ALLOC_ELTS( nr );
@@ -1112,7 +1121,7 @@ static void TAG(render_quads_elts)( GLcontext *ctx,
 
 
 
-static render_func TAG(render_tab_elts)[GL_POLYGON+2] =
+static tnl_render_func TAG(render_tab_elts)[GL_POLYGON+2] =
 {
    TAG(render_points_elts),
    TAG(render_lines_elts),
@@ -1143,7 +1152,7 @@ static GLboolean TAG(validate_render)( GLcontext *ctx,
 {
    GLint i;
 
-   if (VB->ClipOrMask)
+   if (VB->ClipOrMask & ~CLIP_CULL_BIT)
       return GL_FALSE;
 
    if (VB->Elts && !HAVE_ELTS)