[Mesa-dev] [RFC PATCH 06/65] mesa: refuse to update tex parameters when a handle is allocated
Nicolai Hähnle
nhaehnle at gmail.com
Wed May 24 10:25:20 UTC 2017
On 19.05.2017 18:52, Samuel Pitoiset wrote:
> The ARB_bindless_texture spec says:
>
> "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/texparam.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 61 insertions(+)
>
> diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
> index 0156bbd275..c73cf8bf83 100644
> --- a/src/mesa/main/texparam.c
> +++ b/src/mesa/main/texparam.c
> @@ -1026,6 +1026,9 @@ _mesa_TexParameterf(GLenum target, GLenum pname, GLfloat param)
> if (!texObj)
> return;
>
> + if (texObj->HandleAllocated)
> + return;
You're not actually setting an error here.
Also, I think it'd be best to do the check to set_tex_parameter{i,f}.
There's some weird special handling of GL_TEXTURE_BORDER_COLOR in
_mesa_texture_parameterI(u)iv that would have to be stream-lined to go
via set_tex_parameterf, but apart from that it should work fine.
Cheers,
Nicolai
> +
> _mesa_texture_parameterf(ctx, texObj, pname, param, false);
> }
>
> @@ -1039,6 +1042,9 @@ _mesa_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
> if (!texObj)
> return;
>
> + if (texObj->HandleAllocated)
> + return;
> +
> _mesa_texture_parameterfv(ctx, texObj, pname, params, false);
> }
>
> @@ -1052,6 +1058,9 @@ _mesa_TexParameteri(GLenum target, GLenum pname, GLint param)
> if (!texObj)
> return;
>
> + if (texObj->HandleAllocated)
> + return;
> +
> _mesa_texture_parameteri(ctx, texObj, pname, param, false);
> }
>
> @@ -1065,6 +1074,9 @@ _mesa_TexParameteriv(GLenum target, GLenum pname, const GLint *params)
> if (!texObj)
> return;
>
> + if (texObj->HandleAllocated)
> + return;
> +
> _mesa_texture_parameteriv(ctx, texObj, pname, params, false);
> }
>
> @@ -1083,6 +1095,9 @@ _mesa_TexParameterIiv(GLenum target, GLenum pname, const GLint *params)
> if (!texObj)
> return;
>
> + if (texObj->HandleAllocated)
> + return;
> +
> _mesa_texture_parameterIiv(ctx, texObj, pname, params, false);
> }
>
> @@ -1101,6 +1116,9 @@ _mesa_TexParameterIuiv(GLenum target, GLenum pname, const GLuint *params)
> if (!texObj)
> return;
>
> + if (texObj->HandleAllocated)
> + return;
> +
> _mesa_texture_parameterIuiv(ctx, texObj, pname, params, false);
> }
>
> @@ -1118,6 +1136,19 @@ _mesa_TextureParameterfv(GLuint texture, GLenum pname, const GLfloat *params)
> 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,
> + "glTextureParameterfv(immutable texture)");
> + return;
> + }
> +
> _mesa_texture_parameterfv(ctx, texObj, pname, params, true);
> }
>
> @@ -1134,6 +1165,12 @@ _mesa_TextureParameterf(GLuint texture, GLenum pname, GLfloat param)
> return;
> }
>
> + if (texObj->HandleAllocated) {
> + _mesa_error(ctx, GL_INVALID_OPERATION,
> + "glTextureParameterf(immutable texture)");
> + return;
> + }
> +
> _mesa_texture_parameterf(ctx, texObj, pname, param, true);
> }
>
> @@ -1150,6 +1187,12 @@ _mesa_TextureParameteri(GLuint texture, GLenum pname, GLint param)
> return;
> }
>
> + if (texObj->HandleAllocated) {
> + _mesa_error(ctx, GL_INVALID_OPERATION,
> + "glTextureParameteri(immutable texture)");
> + return;
> + }
> +
> _mesa_texture_parameteri(ctx, texObj, pname, param, true);
> }
>
> @@ -1167,6 +1210,12 @@ _mesa_TextureParameteriv(GLuint texture, GLenum pname,
> return;
> }
>
> + if (texObj->HandleAllocated) {
> + _mesa_error(ctx, GL_INVALID_OPERATION,
> + "glTextureParameteriv(immutable texture)");
> + return;
> + }
> +
> _mesa_texture_parameteriv(ctx, texObj, pname, params, true);
> }
>
> @@ -1185,6 +1234,12 @@ _mesa_TextureParameterIiv(GLuint texture, GLenum pname, const GLint *params)
> return;
> }
>
> + if (texObj->HandleAllocated) {
> + _mesa_error(ctx, GL_INVALID_OPERATION,
> + "glTextureParameterIiv(immutable texture)");
> + return;
> + }
> +
> _mesa_texture_parameterIiv(ctx, texObj, pname, params, true);
> }
>
> @@ -1202,6 +1257,12 @@ _mesa_TextureParameterIuiv(GLuint texture, GLenum pname, const GLuint *params)
> return;
> }
>
> + if (texObj->HandleAllocated) {
> + _mesa_error(ctx, GL_INVALID_OPERATION,
> + "glTextureParameterIuv(immutable texture)");
> + return;
> + }
> +
> _mesa_texture_parameterIuiv(ctx, texObj, pname, params, true);
> }
>
>
--
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.
More information about the mesa-dev
mailing list