Open genpfault opened 2 years ago
Quick 'n dirty VULKAN_DEVICE_INDEX=list
implementation:
diff --git a/layer.cpp b/layer.cpp
index 3863862..f7b6b4d 100644
--- a/layer.cpp
+++ b/layer.cpp
@@ -5,6 +5,7 @@
#include <cstdio>
#include <cstdlib>
#include <cstring>
+#include <iostream>
#include <map>
#include <vector>
@@ -63,6 +64,28 @@ static VkResult ChooseDevice(VkInstance instance,
return result;
}
+ if (std::string(env) == "list")
+ {
+ for (size_t i = 0; i < devices.size(); ++i)
+ {
+ VkPhysicalDeviceProperties pdp;
+ dispatch.GetPhysicalDeviceProperties(devices[i], &pdp);
+
+ VkPhysicalDeviceDriverProperties pddp{};
+ pddp.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES;
+ VkPhysicalDeviceProperties2 pdp2{};
+ pdp2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2;
+ pdp2.pNext = &pddp;
+ dispatch.GetPhysicalDeviceProperties2(devices[i], &pdp2);
+
+ std::cerr << "GPU" << i << ":" << std::endl;
+ std::cerr << " deviceName = " << pdp.deviceName << std::endl;
+ std::cerr << " driverInfo = " << pddp.driverInfo << std::endl;
+ }
+
+ std::exit(0);
+ }
+
int deviceIndex = atoi(env);
if (deviceIndex >= count)
@@ -205,6 +228,8 @@ DeviceChooserLayer_CreateInstance(const VkInstanceCreateInfo* pCreateInfo,
GET(EnumeratePhysicalDevices);
GET(EnumeratePhysicalDeviceGroups);
GET(EnumeratePhysicalDeviceGroupsKHR);
+ GET(GetPhysicalDeviceProperties);
+ GET(GetPhysicalDeviceProperties2);
#undef GET
I'm seeing the same GPU index refer to different GPUs in vkdevicechooser & vulkaninfo.
vulkaninfo
's view (from Debian'svulkan-tools
package, version: 1.2.162.0+dfsg1-1):vkdevicechooser's view (current
master
,df15b9d33a
):It's almost like vkdevicechooser's list got shifted up an item, but then the
AMD RADV NAVY_FLOUNDER (ACO) / Mesa 20.3.5
device gets put in after the NVidia card. I wonder if thevulkaninfo
enumeration logic changed between when the README was written and now, resulting in different orders?OS: Debian 11/Bullseye