[Piglit] [PATCH] gl-3.2/adj-prims: fix expected vertex order for triangle strips with adjacency
Nicolai Hähnle
nhaehnle at gmail.com
Mon Oct 31 21:52:34 UTC 2016
From: Nicolai Hähnle <nicolai.haehnle at amd.com>
The first two vertices are swapped for triangle strips with adjacency; see
Table 10.1 of the OpenGL 4.5 (Compatibility Profile) spec.
---
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 */
--
2.7.4
More information about the Piglit
mailing list