[PATCH vkd3d 3/3] vkd3d: Improve UMA memory detection.

Józef Kucia joseph.kucia at gmail.com
Wed Apr 3 04:59:11 CDT 2019


On Wed, Apr 3, 2019 at 10:40 AM Zhiyi Zhang <zzhang at codeweavers.com> wrote:
>      struct d3d12_device *device = impl_from_ID3D12Device(iface);
> +    uint32_t i;

I think that "unsigned int" is preferred.

> -            if (device->memory_properties.memoryTypeCount == 1)
> +            data->UMA = FALSE;
> +            data->CacheCoherentUMA = FALSE;
> +            for (i = 0; i < device->memory_properties.memoryTypeCount; i++)
>              {
> -                TRACE("Assuming cache coherent UMA.\n");
> -                data->UMA = TRUE;
> -                data->CacheCoherentUMA = TRUE;
> -            }
> -            else
> -            {
> -                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 = TRUE;
> +                if (device->memory_properties.memoryTypes[i].propertyFlags & VK_MEMORY_PROPERTY_HOST_COHERENT_BIT)
> +                    data->CacheCoherentUMA = TRUE;
>              }

This detects most of Vulkan implementations as cache coherent UMA. A
better heuristic would be to check that all memory types are host
visible or cache coherent.

> +            TRACE("UMA:%d CacheCoherentUMA:%d\n", data->UMA, data->CacheCoherentUMA);

In d3d code, we tend to trace BOOL value using "%#x". Also, please put
a space before "%" and a period at the end of TRACE() message.



More information about the wine-devel mailing list