mesa: skip fallback draw call if no primitives are being drawn

../src/mesa/main/draw.c: In function ‘_mesa_draw_gallium_fallback’:
../src/mesa/main/draw.c:1056:4: warning: ‘prim’ may be used uninitialized [-Wmaybe-uninitialized]
 1056 |    ctx->Driver.Draw(ctx, prim, num_prims, index_size ? &ib : NULL,
      |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1057 |                     index_bounds_valid, info->primitive_restart,
      |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1058 |                     info->restart_index, min_index, max_index,
      |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1059 |                     info->instance_count, info->start_instance);
      |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12766>
This commit is contained in:
Mike Blumenkrantz 2021-08-31 16:41:12 -04:00 committed by Marge Bot
parent b58d6eaf11
commit 869f0a4992
1 changed files with 5 additions and 4 deletions

View File

@ -1064,10 +1064,11 @@ _mesa_draw_gallium_fallback(struct gl_context *ctx,
}
}
ctx->Driver.Draw(ctx, prim, num_prims, index_size ? &ib : NULL,
index_bounds_valid, info->primitive_restart,
info->restart_index, min_index, max_index,
info->instance_count, info->start_instance);
if (num_prims)
ctx->Driver.Draw(ctx, prim, num_prims, index_size ? &ib : NULL,
index_bounds_valid, info->primitive_restart,
info->restart_index, min_index, max_index,
info->instance_count, info->start_instance);
FREE_PRIMS(prim, num_draws);
}