Mesa (master): etnaviv: remove unnecessary vertex_elements_state_create error checking

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jan 8 17:58:10 UTC 2020


Module: Mesa
Branch: master
Commit: 472593e9cfcb8d5b49d2475ee677700584583812
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=472593e9cfcb8d5b49d2475ee677700584583812

Author: Jonathan Marek <jonathan at marek.ca>
Date:   Sun Jan  5 21:53:36 2020 -0500

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 <jonathan at marek.ca>
Reviewed-by: Christian Gmeiner <christian.gmeiner at gmail.com>

---

 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);
 




More information about the mesa-commit mailing list