mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 02:58:05 +02:00
draw: simplify prim id insertion in prim assembler
Because all topologies are reduced to basic primitives (i.e. no strips, fans) and the vertices involved are all copied, there's no need for any elaborate decisions where to insert the prim id. The logic employed was correct for first provoking vertex, but didn't account at all for the last provoking vertex case. And since we now will get the right constant value even if the primitive type is later changed (for unfilled etc.) this is no longer required to pass certain tests (which were checking for prim_id == some const interpolated value so passing because both were wrong in the end). This is a bit overkill (3x4 values assigned in total even though it's really one scalar per prim...) but the code is now much easier and I don't need to add more cases for last provoking vertex. This fixes piglit primitive-id-no-gs-strip test. Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
This commit is contained in:
parent
db3dfcfe90
commit
ff96537759
1 changed files with 5 additions and 34 deletions
|
|
@ -50,8 +50,6 @@ struct draw_assembler
|
|||
int primid_slot;
|
||||
unsigned primid;
|
||||
|
||||
boolean is_strip;
|
||||
boolean is_first_prim;
|
||||
unsigned num_prims;
|
||||
};
|
||||
|
||||
|
|
@ -154,16 +152,8 @@ prim_line(struct draw_assembler *asmblr,
|
|||
unsigned indices[2];
|
||||
|
||||
if (asmblr->needs_primid) {
|
||||
if (asmblr->is_strip && asmblr->is_first_prim) {
|
||||
inject_primid(asmblr, i0, asmblr->primid++);
|
||||
inject_primid(asmblr, i1, asmblr->primid++);
|
||||
asmblr->is_first_prim = FALSE;
|
||||
} else if (asmblr->is_strip) {
|
||||
inject_primid(asmblr, i1, asmblr->primid++);
|
||||
} else {
|
||||
inject_primid(asmblr, i0, asmblr->primid);
|
||||
inject_primid(asmblr, i1, asmblr->primid++);
|
||||
}
|
||||
inject_primid(asmblr, i0, asmblr->primid);
|
||||
inject_primid(asmblr, i1, asmblr->primid++);
|
||||
}
|
||||
indices[0] = i0;
|
||||
indices[1] = i1;
|
||||
|
|
@ -178,22 +168,9 @@ prim_tri(struct draw_assembler *asmblr,
|
|||
unsigned indices[3];
|
||||
|
||||
if (asmblr->needs_primid) {
|
||||
if (asmblr->is_strip && asmblr->is_first_prim) {
|
||||
inject_primid(asmblr, i0, asmblr->primid++);
|
||||
inject_primid(asmblr, i1, asmblr->primid++);
|
||||
inject_primid(asmblr, i2, asmblr->primid++);
|
||||
asmblr->is_first_prim = FALSE;
|
||||
} else if (asmblr->is_strip) {
|
||||
if (asmblr->num_prims & 1) {
|
||||
inject_primid(asmblr, i1, asmblr->primid++);
|
||||
} else {
|
||||
inject_primid(asmblr, i2, asmblr->primid++);
|
||||
}
|
||||
} else {
|
||||
inject_primid(asmblr, i0, asmblr->primid);
|
||||
inject_primid(asmblr, i1, asmblr->primid);
|
||||
inject_primid(asmblr, i2, asmblr->primid++);
|
||||
}
|
||||
inject_primid(asmblr, i0, asmblr->primid);
|
||||
inject_primid(asmblr, i1, asmblr->primid);
|
||||
inject_primid(asmblr, i2, asmblr->primid++);
|
||||
}
|
||||
indices[0] = i0;
|
||||
indices[1] = i1;
|
||||
|
|
@ -255,13 +232,7 @@ draw_prim_assembler_run(struct draw_context *draw,
|
|||
asmblr->output_verts = output_verts;
|
||||
asmblr->input_prims = input_prims;
|
||||
asmblr->input_verts = input_verts;
|
||||
asmblr->is_strip =
|
||||
(input_prims->prim == PIPE_PRIM_TRIANGLE_STRIP ||
|
||||
input_prims->prim == PIPE_PRIM_TRIANGLE_STRIP_ADJACENCY) ||
|
||||
(input_prims->prim == PIPE_PRIM_LINE_STRIP ||
|
||||
input_prims->prim == PIPE_PRIM_LINE_STRIP_ADJACENCY);
|
||||
asmblr->needs_primid = needs_primid(asmblr->draw);
|
||||
asmblr->is_first_prim = asmblr->is_strip;
|
||||
asmblr->primid = 0;
|
||||
asmblr->num_prims = 0;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue