diff options
author | Samuel Pitoiset <samuel.pitoiset@gmail.com> | 2017-02-22 23:20:03 +0100 |
---|---|---|
committer | Samuel Pitoiset <samuel.pitoiset@gmail.com> | 2017-04-26 16:04:51 +0200 |
commit | ed5d7a8bb2c65018f93d8860adbe3406fac23eee (patch) | |
tree | be30b2df93d3d7d4dfe2cb7dd33a9686264ea5ef | |
parent | 13bd2efb6370d76b2b1739d0250a93ba78121fa2 (diff) |
mesa: refuse to update sampler parameters when a handle is allocated
The ARB_bindless_texture spec says:
"The error INVALID_OPERATION is generated by SamplerParameter* if
<sampler> identifies a sampler object referenced by one or more
texture handles."
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
-rw-r--r-- | src/mesa/main/samplerobj.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/mesa/main/samplerobj.c b/src/mesa/main/samplerobj.c index ee15c68b4f..cf4bcfce7c 100644 --- a/src/mesa/main/samplerobj.c +++ b/src/mesa/main/samplerobj.c @@ -801,6 +801,18 @@ _mesa_SamplerParameteri(GLuint sampler, GLenum pname, GLint param) if (!sampObj) return; + if (sampObj->HandleAllocated) { + /* The ARB_bindless_texture spec says: + * + * "The error INVALID_OPERATION is generated by SamplerParameter* if + * <sampler> identifies a sampler object referenced by one or more + * texture handles." + */ + _mesa_error(ctx, GL_INVALID_OPERATION, + "glSamplerParameteri(immutable sampler)"); + return; + } + switch (pname) { case GL_TEXTURE_WRAP_S: res = set_sampler_wrap_s(ctx, sampObj, param); @@ -884,6 +896,12 @@ _mesa_SamplerParameterf(GLuint sampler, GLenum pname, GLfloat param) if (!sampObj) return; + if (sampObj->HandleAllocated) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glSamplerParameterf(immutable sampler)"); + return; + } + switch (pname) { case GL_TEXTURE_WRAP_S: res = set_sampler_wrap_s(ctx, sampObj, (GLint) param); @@ -966,6 +984,12 @@ _mesa_SamplerParameteriv(GLuint sampler, GLenum pname, const GLint *params) if (!sampObj) return; + if (sampObj->HandleAllocated) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glSamplerParameteriv(immutable sampler)"); + return; + } + switch (pname) { case GL_TEXTURE_WRAP_S: res = set_sampler_wrap_s(ctx, sampObj, params[0]); @@ -1056,6 +1080,12 @@ _mesa_SamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *params) if (!sampObj) return; + if (sampObj->HandleAllocated) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glSamplerParameterfv(immutable sampler)"); + return; + } + switch (pname) { case GL_TEXTURE_WRAP_S: res = set_sampler_wrap_s(ctx, sampObj, (GLint) params[0]); @@ -1139,6 +1169,12 @@ _mesa_SamplerParameterIiv(GLuint sampler, GLenum pname, const GLint *params) if (!sampObj) return; + if (sampObj->HandleAllocated) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glSamplerParameterIiv(immutable sampler)"); + return; + } + switch (pname) { case GL_TEXTURE_WRAP_S: res = set_sampler_wrap_s(ctx, sampObj, params[0]); @@ -1223,6 +1259,12 @@ _mesa_SamplerParameterIuiv(GLuint sampler, GLenum pname, const GLuint *params) if (!sampObj) return; + if (sampObj->HandleAllocated) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glSamplerParameterIuiv(immutable sampler)"); + return; + } + switch (pname) { case GL_TEXTURE_WRAP_S: res = set_sampler_wrap_s(ctx, sampObj, params[0]); |