[Piglit] [PATCH] fbo-3d: test both POT and NPOT depths

apinheiro apinheiro at igalia.com
Wed Jan 2 10:21:13 UTC 2019


I have a nitpick comment below. You can ignore it in any case:

Reviewed-by: Alejandro PiƱeiro <apinheiro at igalia.com>

On 2/1/19 1:02, Ilia Mirkin wrote:
> This demonstrates issues on nv4x, which will use a different layout for
> POT vs NPOT sizes.
>
> Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
> ---
>  tests/fbo/fbo-3d.c | 31 ++++++++++++++++++++++---------
>  1 file changed, 22 insertions(+), 9 deletions(-)
>
> diff --git a/tests/fbo/fbo-3d.c b/tests/fbo/fbo-3d.c
> index e622c1df8..36dbed4e0 100644
> --- a/tests/fbo/fbo-3d.c
> +++ b/tests/fbo/fbo-3d.c
> @@ -58,16 +58,12 @@ float depth_color[NUM_DEPTHS][4] = {
>  	{0.0, 1.0, 1.0, 0.0},
>  };
>  
> -int pot_depth;
> -
>  static int
> -create_3d_fbo(void)
> +create_3d_fbo(int pot_depth)
>  {
>  	GLuint tex, fb;
>  	GLenum status;
>  	int depth;
> -	pot_depth = piglit_is_extension_supported("GL_ARB_texture_non_power_of_two") ?
> -		NUM_DEPTHS: POT_DEPTHS;
>  
>  	glGenTextures(1, &tex);
>  	glBindTexture(GL_TEXTURE_3D, tex);
> @@ -109,7 +105,6 @@ create_3d_fbo(void)
>  		piglit_draw_rect(-2, -2, BUF_WIDTH + 2, BUF_HEIGHT + 2);
>  	}
>  
> -

Is this new line removal really needed?


>  done:
>  	glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, piglit_winsys_fbo);
>  	glDeleteFramebuffersEXT(1, &fb);
> @@ -121,7 +116,7 @@ done:
>   * 3D texture.
>   */
>  static void
> -draw_depth(int x, int y, int depth)
> +draw_depth(int x, int y, int depth, int pot_depth)
>  {
>  	float depth_coord = (float)depth / (pot_depth - 1);
>  
> @@ -171,12 +166,12 @@ piglit_display(void)
>  	glClearColor(1.0, 1.0, 1.0, 1.0);
>  	glClear(GL_COLOR_BUFFER_BIT);
>  
> -	tex = create_3d_fbo();
> +	tex = create_3d_fbo(POT_DEPTHS);
>  
>  	for (depth = 0; depth < NUM_DEPTHS; depth++) {
>  		int x = 1 + depth * (BUF_WIDTH + 1);
>  		int y = 1;
> -		draw_depth(x, y, depth);
> +		draw_depth(x, y, depth, POT_DEPTHS);
>  	}
>  
>  	for (depth = 0; depth < NUM_DEPTHS; depth++) {
> @@ -187,6 +182,24 @@ piglit_display(void)
>  
>  	glDeleteTextures(1, &tex);
>  
> +	if (piglit_is_extension_supported("GL_ARB_texture_non_power_of_two")) {
> +		tex = create_3d_fbo(NUM_DEPTHS);
> +
> +		for (depth = 0; depth < NUM_DEPTHS; depth++) {
> +			int x = 1 + depth * (BUF_WIDTH + 1);
> +			int y = 2 + BUF_HEIGHT;
> +			draw_depth(x, y, depth, NUM_DEPTHS);
> +		}
> +
> +		for (depth = 0; depth < NUM_DEPTHS; depth++) {
> +			int x = 1 + depth * (BUF_WIDTH + 1);
> +			int y = 2 + BUF_HEIGHT;
> +			pass &= test_depth_drawing(x, y, depth_color[depth]);
> +		}
> +
> +		glDeleteTextures(1, &tex);
> +	}
> +
>  	piglit_present_results();
>  
>  	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pEpkey.asc
Type: application/pgp-keys
Size: 1546 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/piglit/attachments/20190102/3584d010/attachment.key>


More information about the Piglit mailing list