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

Zack Rusin zackr at vmware.com
Wed Aug 4 08:01:34 PDT 2010


On Wednesday 04 August 2010 04:17:15 Chia-I Wu wrote: 
> I've updated the geometry shader so that given a triangle with adjacency, 3
> triangles will be emitted:
> 
>   - the triangle formed by the first edge and the first adjacent vertex
>   - the triangle formed by the second edge and the second adjacent vertex
>   - the triangle formed by the third edge and the third adjacent vertex
> 
> and the color is decided by the respective adjacent vertices.
> 
> The vertex array is updated to consist of 8 vertices (2 triangles), which
> layout just like the diagram in the D3D doc, except the diagram has 14
> vertices (5 triangles).  The color of the adjacent vertices for the first
> and second triangles are red and green respectively.
> 
> With this setup, you can find the results of the running the demo with
> master and draw-decompose-2 branches, and with nVidia's driver on Windows.
> 
> This says nothing about D3D triangle strip with adjacency, but it now seems
> to follow wat nVidia's OpenGL driver does.

Nice job! That looks pretty good, I ported the example to D3D to see what it 
does. It looks like at least the right vertices are being used. On my NVIDIA 
linux setup it looks like D3D flips the verts in the second triangle (as we 
expected). 
Compare tristripadj8.png to what the GL  version of my example does with 
glDrawArrays(..., 0, 8) and tristripadj10.png to glDrawArrays(..., 0, 10).
Attached is the D3D example that I used (just change the Vertex data to the 
data from my example to see it since right now it uses the data from yours and 
that looks the same on d3d windows as it does on gl). It accepts "-reference" 
flag which will use Windows reference rasterizer.

z

-------------- next part --------------
A non-text attachment was scrubbed...
Name: gsadjtristrip.cpp
Type: text/x-c++src
Size: 15966 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20100804/7c643bdf/attachment-0001.cpp>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tristripadj6.png
Type: image/png
Size: 8239 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20100804/7c643bdf/attachment-0003.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tristripadj8.png
Type: image/png
Size: 9999 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20100804/7c643bdf/attachment-0004.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tristripadj10.png
Type: image/png
Size: 10467 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20100804/7c643bdf/attachment-0005.png>


More information about the mesa-dev mailing list