summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLaura Ekstrand <[email protected]>2014-12-10 16:32:16 -0800
committerLaura Ekstrand <[email protected]>2015-01-08 11:37:29 -0800
commit795ba44754d99d204dbdfd7042c839c6eae497a1 (patch)
tree18fac16cb70b26148318023c20e525555a2119cd /src
parentf4dce7a6a69de30ab7aad7612f93302c69421fea (diff)
main: set_tex_parameterf now handles errors according to the OpenGL 4.5 Specification.
Beginning in the OpenGL 4.3 core specification, certain error handling has changed. One example shown here is that INVALID_ENUM is thrown instead of INVALID_OPERATION when a user attempts to set sampler parameters for a multisample target. Reviewed-by: Anuj Phogat <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/main/texparam.c37
1 files changed, 20 insertions, 17 deletions
diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
index 7d00283d8d4..cad0e7b0c4b 100644
--- a/src/mesa/main/texparam.c
+++ b/src/mesa/main/texparam.c
@@ -598,15 +598,17 @@ invalid_enum:
static GLboolean
set_tex_parameterf(struct gl_context *ctx,
struct gl_texture_object *texObj,
- GLenum pname, const GLfloat *params)
+ GLenum pname, const GLfloat *params, bool dsa)
{
+ const char *suffix = dsa ? "ture" : "";
+
switch (pname) {
case GL_TEXTURE_MIN_LOD:
if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx))
goto invalid_pname;
if (!target_allows_setting_sampler_parameters(texObj->Target))
- goto invalid_operation;
+ goto invalid_enum;
if (texObj->Sampler.MinLod == params[0])
return GL_FALSE;
@@ -619,7 +621,7 @@ set_tex_parameterf(struct gl_context *ctx,
goto invalid_pname;
if (!target_allows_setting_sampler_parameters(texObj->Target))
- goto invalid_operation;
+ goto invalid_enum;
if (texObj->Sampler.MaxLod == params[0])
return GL_FALSE;
@@ -638,12 +640,13 @@ set_tex_parameterf(struct gl_context *ctx,
case GL_TEXTURE_MAX_ANISOTROPY_EXT:
if (ctx->Extensions.EXT_texture_filter_anisotropic) {
if (!target_allows_setting_sampler_parameters(texObj->Target))
- goto invalid_operation;
+ goto invalid_enum;
if (texObj->Sampler.MaxAnisotropy == params[0])
return GL_FALSE;
if (params[0] < 1.0) {
- _mesa_error(ctx, GL_INVALID_VALUE, "glTexParameter(param)" );
+ _mesa_error(ctx, GL_INVALID_VALUE, "glTex%sParameter(param)",
+ suffix);
return GL_FALSE;
}
flush(ctx);
@@ -665,7 +668,7 @@ set_tex_parameterf(struct gl_context *ctx,
goto invalid_pname;
if (!target_allows_setting_sampler_parameters(texObj->Target))
- goto invalid_operation;
+ goto invalid_enum;
if (texObj->Sampler.LodBias != params[0]) {
flush(ctx);
@@ -679,7 +682,7 @@ set_tex_parameterf(struct gl_context *ctx,
goto invalid_pname;
if (!target_allows_setting_sampler_parameters(texObj->Target))
- goto invalid_operation;
+ goto invalid_enum;
flush(ctx);
/* ARB_texture_float disables clamping */
@@ -702,13 +705,13 @@ set_tex_parameterf(struct gl_context *ctx,
return GL_FALSE;
invalid_pname:
- _mesa_error(ctx, GL_INVALID_ENUM, "glTexParameter(pname=%s)",
- _mesa_lookup_enum_by_nr(pname));
+ _mesa_error(ctx, GL_INVALID_ENUM, "glTex%sParameter(pname=%s)",
+ suffix, _mesa_lookup_enum_by_nr(pname));
return GL_FALSE;
-invalid_operation:
- _mesa_error(ctx, GL_INVALID_OPERATION, "glTexParameter(pname=%s)",
- _mesa_lookup_enum_by_nr(pname));
+invalid_enum:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glTex%sParameter(pname=%s)",
+ suffix, _mesa_lookup_enum_by_nr(pname));
return GL_FALSE;
}
@@ -759,7 +762,7 @@ _mesa_TexParameterf(GLenum target, GLenum pname, GLfloat param)
GLfloat p[4];
p[0] = param;
p[1] = p[2] = p[3] = 0.0F;
- need_update = set_tex_parameterf(ctx, texObj, pname, p);
+ need_update = set_tex_parameterf(ctx, texObj, pname, p, false);
}
}
@@ -832,7 +835,7 @@ _mesa_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params)
break;
default:
/* this will generate an error if pname is illegal */
- need_update = set_tex_parameterf(ctx, texObj, pname, params);
+ need_update = set_tex_parameterf(ctx, texObj, pname, params, false);
}
if (ctx->Driver.TexParameter && need_update) {
@@ -864,7 +867,7 @@ _mesa_TexParameteri(GLenum target, GLenum pname, GLint param)
fparam[0] = (GLfloat) param;
fparam[1] = fparam[2] = fparam[3] = 0.0F;
/* convert int param to float */
- need_update = set_tex_parameterf(ctx, texObj, pname, fparam);
+ need_update = set_tex_parameterf(ctx, texObj, pname, fparam, false);
}
break;
default:
@@ -904,7 +907,7 @@ _mesa_TexParameteriv(GLenum target, GLenum pname, const GLint *params)
fparams[1] = INT_TO_FLOAT(params[1]);
fparams[2] = INT_TO_FLOAT(params[2]);
fparams[3] = INT_TO_FLOAT(params[3]);
- need_update = set_tex_parameterf(ctx, texObj, pname, fparams);
+ need_update = set_tex_parameterf(ctx, texObj, pname, fparams, false);
}
break;
case GL_TEXTURE_MIN_LOD:
@@ -918,7 +921,7 @@ _mesa_TexParameteriv(GLenum target, GLenum pname, const GLint *params)
GLfloat fparams[4];
fparams[0] = (GLfloat) params[0];
fparams[1] = fparams[2] = fparams[3] = 0.0F;
- need_update = set_tex_parameterf(ctx, texObj, pname, fparams);
+ need_update = set_tex_parameterf(ctx, texObj, pname, fparams, false);
}
break;
default: