<div dir="ltr">No, pre-DSA versions do not need this fix.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 3, 2015 at 6:00 PM, Emil Velikov <span dir="ltr"><<a href="mailto:emil.l.velikov@gmail.com" target="_blank">emil.l.velikov@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Laura,<br>
<br>
This patch does not pick cleanly against the 10.4 branch. Considering<br>
it never got any dsa treatment do we need to backport it ? If so can<br>
you send one to the list.<br>
<br>
Thanks<br>
Emil<br>
<div><div class="h5"><br>
On 28 February 2015 at 00:39, Laura Ekstrand <<a href="mailto:laura@jlekstrand.net">laura@jlekstrand.net</a>> wrote:<br>
> CC: 10.4, 10.5<br>
><br>
<br>
<br>
><br>
> ---------- Forwarded message ----------<br>
> From: Anuj Phogat <<a href="mailto:anuj.phogat@gmail.com">anuj.phogat@gmail.com</a>><br>
> Date: Thu, Feb 26, 2015 at 11:46 AM<br>
> Subject: Re: [Mesa-dev] [PATCH] main: Fix target checking for<br>
> CompressedTexSubImage*D.<br>
> To: Laura Ekstrand <<a href="mailto:laura@jlekstrand.net">laura@jlekstrand.net</a>><br>
> Cc: "<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a>" <<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a>><br>
><br>
><br>
> On Wed, Feb 25, 2015 at 3:58 PM, Laura Ekstrand <<a href="mailto:laura@jlekstrand.net">laura@jlekstrand.net</a>><br>
> wrote:<br>
>> This fixes a dEQP test failure. In the test,<br>
>> glCompressedTexSubImage2D was called with target = 0 and failed to throw<br>
>> INVALID ENUM. This failure was caused by _mesa_get_current_tex_object(ctx,<br>
>> target) being called before the target checking. To remedy this, target<br>
>> checking was made into its own function and called prior to<br>
>> _mesa_get_current_tex_object.<br>
>><br>
>> Bugzilla: <a href="https://bugs.freedesktop.org/show_bug.cgi?id=89311" target="_blank">https://bugs.freedesktop.org/show_bug.cgi?id=89311</a><br>
>> ---<br>
>> src/mesa/main/teximage.c | 80<br>
>> +++++++++++++++++++++++++++++++++++++++---------<br>
>> 1 file changed, 65 insertions(+), 15 deletions(-)<br>
>><br>
>> diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c<br>
>> index faec444..87231df 100644<br>
>> --- a/src/mesa/main/teximage.c<br>
>> +++ b/src/mesa/main/teximage.c<br>
>> @@ -4456,25 +4456,21 @@ out:<br>
>><br>
>><br>
>> /**<br>
>> - * Error checking for glCompressedTexSubImage[123]D().<br>
>> + * Target checking for glCompressedTexSubImage[123]D().<br>
>> * \return GL_TRUE if error, GL_FALSE if no error<br>
>> + * Must come before other error checking so that the texture object can<br>
>> + * be correctly retrieved using _mesa_get_current_tex_object.<br>
>> */<br>
>> static GLboolean<br>
>> -compressed_subtexture_error_check(struct gl_context *ctx, GLint dims,<br>
>> - const struct gl_texture_object *texObj,<br>
>> - GLenum target, GLint level,<br>
>> - GLint xoffset, GLint yoffset, GLint<br>
>> zoffset,<br>
>> - GLsizei width, GLsizei height, GLsizei<br>
>> depth,<br>
>> - GLenum format, GLsizei imageSize, bool<br>
>> dsa)<br>
>> +compressed_subtexture_target_check(struct gl_context *ctx, GLenum target,<br>
>> + GLint dims, GLenum format, bool dsa,<br>
>> + const char *caller)<br>
>> {<br>
>> - struct gl_texture_image *texImage;<br>
>> - GLint expectedSize;<br>
>> GLboolean targetOK;<br>
>> - const char *suffix = dsa ? "ture" : "";<br>
>><br>
>> if (dsa && target == GL_TEXTURE_RECTANGLE) {<br>
>> - _mesa_error(ctx, GL_INVALID_OPERATION,<br>
>> - "glCompressedSubTexture%dD(target)", dims);<br>
>> + _mesa_error(ctx, GL_INVALID_OPERATION, "%s(invalid target %s)",<br>
>> caller,<br>
>> + _mesa_lookup_enum_by_nr(target));<br>
>> return GL_TRUE;<br>
>> }<br>
>><br>
>> @@ -4537,7 +4533,9 @@ compressed_subtexture_error_check(struct gl_context<br>
>> *ctx, GLint dims,<br>
>> }<br>
>> if (invalidformat) {<br>
>> _mesa_error(ctx, GL_INVALID_OPERATION,<br>
>> - "glCompressedTex%sSubImage%uD(target)", suffix,<br>
>> dims);<br>
>> + "%s(invalid target %s for format %s)", caller,<br>
>> + _mesa_lookup_enum_by_nr(target),<br>
>> + _mesa_lookup_enum_by_nr(format));<br>
>> return GL_TRUE;<br>
>> }<br>
>> }<br>
>> @@ -4551,11 +4549,30 @@ compressed_subtexture_error_check(struct<br>
>> gl_context *ctx, GLint dims,<br>
>> }<br>
>><br>
>> if (!targetOK) {<br>
>> - _mesa_error(ctx, GL_INVALID_ENUM,<br>
>> - "glCompressedTex%sSubImage%uD(target)", suffix, dims);<br>
>> + _mesa_error(ctx, GL_INVALID_ENUM, "%s(invalid target %s)", caller,<br>
>> + _mesa_lookup_enum_by_nr(target));<br>
>> return GL_TRUE;<br>
>> }<br>
>><br>
>> + return GL_FALSE;<br>
>> +}<br>
>> +<br>
>> +/**<br>
>> + * Error checking for glCompressedTexSubImage[123]D().<br>
>> + * \return GL_TRUE if error, GL_FALSE if no error<br>
>> + */<br>
>> +static GLboolean<br>
>> +compressed_subtexture_error_check(struct gl_context *ctx, GLint dims,<br>
>> + const struct gl_texture_object *texObj,<br>
>> + GLenum target, GLint level,<br>
>> + GLint xoffset, GLint yoffset, GLint<br>
>> zoffset,<br>
>> + GLsizei width, GLsizei height, GLsizei<br>
>> depth,<br>
>> + GLenum format, GLsizei imageSize, bool<br>
>> dsa)<br>
>> +{<br>
>> + struct gl_texture_image *texImage;<br>
>> + GLint expectedSize;<br>
>> + const char *suffix = dsa ? "ture" : "";<br>
>> +<br>
>> /* this will catch any invalid compressed format token */<br>
>> if (!_mesa_is_compressed_format(ctx, format)) {<br>
>> _mesa_error(ctx, GL_INVALID_ENUM,<br>
>> @@ -4702,6 +4719,11 @@ _mesa_CompressedTexSubImage1D(GLenum target, GLint<br>
>> level, GLint xoffset,<br>
>><br>
>> GET_CURRENT_CONTEXT(ctx);<br>
>><br>
>> + if (compressed_subtexture_target_check(ctx, target, 1, format, false,<br>
>> + "glCompressedTexSubImage1D")) {<br>
>> + return;<br>
>> + }<br>
>> +<br>
>> texObj = _mesa_get_current_tex_object(ctx, target);<br>
>> if (!texObj)<br>
>> return;<br>
>> @@ -4737,6 +4759,12 @@ _mesa_CompressedTextureSubImage1D(GLuint texture,<br>
>> GLint level, GLint xoffset,<br>
>> if (!texObj)<br>
>> return;<br>
>><br>
>> + if (compressed_subtexture_target_check(ctx, texObj->Target, 1, format,<br>
>> + true,<br>
>> +<br>
>> "glCompressedTextureSubImage1D")) {<br>
>> + return;<br>
>> + }<br>
>> +<br>
>> if (compressed_subtexture_error_check(ctx, 1, texObj, texObj->Target,<br>
>> level, xoffset, 0, 0,<br>
>> width, 1, 1,<br>
>> @@ -4767,6 +4795,11 @@ _mesa_CompressedTexSubImage2D(GLenum target, GLint<br>
>> level, GLint xoffset,<br>
>><br>
>> GET_CURRENT_CONTEXT(ctx);<br>
>><br>
>> + if (compressed_subtexture_target_check(ctx, target, 2, format, false,<br>
>> + "glCompressedTexSubImage2D")) {<br>
>> + return;<br>
>> + }<br>
>> +<br>
>> texObj = _mesa_get_current_tex_object(ctx, target);<br>
>> if (!texObj)<br>
>> return;<br>
>> @@ -4805,6 +4838,12 @@ _mesa_CompressedTextureSubImage2D(GLuint texture,<br>
>> GLint level, GLint xoffset,<br>
>> if (!texObj)<br>
>> return;<br>
>><br>
>> + if (compressed_subtexture_target_check(ctx, texObj->Target, 2, format,<br>
>> + true,<br>
>> +<br>
>> "glCompressedTextureSubImage2D")) {<br>
>> + return;<br>
>> + }<br>
>> +<br>
>> if (compressed_subtexture_error_check(ctx, 2, texObj, texObj->Target,<br>
>> level, xoffset, yoffset, 0,<br>
>> width, height, 1,<br>
>> @@ -4833,6 +4872,11 @@ _mesa_CompressedTexSubImage3D(GLenum target, GLint<br>
>> level, GLint xoffset,<br>
>><br>
>> GET_CURRENT_CONTEXT(ctx);<br>
>><br>
>> + if (compressed_subtexture_target_check(ctx, target, 3, format, false,<br>
>> + "glCompressedTexSubImage3D")) {<br>
>> + return;<br>
>> + }<br>
>> +<br>
>> texObj = _mesa_get_current_tex_object(ctx, target);<br>
>> if (!texObj)<br>
>> return;<br>
>> @@ -4874,6 +4918,12 @@ _mesa_CompressedTextureSubImage3D(GLuint texture,<br>
>> GLint level, GLint xoffset,<br>
>> if (!texObj)<br>
>> return;<br>
>><br>
>> + if (compressed_subtexture_target_check(ctx, texObj->Target, 3, format,<br>
>> + true,<br>
>> +<br>
>> "glCompressedTextureSubImage3D")) {<br>
>> + return;<br>
>> + }<br>
>> +<br>
>> if (compressed_subtexture_error_check(ctx, 3, texObj, texObj->Target,<br>
>> level, xoffset, yoffset,<br>
>> zoffset,<br>
>> width, height, depth,<br>
>> --<br>
>> 2.1.0<br>
>><br>
>> _______________________________________________<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>
><br>
> Reviewed-by: Anuj Phogat <<a href="mailto:anuj.phogat@gmail.com">anuj.phogat@gmail.com</a>><br>
><br>
><br>
</div></div>> _______________________________________________<br>
> mesa-stable mailing list<br>
> <a href="mailto:mesa-stable@lists.freedesktop.org">mesa-stable@lists.freedesktop.org</a><br>
> <a href="http://lists.freedesktop.org/mailman/listinfo/mesa-stable" target="_blank">http://lists.freedesktop.org/mailman/listinfo/mesa-stable</a><br>
><br>
</blockquote></div><br></div>