<p dir="ltr">I think you're aware, but I actually have an updated version of this patch on my branch. Let me know if you want me to send it out.</p>
<p dir="ltr">The issue is that the texture width/height need not be a multiple of the format's block size. However mip sizes are computed based on that unrounded size.</p>
<div class="gmail_extra"><br><div class="gmail_quote">On Nov 14, 2016 8:45 PM, "Cherniak, Bruce" <<a href="mailto:bruce.cherniak@intel.com">bruce.cherniak@intel.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">We need to run this through CI for all core users.<br>
<br>
> On Nov 12, 2016, at 5:00 PM, Ilia Mirkin <<a href="mailto:imirkin@alum.mit.edu">imirkin@alum.mit.edu</a>> wrote:<br>
><br>
> There's no guarantee that mip width/height will be a multiple of the<br>
> compressed block size. Make sure to round up when dividing.<br>
><br>
> Signed-off-by: Ilia Mirkin <<a href="mailto:imirkin@alum.mit.edu">imirkin@alum.mit.edu</a>><br>
> ---<br>
><br>
> Note - I don't actually need this. An earlier version of my patches needed<br>
> something like this. However since it's a real fix, I figured I'd include<br>
> it here.<br>
><br>
> .../drivers/swr/rasterizer/<wbr>memory/TilingFunctions.h       | 15 ++++++++++++---<br>
> 1 file changed, 12 insertions(+), 3 deletions(-)<br>
><br>
> diff --git a/src/gallium/drivers/swr/<wbr>rasterizer/memory/<wbr>TilingFunctions.h b/src/gallium/drivers/swr/<wbr>rasterizer/memory/<wbr>TilingFunctions.h<br>
> index 0694a99..710bfb3 100644<br>
> --- a/src/gallium/drivers/swr/<wbr>rasterizer/memory/<wbr>TilingFunctions.h<br>
> +++ b/src/gallium/drivers/swr/<wbr>rasterizer/memory/<wbr>TilingFunctions.h<br>
> @@ -276,7 +276,10 @@ INLINE void ComputeLODOffset1D(<br>
>         uint32_t curWidth = baseWidth;<br>
>         // translate mip width from pixels to blocks for block compressed formats<br>
>         // @note hAlign is already in blocks for compressed formats so no need to convert<br>
> -        if (info.isBC) curWidth /= info.bcWidth;<br>
> +        if (info.isBC)<br>
> +        {<br>
> +            curWidth = GFX_ALIGN(curWidth, info.bcWidth) / info.bcWidth;<br>
> +        }<br>
><br>
>         offset = GFX_ALIGN(curWidth, hAlign);<br>
>         for (uint32_t l = 1; l < lod; ++l)<br>
> @@ -314,7 +317,10 @@ INLINE void ComputeLODOffsetX(<br>
>         uint32_t curWidth = baseWidth;<br>
>         // convert mip width from pixels to blocks for block compressed formats<br>
>         // @note hAlign is already in blocks for compressed formats so no need to convert<br>
> -        if (info.isBC) curWidth /= info.bcWidth;<br>
> +        if (info.isBC)<br>
> +        {<br>
> +            curWidth = GFX_ALIGN(curWidth, info.bcWidth) / info.bcWidth;<br>
> +        }<br>
><br>
>         curWidth = std::max<uint32_t>(curWidth >> 1, 1U);<br>
>         curWidth = GFX_ALIGN(curWidth, hAlign);<br>
> @@ -352,7 +358,10 @@ INLINE void ComputeLODOffsetY(<br>
><br>
>         // translate mip height from pixels to blocks for block compressed formats<br>
>         // @note VAlign is already in blocks for compressed formats so no need to convert<br>
> -        if (info.isBC) mipHeight /= info.bcHeight;<br>
> +        if (info.isBC)<br>
> +        {<br>
> +            mipHeight = GFX_ALIGN(mipHeight, info.bcHeight) / info.bcHeight;<br>
> +        }<br>
><br>
>         for (uint32_t l = 1; l <= lod; ++l)<br>
>         {<br>
> --<br>
> 2.7.3<br>
><br>
> ______________________________<wbr>_________________<br>
> mesa-dev mailing list<br>
> <a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
> <a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
<br>
</blockquote></div></div>