mirror of
https://github.com/Yours3lf/rpi-vk-driver.git
synced 2025-01-19 11:52:16 +01:00
fixed cpa alloc strategy so now we get away with a lot less
This commit is contained in:
parent
166d5af755
commit
3860f115c0
@ -60,8 +60,6 @@ uint32_t consecutivePoolAllocate(ConsecutivePoolAllocator* pa, uint32_t numBlock
|
||||
return -1; //no free blocks
|
||||
}
|
||||
|
||||
//TODO change strategy to search for the blocks that are located closest to the start of the buffer
|
||||
//but still are big enough in size
|
||||
for(; ptr; ptr = *ptr)
|
||||
{
|
||||
uint32_t found = 1;
|
||||
@ -84,7 +82,30 @@ uint32_t consecutivePoolAllocate(ConsecutivePoolAllocator* pa, uint32_t numBlock
|
||||
if(found)
|
||||
{
|
||||
//set the next free block to the one that the last block we allocated points to
|
||||
pa->nextFreeBlock = *(uint32_t*)((char*)ptr + (numBlocks - 1) * pa->blockSize);
|
||||
uint32_t* nextFreeBlockCandidate = *(uint32_t*)((char*)ptr + (numBlocks - 1) * pa->blockSize);
|
||||
|
||||
if(pa->nextFreeBlock == ptr)
|
||||
{
|
||||
pa->nextFreeBlock = nextFreeBlockCandidate;
|
||||
break;
|
||||
}
|
||||
|
||||
uint32_t* prevPtr = pa->nextFreeBlock;
|
||||
uint32_t* currPtr = prevPtr;
|
||||
for(; currPtr; currPtr = *currPtr)
|
||||
{
|
||||
if(currPtr == ptr)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
prevPtr = currPtr;
|
||||
}
|
||||
|
||||
assert(currPtr);
|
||||
|
||||
*prevPtr = nextFreeBlockCandidate;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -52,8 +52,8 @@ VKAPI_ATTR VkResult VKAPI_CALL RPIFUNC(vkCreateCommandPool)(
|
||||
//initial number of command buffers to hold
|
||||
int numCommandBufs = 128;
|
||||
//TODO uniforms might need to realloc, which should be handled properly
|
||||
int consecutiveBlockSize = ARM_PAGE_SIZE * 20;
|
||||
int consecutiveBlockNumber = 256;
|
||||
int consecutiveBlockSize = ARM_PAGE_SIZE;// * 20;
|
||||
int consecutiveBlockNumber = 64;
|
||||
//int numCommandBufs = 30;
|
||||
//int consecutiveBlockSize = getCPABlockSize(256);
|
||||
//int consecutiveBlockNumber = 30;
|
||||
|
Loading…
x
Reference in New Issue
Block a user