Dorian Apanel <dorian.apa...@gmail.com> writes:

> Textures created by image load/store tests where not complete.
> Needed to set max level, to relax mip requirements.
> Load/Store on incomplete textures should return zeros/change nothing.
> Added negative test case to check this.
>

I don't think these changes are correct.  It's unlikely that the
sampler minification controls were intended to have any effect on image
unit completeness.  Have a look at the related OpenGL spec bug:

https://cvs.khronos.org/bugzilla/show_bug.cgi?id=16111

And related discussion in the mesa-dev mailing list:

https://lists.freedesktop.org/archives/mesa-dev/2016-July/123212.html

> Signed-off-by: Dorian Apanel <dorian.apa...@gmail.com>
> ---
>  tests/spec/arb_shader_image_load_store/common.c  |  9 +++++++++
>  tests/spec/arb_shader_image_load_store/invalid.c | 18 ++++++++++++++++++
>  2 files changed, 27 insertions(+)
>
> diff --git a/tests/spec/arb_shader_image_load_store/common.c 
> b/tests/spec/arb_shader_image_load_store/common.c
> index cbeaac7..fdc2ef3 100644
> --- a/tests/spec/arb_shader_image_load_store/common.c
> +++ b/tests/spec/arb_shader_image_load_store/common.c
> @@ -141,6 +141,11 @@ upload_image_levels(const struct image_info img, 
> unsigned num_levels,
>          glGenTextures(1, &textures[unit]);
>          glBindTexture(img.target->target, textures[unit]);
>  
> +        if (img.target->target != GL_TEXTURE_BUFFER) {
> +            glTexParameteri(img.target->target, GL_TEXTURE_BASE_LEVEL, 0);
> +            glTexParameteri(img.target->target, GL_TEXTURE_MAX_LEVEL, 
> num_levels - 1);
> +        }
> +
>          switch (img.target->target) {
>          case GL_TEXTURE_1D:
>                  for (l = 0; l < num_levels; ++l) {
> @@ -301,6 +306,8 @@ upload_image_levels(const struct image_info img, unsigned 
> num_levels,
>  
>                  glGenTextures(1, &tmp_tex);
>                  glBindTexture(GL_TEXTURE_2D, tmp_tex);
> +                glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
> +                glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
>  
>                  if (img.target->target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY) {
>                          
> glTexImage3DMultisample(GL_TEXTURE_2D_MULTISAMPLE_ARRAY,
> @@ -462,6 +469,8 @@ download_image_levels(const struct image_info img, 
> unsigned num_levels,
>  
>                  glGenTextures(1, &tmp_tex);
>                  glBindTexture(GL_TEXTURE_2D, tmp_tex);
> +                glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
> +                glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
>  
>                  glTexImage2D(GL_TEXTURE_2D, 0, img.format->format,
>                               grid.size.x, grid.size.y, 0,
> diff --git a/tests/spec/arb_shader_image_load_store/invalid.c 
> b/tests/spec/arb_shader_image_load_store/invalid.c
> index 6bf3bce..cedb37a 100644
> --- a/tests/spec/arb_shader_image_load_store/invalid.c
> +++ b/tests/spec/arb_shader_image_load_store/invalid.c
> @@ -229,6 +229,14 @@ invalidate_incomplete(const struct image_info img, 
> GLuint prog)
>  }
>  
>  static bool
> +invalidate_incomplete_max_level(const struct image_info img, GLuint prog)
> +{
> +        /* Change max level to greater then supplied mips count. */
> +        glTexParameteri(img.target->target, GL_TEXTURE_MAX_LEVEL, 3);
> +        return piglit_check_gl_error(GL_NO_ERROR);
> +}
> +
> +static bool
>  invalidate_level_bounds(const struct image_info img, GLuint prog)
>  {
>          const int level = 1;
> @@ -370,6 +378,16 @@ piglit_init(int argc, char **argv)
>                          "%s/incomplete image test", op->name);
>  
>                  /*
> +                 * Texture is also incomplete if not all mipmaps(down to 1x1)
> +                 * are supplied and GL_TEXTURE_MAX_LEVEL does not relax
> +                 * this requirement.
> +                 */
> +                subtest(&status, true,
> +                        run_test(op, def_img, def_img,
> +                                 invalidate_incomplete_max_level, false),
> +                        "%s/incomplete image test (MAX_LEVEL)", op->name);
> +
> +                /*
>                   * " * the texture level bound to the image unit is
>                   *     less than the base level or greater than the
>                   *     maximum level of the texture; [...]"
> -- 
> 2.10.2.windows.1
>
> _______________________________________________
> Piglit mailing list
> Piglit@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/piglit

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to