[Mesa-dev] [PATCH v2 2/6] swr: [rasterizer memory] minify texture width before alignment

Rowley, Timothy O timothy.o.rowley at intel.com
Mon Nov 21 19:53:20 UTC 2016


Reviewed-by: Tim Rowley <timothy.o.rowley at intel.com<mailto:timothy.o.rowley at intel.com>>

On Nov 17, 2016, at 10:56 PM, Ilia Mirkin <imirkin at alum.mit.edu<mailto:imirkin at alum.mit.edu>> wrote:

The minification should happen before alignment, not after. See similar
logic on ComputeLODOffsetY. The current logic requires unnecessarily
large textures when there's an initial NPOT size.

Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu<mailto:imirkin at alum.mit.edu>>
---
src/gallium/drivers/swr/rasterizer/memory/TilingFunctions.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/swr/rasterizer/memory/TilingFunctions.h b/src/gallium/drivers/swr/rasterizer/memory/TilingFunctions.h
index 11ed451..350e44b 100644
--- a/src/gallium/drivers/swr/rasterizer/memory/TilingFunctions.h
+++ b/src/gallium/drivers/swr/rasterizer/memory/TilingFunctions.h
@@ -284,8 +284,8 @@ INLINE void ComputeLODOffset1D(
        offset = GFX_ALIGN(curWidth, hAlign);
        for (uint32_t l = 1; l < lod; ++l)
        {
-            curWidth = GFX_ALIGN(std::max<uint32_t>(curWidth >> 1, 1U), hAlign);
-            offset += curWidth;
+            curWidth = std::max<uint32_t>(curWidth >> 1, 1U);
+            offset += GFX_ALIGN(curWidth, hAlign);
        }

        if (info.isSubsampled || info.isBC)
--
2.7.3


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20161121/367e5f38/attachment.html>


More information about the mesa-dev mailing list