[Mesa-dev] [PATCH] draw: get rid of special logic to not emit null tris

Roland Scheidegger sroland at vmware.com
Fri May 18 15:06:16 UTC 2018


Thanks for testing, but radeonsi never uses draw - for radeon gallium
drivers, only r300 does, and then only for the IGPs without vertex shaders.

Roland

Am 18.05.2018 um 05:48 schrieb Dieter Nützel:
> Tested-by: Dieter Nützel <Dieter at nuetzel-hh.de>
> 
> on RX580
> 
> with UH, UV, glmark2, Blender 2.79, FreeCAD 0.17, Gimp 2.10, digikam
> 5.9.0, Krita 4.0.3 and some Mesa-demos
> 
> Dieter
> 
> Am 17.05.2018 18:30, schrieb sroland at vmware.com:
>> From: Roland Scheidegger <sroland at vmware.com>
>>
>> I've confirmed after 77554d220d6d74b4d913dc37ea3a874e9dc550e4 we no
>> longer need this to pass some tests from another api (as we no longer
>> generate the bogus extra null tris in the first place).
>> ---
>>  src/gallium/auxiliary/draw/draw_pipe_clip.c | 38
>> -----------------------------
>>  1 file changed, 38 deletions(-)
>>
>> diff --git a/src/gallium/auxiliary/draw/draw_pipe_clip.c
>> b/src/gallium/auxiliary/draw/draw_pipe_clip.c
>> index 46118b6..2a9c944 100644
>> --- a/src/gallium/auxiliary/draw/draw_pipe_clip.c
>> +++ b/src/gallium/auxiliary/draw/draw_pipe_clip.c
>> @@ -210,30 +210,6 @@ static void interp(const struct clip_stage *clip,
>>  }
>>
>>  /**
>> - * Checks whether the specified triangle is empty and if it is returns
>> - * true, otherwise returns false.
>> - * Triangle is considered null/empty if its area is equal to zero.
>> - */
>> -static inline boolean
>> -is_tri_null(const struct clip_stage *clip, const struct prim_header
>> *header)
>> -{
>> -   const unsigned pos_attr = clip->pos_attr;
>> -   float x1 = header->v[1]->data[pos_attr][0] -
>> header->v[0]->data[pos_attr][0];
>> -   float y1 = header->v[1]->data[pos_attr][1] -
>> header->v[0]->data[pos_attr][1];
>> -   float z1 = header->v[1]->data[pos_attr][2] -
>> header->v[0]->data[pos_attr][2];
>> -
>> -   float x2 = header->v[2]->data[pos_attr][0] -
>> header->v[0]->data[pos_attr][0];
>> -   float y2 = header->v[2]->data[pos_attr][1] -
>> header->v[0]->data[pos_attr][1];
>> -   float z2 = header->v[2]->data[pos_attr][2] -
>> header->v[0]->data[pos_attr][2];
>> -
>> -   float vx = y1 * z2 - z1 * y2;
>> -   float vy = x1 * z2 - z1 * x2;
>> -   float vz = x1 * y2 - y1 * x2;
>> -
>> -   return (vx*vx  + vy*vy + vz*vz) == 0.f;
>> -}
>> -
>> -/**
>>   * Emit a post-clip polygon to the next pipeline stage.  The polygon
>>   * will be convex and the provoking vertex will always be vertex[0].
>>   */
>> @@ -247,7 +223,6 @@ static void emit_poly(struct draw_stage *stage,
>>     struct prim_header header;
>>     unsigned i;
>>     ushort edge_first, edge_middle, edge_last;
>> -   boolean tri_emitted = FALSE;
>>
>>     if (stage->draw->rasterizer->flatshade_first) {
>>        edge_first  = DRAW_PIPE_EDGE_FLAG_0;
>> @@ -269,7 +244,6 @@ static void emit_poly(struct draw_stage *stage,
>>     header.pad = 0;
>>
>>     for (i = 2; i < n; i++, header.flags = edge_middle) {
>> -      boolean tri_null;
>>        /* order the triangle verts to respect the provoking vertex
>> mode */
>>        if (stage->draw->rasterizer->flatshade_first) {
>>           header.v[0] = inlist[0];  /* the provoking vertex */
>> @@ -282,18 +256,6 @@ static void emit_poly(struct draw_stage *stage,
>>           header.v[2] = inlist[0];  /* the provoking vertex */
>>        }
>>
>> -      tri_null = is_tri_null(clipper, &header);
>> -      /*
>> -       * If we ever generated a tri (regardless if it had area or not),
>> -       * skip all subsequent null tris.
>> -       * FIXME: I think this logic was hiding bugs elsewhere. It should
>> -       * be possible now to always emit all tris.
>> -       */
>> -      if (tri_null && tri_emitted) {
>> -         continue;
>> -      }
>> -      tri_emitted = TRUE;
>> -
>>        if (!edgeflags[i-1]) {
>>           header.flags &= ~edge_middle;
>>        }



More information about the mesa-dev mailing list