[Mesa-dev] [PATCH v2 08/64] mesa: refuse to change textures when a handle is allocated

Nicolai Hähnle nhaehnle at gmail.com
Wed Jun 7 16:00:44 UTC 2017


Patches 1, 2, and 6-8:

Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>


On 30.05.2017 22:35, Samuel Pitoiset wrote:
> The ARB_bindless_texture spec says:
> 
>     "The error INVALID_OPERATION is generated by TexImage*, CopyTexImage*,
>      CompressedTexImage*, TexBuffer*, TexParameter*, as well as other
>      functions defined in terms of these, if the texture object to be
>      modified is referenced by one or more texture or image handles."
> 
> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
> ---
>   src/mesa/main/teximage.c | 25 ++++++++++++++++++++++++-
>   1 file changed, 24 insertions(+), 1 deletion(-)
> 
> diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
> index fed1dad262..ac06b66985 100644
> --- a/src/mesa/main/teximage.c
> +++ b/src/mesa/main/teximage.c
> @@ -1578,7 +1578,7 @@ legal_texsubimage_target(struct gl_context *ctx, GLuint dims, GLenum target,
>   
>   /**
>    * Helper function to determine if a texture object is mutable (in terms
> - * of GL_ARB_texture_storage).
> + * of GL_ARB_texture_storage/GL_ARB_bindless_texture).
>    */
>   static GLboolean
>   mutable_tex_object(struct gl_context *ctx, GLenum target)
> @@ -1587,6 +1587,17 @@ mutable_tex_object(struct gl_context *ctx, GLenum target)
>      if (!texObj)
>         return GL_FALSE;
>   
> +   if (texObj->HandleAllocated) {
> +      /* The ARB_bindless_texture spec says:
> +       *
> +       * "The error INVALID_OPERATION is generated by TexImage*, CopyTexImage*,
> +       *  CompressedTexImage*, TexBuffer*, TexParameter*, as well as other
> +       *  functions defined in terms of these, if the texture object to be
> +       *  modified is referenced by one or more texture or image handles."
> +       */
> +      return GL_FALSE;
> +   }
> +
>      return !texObj->Immutable;
>   }
>   
> @@ -5009,6 +5020,18 @@ texture_buffer_range(struct gl_context *ctx,
>         return;
>      }
>   
> +   if (texObj->HandleAllocated) {
> +      /* The ARB_bindless_texture spec says:
> +       *
> +       * "The error INVALID_OPERATION is generated by TexImage*, CopyTexImage*,
> +       *  CompressedTexImage*, TexBuffer*, TexParameter*, as well as other
> +       *  functions defined in terms of these, if the texture object to be
> +       *  modified is referenced by one or more texture or image handles."
> +       */
> +      _mesa_error(ctx, GL_INVALID_OPERATION, "%s(immutable texture)", caller);
> +      return;
> +   }
> +
>      format = _mesa_validate_texbuffer_format(ctx, internalFormat);
>      if (format == MESA_FORMAT_NONE) {
>         _mesa_error(ctx, GL_INVALID_ENUM, "%s(internalFormat %s)",
> 


-- 
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.


More information about the mesa-dev mailing list