draw: bail instead of assert on instance count (v2)
authorDave Airlie <airlied@redhat.com>
Mon, 25 Mar 2019 03:17:31 +0000 (13:17 +1000)
committerDave Airlie <airlied@redhat.com>
Mon, 25 Mar 2019 19:16:56 +0000 (05:16 +1000)
With indirect rendering it's fine to set the instance count
parameter to 0, and expect the rendering to be ignored.

Fixes assert in KHR-GLES31.core.compute_shader.pipeline-gen-draw-commands
on softpipe

v2: return earlier before changing fpstate

Reviewed-by: Brian Paul <brianp@vmware.com>
src/gallium/auxiliary/draw/draw_pt.c

index be76a30f97ccbe2c9df8dd9fb809327b7559d3a1..50286149cd48de91a555e720c8e7d72f357489e4 100644 (file)
@@ -464,6 +464,9 @@ draw_vbo(struct draw_context *draw,
    unsigned fpstate = util_fpstate_get();
    struct pipe_draw_info resolved_info;
 
+   if (info->instance_count == 0)
+      return;
+
    /* Make sure that denorms are treated like zeros. This is 
     * the behavior required by D3D10. OpenGL doesn't care.
     */
@@ -472,7 +475,6 @@ draw_vbo(struct draw_context *draw,
    resolve_draw_info(info, &resolved_info, &(draw->pt.vertex_buffer[0]));
    info = &resolved_info;
 
-   assert(info->instance_count > 0);
    if (info->index_size)
       assert(draw->pt.user.elts);