From 472593e9cfcb8d5b49d2475ee677700584583812 Mon Sep 17 00:00:00 2001 From: Jonathan Marek Date: Sun, 5 Jan 2020 21:53:36 -0500 Subject: [PATCH] etnaviv: remove unnecessary vertex_elements_state_create error checking PIPE_CAP_MAX_VERTEX_BUFFERS already sets the maximum vertex_buffer_index. There's no need to error on num_elements == 0 (if that can even happen). Signed-off-by: Jonathan Marek Reviewed-by: Christian Gmeiner --- src/gallium/drivers/etnaviv/etnaviv_state.c | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/src/gallium/drivers/etnaviv/etnaviv_state.c b/src/gallium/drivers/etnaviv/etnaviv_state.c index 34d83f9a3fa..12f2648c566 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_state.c +++ b/src/gallium/drivers/etnaviv/etnaviv_state.c @@ -543,24 +543,7 @@ etna_vertex_elements_state_create(struct pipe_context *pctx, /* XXX could minimize number of consecutive stretches here by sorting, and * permuting the inputs in shader or does Mesa do this already? */ - /* Check that vertex element binding is compatible with hardware; thus - * elements[idx].vertex_buffer_index are < stream_count. If not, the binding - * uses more streams than is supported, and u_vbuf should have done some - * reorganization for compatibility. */ - - /* TODO: does mesa this for us? */ - bool incompatible = false; - for (unsigned idx = 0; idx < num_elements; ++idx) { - if (elements[idx].vertex_buffer_index >= ctx->specs.stream_count) - incompatible = true; - } - cs->num_elements = num_elements; - if (incompatible || num_elements == 0) { - DBG("Error: zero vertex elements, or more vertex buffers used than supported"); - FREE(cs); - return NULL; - } unsigned start_offset = 0; /* start of current consecutive stretch */ bool nonconsecutive = true; /* previous value of nonconsecutive */ @@ -575,6 +558,9 @@ etna_vertex_elements_state_create(struct pipe_context *pctx, if (nonconsecutive) start_offset = elements[idx].src_offset; + /* guaranteed by PIPE_CAP_MAX_VERTEX_BUFFERS */ + assert(buffer_idx < ctx->specs.stream_count); + /* maximum vertex size is 256 bytes */ assert(element_size != 0 && (end_offset - start_offset) < 256); -- 2.30.2