[Piglit] [PATCH 1/2] drawoverhead: test more state changes, remove the GL_FRAMEBUFFER_SRGB test

Brian Paul brianp at vmware.com
Thu Jun 15 02:54:17 UTC 2017


For both,
Reviewed-by: Brian Paul <brianp at vmware.com>

On 06/14/2017 03:37 PM, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>
>
> the sRGB test is unrealistic
> ---
>   tests/perf/drawoverhead.c | 63 +++++++++++++++++++++++++++++++++++++++++++++--
>   1 file changed, 61 insertions(+), 2 deletions(-)
>
> diff --git a/tests/perf/drawoverhead.c b/tests/perf/drawoverhead.c
> index 76aed20..9afd3d0 100644
> --- a/tests/perf/drawoverhead.c
> +++ b/tests/perf/drawoverhead.c
> @@ -341,20 +341,69 @@ draw_state_change(unsigned count)
>   				glEnable(enable_enum);
>   			else
>   				glDisable(enable_enum);
>   			glDrawArrays(GL_TRIANGLES, 0, 3);
>   		}
>   	}
>   	glDisable(enable_enum);
>   }
>
>   static void
> +draw_scissor_change(unsigned count)
> +{
> +	unsigned i;
> +	glEnable(GL_SCISSOR_TEST);
> +	if (indexed) {
> +		for (i = 0; i < count; i++) {
> +			if (i & 1)
> +				glScissor(0, 0, piglit_width / 2, piglit_height / 2);
> +			else
> +				glScissor(0, 0, piglit_width, piglit_height);
> +			glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, NULL);
> +		}
> +	} else {
> +		for (i = 0; i < count; i++) {
> +			if (i & 1)
> +				glScissor(0, 0, piglit_width / 2, piglit_height / 2);
> +			else
> +				glScissor(0, 0, piglit_width, piglit_height);
> +			glDrawArrays(GL_TRIANGLES, 0, 3);
> +		}
> +	}
> +	glDisable(GL_SCISSOR_TEST);
> +}
> +
> +static void
> +draw_viewport_change(unsigned count)
> +{
> +	unsigned i;
> +	if (indexed) {
> +		for (i = 0; i < count; i++) {
> +			if (i & 1)
> +				glViewport(0, 0, piglit_width / 2, piglit_height / 2);
> +			else
> +				glViewport(0, 0, piglit_width, piglit_height);
> +			glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, NULL);
> +		}
> +	} else {
> +		for (i = 0; i < count; i++) {
> +			if (i & 1)
> +				glViewport(0, 0, piglit_width / 2, piglit_height / 2);
> +			else
> +				glViewport(0, 0, piglit_width, piglit_height);
> +			glDrawArrays(GL_TRIANGLES, 0, 3);
> +		}
> +	}
> +	glViewport(0, 0, piglit_width, piglit_height);
> +}
> +
> +static void
>   draw_vertex_attrib_change(unsigned count)
>   {
>   	unsigned i;
>   	if (indexed) {
>   		for (i = 0; i < count; i++) {
>   			if (i & 1)
>   				glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE,
>   						      3 * sizeof(float), NULL);
>   			else
>   				glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE,
> @@ -384,42 +433,47 @@ static double
>   perf_run(const char *call, unsigned num_vbos, unsigned num_ubos,
>   	 unsigned num_textures, const char *change, perf_rate_func f,
>   	 double base_rate)
>   {
>   	double rate = perf_measure_rate(f);
>   	double ratio = base_rate ? rate / base_rate : 1;
>
>   	printf("   %s (%2u VBOs, %u UBOs, %2u Tex) w/ %s change:%*s"
>   	       COLOR_CYAN "%s" COLOR_RESET " %s(%.1f%%)" COLOR_RESET "\n",
>   	       call, num_vbos, num_ubos, num_textures, change,
> -	       MAX2(18 - (int)strlen(change), 0), "",
> +	       MAX2(24 - (int)strlen(change), 0), "",
>   	       perf_human_float(rate),
>   	       base_rate == 0 ? COLOR_RESET :
>   				ratio > 0.7 ? COLOR_GREEN :
>   				ratio > 0.4 ? COLOR_YELLOW : COLOR_RED,
>   	       100 * ratio);
>   	return rate;
>   }
>
>   struct enable_state_t {
>   	GLenum enable;
>   	const char *name;
>   };
>
>   static struct enable_state_t enable_states[] = {
> +	{GL_PRIMITIVE_RESTART, "primitive restart enable"},
>   	{GL_BLEND,	"blend enable"},
>   	{GL_DEPTH_TEST, "depth enable"},
> +	{GL_DEPTH_CLAMP, "depth clamp enable"},
>   	{GL_STENCIL_TEST, "stencil enable"},
>   	{GL_SCISSOR_TEST, "scissor enable"},
>   	{GL_MULTISAMPLE, "MSAA enable"},
> +	{GL_SAMPLE_MASK, "sample mask enable"},
> +	{GL_SAMPLE_ALPHA_TO_COVERAGE, "alpha-to-coverage enable"},
> +	{GL_SAMPLE_SHADING, "sample shading enable"},
>   	{GL_CULL_FACE,	"cull face enable"},
> -	{GL_FRAMEBUFFER_SRGB, "FB sRGB enable"},
> +	{GL_CLIP_DISTANCE0, "clip distance enable"},
>   };
>
>   static void
>   perf_draw_variant(const char *call, bool is_indexed)
>   {
>   	double base_rate = 0;
>   	unsigned num_vbos, num_ubos, num_textures;
>
>   	indexed = is_indexed;
>
> @@ -467,20 +521,25 @@ perf_draw_variant(const char *call, bool is_indexed)
>   		uniform_loc = glGetUniformLocation(prog[0], "u");
>   		perf_run(call, num_vbos, num_ubos, num_textures, "few uniforms / 1",
>   			 draw_uniform_change, base_rate);
>
>   		glUseProgram(prog[1]);
>   		uniform_loc = glGetUniformLocation(prog[1], "u");
>   		perf_run(call, num_vbos, num_ubos, num_textures, "many uniforms / 1",
>   			 draw_uniform_change, base_rate);
>   		glUseProgram(prog[0]);
>
> +		perf_run(call, num_vbos, num_ubos, num_textures, "scissor",
> +			 draw_scissor_change, base_rate);
> +		perf_run(call, num_vbos, num_ubos, num_textures, "viewport",
> +			 draw_viewport_change, base_rate);
> +
>   		for (int state = 0; state < ARRAY_SIZE(enable_states); state++) {
>   			enable_enum = enable_states[state].enable;
>   			perf_run(call, num_vbos, num_ubos, num_textures,
>   				 enable_states[state].name,
>   				 draw_state_change, base_rate);
>   		}
>   	}
>   }
>
>   /** Called from test harness/main */
>



More information about the Piglit mailing list