vkd3d: Mask certain heap flags when suballocating memory.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
This commit is contained in:
parent
f6c6a76735
commit
1d7e424c44
|
@ -1067,6 +1067,7 @@ static HRESULT vkd3d_memory_allocator_try_suballocate_memory(struct vkd3d_memory
|
||||||
const D3D12_HEAP_PROPERTIES *heap_properties, D3D12_HEAP_FLAGS heap_flags,
|
const D3D12_HEAP_PROPERTIES *heap_properties, D3D12_HEAP_FLAGS heap_flags,
|
||||||
struct vkd3d_memory_allocation *allocation)
|
struct vkd3d_memory_allocation *allocation)
|
||||||
{
|
{
|
||||||
|
const D3D12_HEAP_FLAGS heap_flag_mask = ~(D3D12_HEAP_FLAG_CREATE_NOT_ZEROED | D3D12_HEAP_FLAG_CREATE_NOT_RESIDENT);
|
||||||
struct vkd3d_memory_chunk *chunk;
|
struct vkd3d_memory_chunk *chunk;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
@ -1081,7 +1082,7 @@ static HRESULT vkd3d_memory_allocator_try_suballocate_memory(struct vkd3d_memory
|
||||||
/* Match flags since otherwise the backing buffer
|
/* Match flags since otherwise the backing buffer
|
||||||
* may not support our required usage flags */
|
* may not support our required usage flags */
|
||||||
if (chunk->allocation.heap_type != heap_properties->Type ||
|
if (chunk->allocation.heap_type != heap_properties->Type ||
|
||||||
chunk->allocation.heap_flags != heap_flags)
|
chunk->allocation.heap_flags != (heap_flags & heap_flag_mask))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Filter out unsupported memory types */
|
/* Filter out unsupported memory types */
|
||||||
|
@ -1095,7 +1096,7 @@ static HRESULT vkd3d_memory_allocator_try_suballocate_memory(struct vkd3d_memory
|
||||||
/* Try allocating a new chunk on one of the supported memory type
|
/* Try allocating a new chunk on one of the supported memory type
|
||||||
* before the caller falls back to potentially slower memory */
|
* before the caller falls back to potentially slower memory */
|
||||||
if (FAILED(hr = vkd3d_memory_allocator_add_chunk(allocator, device, heap_properties,
|
if (FAILED(hr = vkd3d_memory_allocator_add_chunk(allocator, device, heap_properties,
|
||||||
heap_flags, memory_requirements->memoryTypeBits, &chunk)))
|
heap_flags & heap_flag_mask, memory_requirements->memoryTypeBits, &chunk)))
|
||||||
return hr;
|
return hr;
|
||||||
|
|
||||||
return vkd3d_memory_chunk_allocate_range(chunk, memory_requirements, allocation);
|
return vkd3d_memory_chunk_allocate_range(chunk, memory_requirements, allocation);
|
||||||
|
|
Loading…
Reference in New Issue