[Mesa-dev] [PATCH 0/3] Add u_primconvert front-end to u_indices (v2)

Rob Clark robdclark at gmail.com
Tue Oct 29 21:10:42 CET 2013

From: Rob Clark <robclark at freedesktop.org>

This patchset (compared to RFC I sent previously) changes u_primconvert
to just be a front-end to the u_indices stuff.  It handles binding/
restoring new index buffer state, etc.  So driver using it just has
to put this at the top of their pipe->draw_vbo():

  if (prim_needs_emulating) {
     util_primconvert_save_index_buffer(ctx->primconvert, &ctx->indexbuf);
     util_primconvert_save_rasterizer_state(ctx->primconvert, ctx->rasterizer);
     util_primconvert_draw_vbo(ctx->primconvert, info);

It does not yet handle changing provoking vertex (since I didn't need
this), but that looks like it should be easy to add.

I considered first just using u_indices directly from freedreno, like
svga does.  But it is at least more complex than it needs to be and it
seemed like eventually more code could be shared with this approach.

I suspect some of the index buffer caching done in svga could be moved
into u_primconvert and shared between svga and freedreno (and any other
future drivers for GLES hw which might need the same thing).

The last patch converts freedreno over to use this.  It depends on
another patch with regenerated envytools headers (updated to take into
account differences between a20x/a22x/a3xx) for the draw initiator.

v1: original
v2: update with Brian Paul's review comments (re-indent, fix for MSVC,
    add comments, etc

Rob Clark (3):
  gallium/auxiliary/indices: add start param
  gallium/auxiliary/indices: add u_primconvert
  freedreno: emulated unsupported primitive types

 src/gallium/auxiliary/Makefile.sources             |   1 +
 src/gallium/auxiliary/indices/u_indices.c          |   6 +-
 src/gallium/auxiliary/indices/u_indices.h          |  21 ++-
 src/gallium/auxiliary/indices/u_indices_gen.py     |  21 +--
 src/gallium/auxiliary/indices/u_primconvert.c      | 181 +++++++++++++++++++++
 src/gallium/auxiliary/indices/u_primconvert.h      |  45 +++++
 src/gallium/auxiliary/indices/u_unfilled_gen.py    |  13 +-
 src/gallium/auxiliary/indices/u_unfilled_indices.c |  19 ++-
 src/gallium/drivers/freedreno/a2xx/fd2_context.c   |  24 ++-
 src/gallium/drivers/freedreno/a3xx/fd3_context.c   |  12 +-
 src/gallium/drivers/freedreno/freedreno_context.c  |  16 +-
 src/gallium/drivers/freedreno/freedreno_context.h  |  18 +-
 src/gallium/drivers/freedreno/freedreno_draw.c     |  29 +---
 src/gallium/drivers/svga/svga_draw_arrays.c        |   2 +-
 src/gallium/drivers/svga/svga_draw_elements.c      |   2 +-
 15 files changed, 357 insertions(+), 53 deletions(-)
 create mode 100644 src/gallium/auxiliary/indices/u_primconvert.c
 create mode 100644 src/gallium/auxiliary/indices/u_primconvert.h


More information about the mesa-dev mailing list