[Mesa-dev] [PATCH 16/16] mesa: Returns correct error values from gl(Get)SamplerParameter*() in GLES3
Eduardo Lima Mitev
elima at igalia.com
Thu Dec 11 14:34:22 PST 2014
Per GLES specification, the family of functions glGetSamplerParameter(iv/fv)
and glSamplerParameter(i/f/iv/fv) return an INVALID_OPERATION error if
sampler is not the name of a sampler object previously returned from a call
to GenSamplers.
In desktop GL, an GL_INVALID_VALUE is returned instead.
Fixes 6 dEQP failing tests:
* dEQP-GLES3.functional.negative_api.shader.get_sampler_parameteriv
* dEQP-GLES3.functional.negative_api.shader.get_sampler_parameterfv
* dEQP-GLES3.functional.negative_api.shader.sampler_parameteri
* dEQP-GLES3.functional.negative_api.shader.sampler_parameteriv
* dEQP-GLES3.functional.negative_api.shader.sampler_parameterf
* dEQP-GLES3.functional.negative_api.shader.sampler_parameterfv
---
src/mesa/main/samplerobj.c | 60 ++++++++++++++++++++++++++++++++++++----------
1 file changed, 48 insertions(+), 12 deletions(-)
diff --git a/src/mesa/main/samplerobj.c b/src/mesa/main/samplerobj.c
index cadc9cc..c4e9bdc 100644
--- a/src/mesa/main/samplerobj.c
+++ b/src/mesa/main/samplerobj.c
@@ -732,8 +732,14 @@ _mesa_SamplerParameteri(GLuint sampler, GLenum pname, GLint param)
sampObj = _mesa_lookup_samplerobj(ctx, sampler);
if (!sampObj) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glSamplerParameteri(sampler %u)",
- sampler);
+ /* Per GLES specification, An INVALID_OPERATION error is generated if
+ * sampler is not the name of a sampler object previously returned from a call
+ * to GenSamplers.
+ * In desktop GL, an GL_INVALID_VALUE is returned instead.
+ */
+ _mesa_error(ctx, (_mesa_is_gles(ctx) ?
+ GL_INVALID_OPERATION : GL_INVALID_VALUE),
+ "glSamplerParameteri(sampler %u)", sampler);
return;
}
@@ -817,8 +823,14 @@ _mesa_SamplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
sampObj = _mesa_lookup_samplerobj(ctx, sampler);
if (!sampObj) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glSamplerParameterf(sampler %u)",
- sampler);
+ /* Per GLES specification, An INVALID_OPERATION error is generated if
+ * sampler is not the name of a sampler object previously returned from a call
+ * to GenSamplers.
+ * In desktop GL, an GL_INVALID_VALUE is returned instead.
+ */
+ _mesa_error(ctx, (_mesa_is_gles(ctx) ?
+ GL_INVALID_OPERATION : GL_INVALID_VALUE),
+ "glSamplerParameterf(sampler %u)", sampler);
return;
}
@@ -901,8 +913,14 @@ _mesa_SamplerParameteriv(GLuint sampler, GLenum pname, const GLint *params)
sampObj = _mesa_lookup_samplerobj(ctx, sampler);
if (!sampObj) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glSamplerParameteriv(sampler %u)",
- sampler);
+ /* Per GLES specification, An INVALID_OPERATION error is generated if
+ * sampler is not the name of a sampler object previously returned from a call
+ * to GenSamplers.
+ * In desktop GL, an GL_INVALID_VALUE is returned instead.
+ */
+ _mesa_error(ctx, (_mesa_is_gles(ctx) ?
+ GL_INVALID_OPERATION : GL_INVALID_VALUE),
+ "glSamplerParameteriv(sampler %u)", sampler);
return;
}
@@ -993,8 +1011,14 @@ _mesa_SamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *params)
sampObj = _mesa_lookup_samplerobj(ctx, sampler);
if (!sampObj) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glSamplerParameterfv(sampler %u)",
- sampler);
+ /* Per GLES specification, An INVALID_OPERATION error is generated if
+ * sampler is not the name of a sampler object previously returned from a call
+ * to GenSamplers.
+ * In desktop GL, an GL_INVALID_VALUE is returned instead.
+ */
+ _mesa_error(ctx, (_mesa_is_gles(ctx) ?
+ GL_INVALID_OPERATION : GL_INVALID_VALUE),
+ "glSamplerParameterfv(sampler %u)", sampler);
return;
}
@@ -1249,8 +1273,14 @@ _mesa_GetSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params)
sampObj = _mesa_lookup_samplerobj(ctx, sampler);
if (!sampObj) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glGetSamplerParameteriv(sampler %u)",
- sampler);
+ /* Per GLES specification, An INVALID_OPERATION error is generated if
+ * sampler is not the name of a sampler object previously returned from a call
+ * to GenSamplers.
+ * In desktop GL, an GL_INVALID_VALUE is returned instead.
+ */
+ _mesa_error(ctx, (_mesa_is_gles(ctx) ?
+ GL_INVALID_OPERATION : GL_INVALID_VALUE),
+ "glGetSamplerParameteriv(sampler %u)", sampler);
return;
}
@@ -1339,8 +1369,14 @@ _mesa_GetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params)
sampObj = _mesa_lookup_samplerobj(ctx, sampler);
if (!sampObj) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glGetSamplerParameterfv(sampler %u)",
- sampler);
+ /* Per GLES specification, An INVALID_OPERATION error is generated if
+ * sampler is not the name of a sampler object previously returned from a call
+ * to GenSamplers.
+ * In desktop GL, an GL_INVALID_VALUE is returned instead.
+ */
+ _mesa_error(ctx, (_mesa_is_gles(ctx) ?
+ GL_INVALID_OPERATION : GL_INVALID_VALUE),
+ "glGetSamplerParameterfv(sampler %u)", sampler);
return;
}
--
2.1.3
More information about the mesa-dev
mailing list