vc4: remove primconvert

We are losing the optimization of converting a single quad to
a triangle fan reusing the same four vertex in the buffer.

Maybe this optimization can be ported to primconvert, QUADS are
always converted to TRIANGLES with primconvert. And i965, crocus
and svga have similar optimizations.

V3D doesn't implement this optimization and according to when it was
introduced on 230e646a40 ("broadcom/vc4: Decompose single QUADs to
a TRIANGLE_FAN."):

 "No significant difference in the minetest replay, but it should reduce
  overhead by not requiring that we write quad indices to index buffers
  that we repeatedly re-upload (and making the draw packet smaller, as
  well)."

v2: Commit log includes more detail about the removed optimization.
    (Alejandro Piñeiro)

Reference: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5277
Suggested-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Acked-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12669>
This commit is contained in:
Jose Maria Casanova Crespo 2021-08-31 18:41:53 +02:00
parent dad69c7ccd
commit deb55340ca
3 changed files with 0 additions and 29 deletions

View file

@ -30,7 +30,6 @@
#include "util/u_memory.h"
#include "util/u_blitter.h"
#include "util/u_upload_mgr.h"
#include "indices/u_primconvert.h"
#include "pipe/p_screen.h"
#include "vc4_screen.h"
@ -124,9 +123,6 @@ vc4_context_destroy(struct pipe_context *pctx)
if (vc4->blitter)
util_blitter_destroy(vc4->blitter);
if (vc4->primconvert)
util_primconvert_destroy(vc4->primconvert);
if (vc4->uploader)
u_upload_destroy(vc4->uploader);
@ -206,11 +202,6 @@ vc4_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags)
if (!vc4->blitter)
goto fail;
vc4->primconvert = util_primconvert_create(pctx,
(1 << PIPE_PRIM_QUADS) - 1);
if (!vc4->primconvert)
goto fail;
vc4_debug |= saved_shaderdb_flag;
vc4->sample_mask = (1 << VC4_MAX_SAMPLES) - 1;

View file

@ -328,8 +328,6 @@ struct vc4_context {
/** bitfield of VC4_DIRTY_* */
uint32_t dirty;
struct primconvert_context *primconvert;
struct hash_table *fs_cache, *vs_cache;
struct set *fs_inputs_set;
uint32_t next_uncompiled_program_id;

View file

@ -29,7 +29,6 @@
#include "util/u_pack_color.h"
#include "util/u_split_draw.h"
#include "util/u_upload_mgr.h"
#include "indices/u_primconvert.h"
#include "vc4_context.h"
#include "vc4_resource.h"
@ -304,29 +303,12 @@ vc4_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info,
return;
struct vc4_context *vc4 = vc4_context(pctx);
struct pipe_draw_info local_info;
if (!indirect &&
!info->primitive_restart &&
!u_trim_pipe_prim(info->mode, (unsigned*)&draws[0].count))
return;
if (info->mode >= PIPE_PRIM_QUADS) {
if (info->mode == PIPE_PRIM_QUADS &&
draws[0].count == 4 &&
!vc4->rasterizer->base.flatshade) {
local_info = *info;
local_info.mode = PIPE_PRIM_TRIANGLE_FAN;
info = &local_info;
} else {
util_primconvert_save_rasterizer_state(vc4->primconvert, &vc4->rasterizer->base);
util_primconvert_draw_vbo(vc4->primconvert, info, drawid_offset, indirect, draws, num_draws);
perf_debug("Fallback conversion for %d %s vertices\n",
draws[0].count, u_prim_name(info->mode));
return;
}
}
/* Before setting up the draw, do any fixup blits necessary. */
vc4_predraw_check_textures(pctx, &vc4->verttex);
vc4_predraw_check_textures(pctx, &vc4->fragtex);