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

Chia-I Wu olvaffe at gmail.com
Wed Aug 4 01:17:15 PDT 2010


On Wed, Aug 4, 2010 at 4:14 AM, Zack Rusin <zackr at vmware.com> wrote:
> On Tuesday 03 August 2010 12:56:41 Chia-I Wu wrote:
>> I see your point.  There are more than one way to interpret the
>> diagram.  Now I am curious if the diagram is all the D3D documents have
>> for triangle strip with adjacency?
>
> As far as the public docs go I think that's it.
>
>> > and so on. If you have a testcase that shows  which way it is, great,
>> > lets change it (aka fix it). Otherwise I'm just not too excited about
>> > changing code that was working with the (corny) testcases it had for
>> > something without any.
>>
>> Sure.  Where can I find the test cases, if they are public?
>
> I've tested with a few proprietary demos/apps, but since I've implemented gs
> in Mesa as well we can use that. You can put the attached files in
> demos/src/glsl and compile it there. I never tested triangle strips with
> adjacency in mesa but it seems to be at least rendering something (the
> adjacency vertices are definitely flipped). Try glDrawArrays with different
> values, e.g.
> 1) glDrawArrays(GL_TRIANGLE_STRIP_ADJACENCY_ARB, 0, 6);
> 2) glDrawArrays(GL_TRIANGLE_STRIP_ADJACENCY_ARB, 2, 6);
> 3) glDrawArrays(GL_TRIANGLE_STRIP_ADJACENCY_ARB, 4, 6);
> 4) glDrawArrays(GL_TRIANGLE_STRIP_ADJACENCY_ARB, 0, 8);
> 5) glDrawArrays(GL_TRIANGLE_STRIP_ADJACENCY_ARB, 2, 8);
> 6) glDrawArrays(GL_TRIANGLE_STRIP_ADJACENCY_ARB, 0, 10);
>
> It'd be awesome if we had a piglit test for it, but right now anything that
> with some manual testing looks like whatever proprietary NVIDIA/AMD drivers do
> would be fine.
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.

-- 
olv at LunarG.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tri-adj.c
Type: text/x-csrc
Size: 7272 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20100804/e00917b2/attachment-0001.c>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tri-adj-nvidia-win.png
Type: image/png
Size: 26148 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20100804/e00917b2/attachment-0003.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tri-adj-llvmpipe-master.png
Type: image/png
Size: 4383 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20100804/e00917b2/attachment-0004.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tri-adj-llvmpipe-new.png
Type: image/png
Size: 5302 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20100804/e00917b2/attachment-0005.png>


More information about the mesa-dev mailing list