On 31.10.2016 22:52, Nicolai Hähnle wrote:
From: Nicolai Hähnle <[email protected]>

The first two vertices are swapped for triangle strips with adjacency; see
Table 10.1 of the OpenGL 4.5 (Compatibility Profile) spec.

FWIW, people report that the test passes as-is on NVidia hardware (both nouveau and blob) but fails on various Intel hardware.

I ran across this because radeonsi used to pass the test as-is, but now that I've added a fix for how our hardware rotates the odd triangles we started failing it (in the same way as Intel):

$ bin/gl-3.2-adj-prims pv-first -auto -fbo
Failure for GL_TRIANGLE_STRIP_ADJACENCY, prim 1 wrong color at (641,108)
Expected 0.2, 0.2, 1, 1
Found 0.2, 1, 1, 1
PIGLIT: {"result": "fail" }

My reading of the spec is that the GS invocation for the second triangle should have vs_gs_color[0] sourced from colors[4] instead of colors[2] as the test expects, and then this becomes the color of the first vertex and hence the color of the provoking vertex in this particular subtest.

(And I guess this explanation should go into the commit message if people agree that this change is correct.)

Cheers,
Nicolai

---
 tests/spec/gl-3.2/adj-prims.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/tests/spec/gl-3.2/adj-prims.c b/tests/spec/gl-3.2/adj-prims.c
index 9d2f121..30c5f4b 100644
--- a/tests/spec/gl-3.2/adj-prims.c
+++ b/tests/spec/gl-3.2/adj-prims.c
@@ -166,23 +166,26 @@ provoking_vertex_index(GLenum prim_mode, GLenum pv_mode, 
unsigned prim_index)
                if (pv_mode == GL_FIRST_VERTEX_CONVENTION)
                        return prim_index + 1;
                else
                        return prim_index + 2;
        case GL_TRIANGLES_ADJACENCY:
                if (pv_mode == GL_FIRST_VERTEX_CONVENTION)
                        return prim_index * 6 + 0;
                else
                        return prim_index * 6 + 4;
        case GL_TRIANGLE_STRIP_ADJACENCY:
-               if (pv_mode == GL_FIRST_VERTEX_CONVENTION)
-                       return prim_index * 2;
-               else
+               if (pv_mode == GL_FIRST_VERTEX_CONVENTION) {
+                       if (prim_index & 1)
+                               return prim_index * 2 + 2;
+                       else
+                               return prim_index * 2;
+               } else
                        return prim_index * 2 + 4;
        default:
                assert(!"Unexpected prim_mode");
                return 0;
        }
 }


 /**
  * Given a primitive type and a primitive (line/triangle) index, return
@@ -205,22 +208,27 @@ compute_probe_location(GLenum prim_mode, unsigned 
prim_index,
                i0 = prim_index + 1;
                i1 = prim_index + 2;
                break;
        case GL_TRIANGLES_ADJACENCY:
                i0 = prim_index * 6 + 0;
                i1 = prim_index * 6 + 2;
                if (polygon_mode != GL_LINE)
                        i2 = prim_index * 6 + 4;
                break;
        case GL_TRIANGLE_STRIP_ADJACENCY:
-               i0 = prim_index * 2;
-               i1 = prim_index * 2 + 2;
+               if (prim_index & 1) {
+                       i0 = prim_index * 2;
+                       i1 = prim_index * 2 + 2;
+               } else {
+                       i0 = prim_index * 2 + 2;
+                       i1 = prim_index * 2;
+               }
                if (polygon_mode != GL_LINE)
                        i2 = prim_index * 2 + 4;
                break;
        default:
                assert(!"Unexpected prim_mode");
                *x = *y = 0;
                return;
        }

        /* average of 2 or 3 points */

_______________________________________________
Piglit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to