[Mesa-dev] [PATCH-RFC] draw: Rewrite primitive decomposer
Chia-I Wu
olvaffe at gmail.com
Wed Aug 4 10:06:33 PDT 2010
On Wed, Aug 4, 2010 at 11:01 PM, Zack Rusin <zackr at vmware.com> wrote:
> 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.
I've uploaded the results, due to the size, to
http://people.freedesktop.org/~olv/tmp/tristripadj/
tristripadj6.png, tristripadj8.png, and tristripadj10.png are the results of
running the original tri-adj.c with 6, 8, and 10 vertices. The vertices of
ever other triangles are flipped.
tristripadj-d3d-order.patch forces draw_decompose_tmp.h to use D3D
decomposition rule. With it applied, the results are exactly the same as the
D3D's.
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).
--
olv at LunarG.com
More information about the mesa-dev
mailing list