void cso_set_vertex_buffers(struct cso_context *ctx, unsigned start_slot, unsigned count, const struct pipe_vertex_buffer *buffers) { struct u_vbuf *vbuf = ctx->vbuf; if (vbuf) { u_vbuf_set_vertex_buffers(vbuf, start_slot, count, buffers); return; } /* Save what's in the auxiliary slot, so that we can save and restore it * for meta ops. */ if (start_slot <= ctx->aux_vertex_buffer_index && start_slot+count > ctx->aux_vertex_buffer_index) { if (buffers) { const struct pipe_vertex_buffer *vb = buffers + (ctx->aux_vertex_buffer_index - start_slot); pipe_resource_reference(&ctx->aux_vertex_buffer_current.buffer, vb->buffer); memcpy(&ctx->aux_vertex_buffer_current, vb, sizeof(struct pipe_vertex_buffer)); } else { pipe_resource_reference(&ctx->aux_vertex_buffer_current.buffer, NULL); ctx->aux_vertex_buffer_current.user_buffer = NULL; } } ctx->pipe->set_vertex_buffers(ctx->pipe, start_slot, count, buffers); }
void r600_set_vertex_buffers(struct pipe_context *ctx, unsigned count, const struct pipe_vertex_buffer *buffers) { struct r600_pipe_context *rctx = (struct r600_pipe_context *)ctx; int i; /* Zero states. */ for (i = 0; i < count; i++) { if (!buffers[i].buffer) { if (rctx->chip_class >= EVERGREEN) { evergreen_context_pipe_state_set_fs_resource(&rctx->ctx, NULL, i); } else { r600_context_pipe_state_set_fs_resource(&rctx->ctx, NULL, i); } } } for (; i < rctx->vbuf_mgr->nr_real_vertex_buffers; i++) { if (rctx->chip_class >= EVERGREEN) { evergreen_context_pipe_state_set_fs_resource(&rctx->ctx, NULL, i); } else { r600_context_pipe_state_set_fs_resource(&rctx->ctx, NULL, i); } } u_vbuf_set_vertex_buffers(rctx->vbuf_mgr, count, buffers); }
void u_vbuf_restore_vertex_buffers(struct u_vbuf *mgr) { unsigned i; u_vbuf_set_vertex_buffers(mgr, mgr->nr_vertex_buffers_saved, mgr->vertex_buffer_saved); for (i = 0; i < mgr->nr_vertex_buffers_saved; i++) { pipe_resource_reference(&mgr->vertex_buffer_saved[i].buffer, NULL); } mgr->nr_vertex_buffers_saved = 0; }
void cso_set_vertex_buffers(struct cso_context *ctx, unsigned count, const struct pipe_vertex_buffer *buffers) { struct u_vbuf *vbuf = ctx->vbuf; if (vbuf) { u_vbuf_set_vertex_buffers(vbuf, count, buffers); return; } if (count != ctx->nr_vertex_buffers || memcmp(buffers, ctx->vertex_buffers, sizeof(struct pipe_vertex_buffer) * count) != 0) { util_copy_vertex_buffers(ctx->vertex_buffers, &ctx->nr_vertex_buffers, buffers, count); ctx->pipe->set_vertex_buffers(ctx->pipe, count, buffers); } }
void u_vbuf_restore_aux_vertex_buffer_slot(struct u_vbuf *mgr) { u_vbuf_set_vertex_buffers(mgr, mgr->aux_vertex_buffer_slot, 1, &mgr->aux_vertex_buffer_saved); pipe_resource_reference(&mgr->aux_vertex_buffer_saved.buffer, NULL); }