st/mesa: remove redundant flushes from st_flush
[mesa.git] / src / mesa / state_tracker / st_cb_feedback.c
index a18f4f76bcf26bb8331691050e79797cf81658e0..436062b1f8581ffaac3969c04ca7f715c9341c1a 100644 (file)
@@ -46,6 +46,7 @@
 #include "st_context.h"
 #include "st_draw.h"
 #include "st_cb_feedback.h"
+#include "st_program.h"
 
 #include "pipe/p_context.h"
 #include "pipe/p_defines.h"
@@ -98,13 +99,13 @@ feedback_vertex(struct gl_context *ctx, const struct draw_context *draw,
     * color and texcoord attribs to use here.
     */
 
-   slot = st->vertex_result_to_slot[VARYING_SLOT_COL0];
+   slot = st->vp->result_to_output[VARYING_SLOT_COL0];
    if (slot != ~0U)
       color = v->data[slot];
    else
       color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0];
 
-   slot = st->vertex_result_to_slot[VARYING_SLOT_TEX0];
+   slot = st->vp->result_to_output[VARYING_SLOT_TEX0];
    if (slot != ~0U)
       texcoord = v->data[slot];
    else
@@ -281,7 +282,7 @@ st_RenderMode(struct gl_context *ctx, GLenum newMode )
 
    if (newMode == GL_RENDER) {
       /* restore normal VBO draw function */
-      vbo_set_draw_func(ctx, st_draw_vbo);
+      st_init_draw(st);
    }
    else if (newMode == GL_SELECT) {
       if (!st->selection_stage)
@@ -291,13 +292,16 @@ st_RenderMode(struct gl_context *ctx, GLenum newMode )
       vbo_set_draw_func(ctx, st_feedback_draw_vbo);
    }
    else {
+      struct gl_program *vp = st->ctx->VertexProgram._Current;
+
       if (!st->feedback_stage)
          st->feedback_stage = draw_glfeedback_stage(ctx, draw);
       draw_set_rasterize_stage(draw, st->feedback_stage);
       /* Plug in new vbo draw function */
       vbo_set_draw_func(ctx, st_feedback_draw_vbo);
       /* need to generate/use a vertex program that emits pos/color/tex */
-      st->dirty |= ST_NEW_VERTEX_PROGRAM;
+      if (vp)
+         st->dirty |= ST_NEW_VERTEX_PROGRAM(st, st_vertex_program(vp));
    }
 }