From 51549912d1b1137572a0692972d1059ebb2e3384 Mon Sep 17 00:00:00 2001 From: Tim Rowley Date: Tue, 22 Mar 2016 09:27:18 -0600 Subject: [PATCH] swr: [rasterizer core] Reduce Arena blocksize to 128KB (from 1MB). With global allocator this doesn't seem to affect performance at all. Overall memory consumption drops by up to 85%. --- src/gallium/drivers/swr/rasterizer/core/arena.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/swr/rasterizer/core/arena.h b/src/gallium/drivers/swr/rasterizer/core/arena.h index 5d08cda6506..d777c20a4ee 100644 --- a/src/gallium/drivers/swr/rasterizer/core/arena.h +++ b/src/gallium/drivers/swr/rasterizer/core/arena.h @@ -212,7 +212,7 @@ struct CachingAllocatorT : DefaultAllocator }; typedef CachingAllocatorT<> CachingAllocator; -template +template class TArena { public: @@ -225,7 +225,11 @@ public: void* AllocAligned(size_t size, size_t align) { - SWR_ASSERT(size); + if (0 == size) + { + return nullptr; + } + SWR_ASSERT(align <= ARENA_BLOCK_ALIGN); if (m_pCurBlock) @@ -244,7 +248,7 @@ public: // a new block } - static const size_t ArenaBlockSize = 1024 * 1024 - ARENA_BLOCK_ALIGN; + static const size_t ArenaBlockSize = BlockSizeT - ARENA_BLOCK_ALIGN; size_t blockSize = std::max(size, ArenaBlockSize); // Add in one BLOCK_ALIGN unit to store ArenaBlock in. -- 2.30.2