On Tue, 22 Oct 2019 at 17:42, Conor McCarthy cmccarthy@codeweavers.com wrote:
case D3D12_HEAP_TYPE_CUSTOM:
FIXME("Custom heaps not supported yet.\n");
flags[count++] = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT
| VK_MEMORY_PROPERTY_HOST_CACHED_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT;
switch (heap_properties->CPUPageProperty)
{
case D3D12_CPU_PAGE_PROPERTY_WRITE_COMBINE:
flags[count++] = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT;
break;
default:
WARN("Invalid CPU page property.\n");
/* Fall through. */
I'd argue that's the kind of thing that should make the allocation fail, and for which it's probably easy enough to write a test. The MSDN page for D3D12_HEAP_PROPERTIES seems to imply that at least D3D12_CPU_PAGE_PROPERTY_NOT_AVAILABLE is a valid value.
case D3D12_CPU_PAGE_PROPERTY_WRITE_BACK:
flags[count++] = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT
| VK_MEMORY_PROPERTY_HOST_CACHED_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT;
break;
} flags[count++] = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT; flags[count++] = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT; break;
If CPUPageProperty is D3D12_CPU_PAGE_PROPERTY_WRITE_COMBINE, we now try HOST_COHERENT | HOST_VISIBLE twice. We should probably also take MemoryPoolPreference into account to decide whether to prefer DEVICE_LOCAL or not.