summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>2017-02-22 23:20:03 +0100
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>2017-06-14 10:04:36 +0200
commit67ab372c60cd18d88468aa586ceaf2810da79200 (patch)
tree5275a31434b13cc8ff6a4ed7475e27a9218abba8 /src
parent326a82a255c1a72376ce2b7f3d878bfff5cb9621 (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> Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/main/samplerobj.c33
1 files changed, 22 insertions, 11 deletions
diff --git a/src/mesa/main/samplerobj.c b/src/mesa/main/samplerobj.c
index ee15c68b4ff..d3ed4da3932 100644
--- a/src/mesa/main/samplerobj.c
+++ b/src/mesa/main/samplerobj.c
@@ -769,7 +769,7 @@ set_sampler_srgb_decode(struct gl_context *ctx,
static struct gl_sampler_object *
sampler_parameter_error_check(struct gl_context *ctx, GLuint sampler,
- const char *name)
+ bool get, const char *name)
{
struct gl_sampler_object *sampObj;
@@ -786,6 +786,17 @@ sampler_parameter_error_check(struct gl_context *ctx, GLuint sampler,
return NULL;
}
+ if (!get && 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, "%s(immutable sampler)", name);
+ return NULL;
+ }
+
return sampObj;
}
@@ -796,7 +807,7 @@ _mesa_SamplerParameteri(GLuint sampler, GLenum pname, GLint param)
GLuint res;
GET_CURRENT_CONTEXT(ctx);
- sampObj = sampler_parameter_error_check(ctx, sampler,
+ sampObj = sampler_parameter_error_check(ctx, sampler, false,
"glSamplerParameteri");
if (!sampObj)
return;
@@ -879,7 +890,7 @@ _mesa_SamplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
GLuint res;
GET_CURRENT_CONTEXT(ctx);
- sampObj = sampler_parameter_error_check(ctx, sampler,
+ sampObj = sampler_parameter_error_check(ctx, sampler, false,
"glSamplerParameterf");
if (!sampObj)
return;
@@ -961,7 +972,7 @@ _mesa_SamplerParameteriv(GLuint sampler, GLenum pname, const GLint *params)
GLuint res;
GET_CURRENT_CONTEXT(ctx);
- sampObj = sampler_parameter_error_check(ctx, sampler,
+ sampObj = sampler_parameter_error_check(ctx, sampler, false,
"glSamplerParameteriv");
if (!sampObj)
return;
@@ -1051,7 +1062,7 @@ _mesa_SamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *params)
GLuint res;
GET_CURRENT_CONTEXT(ctx);
- sampObj = sampler_parameter_error_check(ctx, sampler,
+ sampObj = sampler_parameter_error_check(ctx, sampler, false,
"glSamplerParameterfv");
if (!sampObj)
return;
@@ -1134,7 +1145,7 @@ _mesa_SamplerParameterIiv(GLuint sampler, GLenum pname, const GLint *params)
GLuint res;
GET_CURRENT_CONTEXT(ctx);
- sampObj = sampler_parameter_error_check(ctx, sampler,
+ sampObj = sampler_parameter_error_check(ctx, sampler, false,
"glSamplerParameterIiv");
if (!sampObj)
return;
@@ -1218,7 +1229,7 @@ _mesa_SamplerParameterIuiv(GLuint sampler, GLenum pname, const GLuint *params)
GLuint res;
GET_CURRENT_CONTEXT(ctx);
- sampObj = sampler_parameter_error_check(ctx, sampler,
+ sampObj = sampler_parameter_error_check(ctx, sampler, false,
"glSamplerParameterIuiv");
if (!sampObj)
return;
@@ -1301,7 +1312,7 @@ _mesa_GetSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params)
struct gl_sampler_object *sampObj;
GET_CURRENT_CONTEXT(ctx);
- sampObj = sampler_parameter_error_check(ctx, sampler,
+ sampObj = sampler_parameter_error_check(ctx, sampler, true,
"glGetSamplerParameteriv");
if (!sampObj)
return;
@@ -1385,7 +1396,7 @@ _mesa_GetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params)
struct gl_sampler_object *sampObj;
GET_CURRENT_CONTEXT(ctx);
- sampObj = sampler_parameter_error_check(ctx, sampler,
+ sampObj = sampler_parameter_error_check(ctx, sampler, true,
"glGetSamplerParameterfv");
if (!sampObj)
return;
@@ -1457,7 +1468,7 @@ _mesa_GetSamplerParameterIiv(GLuint sampler, GLenum pname, GLint *params)
struct gl_sampler_object *sampObj;
GET_CURRENT_CONTEXT(ctx);
- sampObj = sampler_parameter_error_check(ctx, sampler,
+ sampObj = sampler_parameter_error_check(ctx, sampler, true,
"glGetSamplerParameterIiv");
if (!sampObj)
return;
@@ -1529,7 +1540,7 @@ _mesa_GetSamplerParameterIuiv(GLuint sampler, GLenum pname, GLuint *params)
struct gl_sampler_object *sampObj;
GET_CURRENT_CONTEXT(ctx);
- sampObj = sampler_parameter_error_check(ctx, sampler,
+ sampObj = sampler_parameter_error_check(ctx, sampler, true,
"glGetSamplerParameterIuiv");
if (!sampObj)
return;