mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-03-14 01:27:00 +00:00
vk/vma: Always use aligned requests
- Performance optimization when combined with vma optimizations added by me
This commit is contained in:
parent
bf66c36ba4
commit
6f4dbf4fcd
@ -1,6 +1,16 @@
|
||||
#include "device.h"
|
||||
#include "memory.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
// Copied from rsx_utils.h. Move to a more convenient location
|
||||
template<typename T, typename U>
|
||||
static inline T align2(T value, U alignment)
|
||||
{
|
||||
return ((value + alignment - 1) / alignment) * alignment;
|
||||
}
|
||||
}
|
||||
|
||||
namespace vk
|
||||
{
|
||||
mem_allocator_vma::mem_allocator_vma(VkDevice dev, VkPhysicalDevice pdev) : mem_allocator_base(dev, pdev)
|
||||
@ -27,9 +37,10 @@ namespace vk
|
||||
VmaAllocationCreateInfo create_info = {};
|
||||
|
||||
mem_req.memoryTypeBits = 1u << memory_type_index;
|
||||
mem_req.size = block_sz;
|
||||
mem_req.size = ::align2(block_sz, alignment);
|
||||
mem_req.alignment = alignment;
|
||||
create_info.memoryTypeBits = 1u << memory_type_index;
|
||||
create_info.flags = VMA_ALLOCATION_CREATE_STRATEGY_MIN_TIME_BIT;
|
||||
|
||||
if (VkResult result = vmaAllocateMemory(m_allocator, &mem_req, &create_info, &vma_alloc, nullptr);
|
||||
result != VK_SUCCESS)
|
||||
|
Loading…
x
Reference in New Issue
Block a user