radeonsi: add si_context::num_vertex_elements

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
This commit is contained in:
Marek Olšák 2020-01-07 18:10:38 -05:00
parent 1e03b63b3b
commit c278c73f13
3 changed files with 7 additions and 11 deletions

View file

@ -1070,7 +1070,7 @@ static void si_get_buffer_from_descriptors(struct si_buffer_resources *buffers,
static void si_vertex_buffers_begin_new_cs(struct si_context *sctx)
{
int count = sctx->vertex_elements ? sctx->vertex_elements->count : 0;
int count = sctx->num_vertex_elements;
int i;
for (i = 0; i < count; i++) {
@ -1095,18 +1095,13 @@ static void si_vertex_buffers_begin_new_cs(struct si_context *sctx)
bool si_upload_vertex_buffer_descriptors(struct si_context *sctx)
{
struct si_vertex_elements *velems = sctx->vertex_elements;
unsigned i, count;
unsigned i, count = sctx->num_vertex_elements;
uint32_t *ptr;
if (!sctx->vertex_buffers_dirty || !velems)
return true;
count = velems->count;
if (!count)
if (!sctx->vertex_buffers_dirty || !count)
return true;
struct si_vertex_elements *velems = sctx->vertex_elements;
unsigned alloc_size = velems->vb_desc_list_alloc_size;
unsigned first_vb_use_mask = velems->first_vb_use_mask;
@ -1667,8 +1662,7 @@ void si_rebind_buffer(struct si_context *sctx, struct pipe_resource *buf)
{
struct si_resource *buffer = si_resource(buf);
unsigned i, shader;
unsigned num_elems = sctx->vertex_elements ?
sctx->vertex_elements->count : 0;
unsigned num_elems = sctx->num_vertex_elements;
/* We changed the buffer, now we need to bind it where the old one
* was bound. This consists of 2 things:

View file

@ -1000,6 +1000,7 @@ struct si_context {
/* shader information */
struct si_vertex_elements *vertex_elements;
unsigned num_vertex_elements;
unsigned sprite_coord_enable;
unsigned cs_max_waves_per_sh;
bool flatshade;

View file

@ -5074,6 +5074,7 @@ static void si_bind_vertex_elements(struct pipe_context *ctx, void *state)
struct si_vertex_elements *v = (struct si_vertex_elements*)state;
sctx->vertex_elements = v;
sctx->num_vertex_elements = v ? v->count : 0;
sctx->vertex_buffers_dirty = true;
if (v &&