Signed-off-by: Jan Sikorski jsikorski@codeweavers.com --- dlls/wined3d/adapter_vk.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/dlls/wined3d/adapter_vk.c b/dlls/wined3d/adapter_vk.c index 9a226edc65a..11f7db44370 100644 --- a/dlls/wined3d/adapter_vk.c +++ b/dlls/wined3d/adapter_vk.c @@ -1980,8 +1980,8 @@ fail:
static VkPhysicalDevice get_vulkan_physical_device(struct wined3d_vk_info *vk_info) { - VkPhysicalDevice physical_devices[1]; - uint32_t count; + VkPhysicalDevice physical_devices[16]; + uint32_t count, selected = 0, i, best_api_version = 0; VkResult vr;
if ((vr = VK_CALL(vkEnumeratePhysicalDevices(vk_info->instance, &count, NULL))) < 0) @@ -1998,7 +1998,8 @@ static VkPhysicalDevice get_vulkan_physical_device(struct wined3d_vk_info *vk_in { /* TODO: Create wined3d_adapter for each device. */ FIXME("Multiple physical devices available.\n"); - count = 1; + if (count > ARRAY_SIZE(physical_devices)) + count = ARRAY_SIZE(physical_devices); }
if ((vr = VK_CALL(vkEnumeratePhysicalDevices(vk_info->instance, &count, physical_devices))) < 0) @@ -2007,7 +2008,17 @@ static VkPhysicalDevice get_vulkan_physical_device(struct wined3d_vk_info *vk_in return VK_NULL_HANDLE; }
- return physical_devices[0]; + for (i = 0; i < count; ++i) + { + VkPhysicalDeviceProperties properties; + VK_CALL(vkGetPhysicalDeviceProperties(physical_devices[i], &properties)); + if (properties.apiVersion > best_api_version) { + selected = i; + best_api_version = properties.apiVersion; + } + } + + return physical_devices[selected]; }
static enum wined3d_display_driver guess_display_driver(enum wined3d_pci_vendor vendor)
On Mon, 25 Jan 2021 at 17:03, Jan Sikorski jsikorski@codeweavers.com wrote:
dlls/wined3d/adapter_vk.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-)
I'm not sure that's a good idea, the device with the highest API version may very well be a software renderer.
It should also ultimately be unnecessary. On systems with multiple GPUs, we should simply create a wined3d adapter for each device. If for some reason we'd like to change the order in which those are enumerated, either winex11/winemac or the native Vulkan loader would seem like a better place.
On 1/25/21 5:14 PM, Henri Verbeet wrote:
On Mon, 25 Jan 2021 at 17:03, Jan Sikorski jsikorski@codeweavers.com wrote:
dlls/wined3d/adapter_vk.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-)
I'm not sure that's a good idea, the device with the highest API version may very well be a software renderer.
Right, good point. The first device could be as well? (not sure if there's some implied ordering)
It should also ultimately be unnecessary. On systems with multiple GPUs, we should simply create a wined3d adapter for each device. If for some reason we'd like to change the order in which those are enumerated, either winex11/winemac or the native Vulkan loader would seem like a better place.
That was meant as a slight improvement over just picking the first one - apparently even a single GPU can present multiple physical devices with different capabilities. Changing the order seems even more hacky. Either way it's a workaround, not intended as a final solution.
- Janek
This is a bad idea, and having a fixed set of 16 physical devices is also a bad idea.
Regards, - Joshie 🐸✨
On 1/25/21 4:03 PM, Jan Sikorski wrote:
Signed-off-by: Jan Sikorski jsikorski@codeweavers.com
dlls/wined3d/adapter_vk.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/dlls/wined3d/adapter_vk.c b/dlls/wined3d/adapter_vk.c index 9a226edc65a..11f7db44370 100644 --- a/dlls/wined3d/adapter_vk.c +++ b/dlls/wined3d/adapter_vk.c @@ -1980,8 +1980,8 @@ fail:
static VkPhysicalDevice get_vulkan_physical_device(struct wined3d_vk_info *vk_info) {
- VkPhysicalDevice physical_devices[1];
- uint32_t count;
VkPhysicalDevice physical_devices[16];
uint32_t count, selected = 0, i, best_api_version = 0; VkResult vr;
if ((vr = VK_CALL(vkEnumeratePhysicalDevices(vk_info->instance, &count, NULL))) < 0)
@@ -1998,7 +1998,8 @@ static VkPhysicalDevice get_vulkan_physical_device(struct wined3d_vk_info *vk_in { /* TODO: Create wined3d_adapter for each device. */ FIXME("Multiple physical devices available.\n");
count = 1;
if (count > ARRAY_SIZE(physical_devices))
count = ARRAY_SIZE(physical_devices); } if ((vr = VK_CALL(vkEnumeratePhysicalDevices(vk_info->instance, &count, physical_devices))) < 0)
@@ -2007,7 +2008,17 @@ static VkPhysicalDevice get_vulkan_physical_device(struct wined3d_vk_info *vk_in return VK_NULL_HANDLE; }
- return physical_devices[0];
for (i = 0; i < count; ++i)
{
VkPhysicalDeviceProperties properties;
VK_CALL(vkGetPhysicalDeviceProperties(physical_devices[i], &properties));
if (properties.apiVersion > best_api_version) {
selected = i;
best_api_version = properties.apiVersion;
}
}
return physical_devices[selected]; }
static enum wined3d_display_driver guess_display_driver(enum wined3d_pci_vendor vendor)