summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gallium/drivers/etnaviv/etnaviv_context.c5
-rw-r--r--src/gallium/drivers/freedreno/freedreno_draw.c5
-rw-r--r--src/gallium/drivers/i915/i915_context.c4
-rw-r--r--src/gallium/drivers/nouveau/nv30/nv30_vbo.c5
-rw-r--r--src/gallium/drivers/r300/r300_render.c3
-rw-r--r--src/gallium/drivers/swr/swr_draw.cpp5
-rw-r--r--src/gallium/drivers/vc4/vc4_draw.c5
-rw-r--r--src/gallium/drivers/virgl/virgl_context.c6
-rw-r--r--src/mesa/state_tracker/st_draw.c12
9 files changed, 40 insertions, 10 deletions
diff --git a/src/gallium/drivers/etnaviv/etnaviv_context.c b/src/gallium/drivers/etnaviv/etnaviv_context.c
index cfbc9065426..e426d4f1d19 100644
--- a/src/gallium/drivers/etnaviv/etnaviv_context.c
+++ b/src/gallium/drivers/etnaviv/etnaviv_context.c
@@ -149,6 +149,11 @@ etna_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info)
uint32_t draw_mode;
unsigned i;
+ if (!info->count_from_stream_output && !info->indirect &&
+ !info->primitive_restart &&
+ !u_trim_pipe_prim(info->mode, (unsigned*)&info->count))
+ return;
+
if (ctx->vertex_elements == NULL || ctx->vertex_elements->num_elements == 0)
return; /* Nothing to do */
diff --git a/src/gallium/drivers/freedreno/freedreno_draw.c b/src/gallium/drivers/freedreno/freedreno_draw.c
index 16c9ea84af3..6243984dc80 100644
--- a/src/gallium/drivers/freedreno/freedreno_draw.c
+++ b/src/gallium/drivers/freedreno/freedreno_draw.c
@@ -65,6 +65,11 @@ fd_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info)
struct pipe_scissor_state *scissor = fd_context_get_scissor(ctx);
unsigned i, prims, buffers = 0;
+ if (!info->count_from_stream_output && !info->indirect &&
+ !info->primitive_restart &&
+ !u_trim_pipe_prim(info->mode, (unsigned*)&info->count))
+ return;
+
/* if we supported transform feedback, we'd have to disable this: */
if (((scissor->maxx - scissor->minx) *
(scissor->maxy - scissor->miny)) == 0) {
diff --git a/src/gallium/drivers/i915/i915_context.c b/src/gallium/drivers/i915/i915_context.c
index 6664cfc3dfe..c22e4056424 100644
--- a/src/gallium/drivers/i915/i915_context.c
+++ b/src/gallium/drivers/i915/i915_context.c
@@ -37,6 +37,7 @@
#include "pipe/p_defines.h"
#include "util/u_inlines.h"
#include "util/u_memory.h"
+#include "util/u_prim.h"
#include "util/u_upload_mgr.h"
#include "pipe/p_screen.h"
@@ -57,6 +58,9 @@ i915_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info)
const void *mapped_indices = NULL;
unsigned i;
+ if (!u_trim_pipe_prim(info->mode, (unsigned*)&info->count))
+ return;
+
/*
* Ack vs contants here, helps ipers a lot.
*/
diff --git a/src/gallium/drivers/nouveau/nv30/nv30_vbo.c b/src/gallium/drivers/nouveau/nv30/nv30_vbo.c
index bc9b9a16ea8..9338f2ed700 100644
--- a/src/gallium/drivers/nouveau/nv30/nv30_vbo.c
+++ b/src/gallium/drivers/nouveau/nv30/nv30_vbo.c
@@ -25,6 +25,7 @@
#include "util/u_format.h"
#include "util/u_inlines.h"
+#include "util/u_prim.h"
#include "translate/translate.h"
#include "nouveau_fence.h"
@@ -550,6 +551,10 @@ nv30_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info)
struct nouveau_pushbuf *push = nv30->base.pushbuf;
int i;
+ if (!info->primitive_restart &&
+ !u_trim_pipe_prim(info->mode, (unsigned*)&info->count))
+ return;
+
/* For picking only a few vertices from a large user buffer, push is better,
* if index count is larger and we expect repeated vertices, suggest upload.
*/
diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c
index ad0f4896172..9702a2e32ed 100644
--- a/src/gallium/drivers/r300/r300_render.c
+++ b/src/gallium/drivers/r300/r300_render.c
@@ -847,6 +847,9 @@ static void r300_swtcl_draw_vbo(struct pipe_context* pipe,
return;
}
+ if (!u_trim_pipe_prim(info->mode, (unsigned*)&info->count))
+ return;
+
r300_update_derived_state(r300);
draw_vbo(r300->draw, info);
diff --git a/src/gallium/drivers/swr/swr_draw.cpp b/src/gallium/drivers/swr/swr_draw.cpp
index c43f4a5f64d..de78cf34750 100644
--- a/src/gallium/drivers/swr/swr_draw.cpp
+++ b/src/gallium/drivers/swr/swr_draw.cpp
@@ -39,6 +39,11 @@ swr_draw_vbo(struct pipe_context *pipe, const struct pipe_draw_info *info)
{
struct swr_context *ctx = swr_context(pipe);
+ if (!info->count_from_stream_output && !info->indirect &&
+ !info->primitive_restart &&
+ !u_trim_pipe_prim(info->mode, (unsigned*)&info->count))
+ return;
+
if (!swr_check_render_cond(pipe))
return;
diff --git a/src/gallium/drivers/vc4/vc4_draw.c b/src/gallium/drivers/vc4/vc4_draw.c
index ebd080298a4..61694ecda6c 100644
--- a/src/gallium/drivers/vc4/vc4_draw.c
+++ b/src/gallium/drivers/vc4/vc4_draw.c
@@ -283,6 +283,11 @@ vc4_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info)
{
struct vc4_context *vc4 = vc4_context(pctx);
+ if (!info->count_from_stream_output && !info->indirect &&
+ !info->primitive_restart &&
+ !u_trim_pipe_prim(info->mode, (unsigned*)&info->count))
+ return;
+
if (info->mode >= PIPE_PRIM_QUADS) {
util_primconvert_save_index_buffer(vc4->primconvert, &vc4->indexbuf);
util_primconvert_save_rasterizer_state(vc4->primconvert, &vc4->rasterizer->base);
diff --git a/src/gallium/drivers/virgl/virgl_context.c b/src/gallium/drivers/virgl/virgl_context.c
index 4b990a6a5d0..25b24c895d3 100644
--- a/src/gallium/drivers/virgl/virgl_context.c
+++ b/src/gallium/drivers/virgl/virgl_context.c
@@ -30,6 +30,7 @@
#include "util/u_inlines.h"
#include "util/u_memory.h"
#include "util/u_format.h"
+#include "util/u_prim.h"
#include "util/u_transfer.h"
#include "util/u_helpers.h"
#include "util/slab.h"
@@ -592,6 +593,11 @@ static void virgl_draw_vbo(struct pipe_context *ctx,
struct pipe_index_buffer ib = {};
struct pipe_draw_info info = *dinfo;
+ if (!dinfo->count_from_stream_output && !dinfo->indirect &&
+ !dinfo->primitive_restart &&
+ !u_trim_pipe_prim(dinfo->mode, (unsigned*)&dinfo->count))
+ return;
+
if (!(rs->caps.caps.v1.prim_mask & (1 << dinfo->mode))) {
util_primconvert_save_index_buffer(vctx->primconvert, &vctx->index_buffer);
util_primconvert_draw_vbo(vctx->primconvert, dinfo);
diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c
index f04b6c2f163..561633cdaf0 100644
--- a/src/mesa/state_tracker/st_draw.c
+++ b/src/mesa/state_tracker/st_draw.c
@@ -251,16 +251,8 @@ st_draw_vbo(struct gl_context *ctx,
info.indexed);
}
- if (info.count_from_stream_output) {
- cso_draw_vbo(st->cso_context, &info);
- }
- else if (info.primitive_restart) {
- /* don't trim, restarts might be inside index list */
- cso_draw_vbo(st->cso_context, &info);
- }
- else if (u_trim_pipe_prim(prims[i].mode, &info.count)) {
- cso_draw_vbo(st->cso_context, &info);
- }
+ /* Don't call u_trim_pipe_prim. Drivers should do it if they need it. */
+ cso_draw_vbo(st->cso_context, &info);
}
}