Merge branch '7.8' into master
[mesa.git] / src / mesa / state_tracker / st_cb_feedback.c
index ea775b9452d7c8f32688f86b7136e54333bca6df..37b1fb55f4a0bf255aa6c6c5cf3bdc39b9afc51c 100644 (file)
 #include "main/imports.h"
 #include "main/context.h"
 #include "main/feedback.h"
-#include "main/macros.h"
 
 #include "vbo/vbo.h"
 
 #include "st_context.h"
-#include "st_atom.h"
 #include "st_draw.h"
 #include "st_cb_feedback.h"
-#include "st_cb_bufferobjects.h"
 
 #include "pipe/p_context.h"
 #include "pipe/p_defines.h"
-#include "pipe/p_winsys.h"
-#include "pipe/cso_cache/cso_cache.h"
 
-#include "pipe/draw/draw_context.h"
-#include "pipe/draw/draw_private.h"
+#include "draw/draw_context.h"
+#include "draw/draw_pipe.h"
 
 
 /**
@@ -88,7 +83,6 @@ feedback_vertex(GLcontext *ctx, const struct draw_context *draw,
    const struct st_context *st = ctx->st;
    GLfloat win[4];
    const GLfloat *color, *texcoord;
-   const GLfloat ci = 0;
    GLuint slot;
 
    /* Recall that Y=0=Top of window for Gallium wincoords */
@@ -103,18 +97,18 @@ feedback_vertex(GLcontext *ctx, const struct draw_context *draw,
     */
 
    slot = st->vertex_result_to_slot[VERT_RESULT_COL0];
-   if (slot != ~0)
+   if (slot != ~0U)
       color = v->data[slot];
    else
       color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0];
 
    slot = st->vertex_result_to_slot[VERT_RESULT_TEX0];
-   if (slot != ~0)
+   if (slot != ~0U)
       texcoord = v->data[slot];
    else
       texcoord = ctx->Current.Attrib[VERT_ATTRIB_TEX0];
 
-   _mesa_feedback_vertex(ctx, win, color, ci, texcoord);
+   _mesa_feedback_vertex(ctx, win, color, texcoord);
 }
 
 
@@ -123,8 +117,8 @@ feedback_tri( struct draw_stage *stage, struct prim_header *prim )
 {
    struct feedback_stage *fs = feedback_stage(stage);
    struct draw_context *draw = stage->draw;
-   FEEDBACK_TOKEN(fs->ctx, (GLfloat) GL_POLYGON_TOKEN);
-   FEEDBACK_TOKEN(fs->ctx, (GLfloat) 3); /* three vertices */
+   _mesa_feedback_token(fs->ctx, (GLfloat) GL_POLYGON_TOKEN);
+   _mesa_feedback_token(fs->ctx, (GLfloat) 3); /* three vertices */
    feedback_vertex(fs->ctx, draw, prim->v[0]);
    feedback_vertex(fs->ctx, draw, prim->v[1]);
    feedback_vertex(fs->ctx, draw, prim->v[2]);
@@ -137,11 +131,11 @@ feedback_line( struct draw_stage *stage, struct prim_header *prim )
    struct feedback_stage *fs = feedback_stage(stage);
    struct draw_context *draw = stage->draw;
    if (fs->reset_stipple_counter) {
-      FEEDBACK_TOKEN(fs->ctx, (GLfloat) GL_LINE_RESET_TOKEN);
+      _mesa_feedback_token(fs->ctx, (GLfloat) GL_LINE_RESET_TOKEN);
       fs->reset_stipple_counter = GL_FALSE;
    }
    else {
-      FEEDBACK_TOKEN(fs->ctx, (GLfloat) GL_LINE_TOKEN);
+      _mesa_feedback_token(fs->ctx, (GLfloat) GL_LINE_TOKEN);
    }
    feedback_vertex(fs->ctx, draw, prim->v[0]);
    feedback_vertex(fs->ctx, draw, prim->v[1]);
@@ -153,49 +147,48 @@ feedback_point( struct draw_stage *stage, struct prim_header *prim )
 {
    struct feedback_stage *fs = feedback_stage(stage);
    struct draw_context *draw = stage->draw;
-   FEEDBACK_TOKEN(fs->ctx, (GLfloat) GL_POINT_TOKEN);
+   _mesa_feedback_token(fs->ctx, (GLfloat) GL_POINT_TOKEN);
    feedback_vertex(fs->ctx, draw, prim->v[0]);
 }
 
 
 static void
-feedback_end( struct draw_stage *stage )
+feedback_flush( struct draw_stage *stage, unsigned flags )
 {
    /* no-op */
 }
 
 
 static void
-feedback_begin( struct draw_stage *stage )
+feedback_reset_stipple_counter( struct draw_stage *stage )
 {
-   /* no-op */
+   struct feedback_stage *fs = feedback_stage(stage);
+   fs->reset_stipple_counter = GL_TRUE;
 }
 
 
 static void
-feedback_reset_stipple_counter( struct draw_stage *stage )
+feedback_destroy( struct draw_stage *stage )
 {
-   struct feedback_stage *fs = feedback_stage(stage);
-   fs->reset_stipple_counter = GL_TRUE;
+   /* no-op */
 }
 
-
 /**
  * Create GL feedback drawing stage.
  */
 static struct draw_stage *
 draw_glfeedback_stage(GLcontext *ctx, struct draw_context *draw)
 {
-   struct feedback_stage *fs = CALLOC_STRUCT(feedback_stage);
+   struct feedback_stage *fs = ST_CALLOC_STRUCT(feedback_stage);
 
    fs->stage.draw = draw;
    fs->stage.next = NULL;
-   fs->stage.begin = feedback_begin;
    fs->stage.point = feedback_point;
    fs->stage.line = feedback_line;
    fs->stage.tri = feedback_tri;
-   fs->stage.end = feedback_end;
+   fs->stage.flush = feedback_flush;
    fs->stage.reset_stipple_counter = feedback_reset_stipple_counter;
+   fs->stage.destroy = feedback_destroy;
    fs->ctx = ctx;
 
    return &fs->stage;
@@ -234,21 +227,20 @@ select_point( struct draw_stage *stage, struct prim_header *prim )
 
 
 static void
-select_begin( struct draw_stage *stage )
+select_flush( struct draw_stage *stage, unsigned flags )
 {
    /* no-op */
 }
 
 
 static void
-select_end( struct draw_stage *stage )
+select_reset_stipple_counter( struct draw_stage *stage )
 {
    /* no-op */
 }
 
-
 static void
-select_reset_stipple_counter( struct draw_stage *stage )
+select_destroy( struct draw_stage *stage )
 {
    /* no-op */
 }
@@ -260,16 +252,16 @@ select_reset_stipple_counter( struct draw_stage *stage )
 static struct draw_stage *
 draw_glselect_stage(GLcontext *ctx, struct draw_context *draw)
 {
-   struct feedback_stage *fs = CALLOC_STRUCT(feedback_stage);
+   struct feedback_stage *fs = ST_CALLOC_STRUCT(feedback_stage);
 
    fs->stage.draw = draw;
    fs->stage.next = NULL;
-   fs->stage.begin = select_begin;
    fs->stage.point = select_point;
    fs->stage.line = select_line;
    fs->stage.tri = select_tri;
-   fs->stage.end = select_end;
+   fs->stage.flush = select_flush;
    fs->stage.reset_stipple_counter = select_reset_stipple_counter;
+   fs->stage.destroy = select_destroy;
    fs->ctx = ctx;
 
    return &fs->stage;