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."
v2: - move the error checks to set_tex_parameter{i,f} - handle the weird GL_TEXTURE_BORDER_COLOR cases Signed-off-by: Samuel Pitoiset <samuel.pitoi...@gmail.com> --- src/mesa/main/texparam.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c index 0156bbd275..d6b611c640 100644 --- a/src/mesa/main/texparam.c +++ b/src/mesa/main/texparam.c @@ -277,6 +277,19 @@ set_tex_parameteri(struct gl_context *ctx, { const char *suffix = dsa ? "ture" : ""; + 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, + "glTex%sParameter(immutable texture)", suffix); + return GL_FALSE; + } + switch (pname) { case GL_TEXTURE_MIN_FILTER: if (!_mesa_target_allows_setting_sampler_parameters(texObj->Target)) @@ -640,6 +653,19 @@ set_tex_parameterf(struct gl_context *ctx, { const char *suffix = dsa ? "ture" : ""; + 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, + "glTex%sParameter(immutable texture)", suffix); + return GL_FALSE; + } + switch (pname) { case GL_TEXTURE_MIN_LOD: if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx)) @@ -978,6 +1004,12 @@ _mesa_texture_parameterIiv(struct gl_context *ctx, { switch (pname) { case GL_TEXTURE_BORDER_COLOR: + if (texObj->HandleAllocated) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glTextureParameterIiv(immutable texture)"); + return; + } + if (!_mesa_target_allows_setting_sampler_parameters(texObj->Target)) { _mesa_error(ctx, GL_INVALID_ENUM, "glTextureParameterIiv(texture)"); return; @@ -1000,6 +1032,12 @@ _mesa_texture_parameterIuiv(struct gl_context *ctx, { switch (pname) { case GL_TEXTURE_BORDER_COLOR: + if (texObj->HandleAllocated) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glTextureParameterIuiv(immutable texture)"); + return; + } + if (!_mesa_target_allows_setting_sampler_parameters(texObj->Target)) { _mesa_error(ctx, GL_INVALID_ENUM, "glTextureParameterIuiv(texture)"); return; -- 2.13.0 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev