iris: Fix assert when using vertex attrib without buffer binding
authorDanylo Piliaiev <danylo.piliaiev@globallogic.com>
Thu, 4 Apr 2019 12:04:50 +0000 (15:04 +0300)
committerKenneth Graunke <kenneth@whitecape.org>
Thu, 4 Apr 2019 22:57:24 +0000 (22:57 +0000)
The GL 4.5 spec says:
 "If any enabled array’s buffer binding is zero when DrawArrays or
  one of the other drawing commands defined in section 10.4 is called,
  the result is undefined."

The result is undefined but it should not crash.

Fixes: gl-3.1-vao-broken-attrib
Signed-off-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/gallium/drivers/iris/iris_state.c

index 591c63593151500170ef5bda680e165c83b9de23..0035b07caeb17f476b84b50374a7daa68c402eea 100644 (file)
@@ -2642,7 +2642,8 @@ iris_set_vertex_buffers(struct pipe_context *ctx,
          continue;
       }
 
-      assert(!buffer->is_user_buffer);
+      /* We may see user buffers that are NULL bindings. */
+      assert(!(buffer->is_user_buffer && buffer->buffer.user != NULL));
 
       pipe_resource_reference(&state->resource, buffer->buffer.resource);
       struct iris_resource *res = (void *) state->resource;