浏览代码

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%.
tags/12.0-branchpoint
Tim Rowley 9 年前
父节点
当前提交
51549912d1
共有 1 个文件被更改,包括 7 次插入3 次删除
  1. 7
    3
      src/gallium/drivers/swr/rasterizer/core/arena.h

+ 7
- 3
src/gallium/drivers/swr/rasterizer/core/arena.h 查看文件

@@ -212,7 +212,7 @@ struct CachingAllocatorT : DefaultAllocator
};
typedef CachingAllocatorT<> CachingAllocator;

template<typename T = DefaultAllocator>
template<typename T = DefaultAllocator, size_t BlockSizeT = (128 * 1024)>
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.

正在加载...
取消
保存