[Mesa-dev] [PATCH-RFC] draw: Rewrite primitive decomposer

Zack Rusin zackr at vmware.com
Thu Aug 5 12:43:11 PDT 2010

On Thursday 05 August 2010 12:51:57 Chia-I Wu wrote:
> On Thu, Aug 5, 2010 at 3:20 AM, Zack Rusin <zackr at vmware.com> wrote:
> >> With GS, the order of the vertices of a primitive becomes significant.
> >>  We can no longer permute the vertices to support flatshade_first (at
> >> least, not before GS runs).
> > 
> > Awesome stuff. Thanks for looking into this. I'd commit that patch and
> > we'll abstract it under some settable "use d3d or gl rules" flag for
> > draw - we'll
> Yeah, that should be a settable flag.  But we should then support
> flatshade_first somewhere else.
> The GL rule is last vertex last for each primitive.  The D3D rule is first
> vertex first.  My idea is to have draw_decompose_tmp.h use a local
> variable, last_vertex_last, to select the rules.  In draw_gs_tmp.h and
> draw_so_emit_tmp.h, last_vertex_last is TRUE when the new settable flags is
> TRUE.  However, in draw_pt_decompse.h, where the rules no longer matter,
> last_vertex_last is set to !(flatshade && flatshade_first).
> As for draw_pt_vcache_tmp.h, I am considering removing it and make vcache
> look more like varray except with index buffer buffer.  I will try to work
> out the idea soon.

Sounds like a good plan to me.

> > need it for clipping anyway.
> For clipping?

Yea, GL defines the view volume as:
-w <= x <= w
-w <= y <= w
-w <= z <= w
while the other api defines it as:
-w <= x <= w
-w <= y <= w
 0 <= z <= w

(difference in draw as shown in the attached diff)

In draw currently we're implementing the GL semantics so I'm just adding a 
switch to let the draw users pick which semantics they'd like to have draw 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: d3d_clip.diff
Type: text/x-patch
Size: 1430 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20100805/09b2fc62/attachment.bin>

More information about the mesa-dev mailing list