diff options
author | Brian Paul <[email protected]> | 2016-05-26 09:50:24 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2016-05-26 17:44:18 -0600 |
commit | 7a49b41436e540e7dfa3d34d119a6aef72f228a5 (patch) | |
tree | 5ebf5eaae2e64c1e88e5b7ef918969c1e2c569fc /src/gallium/auxiliary | |
parent | 46be65c681b251beced67abfabbb86117b589d44 (diff) |
util/indices: move duplicated assignments out of switch cases
Spotted by Roland.
Reviewed-by: Roland Scheidegger <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r-- | src/gallium/auxiliary/indices/u_indices.c | 33 |
1 files changed, 4 insertions, 29 deletions
diff --git a/src/gallium/auxiliary/indices/u_indices.c b/src/gallium/auxiliary/indices/u_indices.c index 91f00f2bb7d..323c971e1ec 100644 --- a/src/gallium/auxiliary/indices/u_indices.c +++ b/src/gallium/auxiliary/indices/u_indices.c @@ -113,94 +113,81 @@ u_index_translator(unsigned hw_mask, return U_TRANSLATE_MEMCPY; } else { + *out_translate = translate[in_idx][out_idx][in_pv][out_pv][prim_restart][prim]; + switch (prim) { case PIPE_PRIM_POINTS: - *out_translate = translate[in_idx][out_idx][in_pv][out_pv][prim_restart][prim]; *out_prim = PIPE_PRIM_POINTS; *out_nr = nr; break; case PIPE_PRIM_LINES: - *out_translate = translate[in_idx][out_idx][in_pv][out_pv][prim_restart][prim]; *out_prim = PIPE_PRIM_LINES; *out_nr = nr; break; case PIPE_PRIM_LINE_STRIP: - *out_translate = translate[in_idx][out_idx][in_pv][out_pv][prim_restart][prim]; *out_prim = PIPE_PRIM_LINES; *out_nr = (nr - 1) * 2; break; case PIPE_PRIM_LINE_LOOP: - *out_translate = translate[in_idx][out_idx][in_pv][out_pv][prim_restart][prim]; *out_prim = PIPE_PRIM_LINES; *out_nr = nr * 2; break; case PIPE_PRIM_TRIANGLES: - *out_translate = translate[in_idx][out_idx][in_pv][out_pv][prim_restart][prim]; *out_prim = PIPE_PRIM_TRIANGLES; *out_nr = nr; break; case PIPE_PRIM_TRIANGLE_STRIP: - *out_translate = translate[in_idx][out_idx][in_pv][out_pv][prim_restart][prim]; *out_prim = PIPE_PRIM_TRIANGLES; *out_nr = (nr - 2) * 3; break; case PIPE_PRIM_TRIANGLE_FAN: - *out_translate = translate[in_idx][out_idx][in_pv][out_pv][prim_restart][prim]; *out_prim = PIPE_PRIM_TRIANGLES; *out_nr = (nr - 2) * 3; break; case PIPE_PRIM_QUADS: - *out_translate = translate[in_idx][out_idx][in_pv][out_pv][prim_restart][prim]; *out_prim = PIPE_PRIM_TRIANGLES; *out_nr = (nr / 4) * 6; break; case PIPE_PRIM_QUAD_STRIP: - *out_translate = translate[in_idx][out_idx][in_pv][out_pv][prim_restart][prim]; *out_prim = PIPE_PRIM_TRIANGLES; *out_nr = (nr - 2) * 3; break; case PIPE_PRIM_POLYGON: - *out_translate = translate[in_idx][out_idx][in_pv][out_pv][prim_restart][prim]; *out_prim = PIPE_PRIM_TRIANGLES; *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]; *out_prim = PIPE_PRIM_POINTS; *out_nr = nr; return U_TRANSLATE_ERROR; @@ -261,87 +248,75 @@ u_index_generator(unsigned hw_mask, return U_GENERATE_LINEAR; } else { + *out_generate = generate[out_idx][in_pv][out_pv][prim]; + switch (prim) { case PIPE_PRIM_POINTS: - *out_generate = generate[out_idx][in_pv][out_pv][prim]; *out_prim = PIPE_PRIM_POINTS; *out_nr = nr; return U_GENERATE_REUSABLE; case PIPE_PRIM_LINES: - *out_generate = generate[out_idx][in_pv][out_pv][prim]; *out_prim = PIPE_PRIM_LINES; *out_nr = nr; return U_GENERATE_REUSABLE; case PIPE_PRIM_LINE_STRIP: - *out_generate = generate[out_idx][in_pv][out_pv][prim]; *out_prim = PIPE_PRIM_LINES; *out_nr = (nr - 1) * 2; return U_GENERATE_REUSABLE; case PIPE_PRIM_LINE_LOOP: - *out_generate = generate[out_idx][in_pv][out_pv][prim]; *out_prim = PIPE_PRIM_LINES; *out_nr = nr * 2; return U_GENERATE_ONE_OFF; case PIPE_PRIM_TRIANGLES: - *out_generate = generate[out_idx][in_pv][out_pv][prim]; *out_prim = PIPE_PRIM_TRIANGLES; *out_nr = nr; return U_GENERATE_REUSABLE; case PIPE_PRIM_TRIANGLE_STRIP: - *out_generate = generate[out_idx][in_pv][out_pv][prim]; *out_prim = PIPE_PRIM_TRIANGLES; *out_nr = (nr - 2) * 3; return U_GENERATE_REUSABLE; case PIPE_PRIM_TRIANGLE_FAN: - *out_generate = generate[out_idx][in_pv][out_pv][prim]; *out_prim = PIPE_PRIM_TRIANGLES; *out_nr = (nr - 2) * 3; return U_GENERATE_REUSABLE; case PIPE_PRIM_QUADS: - *out_generate = generate[out_idx][in_pv][out_pv][prim]; *out_prim = PIPE_PRIM_TRIANGLES; *out_nr = (nr / 4) * 6; return U_GENERATE_REUSABLE; case PIPE_PRIM_QUAD_STRIP: - *out_generate = generate[out_idx][in_pv][out_pv][prim]; *out_prim = PIPE_PRIM_TRIANGLES; *out_nr = (nr - 2) * 3; return U_GENERATE_REUSABLE; case PIPE_PRIM_POLYGON: - *out_generate = generate[out_idx][in_pv][out_pv][prim]; *out_prim = PIPE_PRIM_TRIANGLES; *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; |