unsigned pkt_flags)
{
struct radeon_cmdbuf *cs = &rctx->b.gfx.cs;
- uint32_t dirty_mask = state->dirty_mask;
+ struct r600_fetch_shader *shader = (struct r600_fetch_shader*)rctx->vertex_fetch_shader.cso;
+ uint32_t dirty_mask = state->dirty_mask & shader->buffer_mask;
while (dirty_mask) {
struct pipe_vertex_buffer *vb;
struct r600_resource *rbuffer;
uint64_t va;
unsigned buffer_index = u_bit_scan(&dirty_mask);
- struct r600_fetch_shader *shader = (struct r600_fetch_shader*)rctx->vertex_fetch_shader.cso;
unsigned stride = pkt_flags == RADEON_CP_PACKET3_COMPUTE_MODE ?
1 : shader->strides[buffer_index];
radeon_emit(cs, radeon_add_to_buffer_list(&rctx->b, &rctx->b.gfx, rbuffer,
RADEON_USAGE_READ | RADEON_PRIO_VERTEX_BUFFER));
}
- state->dirty_mask = 0;
+ state->dirty_mask &= ~shader->buffer_mask;
}
static void evergreen_fs_emit_vertex_buffers(struct r600_context *rctx, struct r600_atom * atom)
static void r600_emit_vertex_buffers(struct r600_context *rctx, struct r600_atom *atom)
{
struct radeon_cmdbuf *cs = &rctx->b.gfx.cs;
- uint32_t dirty_mask = rctx->vertex_buffer_state.dirty_mask;
+ struct r600_fetch_shader *shader = (struct r600_fetch_shader*)rctx->vertex_fetch_shader.cso;
+ uint32_t dirty_mask = rctx->vertex_buffer_state.dirty_mask & shader->buffer_mask;
while (dirty_mask) {
struct pipe_vertex_buffer *vb;
struct r600_resource *rbuffer;
unsigned offset;
unsigned buffer_index = u_bit_scan(&dirty_mask);
- struct r600_fetch_shader *shader = (struct r600_fetch_shader*)rctx->vertex_fetch_shader.cso;
unsigned stride = shader->strides[buffer_index];
vb = &rctx->vertex_buffer_state.vb[buffer_index];
free(dsa);
}
-static void r600_bind_vertex_elements(struct pipe_context *ctx, void *state)
-{
- struct r600_context *rctx = (struct r600_context *)ctx;
-
- r600_set_cso_state(rctx, &rctx->vertex_fetch_shader, state);
-}
-
static void r600_delete_vertex_elements(struct pipe_context *ctx, void *state)
{
struct r600_fetch_shader *shader = (struct r600_fetch_shader*)state;
void r600_vertex_buffers_dirty(struct r600_context *rctx)
{
- if (rctx->vertex_buffer_state.dirty_mask) {
+ struct r600_fetch_shader *shader = (struct r600_fetch_shader*)rctx->vertex_fetch_shader.cso;
+ if (shader && (rctx->vertex_buffer_state.dirty_mask & shader->buffer_mask)) {
rctx->vertex_buffer_state.atom.num_dw = (rctx->b.gfx_level >= EVERGREEN ? 12 : 11) *
- util_bitcount(rctx->vertex_buffer_state.dirty_mask);
+ util_bitcount(rctx->vertex_buffer_state.dirty_mask & shader->buffer_mask);
r600_mark_atom_dirty(rctx, &rctx->vertex_buffer_state.atom);
}
}
+static void r600_bind_vertex_elements(struct pipe_context *ctx, void *state)
+{
+ struct r600_context *rctx = (struct r600_context *)ctx;
+ struct r600_fetch_shader *prev = (struct r600_fetch_shader*)rctx->vertex_fetch_shader.cso;
+ struct r600_fetch_shader *cso = state;
+
+ r600_set_cso_state(rctx, &rctx->vertex_fetch_shader, state);
+ if (!prev || (cso && cso->buffer_mask &&
+ (prev->buffer_mask != cso->buffer_mask || memcmp(cso->strides, prev->strides, util_last_bit(cso->buffer_mask))))) {
+ rctx->vertex_buffer_state.dirty_mask |= cso ? cso->buffer_mask : 0;
+ r600_vertex_buffers_dirty(rctx);
+ }
+}
+
static void r600_set_vertex_buffers(struct pipe_context *ctx,
unsigned count,
unsigned unbind_num_trailing_slots,