[Mesa-dev] [PATCH] mesa: Use immutable level count in FramebufferTexture error check.

Ilia Mirkin imirkin at alum.mit.edu
Sat Oct 7 13:30:38 UTC 2017


Hi Ken,

Have a look at

https://patchwork.freedesktop.org/patch/134865/
https://patchwork.freedesktop.org/patch/135410/

No idea what the outcome of that was. I guess some code reorg has
happened since too. If, after reading through those, you think this is
right - go ahead :) I've lost all context on this.

  -ilia

On Sat, Oct 7, 2017 at 3:05 AM, Kenneth Graunke <kenneth at whitecape.org> wrote:
> This offers a more accurate bound.
>
> Fixes KHR-GL45.geometry_shader.layered_fbo.fb_texture_invalid_level_number.
> ---
>  src/mesa/main/fbobject.c | 14 ++++++++------
>  1 file changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
> index 0867ff70fa7..e11feda5f3c 100644
> --- a/src/mesa/main/fbobject.c
> +++ b/src/mesa/main/fbobject.c
> @@ -3223,11 +3223,13 @@ check_layer(struct gl_context *ctx, GLenum target, GLint layer,
>   * \return true if no errors, false if errors
>   */
>  static bool
> -check_level(struct gl_context *ctx, GLenum target, GLint level,
> -            const char *caller)
> +check_level(struct gl_context *ctx, struct gl_texture_object *texObj,
> +            GLenum target, GLint level, const char *caller)
>  {
> -   if ((level < 0) ||
> -       (level >= _mesa_max_texture_levels(ctx, target))) {
> +   const int max_levels = texObj->Immutable ? texObj->ImmutableLevels :
> +                          _mesa_max_texture_levels(ctx, target);
> +
> +   if (level < 0 || level >= max_levels) {
>        _mesa_error(ctx, GL_INVALID_VALUE,
>                    "%s(invalid level %d)", caller, level);
>        return false;
> @@ -3393,7 +3395,7 @@ framebuffer_texture_with_dims(int dims, GLenum target,
>        if ((dims == 3) && !check_layer(ctx, texObj->Target, layer, caller))
>           return;
>
> -      if (!check_level(ctx, textarget, level, caller))
> +      if (!check_level(ctx, texObj, textarget, level, caller))
>           return;
>     }
>
> @@ -3539,7 +3541,7 @@ frame_buffer_texture(GLuint framebuffer, GLenum target,
>                 return;
>           }
>
> -         if (!check_level(ctx, texObj->Target, level, func))
> +         if (!check_level(ctx, texObj, texObj->Target, level, func))
>              return;
>        }
>
> --
> 2.14.2
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list