Bug 25290 - R600: Doesn't correctly handle glFrontFace(GL_CW)
Summary: R600: Doesn't correctly handle glFrontFace(GL_CW)
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/DRI/R600 (show other bugs)
Version: git
Hardware: Other All
: medium normal
Assignee: Default DRI bug account
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-11-25 18:30 UTC by Rafael Monica
Modified: 2009-12-21 07:26 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
program draws triangle with clockwise winding (831 bytes, text/x-csrc)
2009-11-25 18:30 UTC, Rafael Monica
Details
select proper front/back face in polygon mode (648 bytes, patch)
2009-12-01 12:47 UTC, Alex Deucher
Details | Splinter Review

Description Rafael Monica 2009-11-25 18:30:32 UTC
Created attachment 31480 [details]
program draws triangle with clockwise winding

The R600 driver doesn't correctly handle glFrontFace(GL_CW) I attached a small program to demonstrate the problem.

The attached program:

- sets the mode of back-facing polygons to GL_LINE, so one can see the visual difference between the front-facing and back-facing polygons.

- selects polygons with clockwise winding as front-facing
- draws a triangle with clockwise winding

When the program is run with the software renderer it renders the front-facing polygons as expected, but the R600 driver renders the back-facing polygons.
Comment 1 Alex Deucher 2009-12-01 12:47:50 UTC
Created attachment 31633 [details] [review]
select proper front/back face in polygon mode

This patch seems to fix the issue here.
Comment 2 Rafael Monica 2009-12-01 13:54:10 UTC
Hmm, with the patch the test program runs correctly, but if I comment out glFrontFace(GL_CW) in the test program, the situation is reversed. It will render a solid triangle while the software renderer renders an outline triangle.
Comment 3 Rafael Monica 2009-12-20 08:49:05 UTC
I think I found the problem. The hardware already makes the right decision based on the FACE_bit. This code in r700UpdatePolygonMode actually reverses it when using clockwise winding:

if (ctx->Polygon.FrontFace == GL_CCW) {
    f = ctx->Polygon.FrontMode;
    b = ctx->Polygon.BackMode;
} else {
    f = ctx->Polygon.BackMode;
    b = ctx->Polygon.FrontMode;
}


Changing it to:

f = ctx->Polygon.FrontMode;
b = ctx->Polygon.BackMode;

seems to fix it and render everything correctly.
Comment 4 Rafael Monica 2009-12-21 07:26:06 UTC
fixed in master


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.