i965/blorp: Pull the guts of resolve_color into a miptree-agnostic helper
[mesa.git] / src / mesa / vbo / vbo_save_loopback.c
index 430333b84dd002bfe88558df486882627bfd0f43..7410f1875ecd529626523556d3c6d5590b0336e0 100644 (file)
@@ -1,6 +1,6 @@
 /**************************************************************************
  * 
- * Copyright 2005 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * Copyright 2005 VMware, Inc.
  * All Rights Reserved.
  * 
  * Permission is hereby granted, free of charge, to any person obtaining a
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  * 
  **************************************************************************/
 
-#include "swrast_setup/swrast_setup.h"
-#include "swrast/swrast.h"
-#include "tnl/tnl.h"
-#include "context.h"
+#include <stdio.h>
+#include "main/context.h"
+#include "main/glheader.h"
+#include "main/enums.h"
+#include "main/imports.h"
+#include "main/mtypes.h"
+#include "main/dispatch.h"
+#include "glapi/glapi.h"
 
 #include "vbo_context.h"
 
-#include "glheader.h"
-#include "enums.h"
-#include "glapi.h"
-#include "imports.h"
-#include "macros.h"
-#include "mtypes.h"
-#include "dispatch.h"
 
-
-typedef void (*attr_func)( GLcontext *ctx, GLint target, const GLfloat * );
+typedef void (*attr_func)( struct gl_context *ctx, GLint target, const GLfloat * );
 
 
 /* This file makes heavy use of the aliasing of NV vertex attributes
  * with the legacy attributes, and also with ARB and Material
  * attributes as currently implemented.
  */
-static void VertexAttrib1fvNV(GLcontext *ctx, GLint target, const GLfloat *v)
+static void VertexAttrib1fvNV(struct gl_context *ctx, GLint target, const GLfloat *v)
 {
    CALL_VertexAttrib1fvNV(ctx->Exec, (target, v));
 }
 
-static void VertexAttrib2fvNV(GLcontext *ctx, GLint target, const GLfloat *v)
+static void VertexAttrib2fvNV(struct gl_context *ctx, GLint target, const GLfloat *v)
 {
    CALL_VertexAttrib2fvNV(ctx->Exec, (target, v));
 }
 
-static void VertexAttrib3fvNV(GLcontext *ctx, GLint target, const GLfloat *v)
+static void VertexAttrib3fvNV(struct gl_context *ctx, GLint target, const GLfloat *v)
 {
    CALL_VertexAttrib3fvNV(ctx->Exec, (target, v));
 }
 
-static void VertexAttrib4fvNV(GLcontext *ctx, GLint target, const GLfloat *v)
+static void VertexAttrib4fvNV(struct gl_context *ctx, GLint target, const GLfloat *v)
 {
    CALL_VertexAttrib4fvNV(ctx->Exec, (target, v));
 }
@@ -82,10 +78,10 @@ struct loopback_attr {
 };
 
 /* Don't emit ends and begins on wrapped primitives.  Don't replay
- * wrapped vertices.  If we get here, it's probably because the the
+ * wrapped vertices.  If we get here, it's probably because the
  * precalculated wrapping is wrong.
  */
-static void loopback_prim( GLcontext *ctx,
+static void loopback_prim( struct gl_context *ctx,
                           const GLfloat *buffer,
                           const struct _mesa_prim *prim,
                           GLuint wrap_count,
@@ -99,12 +95,12 @@ static void loopback_prim( GLcontext *ctx,
    GLuint k;
 
    if (0)
-      _mesa_printf("loopback prim %s(%s,%s) verts %d..%d\n",
-                  _mesa_lookup_enum_by_nr(prim->mode),
-                  prim->begin ? "begin" : "..",
-                  prim->end ? "end" : "..",
-                  start, 
-                  end);
+      printf("loopback prim %s(%s,%s) verts %d..%d\n",
+            _mesa_lookup_prim_by_nr(prim->mode),
+            prim->begin ? "begin" : "..",
+            prim->end ? "end" : "..",
+            start, 
+            end);
 
    if (prim->begin) {
       CALL_Begin(GET_DISPATCH(), ( prim->mode ));
@@ -140,7 +136,7 @@ static void loopback_prim( GLcontext *ctx,
  * normally, otherwise need to track and discard the generated
  * primitives.
  */
-static void loopback_weak_prim( GLcontext *ctx,
+static void loopback_weak_prim( struct gl_context *ctx,
                                const struct _mesa_prim *prim )
 {
    /* Use the prim_weak flag to ensure that if this primitive
@@ -157,7 +153,7 @@ static void loopback_weak_prim( GLcontext *ctx,
 }
 
 
-void vbo_loopback_vertex_list( GLcontext *ctx,
+void vbo_loopback_vertex_list( struct gl_context *ctx,
                               const GLfloat *buffer,
                               const GLubyte *attrsz,
                               const struct _mesa_prim *prim,
@@ -182,7 +178,7 @@ void vbo_loopback_vertex_list( GLcontext *ctx,
 
    for (i = 0 ; i < prim_count ; i++) {
       if ((prim[i].mode & VBO_SAVE_PRIM_WEAK) &&
-         (ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END))
+          _mesa_inside_begin_end(ctx))
       {
         loopback_weak_prim( ctx, &prim[i] );
       }