[Piglit] [PATCH 03/15] gl-3.2/adj-prims: fix expected vertex order for triangle strips with adjacency
Brian Paul
brianp at vmware.com
Tue Mar 27 14:38:34 UTC 2018
For 3&4,
Reviewed-by: Brian Paul <brianp at vmware.com>
Tested-by: Brian Paul <brianp at vmware.com> (on NVIDIA)
On 03/26/2018 05:32 PM, Marek Olšák wrote:
> 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 794ab3dc9..f4479c708 100644
> --- a/tests/spec/gl-3.2/adj-prims.c
> +++ b/tests/spec/gl-3.2/adj-prims.c
> @@ -167,23 +167,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
> @@ -206,22 +209,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 */
>
More information about the Piglit
mailing list