<div dir="ltr">These comments have been addressed: <a href="http://cgit.freedesktop.org/~ldeks/mesa/commit/?h=adsa-textures&id=fe7abbcd2356a25758791bf1a66654936a7a1837">http://cgit.freedesktop.org/~ldeks/mesa/commit/?h=adsa-textures&id=fe7abbcd2356a25758791bf1a66654936a7a1837</a><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Dec 30, 2014 at 4:03 PM, Anuj Phogat <span dir="ltr"><<a href="mailto:anuj.phogat@gmail.com" target="_blank">anuj.phogat@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Tue, Dec 16, 2014 at 6:52 AM, Laura Ekstrand <<a href="mailto:laura@jlekstrand.net">laura@jlekstrand.net</a>> wrote:<br>
> Beginning in the OpenGL 4.3 core specification, some error handling has<br>
> changed. As an example, changing sampler states with a multisample target<br>
> throws INVALID_ENUM rather than INVALID_OPERATION.<br>
</span>Patch also changes error handling for GL_TEXTURE_RECTANGLE. It'll be<br>
nice to provide the spec reference for the change in the commit message.<br>
<div><div class="h5"><br>
> ---<br>
> src/mesa/main/texparam.c | 70 ++++++++++++++++++++++++++++++------------------<br>
> 1 file changed, 44 insertions(+), 26 deletions(-)<br>
><br>
> diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c<br>
> index e40fb24..70685f2 100644<br>
> --- a/src/mesa/main/texparam.c<br>
> +++ b/src/mesa/main/texparam.c<br>
> @@ -234,12 +234,12 @@ target_allows_setting_sampler_parameters(GLenum target)<br>
> static GLboolean<br>
> set_tex_parameteri(struct gl_context *ctx,<br>
> struct gl_texture_object *texObj,<br>
> - GLenum pname, const GLint *params)<br>
> + GLenum pname, const GLint *params, bool dsa)<br>
> {<br>
> switch (pname) {<br>
> case GL_TEXTURE_MIN_FILTER:<br>
> if (!target_allows_setting_sampler_parameters(texObj->Target))<br>
> - goto invalid_operation;<br>
> + goto invalid_enum;<br>
><br>
> if (texObj->Sampler.MinFilter == params[0])<br>
> return GL_FALSE;<br>
> @@ -267,7 +267,7 @@ set_tex_parameteri(struct gl_context *ctx,<br>
><br>
> case GL_TEXTURE_MAG_FILTER:<br>
> if (!target_allows_setting_sampler_parameters(texObj->Target))<br>
> - goto invalid_operation;<br>
> + goto invalid_enum;<br>
><br>
> if (texObj->Sampler.MagFilter == params[0])<br>
> return GL_FALSE;<br>
> @@ -284,7 +284,7 @@ set_tex_parameteri(struct gl_context *ctx,<br>
><br>
> case GL_TEXTURE_WRAP_S:<br>
> if (!target_allows_setting_sampler_parameters(texObj->Target))<br>
> - goto invalid_operation;<br>
> + goto invalid_enum;<br>
><br>
> if (texObj->Sampler.WrapS == params[0])<br>
> return GL_FALSE;<br>
> @@ -297,7 +297,7 @@ set_tex_parameteri(struct gl_context *ctx,<br>
><br>
> case GL_TEXTURE_WRAP_T:<br>
> if (!target_allows_setting_sampler_parameters(texObj->Target))<br>
> - goto invalid_operation;<br>
> + goto invalid_enum;<br>
><br>
> if (texObj->Sampler.WrapT == params[0])<br>
> return GL_FALSE;<br>
> @@ -310,7 +310,7 @@ set_tex_parameteri(struct gl_context *ctx,<br>
><br>
> case GL_TEXTURE_WRAP_R:<br>
> if (!target_allows_setting_sampler_parameters(texObj->Target))<br>
> - goto invalid_operation;<br>
> + goto invalid_enum;<br>
><br>
> if (texObj->Sampler.WrapR == params[0])<br>
> return GL_FALSE;<br>
> @@ -332,10 +332,17 @@ set_tex_parameteri(struct gl_context *ctx,<br>
> texObj->Target == GL_TEXTURE_2D_MULTISAMPLE_ARRAY) && params[0] != 0)<br>
> goto invalid_operation;<br>
><br>
> - if (params[0] < 0 ||<br>
> - (texObj->Target == GL_TEXTURE_RECTANGLE_ARB && params[0] != 0)) {<br>
> + if (params[0] < 0) {<br>
> _mesa_error(ctx, GL_INVALID_VALUE,<br>
> - "glTexParameter(param=%d)", params[0]);<br>
> + "glTex%sParameter(param=%d)", dsa ? "ture" : "",<br>
> + params[0]);<br>
> + return GL_FALSE;<br>
> + }<br>
> + if (texObj->Target == GL_TEXTURE_RECTANGLE_ARB && params[0] != 0) {<br>
> + _mesa_error(ctx, GL_INVALID_OPERATION,<br>
> + "glTex%sParameter(target=%s, param=%d)",<br>
> + dsa ? "true" : "",<br>
> + _mesa_lookup_enum_by_nr(texObj->Target), params[0]);<br>
> return GL_FALSE;<br>
> }<br>
> incomplete(ctx, texObj);<br>
> @@ -355,7 +362,8 @@ set_tex_parameteri(struct gl_context *ctx,<br>
> if (params[0] < 0 ||<br>
> (texObj->Target == GL_TEXTURE_RECTANGLE_ARB && params[0] > 0)) {<br>
> _mesa_error(ctx, GL_INVALID_VALUE,<br>
> - "glTexParameter(param=%d)", params[0]);<br>
> + "glTex%sParameter(param=%d)", dsa ? "ture" : "",<br>
> + params[0]);<br>
> return GL_FALSE;<br>
> }<br>
> incomplete(ctx, texObj);<br>
> @@ -392,7 +400,7 @@ set_tex_parameteri(struct gl_context *ctx,<br>
> || _mesa_is_gles3(ctx)) {<br>
><br>
> if (!target_allows_setting_sampler_parameters(texObj->Target))<br>
> - goto invalid_operation;<br>
> + goto invalid_enum;<br>
><br>
> if (texObj->Sampler.CompareMode == params[0])<br>
> return GL_FALSE;<br>
> @@ -411,7 +419,7 @@ set_tex_parameteri(struct gl_context *ctx,<br>
> || _mesa_is_gles3(ctx)) {<br>
><br>
> if (!target_allows_setting_sampler_parameters(texObj->Target))<br>
> - goto invalid_operation;<br>
> + goto invalid_enum;<br>
><br>
> if (texObj->Sampler.CompareFunc == params[0])<br>
> return GL_FALSE;<br>
> @@ -486,7 +494,8 @@ set_tex_parameteri(struct gl_context *ctx,<br>
> const GLint swz = comp_to_swizzle(params[0]);<br>
> if (swz < 0) {<br>
> _mesa_error(ctx, GL_INVALID_ENUM,<br>
> - "glTexParameter(swizzle 0x%x)", params[0]);<br>
> + "glTex%sParameter(swizzle 0x%x)", dsa ? "ture" : "",<br>
> + params[0]);<br>
> return GL_FALSE;<br>
> }<br>
> ASSERT(comp < 4);<br>
> @@ -511,7 +520,8 @@ set_tex_parameteri(struct gl_context *ctx,<br>
> }<br>
> else {<br>
> _mesa_error(ctx, GL_INVALID_ENUM,<br>
> - "glTexParameter(swizzle 0x%x)", params[comp]);<br>
> + "glTex%sParameter(swizzle 0x%x)",<br>
> + dsa ? "ture" : "", params[comp]);<br>
> return GL_FALSE;<br>
> }<br>
> }<br>
> @@ -525,7 +535,7 @@ set_tex_parameteri(struct gl_context *ctx,<br>
> GLenum decode = params[0];<br>
><br>
> if (!target_allows_setting_sampler_parameters(texObj->Target))<br>
> - goto invalid_operation;<br>
> + goto invalid_enum;<br>
><br>
> if (decode == GL_DECODE_EXT || decode == GL_SKIP_DECODE_EXT) {<br>
> if (texObj->Sampler.sRGBDecode != decode) {<br>
> @@ -543,7 +553,7 @@ set_tex_parameteri(struct gl_context *ctx,<br>
> GLenum param = params[0];<br>
><br>
> if (!target_allows_setting_sampler_parameters(texObj->Target))<br>
> - goto invalid_operation;<br>
> + goto invalid_enum;<br>
><br>
> if (param != GL_TRUE && param != GL_FALSE) {<br>
> goto invalid_param;<br>
> @@ -561,17 +571,25 @@ set_tex_parameteri(struct gl_context *ctx,<br>
> }<br>
><br>
> invalid_pname:<br>
> - _mesa_error(ctx, GL_INVALID_ENUM, "glTexParameter(pname=%s)",<br>
> - _mesa_lookup_enum_by_nr(pname));<br>
> + _mesa_error(ctx, GL_INVALID_ENUM, "glTex%sParameter(pname=%s)",<br>
> + dsa ? "ture" : "", _mesa_lookup_enum_by_nr(pname));<br>
> return GL_FALSE;<br>
><br>
> invalid_param:<br>
> - _mesa_error(ctx, GL_INVALID_ENUM, "glTexParameter(param=%s)",<br>
> + _mesa_error(ctx, GL_INVALID_ENUM, "glTex%sParameter(param=%s)",<br>
> + dsa ? "ture" : "",<br>
> _mesa_lookup_enum_by_nr(params[0]));<br>
> return GL_FALSE;<br>
><br>
> invalid_operation:<br>
> - _mesa_error(ctx, GL_INVALID_OPERATION, "glTexParameter(pname=%s)",<br>
> + _mesa_error(ctx, GL_INVALID_OPERATION, "glTex%sParameter(pname=%s)",<br>
> + dsa ? "ture" : "",<br>
> + _mesa_lookup_enum_by_nr(pname));<br>
> + return GL_FALSE;<br>
> +<br>
> +invalid_enum:<br>
> + _mesa_error(ctx, GL_INVALID_ENUM, "glTex%sParameter(pname=%s)",<br>
> + dsa ? "ture" : "",<br>
> _mesa_lookup_enum_by_nr(pname));<br>
> return GL_FALSE;<br>
> }<br>
> @@ -736,7 +754,7 @@ _mesa_TexParameterf(GLenum target, GLenum pname, GLfloat param)<br>
> ((param < INT_MIN) ? INT_MIN : (GLint) (param - 0.5));<br>
><br>
> p[1] = p[2] = p[3] = 0;<br>
> - need_update = set_tex_parameteri(ctx, texObj, pname, p);<br>
> + need_update = set_tex_parameteri(ctx, texObj, pname, p, false);<br>
> }<br>
> break;<br>
> default:<br>
> @@ -786,7 +804,7 @@ _mesa_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params)<br>
> GLint p[4];<br>
> p[0] = (GLint) params[0];<br>
> p[1] = p[2] = p[3] = 0;<br>
> - need_update = set_tex_parameteri(ctx, texObj, pname, p);<br>
> + need_update = set_tex_parameteri(ctx, texObj, pname, p, false);<br>
> }<br>
> break;<br>
> case GL_TEXTURE_CROP_RECT_OES:<br>
> @@ -797,7 +815,7 @@ _mesa_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params)<br>
> iparams[1] = (GLint) params[1];<br>
> iparams[2] = (GLint) params[2];<br>
> iparams[3] = (GLint) params[3];<br>
> - need_update = set_tex_parameteri(ctx, texObj, pname, iparams);<br>
> + need_update = set_tex_parameteri(ctx, texObj, pname, iparams, false);<br>
> }<br>
> break;<br>
> case GL_TEXTURE_SWIZZLE_R_EXT:<br>
> @@ -813,7 +831,7 @@ _mesa_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params)<br>
> p[2] = (GLint) params[2];<br>
> p[3] = (GLint) params[3];<br>
> }<br>
> - need_update = set_tex_parameteri(ctx, texObj, pname, p);<br>
> + need_update = set_tex_parameteri(ctx, texObj, pname, p, false);<br>
> }<br>
> break;<br>
> default:<br>
> @@ -859,7 +877,7 @@ _mesa_TexParameteri(GLenum target, GLenum pname, GLint param)<br>
> GLint iparam[4];<br>
> iparam[0] = param;<br>
> iparam[1] = iparam[2] = iparam[3] = 0;<br>
> - need_update = set_tex_parameteri(ctx, texObj, pname, iparam);<br>
> + need_update = set_tex_parameteri(ctx, texObj, pname, iparam, false);<br>
> }<br>
> }<br>
><br>
> @@ -909,7 +927,7 @@ _mesa_TexParameteriv(GLenum target, GLenum pname, const GLint *params)<br>
> break;<br>
> default:<br>
> /* this will generate an error if pname is illegal */<br>
> - need_update = set_tex_parameteri(ctx, texObj, pname, params);<br>
> + need_update = set_tex_parameteri(ctx, texObj, pname, params, false);<br>
> }<br>
><br>
> if (ctx->Driver.TexParameter && need_update) {<br>
> --<br>
> 2.1.0<br>
><br>
</div></div>> _______________________________________________<br>
> mesa-dev mailing list<br>
> <a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
> <a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev" target="_blank">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</blockquote></div><br></div>