mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-31 14:52:11 +01:00
[dxvk] Add allocation flag for moveable resources
This commit is contained in:
parent
bb05f123db
commit
4e40d0b939
@ -1121,6 +1121,10 @@ namespace dxvk {
|
||||
VkDeviceSize offset = address & DxvkPageAllocator::ChunkAddressMask;
|
||||
|
||||
auto allocation = m_allocationPool.create(this, &type);
|
||||
|
||||
if (!(allocationInfo.properties & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) && allocationInfo.resourceCookie)
|
||||
allocation->m_flags.set(DxvkAllocationFlag::CanMove);
|
||||
|
||||
allocation->m_resourceCookie = allocationInfo.resourceCookie;
|
||||
allocation->m_memory = chunk.memory.memory;
|
||||
allocation->m_address = address;
|
||||
@ -1163,6 +1167,9 @@ namespace dxvk {
|
||||
if (memory.buffer)
|
||||
allocation->m_flags.set(DxvkAllocationFlag::OwnsBuffer);
|
||||
|
||||
if (!(allocationInfo.properties & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) && allocationInfo.resourceCookie)
|
||||
allocation->m_flags.set(DxvkAllocationFlag::CanMove);
|
||||
|
||||
allocation->m_resourceCookie = allocationInfo.resourceCookie;
|
||||
allocation->m_memory = memory.memory;
|
||||
allocation->m_address = DedicatedChunkAddress;
|
||||
@ -1188,7 +1195,7 @@ namespace dxvk {
|
||||
|
||||
void DxvkMemoryAllocator::freeAllocation(
|
||||
DxvkResourceAllocation* allocation) {
|
||||
if (allocation->m_flags.test(DxvkAllocationFlag::Cacheable)) {
|
||||
if (allocation->m_flags.test(DxvkAllocationFlag::CanCache)) {
|
||||
// Return cacheable allocations to the shared cache
|
||||
allocation->destroyBufferViews();
|
||||
|
||||
@ -1454,7 +1461,7 @@ namespace dxvk {
|
||||
// so it will get recycled as-is after use.
|
||||
allocation = createAllocation(memoryType, memoryPool,
|
||||
address, allocationSize, DxvkAllocationInfo());
|
||||
allocation->m_flags.set(DxvkAllocationFlag::Cacheable);
|
||||
allocation->m_flags.set(DxvkAllocationFlag::CanCache);
|
||||
|
||||
if (tail) {
|
||||
tail->m_nextCached = allocation;
|
||||
|
@ -448,8 +448,9 @@ namespace dxvk {
|
||||
OwnsMemory = 0,
|
||||
OwnsBuffer = 1,
|
||||
OwnsImage = 2,
|
||||
Cacheable = 3,
|
||||
Imported = 4,
|
||||
CanCache = 3,
|
||||
CanMove = 4,
|
||||
Imported = 5,
|
||||
};
|
||||
|
||||
using DxvkAllocationFlags = Flags<DxvkAllocationFlag>;
|
||||
|
Loading…
x
Reference in New Issue
Block a user