[Piglit] [PATCH 1/2] shader_draw_parameters: Also test using glDrawArrays with first > 0

Antia Puentes apuentes at igalia.com
Thu Jan 25 18:49:27 UTC 2018


Reviewed-by: Antia Puentes <apuentes at igalia.com>


On 10/11/17 19:05, Neil Roberts wrote:
> The ‘first’ parameter should not affect the value of gl_BaseVertex put
> it should be added to gl_VertexID. This patch adds an extra rectangle
> to the drawn area to test a non-zero ‘first’ parameter. This is worth
> testing because Mesa is currently getting this wrong.
> ---
>   tests/spec/arb_shader_draw_parameters/basevertex.c | 52 ++++++++++++++++++----
>   1 file changed, 44 insertions(+), 8 deletions(-)
>
> diff --git a/tests/spec/arb_shader_draw_parameters/basevertex.c b/tests/spec/arb_shader_draw_parameters/basevertex.c
> index 2279e0f..333d4e2 100644
> --- a/tests/spec/arb_shader_draw_parameters/basevertex.c
> +++ b/tests/spec/arb_shader_draw_parameters/basevertex.c
> @@ -24,10 +24,26 @@
>   /**
>    * \file basevertex.c
>    *
> - * Test that gl_BaseVertexARB has the correct values. Draw left side
> - * of window with a non-base-vertex draw call to verify
> - * gl_BaseVertexARB is 0 in that case, then draw other half with base
> - * vertex 4 and verifies that that works.
> + * Test that gl_BaseVertexARB has the correct values.
> + *
> + * The framebuffer is filled with three quads like this:
> + *
> + * #########
> + * #   #   #
> + * #   # B #
> + * # A #####
> + * #   # C #
> + * #   #   #
> + * #########
> + *
> + * Quad A is rendered using a non-base-vertex draw call to verify that
> + * gl_BaseVertexARB is zero in that case.
> + *
> + * Quad B is rendered with baseVertex as 4.
> + *
> + * Quad C is rendered using a non-indexed draw call with a non-zero
> + * ‘first’ parameter. This shouldn’t affect gl_BaseVertex but it
> + * should affect gl_VertexID.
>    */
>   
>   #include "piglit-util-gl.h"
> @@ -104,19 +120,27 @@ piglit_display()
>   {
>   	bool pass;
>   
> -	static const float vertex_array[16] = {
> +	static const float vertex_array[24] = {
> +		/* Left half of the screen */
>   		-1, -1,
>   		0, -1,
>   		0, 1,
>   		-1, 1,
>   
> -		0, -1,
> -		1, -1,
> +		/* Top-right quarter of the screen */
> +		0, 0,
> +		1, 0,
>   		1, 1,
>   		0, 1,
> +
> +		/* Bottom-right quarter of the screen */
> +		0, -1,
> +		1, -1,
> +		0, 0,
> +		1, 0,
>   	};
>   
> -	static const int reference_array[32] = {
> +	static const int reference_array[48] = {
>   		0, 0, 0, 0,
>   		0, 0, 1, 0,
>   		0, 0, 2, 0,
> @@ -125,6 +149,10 @@ piglit_display()
>   		4, 7, 1, 0,
>   		4, 7, 2, 0,
>   		4, 7, 3, 0,
> +		0, 0, 8, 0,
> +		0, 0, 9, 0,
> +		0, 0, 10, 0,
> +		0, 0, 11, 0,
>   	};
>   
>   	const int indices[6] = {
> @@ -167,6 +195,14 @@ piglit_display()
>   						      4, /* basevertex */
>   						      7 /* baseinstance */);
>   
> +	/* Test using glDrawArrays with a non-zero ‘first’ parameter.
> +	 * This value should be included in gl_VertexID but not in
> +	 * gl_BaseVertex.
> +	 */
> +	glDrawArrays(GL_TRIANGLE_STRIP,
> +		     8, /* first */
> +		     4 /* count */);
> +
>   	pass = piglit_probe_rect_rgba(0, 0, piglit_width, piglit_height,
>   				      green);
>   



More information about the Piglit mailing list