Some vulkan implementation report 2 memory types with the same VkMemoryPropertyFlags for a device. So check property flags to determine if UMA and CacheCoherentUMA are actually supported by the device.
Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com --- Supersede 162192
libs/vkd3d/device.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/libs/vkd3d/device.c b/libs/vkd3d/device.c index a754077..8563b43 100644 --- a/libs/vkd3d/device.c +++ b/libs/vkd3d/device.c @@ -2098,6 +2098,7 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_CheckFeatureSupport(ID3D12Device * D3D12_FEATURE feature, void *feature_data, UINT feature_data_size) { struct d3d12_device *device = impl_from_ID3D12Device(iface); + unsigned int i;
TRACE("iface %p, feature %#x, feature_data %p, feature_data_size %u.\n", iface, feature, feature_data, feature_data_size); @@ -2138,18 +2139,16 @@ static HRESULT STDMETHODCALLTYPE d3d12_device_CheckFeatureSupport(ID3D12Device * FIXME("Assuming device does not support tile based rendering.\n"); data->TileBasedRenderer = FALSE;
- if (device->memory_properties.memoryTypeCount == 1) - { - TRACE("Assuming cache coherent UMA.\n"); - data->UMA = TRUE; - data->CacheCoherentUMA = TRUE; - } - else + data->UMA = TRUE; + data->CacheCoherentUMA = TRUE; + for (i = 0; i < device->memory_properties.memoryTypeCount; ++i) { - FIXME("Assuming NUMA.\n"); - data->UMA = FALSE; - data->CacheCoherentUMA = FALSE; + if (!(device->memory_properties.memoryTypes[i].propertyFlags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT)) + data->UMA = FALSE; + if (!(device->memory_properties.memoryTypes[i].propertyFlags & VK_MEMORY_PROPERTY_HOST_COHERENT_BIT)) + data->CacheCoherentUMA = FALSE; } + TRACE("UMA: %#x CacheCoherentUMA: %#x.\n", data->UMA, data->CacheCoherentUMA); return S_OK; }