vkd3d: Add allocation flag for DEDICATED.
When allocating dedicated memory, ignore heap_flag requirements we deduce from memory info. Any memory type is allowed. This is important on NV when allocating fallback render targets. Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
This commit is contained in:
parent
cddb98acc6
commit
7ee8eac818
|
@ -514,8 +514,14 @@ static HRESULT vkd3d_memory_allocation_init(struct vkd3d_memory_allocation *allo
|
|||
memory_requirements = info->memory_requirements;
|
||||
}
|
||||
|
||||
type_mask = vkd3d_select_memory_types(device, &info->heap_properties,
|
||||
info->heap_flags) & memory_requirements.memoryTypeBits;
|
||||
/* If an allocation is a dedicated fallback allocation,
|
||||
* we must not look at heap_flags, since we might end up noping out
|
||||
* the memory types we want to allocate with. */
|
||||
type_mask = memory_requirements.memoryTypeBits;
|
||||
if (info->flags & VKD3D_ALLOCATION_FLAG_DEDICATED)
|
||||
type_mask &= device->memory_info.global_mask;
|
||||
else
|
||||
type_mask &= vkd3d_select_memory_types(device, &info->heap_properties, info->heap_flags);
|
||||
|
||||
/* Allocate actual backing storage */
|
||||
flags_info.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO;
|
||||
|
@ -549,7 +555,7 @@ static HRESULT vkd3d_memory_allocation_init(struct vkd3d_memory_allocation *allo
|
|||
hr = vkd3d_import_host_memory(device, host_ptr, memory_requirements.size,
|
||||
type_flags, type_mask, &flags_info, &allocation->device_allocation);
|
||||
}
|
||||
else if (info->flags & VKD3D_ALLOCATION_NO_FALLBACK)
|
||||
else if (info->flags & VKD3D_ALLOCATION_FLAG_NO_FALLBACK)
|
||||
{
|
||||
hr = vkd3d_try_allocate_device_memory(device, memory_requirements.size, type_flags,
|
||||
type_mask, &flags_info, &allocation->device_allocation);
|
||||
|
@ -1253,7 +1259,7 @@ static HRESULT vkd3d_memory_allocator_try_add_chunk(struct vkd3d_memory_allocato
|
|||
alloc_info.memory_requirements.memoryTypeBits = type_mask;
|
||||
alloc_info.heap_properties = *heap_properties;
|
||||
alloc_info.heap_flags = heap_flags;
|
||||
alloc_info.flags = VKD3D_ALLOCATION_NO_FALLBACK;
|
||||
alloc_info.flags = VKD3D_ALLOCATION_FLAG_NO_FALLBACK;
|
||||
alloc_info.optional_memory_properties = optional_properties;
|
||||
|
||||
if (!(heap_flags & D3D12_HEAP_FLAG_DENY_BUFFERS))
|
||||
|
|
|
@ -2536,6 +2536,7 @@ HRESULT d3d12_resource_create_committed(struct d3d12_device *device, const D3D12
|
|||
dedicated_info.image = object->res.vk_image;
|
||||
dedicated_info.buffer = VK_NULL_HANDLE;
|
||||
allocate_info.pNext = &dedicated_info;
|
||||
allocate_info.flags = VKD3D_ALLOCATION_FLAG_DEDICATED;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -599,7 +599,8 @@ enum vkd3d_allocation_flag
|
|||
VKD3D_ALLOCATION_FLAG_GPU_ADDRESS = (1u << 1),
|
||||
VKD3D_ALLOCATION_FLAG_CPU_ACCESS = (1u << 2),
|
||||
VKD3D_ALLOCATION_FLAG_ALLOW_WRITE_WATCH = (1u << 3),
|
||||
VKD3D_ALLOCATION_NO_FALLBACK = (1u << 4),
|
||||
VKD3D_ALLOCATION_FLAG_NO_FALLBACK = (1u << 4),
|
||||
VKD3D_ALLOCATION_FLAG_DEDICATED = (1u << 5),
|
||||
};
|
||||
|
||||
#define VKD3D_MEMORY_CHUNK_SIZE (VKD3D_VA_BLOCK_SIZE * 16)
|
||||
|
|
Loading…
Reference in New Issue