diff options
author | Brian Paul <[email protected]> | 2016-05-25 15:53:25 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2016-05-26 17:44:17 -0600 |
commit | d6c2c7d7109785935086551ac3d82c4ad819483a (patch) | |
tree | 7f81bec33273673beededcb284f58a0b4c985364 /src/gallium/auxiliary/indices/u_indices.c | |
parent | 479d364c39e06dfcbe2e1d995bd82f748b1a172d (diff) |
util/indices: implement provoking vertex conversion for adjacency primitives
Tested with new piglit gl-3.2-adj-prims test.
Reviewed-by: Roland Scheidegger <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/indices/u_indices.c')
-rw-r--r-- | src/gallium/auxiliary/indices/u_indices.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/indices/u_indices.c b/src/gallium/auxiliary/indices/u_indices.c index 436f8f008cb..2b2d10c9cba 100644 --- a/src/gallium/auxiliary/indices/u_indices.c +++ b/src/gallium/auxiliary/indices/u_indices.c @@ -55,6 +55,8 @@ static void translate_memcpy_uint( const void *in, * - Translate from first provoking vertex to last provoking vertex and * vice versa. * + * Note that this function is used for indexed primitives. + * * \param hw_mask mask of (1 << PIPE_PRIM_x) flags indicating which types * of primitives are supported by the hardware. * \param prim incoming PIPE_PRIM_x @@ -172,6 +174,30 @@ u_index_translator(unsigned hw_mask, *out_nr = (nr - 2) * 3; break; + case PIPE_PRIM_LINES_ADJACENCY: + *out_translate = translate[in_idx][out_idx][in_pv][out_pv][prim_restart][prim]; + *out_prim = PIPE_PRIM_LINES_ADJACENCY; + *out_nr = nr; + break; + + case PIPE_PRIM_LINE_STRIP_ADJACENCY: + *out_translate = translate[in_idx][out_idx][in_pv][out_pv][prim_restart][prim]; + *out_prim = PIPE_PRIM_LINES_ADJACENCY; + *out_nr = (nr - 3) * 4; + break; + + case PIPE_PRIM_TRIANGLES_ADJACENCY: + *out_translate = translate[in_idx][out_idx][in_pv][out_pv][prim_restart][prim]; + *out_prim = PIPE_PRIM_TRIANGLES_ADJACENCY; + *out_nr = nr; + break; + + case PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY: + *out_translate = translate[in_idx][out_idx][in_pv][out_pv][prim_restart][prim]; + *out_prim = PIPE_PRIM_TRIANGLES_ADJACENCY; + *out_nr = ((nr - 4) / 2) * 6; + break; + default: assert(0); *out_translate = translate[in_idx][out_idx][in_pv][out_pv][prim_restart][prim]; @@ -193,6 +219,8 @@ u_index_translator(unsigned hw_mask, * The generator functions generates a number of ushort or uint indexes * for drawing the new type of primitive. * + * Note that this function is used for non-indexed primitives. + * * \param hw_mask a bitmask of (1 << PIPE_PRIM_x) values that indicates * kind of primitives are supported by the driver. * \param prim the PIPE_PRIM_x that the user wants to draw @@ -294,6 +322,30 @@ u_index_generator(unsigned hw_mask, *out_nr = (nr - 2) * 3; return U_GENERATE_REUSABLE; + case PIPE_PRIM_LINES_ADJACENCY: + *out_generate = generate[out_idx][in_pv][out_pv][prim]; + *out_prim = PIPE_PRIM_LINES_ADJACENCY; + *out_nr = nr; + return U_GENERATE_REUSABLE; + + case PIPE_PRIM_LINE_STRIP_ADJACENCY: + *out_generate = generate[out_idx][in_pv][out_pv][prim]; + *out_prim = PIPE_PRIM_LINES_ADJACENCY; + *out_nr = (nr - 3) * 4; + return U_GENERATE_REUSABLE; + + case PIPE_PRIM_TRIANGLES_ADJACENCY: + *out_generate = generate[out_idx][in_pv][out_pv][prim]; + *out_prim = PIPE_PRIM_TRIANGLES_ADJACENCY; + *out_nr = nr; + return U_GENERATE_REUSABLE; + + case PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY: + *out_generate = generate[out_idx][in_pv][out_pv][prim]; + *out_prim = PIPE_PRIM_TRIANGLES_ADJACENCY; + *out_nr = ((nr - 4) / 2) * 6; + return U_GENERATE_REUSABLE; + default: assert(0); *out_generate = generate[out_idx][in_pv][out_pv][PIPE_PRIM_POINTS]; |