[Mesa-dev] [PATCH 02/14] swr: [rasterizer memory] round up when dividing by block sizes
Cherniak, Bruce
bruce.cherniak at intel.com
Tue Nov 15 01:45:35 UTC 2016
We need to run this through CI for all core users.
> On Nov 12, 2016, at 5:00 PM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
>
> There's no guarantee that mip width/height will be a multiple of the
> compressed block size. Make sure to round up when dividing.
>
> Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
> ---
>
> Note - I don't actually need this. An earlier version of my patches needed
> something like this. However since it's a real fix, I figured I'd include
> it here.
>
> .../drivers/swr/rasterizer/memory/TilingFunctions.h | 15 ++++++++++++---
> 1 file changed, 12 insertions(+), 3 deletions(-)
>
> diff --git a/src/gallium/drivers/swr/rasterizer/memory/TilingFunctions.h b/src/gallium/drivers/swr/rasterizer/memory/TilingFunctions.h
> index 0694a99..710bfb3 100644
> --- a/src/gallium/drivers/swr/rasterizer/memory/TilingFunctions.h
> +++ b/src/gallium/drivers/swr/rasterizer/memory/TilingFunctions.h
> @@ -276,7 +276,10 @@ INLINE void ComputeLODOffset1D(
> uint32_t curWidth = baseWidth;
> // translate mip width from pixels to blocks for block compressed formats
> // @note hAlign is already in blocks for compressed formats so no need to convert
> - if (info.isBC) curWidth /= info.bcWidth;
> + if (info.isBC)
> + {
> + curWidth = GFX_ALIGN(curWidth, info.bcWidth) / info.bcWidth;
> + }
>
> offset = GFX_ALIGN(curWidth, hAlign);
> for (uint32_t l = 1; l < lod; ++l)
> @@ -314,7 +317,10 @@ INLINE void ComputeLODOffsetX(
> uint32_t curWidth = baseWidth;
> // convert mip width from pixels to blocks for block compressed formats
> // @note hAlign is already in blocks for compressed formats so no need to convert
> - if (info.isBC) curWidth /= info.bcWidth;
> + if (info.isBC)
> + {
> + curWidth = GFX_ALIGN(curWidth, info.bcWidth) / info.bcWidth;
> + }
>
> curWidth = std::max<uint32_t>(curWidth >> 1, 1U);
> curWidth = GFX_ALIGN(curWidth, hAlign);
> @@ -352,7 +358,10 @@ INLINE void ComputeLODOffsetY(
>
> // translate mip height from pixels to blocks for block compressed formats
> // @note VAlign is already in blocks for compressed formats so no need to convert
> - if (info.isBC) mipHeight /= info.bcHeight;
> + if (info.isBC)
> + {
> + mipHeight = GFX_ALIGN(mipHeight, info.bcHeight) / info.bcHeight;
> + }
>
> for (uint32_t l = 1; l <= lod; ++l)
> {
> --
> 2.7.3
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list