summaryrefslogtreecommitdiff
path: root/src/mesa/main/samplerobj.c
diff options
context:
space:
mode:
authorAdam Jackson <ajax@redhat.com>2019-11-14 13:09:32 -0500
committerMarge Bot <eric+marge@anholt.net>2020-09-09 17:45:08 +0000
commitcdc025c9ef67bddf733fccb5b3e78d8d7c8b4880 (patch)
tree091da4d1ba774c8177ac67c6c3d37a686d73ebb0 /src/mesa/main/samplerobj.c
parent06c6920a5b1046305408089561c4e5f7b90511d5 (diff)
mesa: Generate more errors from GetSamplerParameter
Not all of the corresponding extensions are enabled unconditionally, and we should throw INVALID_ENUM in those cases. Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Adam Jackson <ajax@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6653>
Diffstat (limited to 'src/mesa/main/samplerobj.c')
-rw-r--r--src/mesa/main/samplerobj.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mesa/main/samplerobj.c b/src/mesa/main/samplerobj.c
index 0bf58859a54..271983e4f10 100644
--- a/src/mesa/main/samplerobj.c
+++ b/src/mesa/main/samplerobj.c
@@ -1445,18 +1445,26 @@ _mesa_GetSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params)
*params = lroundf(sampObj->LodBias);
break;
case GL_TEXTURE_COMPARE_MODE:
+ if (!ctx->Extensions.ARB_shadow)
+ goto invalid_pname;
*params = sampObj->CompareMode;
break;
case GL_TEXTURE_COMPARE_FUNC:
+ if (!ctx->Extensions.ARB_shadow)
+ goto invalid_pname;
*params = sampObj->CompareFunc;
break;
case GL_TEXTURE_MAX_ANISOTROPY_EXT:
+ if (!ctx->Extensions.EXT_texture_filter_anisotropic)
+ goto invalid_pname;
/* GL spec 'Data Conversions' section specifies that floating-point
* value in integer Get function is rounded to nearest integer
*/
*params = lroundf(sampObj->MaxAnisotropy);
break;
case GL_TEXTURE_BORDER_COLOR:
+ if (!ctx->Extensions.ARB_texture_border_clamp)
+ goto invalid_pname;
params[0] = FLOAT_TO_INT(sampObj->BorderColor.f[0]);
params[1] = FLOAT_TO_INT(sampObj->BorderColor.f[1]);
params[2] = FLOAT_TO_INT(sampObj->BorderColor.f[2]);