r600g: Implement GL_ARB_texture_gather
[mesa.git] / src / mesa / state_tracker / st_draw.c
index 355c180f86de6bec447cbe84df09a30236731b33..64d6ef52514ade994d15784bbfc70ac330420162 100644 (file)
@@ -131,7 +131,7 @@ setup_index_buffer(struct st_context *st,
 static void
 check_uniforms(struct gl_context *ctx)
 {
-   struct gl_shader_program **shProg = ctx->Shader.CurrentProgram;
+   struct gl_shader_program **shProg = ctx->_Shader->CurrentProgram;
    unsigned j;
 
    for (j = 0; j < 3; j++) {
@@ -164,16 +164,6 @@ translate_prim(const struct gl_context *ctx, unsigned prim)
    STATIC_ASSERT(GL_QUADS == PIPE_PRIM_QUADS);
    STATIC_ASSERT(GL_TRIANGLE_STRIP_ADJACENCY == PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY);
 
-   /* Avoid quadstrips if it's easy to do so:
-    * Note: it's important to do the correct trimming if we change the
-    * prim type!  We do that wherever this function is called.
-    */
-   if (prim == GL_QUAD_STRIP &&
-       ctx->Light.ShadeModel != GL_FLAT &&
-       ctx->Polygon.FrontMode == GL_FILL &&
-       ctx->Polygon.BackMode == GL_FILL)
-      prim = GL_TRIANGLE_STRIP;
-
    return prim;
 }
 
@@ -254,6 +244,14 @@ st_draw_vbo(struct gl_context *ctx,
       }
    }
 
+   if (indirect) {
+      info.indirect = st_buffer_object(indirect)->buffer;
+
+      /* Primitive restart is not handled by the VBO module in this case. */
+      info.primitive_restart = ctx->Array._PrimitiveRestart;
+      info.restart_index = ctx->Array.RestartIndex;
+   }
+
    /* do actual drawing */
    for (i = 0; i < nr_prims; i++) {
       info.mode = translate_prim(ctx, prims[i].mode);
@@ -266,6 +264,7 @@ st_draw_vbo(struct gl_context *ctx,
          info.min_index = info.start;
          info.max_index = info.start + info.count - 1;
       }
+      info.indirect_offset = prims[i].indirect_offset;
 
       if (ST_DEBUG & DEBUG_DRAW) {
          debug_printf("st/draw: mode %s  start %u  count %u  indexed %d\n",
@@ -275,7 +274,7 @@ st_draw_vbo(struct gl_context *ctx,
                       info.indexed);
       }
 
-      if (info.count_from_stream_output) {
+      if (info.count_from_stream_output || info.indirect) {
          cso_draw_vbo(st->cso_context, &info);
       }
       else if (info.primitive_restart) {