[Piglit] [PATCH 2/4] framebuffer-blit-levels: fix off-by-one error.
Anuj Phogat
anuj.phogat at gmail.com
Wed Sep 12 12:18:06 PDT 2012
On Wed, Sep 5, 2012 at 2:59 PM, Paul Berry <stereotype441 at gmail.com> wrote:
> Previously, the test made the erroneous assumption that if the size of
> a texture is 2^n, then that texture has n miplevels. This was
> wrong--the texture has n+1 miplevels, ranging in size from 2^n to 2^0.
> ---
> .../framebuffer-blit-levels.c | 7 ++++---
> 1 files changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/tests/spec/arb_framebuffer_object/framebuffer-blit-levels.c b/tests/spec/arb_framebuffer_object/framebuffer-blit-levels.c
> index 16680c4..eb951bc 100644
> --- a/tests/spec/arb_framebuffer_object/framebuffer-blit-levels.c
> +++ b/tests/spec/arb_framebuffer_object/framebuffer-blit-levels.c
> @@ -80,6 +80,7 @@ GLenum framebuffer_attachment;
>
> #define LOG2_SIZE 7
> #define SIZE (1 << LOG2_SIZE)
> +#define NUM_LEVELS (LOG2_SIZE + 1)
>
> /**
> * Generate a block of test data in which each pixel has a unique RGBA
> @@ -195,7 +196,7 @@ piglit_init(int argc, char **argv)
> GL_NEAREST);
> glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
> GL_NEAREST);
> - for (level = 0; level < LOG2_SIZE; ++level) {
> + for (level = 0; level < NUM_LEVELS; ++level) {
> glTexImage2D(GL_TEXTURE_2D, level,
> texture_internal_format,
> SIZE >> level, SIZE >> level,
> @@ -228,7 +229,7 @@ piglit_display()
> unsigned level;
>
> /* Populate the test texture */
> - for (level = 0; level < LOG2_SIZE; ++level) {
> + for (level = 0; level < NUM_LEVELS; ++level) {
> unsigned width = SIZE >> level;
> unsigned height = SIZE >> level;
> create_test_data(data, texture_format, level, width, height);
> @@ -263,7 +264,7 @@ piglit_display()
> }
>
> /* Verify the test texture */
> - for (level = 0; level < LOG2_SIZE; ++level) {
> + for (level = 0; level < NUM_LEVELS; ++level) {
> unsigned width = SIZE >> level;
> unsigned height = SIZE >> level;
> printf("Testing level %d\n", level);
> --
> 1.7.7.6
>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
Reviewed-by: Anuj Phogat <anuj.phogat at gmail.com>
More information about the Piglit
mailing list