diff options
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r-- | src/mesa/state_tracker/st_atom_array.c | 8 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_cb_bitmap.c | 8 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_cb_clear.c | 8 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_cb_drawpixels.c | 8 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_cb_drawtex.c | 5 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_context.c | 3 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_context.h | 3 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_draw_feedback.c | 4 |
8 files changed, 32 insertions, 15 deletions
diff --git a/src/mesa/state_tracker/st_atom_array.c b/src/mesa/state_tracker/st_atom_array.c index ab46f11887e..c96f6dc70c3 100644 --- a/src/mesa/state_tracker/st_atom_array.c +++ b/src/mesa/state_tracker/st_atom_array.c @@ -574,7 +574,13 @@ static void update_array(struct st_context *st) num_velements = vpv->num_inputs; } - cso_set_vertex_buffers(st->cso_context, num_vbuffers, vbuffer); + cso_set_vertex_buffers(st->cso_context, 0, num_vbuffers, vbuffer); + if (st->last_num_vbuffers > num_vbuffers) { + /* Unbind remaining buffers, if any. */ + cso_set_vertex_buffers(st->cso_context, num_vbuffers, + st->last_num_vbuffers - num_vbuffers, NULL); + } + st->last_num_vbuffers = num_vbuffers; cso_set_vertex_elements(st->cso_context, num_velements, velements); } diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c index b024ef0db32..843dc5be337 100644 --- a/src/mesa/state_tracker/st_cb_bitmap.c +++ b/src/mesa/state_tracker/st_cb_bitmap.c @@ -457,7 +457,7 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z, cso_save_vertex_shader(cso); cso_save_geometry_shader(cso); cso_save_vertex_elements(cso); - cso_save_vertex_buffers(cso); + cso_save_aux_vertex_buffer_slot(cso); /* rasterizer state: just scissor */ st->bitmap.rasterizer.scissor = ctx->Scissor.Enabled; @@ -526,7 +526,9 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z, x, y, width, height, z, color, &vbuf, &offset); if (vbuf) { - util_draw_vertex_buffer(pipe, st->cso_context, vbuf, offset, + util_draw_vertex_buffer(pipe, st->cso_context, vbuf, + cso_get_aux_vertex_buffer_slot(st->cso_context), + offset, PIPE_PRIM_TRIANGLE_FAN, 4, /* verts */ 3); /* attribs/vert */ @@ -541,7 +543,7 @@ draw_bitmap_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z, cso_restore_vertex_shader(cso); cso_restore_geometry_shader(cso); cso_restore_vertex_elements(cso); - cso_restore_vertex_buffers(cso); + cso_restore_aux_vertex_buffer_slot(cso); cso_restore_stream_outputs(cso); pipe_resource_reference(&vbuf, NULL); diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c index 90eb0af4fe0..4aa0bc18ff5 100644 --- a/src/mesa/state_tracker/st_cb_clear.c +++ b/src/mesa/state_tracker/st_cb_clear.c @@ -176,7 +176,9 @@ draw_quad(struct st_context *st, /* draw */ util_draw_vertex_buffer(pipe, st->cso_context, - vbuf, offset, + vbuf, + cso_get_aux_vertex_buffer_slot(st->cso_context), + offset, PIPE_PRIM_TRIANGLE_FAN, 4, /* verts */ 2); /* attribs/vert */ @@ -225,7 +227,7 @@ clear_with_quad(struct gl_context *ctx, cso_save_vertex_shader(st->cso_context); cso_save_geometry_shader(st->cso_context); cso_save_vertex_elements(st->cso_context); - cso_save_vertex_buffers(st->cso_context); + cso_save_aux_vertex_buffer_slot(st->cso_context); /* blend state: RGBA masking */ { @@ -325,7 +327,7 @@ clear_with_quad(struct gl_context *ctx, cso_restore_vertex_shader(st->cso_context); cso_restore_geometry_shader(st->cso_context); cso_restore_vertex_elements(st->cso_context); - cso_restore_vertex_buffers(st->cso_context); + cso_restore_aux_vertex_buffer_slot(st->cso_context); cso_restore_stream_outputs(st->cso_context); } diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index 642011488cd..ff8a9dc4364 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -637,7 +637,9 @@ draw_quad(struct gl_context *ctx, GLfloat x0, GLfloat y0, GLfloat z, } u_upload_unmap(st->uploader); - util_draw_vertex_buffer(pipe, st->cso_context, buf, offset, + util_draw_vertex_buffer(pipe, st->cso_context, buf, + cso_get_aux_vertex_buffer_slot(st->cso_context), + offset, PIPE_PRIM_QUADS, 4, /* verts */ 3); /* attribs/vert */ @@ -683,7 +685,7 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z, cso_save_vertex_shader(cso); cso_save_geometry_shader(cso); cso_save_vertex_elements(cso); - cso_save_vertex_buffers(cso); + cso_save_aux_vertex_buffer_slot(cso); if (write_stencil) { cso_save_depth_stencil_alpha(cso); cso_save_blend(cso); @@ -808,7 +810,7 @@ draw_textured_quad(struct gl_context *ctx, GLint x, GLint y, GLfloat z, cso_restore_vertex_shader(cso); cso_restore_geometry_shader(cso); cso_restore_vertex_elements(cso); - cso_restore_vertex_buffers(cso); + cso_restore_aux_vertex_buffer_slot(cso); cso_restore_stream_outputs(cso); if (write_stencil) { cso_restore_depth_stencil_alpha(cso); diff --git a/src/mesa/state_tracker/st_cb_drawtex.c b/src/mesa/state_tracker/st_cb_drawtex.c index e87de44063e..269068da2b0 100644 --- a/src/mesa/state_tracker/st_cb_drawtex.c +++ b/src/mesa/state_tracker/st_cb_drawtex.c @@ -228,7 +228,7 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z, cso_save_vertex_shader(cso); cso_save_geometry_shader(cso); cso_save_vertex_elements(cso); - cso_save_vertex_buffers(cso); + cso_save_aux_vertex_buffer_slot(cso); { void *vs = lookup_shader(pipe, numAttribs, @@ -266,6 +266,7 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z, util_draw_vertex_buffer(pipe, cso, vbuffer, + cso_get_aux_vertex_buffer_slot(cso), offset, /* offset */ PIPE_PRIM_TRIANGLE_FAN, 4, /* verts */ @@ -279,7 +280,7 @@ st_DrawTex(struct gl_context *ctx, GLfloat x, GLfloat y, GLfloat z, cso_restore_vertex_shader(cso); cso_restore_geometry_shader(cso); cso_restore_vertex_elements(cso); - cso_restore_vertex_buffers(cso); + cso_restore_aux_vertex_buffer_slot(cso); cso_restore_stream_outputs(cso); } diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index da361d88795..69bd50336ec 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -173,7 +173,8 @@ st_create_context_priv( struct gl_context *ctx, struct pipe_context *pipe, memset(&st->velems_util_draw[i], 0, sizeof(struct pipe_vertex_element)); st->velems_util_draw[i].src_offset = i * 4 * sizeof(float); st->velems_util_draw[i].instance_divisor = 0; - st->velems_util_draw[i].vertex_buffer_index = 0; + st->velems_util_draw[i].vertex_buffer_index = + cso_get_aux_vertex_buffer_slot(st->cso_context); st->velems_util_draw[i].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT; } diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h index c85d09cb5cd..2cc52773efb 100644 --- a/src/mesa/state_tracker/st_context.h +++ b/src/mesa/state_tracker/st_context.h @@ -188,6 +188,9 @@ struct st_context int force_msaa; void *winsys_drawable_handle; + /* The number of vertex buffers from the last call of validate_arrays. */ + unsigned last_num_vbuffers; + /* Active render condition. */ struct pipe_query *render_condition; unsigned condition_mode; diff --git a/src/mesa/state_tracker/st_draw_feedback.c b/src/mesa/state_tracker/st_draw_feedback.c index a6c7d0eec85..ae87fb28dbf 100644 --- a/src/mesa/state_tracker/st_draw_feedback.c +++ b/src/mesa/state_tracker/st_draw_feedback.c @@ -205,7 +205,7 @@ st_feedback_draw_vbo(struct gl_context *ctx, #endif } - draw_set_vertex_buffers(draw, vp->num_inputs, vbuffers); + draw_set_vertex_buffers(draw, 0, vp->num_inputs, vbuffers); draw_set_vertex_elements(draw, vp->num_inputs, velements); memset(&ibuffer, 0, sizeof(ibuffer)); @@ -264,5 +264,5 @@ st_feedback_draw_vbo(struct gl_context *ctx, draw_set_mapped_vertex_buffer(draw, attr, NULL); pipe_resource_reference(&vbuffers[attr].buffer, NULL); } - draw_set_vertex_buffers(draw, 0, NULL); + draw_set_vertex_buffers(draw, 0, vp->num_inputs, NULL); } |