gallium: skip draws with count == 0 or instance_count == 0 in drivers

Fixes: 85b6ba136b "st/mesa: implement Driver.DrawGallium callbacks"

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8345>
This commit is contained in:
Marek Olšák 2021-01-05 23:07:46 -05:00 committed by Marge Bot
parent 275079e3ad
commit 8fc6a19765
17 changed files with 51 additions and 0 deletions

View file

@ -437,6 +437,9 @@ d3d12_draw_vbo(struct pipe_context *pctx,
return;
}
if (!indirect && (!draws[0].count || !dinfo->instance_count))
return;
struct d3d12_context *ctx = d3d12_context(pctx);
struct d3d12_batch *batch;
struct pipe_resource *index_buffer = NULL;

View file

@ -239,6 +239,9 @@ etna_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info,
return;
}
if (!indirect && (!draws[0].count || !info->instance_count))
return;
struct etna_context *ctx = etna_context(pctx);
struct etna_screen *screen = ctx->screen;
struct pipe_framebuffer_state *pfb = &ctx->framebuffer_s;

View file

@ -227,6 +227,9 @@ fd_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info,
return;
}
if (!indirect && (!draws[0].count || !info->instance_count))
return;
struct fd_context *ctx = fd_context(pctx);
/* for debugging problems with indirect draw, it is convenient

View file

@ -251,6 +251,9 @@ iris_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info,
return;
}
if (!indirect && (!draws[0].count || !info->instance_count))
return;
struct iris_context *ice = (struct iris_context *) ctx;
struct iris_screen *screen = (struct iris_screen*)ice->ctx.screen;
const struct gen_device_info *devinfo = &screen->devinfo;

View file

@ -67,6 +67,9 @@ llvmpipe_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info,
return;
}
if (!indirect && (!draws[0].count || !info->instance_count))
return;
struct llvmpipe_context *lp = llvmpipe_context(pipe);
struct draw_context *draw = lp->draw;
const void *mapped_indices = NULL;

View file

@ -560,6 +560,9 @@ nv30_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info,
return;
}
if (!indirect && (!draws[0].count || !info->instance_count))
return;
struct nv30_context *nv30 = nv30_context(pipe);
struct nouveau_pushbuf *push = nv30->base.pushbuf;
int i;

View file

@ -771,6 +771,9 @@ nv50_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info,
return;
}
if (!indirect && (!draws[0].count || !info->instance_count))
return;
struct nv50_context *nv50 = nv50_context(pipe);
struct nouveau_pushbuf *push = nv50->base.pushbuf;
bool tex_dirty = false;

View file

@ -938,6 +938,9 @@ nvc0_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info,
return;
}
if (!indirect && (!draws[0].count || !info->instance_count))
return;
struct nvc0_context *nvc0 = nvc0_context(pipe);
struct nouveau_pushbuf *push = nvc0->base.pushbuf;
struct nvc0_screen *screen = nvc0->screen;

View file

@ -468,6 +468,9 @@ panfrost_draw_vbo(
return;
}
if (!indirect && (!draws[0].count || !info->instance_count))
return;
struct panfrost_context *ctx = pan_context(pipe);
struct panfrost_device *device = pan_device(ctx->base.screen);

View file

@ -75,6 +75,9 @@ softpipe_draw_vbo(struct pipe_context *pipe,
return;
}
if (!indirect && (!draws[0].count || !info->instance_count))
return;
struct softpipe_context *sp = softpipe_context(pipe);
struct draw_context *draw = sp->draw;
const void *mapped_indices = NULL;

View file

@ -233,6 +233,9 @@ svga_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info,
return;
}
if (!indirect && (!draws[0].count || !info->instance_count))
return;
struct svga_context *svga = svga_context(pipe);
enum pipe_prim_type reduced_prim = u_reduced_prim(info->mode);
unsigned count = draws[0].count;

View file

@ -53,6 +53,9 @@ swr_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info,
return;
}
if (!indirect && (!draws[0].count || !info->instance_count))
return;
struct swr_context *ctx = swr_context(pipe);
if (!indirect &&

View file

@ -62,6 +62,9 @@ tegra_draw_vbo(struct pipe_context *pcontext,
return;
}
if (!pindirect && (!draws[0].count || !pinfo->instance_count))
return;
struct tegra_context *context = to_tegra_context(pcontext);
struct pipe_draw_indirect_info indirect;
struct pipe_draw_info info;

View file

@ -1108,6 +1108,9 @@ v3d_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info,
return;
}
if (!indirect && (!draws[0].count || !info->instance_count))
return;
struct v3d_context *v3d = v3d_context(pctx);
if (!indirect &&

View file

@ -303,6 +303,9 @@ vc4_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info,
return;
}
if (!indirect && (!draws[0].count || !info->instance_count))
return;
struct vc4_context *vc4 = vc4_context(pctx);
struct pipe_draw_info local_info;

View file

@ -864,6 +864,9 @@ static void virgl_draw_vbo(struct pipe_context *ctx,
return;
}
if (!indirect && (!draws[0].count || !dinfo->instance_count))
return;
struct virgl_context *vctx = virgl_context(ctx);
struct virgl_screen *rs = virgl_screen(ctx->screen);
struct virgl_indexbuf ib = {};

View file

@ -224,6 +224,9 @@ zink_draw_vbo(struct pipe_context *pctx,
return;
}
if (!dindirect && (!draws[0].count || !dinfo->instance_count))
return;
struct zink_context *ctx = zink_context(pctx);
struct zink_screen *screen = zink_screen(pctx->screen);
struct zink_rasterizer_state *rast_state = ctx->rast_state;