diff options
author | Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> | 2019-12-06 16:45:57 -0500 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2019-12-10 09:14:28 -0800 |
commit | 166a3ae3c894d0ee2b660b7bbf2d6eee47eaa6ff (patch) | |
tree | 7b71310543757f380f53901a3c591c8c7c872920 | |
parent | c5e203ff501511af27ee301249ec93729b4cce63 (diff) | |
download | mesa-166a3ae3c894d0ee2b660b7bbf2d6eee47eaa6ff.tar.gz |
gallium/util: Support POLYGON in u_stream_outputs_for_vertices
u_decomposed_prims_for_vertices cannot support POLYGON, but POLYGON is
trivial to support as a special case directly (since we have the number
of vertices directly).
Fixes aborts in Panfrost in apps using GL_POLYGON.
Fixes: e881aa8c12c ("gallium/util: Add u_stream_outputs_for_vertices helper")
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Revewied-by: Eric Anholt <eric@anholt.net>
(cherry picked from commit a37822f5f740c55cd6f848adfd6c3d567ae4fd79)
-rw-r--r-- | src/gallium/auxiliary/util/u_prim.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/util/u_prim.h b/src/gallium/auxiliary/util/u_prim.h index d80e235ffd9..b4c06df01e0 100644 --- a/src/gallium/auxiliary/util/u_prim.h +++ b/src/gallium/auxiliary/util/u_prim.h @@ -338,7 +338,14 @@ u_stream_outputs_for_vertices(enum pipe_prim_type primitive, unsigned nr) /* Extraneous vertices don't contribute to stream outputs */ u_trim_pipe_prim(primitive, &nr); - /* Consider how many primitives are actually generated */ + /* Polygons are special, since they are a single primitive with many + * vertices. In this case, we just have an output for each vertex (after + * trimming) */ + + if (primitive == PIPE_PRIM_POLYGON) + return nr; + + /* Normally, consider how many primitives are actually generated */ unsigned prims = u_decomposed_prims_for_vertices(primitive, nr); /* One output per vertex after decomposition */ |