<div dir="ltr">Courtney, Should I consider this r-b you?<br><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jun 11, 2014 at 11:34 AM, Courtney Goeltzenleuchter <span dir="ltr"><<a href="mailto:courtney@lunarg.com" target="_blank">courtney@lunarg.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Very good. I thought there might be something limiting the inputs but wasn't immediately obvious.</div>
<div class="gmail_extra"><div><div class="h5"><br><br><div class="gmail_quote">On Wed, Jun 11, 2014 at 12:09 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:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Adding mesa-dev to the conversation.<br>
<div><br>
On Wed, Jun 11, 2014 at 10:52 AM, Anuj Phogat <<a href="mailto:anuj.phogat@gmail.com" target="_blank">anuj.phogat@gmail.com</a>> wrote:<br>
><br>
> On Wed, Jun 11, 2014 at 10:28 AM, Courtney Goeltzenleuchter<br>
> <<a href="mailto:courtney@lunarg.com" target="_blank">courtney@lunarg.com</a>> wrote:<br>
>><br>
>> On Fri, Jun 6, 2014 at 5:57 PM, Anuj Phogat <<a href="mailto:anuj.phogat@gmail.com" target="_blank">anuj.phogat@gmail.com</a>> wrote:<br>
>>><br>
</div><div><div>>>> Fixes many failures in gles3 Khronos CTS test: packed_pixels<br>
>>><br>
>>> Cc: <<a href="mailto:mesa-stable@lists.freedesktop.org" target="_blank">mesa-stable@lists.freedesktop.org</a>><br>
>>> Signed-off-by: Anuj Phogat <<a href="mailto:anuj.phogat@gmail.com" target="_blank">anuj.phogat@gmail.com</a>><br>
>>> ---<br>
>>> src/mesa/main/teximage.c | 43<br>
>>> +++++++++++++++++++++++++++++++++++++++++++<br>
>>> 1 file changed, 43 insertions(+)<br>
>>><br>
>>> diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c<br>
>>> index 6474dba..c926a2f 100644<br>
>>> --- a/src/mesa/main/teximage.c<br>
>>> +++ b/src/mesa/main/teximage.c<br>
>>> @@ -3582,6 +3582,25 @@ copytexsubimage_by_slice(struct gl_context *ctx,<br>
>>> }<br>
>>> }<br>
>>><br>
>>> +static GLboolean<br>
>>> +formats_differ_in_component_sizes (mesa_format f1,<br>
>>> + mesa_format f2)<br>
>>> +{<br>
>>> + GLint f1_r_bits = _mesa_get_format_bits(f1, GL_RED_BITS);<br>
>>> + GLint f1_g_bits = _mesa_get_format_bits(f1, GL_GREEN_BITS);<br>
>>> + GLint f1_b_bits = _mesa_get_format_bits(f1, GL_BLUE_BITS);<br>
>>> +<br>
>>> + GLint f2_r_bits = _mesa_get_format_bits(f2, GL_RED_BITS);<br>
>>> + GLint f2_g_bits = _mesa_get_format_bits(f2, GL_GREEN_BITS);<br>
>>> + GLint f2_b_bits = _mesa_get_format_bits(f2, GL_BLUE_BITS);<br>
>>> +<br>
>>> + if ((f1_r_bits && f2_r_bits && f1_r_bits != f2_r_bits)<br>
>><br>
>><br>
</div></div><div>>> I'm curious, why wouldn't a format with f1_r_bits = 0 and f2_r_bits != 0<br>
>> and everything else the same, not be considered different formats?<br>
><br>
> If we include that condition, it will be equivalent using:<br>
> if(f1_r_bits != f2_r_bits || f1_g_bits != f2_g_bits || f1_b_bits !=<br>
> f2_b_bits)<br>
><br>
> This won't work because gles allows dropping the components in internal<br>
> formats but doesn't allow adding new components. This check in<br>
> copytexture_error_check() takes care of this case when one component is<br>
> missing:<br>
><br>
> [snip]<br>
> if (_mesa_base_format_component_count(baseFormat) ><br>
> _mesa_base_format_component_count(rb_base_format)) {<br>
> valid = false;<br>
> }<br>
> [snip]<br>
>><br>
>><br>
>>><br>
</div><div><div>>>> + || (f1_g_bits && f2_g_bits && f1_g_bits != f2_g_bits)<br>
>>> + || (f1_b_bits && f2_b_bits && f1_b_bits != f2_b_bits))<br>
>>> + return GL_TRUE;<br>
>>> +<br>
>>> + return GL_FALSE;<br>
>>> +}<br>
>>><br>
>>> /**<br>
>>> * Implement the glCopyTexImage1/2D() functions.<br>
>>> @@ -3595,6 +3614,7 @@ copyteximage(struct gl_context *ctx, GLuint dims,<br>
>>> struct gl_texture_image *texImage;<br>
>>> const GLuint face = _mesa_tex_target_to_face(target);<br>
>>> mesa_format texFormat;<br>
>>> + struct gl_renderbuffer *rb;<br>
>>><br>
>>> FLUSH_VERTICES(ctx, 0);<br>
>>><br>
>>> @@ -3624,6 +3644,29 @@ copyteximage(struct gl_context *ctx, GLuint dims,<br>
>>><br>
>>> texFormat = _mesa_choose_texture_format(ctx, texObj, target, level,<br>
>>> internalFormat, GL_NONE,<br>
>>> GL_NONE);<br>
>>> +<br>
>>> + rb = _mesa_get_read_renderbuffer_for_format(ctx, internalFormat);<br>
>>> +<br>
>>> + /* From Page 139 of OpenGL ES 3.0 spec:<br>
>>> + * "If internalformat is sized, the internal format of the new<br>
>>> texel<br>
>>> + * array is internalformat, and this is also the new texel array’s<br>
>>> + * effective internal format. If the component sizes of<br>
>>> internalformat<br>
>>> + * do not exactly match the corresponding component sizes of the<br>
>>> source<br>
>>> + * buffer’s effective internal format, described below, an<br>
>>> + * INVALID_OPERATION error is generated. If internalformat is<br>
>>> unsized,<br>
>>> + * the internal format of the new texel array is the effective<br>
>>> internal<br>
>>> + * format of the source buffer, and this is also the new texel<br>
>>> array’s<br>
>>> + * effective internal format.<br>
>>> + */<br>
>>> + if (_mesa_is_gles3(ctx)<br>
>>> + && !_mesa_is_enum_format_unsized(internalFormat)<br>
>>> + && formats_differ_in_component_sizes (texFormat, rb->Format)) {<br>
>>> + _mesa_error(ctx, GL_INVALID_OPERATION,<br>
>>> + "glCopyTexImage%uD(componenet size changed in"<br>
>>> + " internal format)", dims);<br>
>>> + return;<br>
>>> + }<br>
>>> +<br>
>>> assert(texFormat != MESA_FORMAT_NONE);<br>
>>><br>
>>> if (!ctx->Driver.TestProxyTexImage(ctx, proxy_target(target),<br>
>>> --<br>
>>> 1.8.3.1<br>
>>><br>
>>> _______________________________________________<br>
>>> mesa-stable mailing list<br>
>>> <a href="mailto:mesa-stable@lists.freedesktop.org" target="_blank">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>
>><br>
</div></div><span><font color="#888888">>> --<br>
>> Courtney Goeltzenleuchter<br>
>> LunarG<br>
>><br>
</font></span></blockquote></div><br><br clear="all"><div><br></div></div></div><div class="">-- <br><div dir="ltr">Courtney Goeltzenleuchter<br><div>LunarG</div><div><img src="http://media.lunarg.com/wp-content/themes/LunarG/images/logo.png" width="96" height="65"><br>
</div></div>
</div></div>
</blockquote></div><br></div></div>