tests/shader_runner_metal: Try harder to find a suitable device.

This commit is contained in:
Henri Verbeet
2025-05-22 22:34:43 +02:00
parent e17a98f870
commit 0a28abd8f6
Notes: Henri Verbeet 2025-05-27 21:08:45 +02:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1512

View File

@@ -888,25 +888,31 @@ static bool metal_runner_init(struct metal_runner *runner)
memset(runner, 0, sizeof(*runner)); memset(runner, 0, sizeof(*runner));
devices = MTLCopyAllDevices(); devices = MTLCopyAllDevices();
if (![devices count]) for (device in devices)
{ {
skip("Failed to find a usable Metal device.\n"); if (!check_argument_buffer_support(device))
[devices release]; {
return false; trace("Ignoring device \"%s\" because it doesn't have usable argument buffer support.\n",
[[device name] UTF8String]);
continue;
}
if (!runner->device
|| (!device.lowPower && runner->device.lowPower)
|| (!device.removable && runner->device.removable))
runner->device = device;
} }
device = [devices objectAtIndex:0]; device = [runner->device retain];
runner->device = [device retain];
[devices release]; [devices release];
trace("GPU: %s\n", [[device name] UTF8String]); if (!device)
if (!check_argument_buffer_support(device))
{ {
skip("Device does not have usable argument buffer support.\n"); skip("Failed to find a suitable Metal device.\n");
[device release];
return false; return false;
} }
trace("GPU: %s\n", [[device name] UTF8String]);
if (!(runner->queue = [device newCommandQueue])) if (!(runner->queue = [device newCommandQueue]))
{ {
skip("Failed to create command queue.\n"); skip("Failed to create command queue.\n");