Try to get correct amd gpu when multiple

mangoapp_nodisplay
FlightlessMango 2 years ago
parent e7c59c55a2
commit 9758d2a286

@ -135,7 +135,7 @@ void imgui_create(void *ctx)
} else {
vendorID = 0x10de;
}
init_gpu_stats(vendorID, params);
init_gpu_stats(vendorID, 0, params);
get_device_name(vendorID, deviceID, sw_stats);
// Setup Dear ImGui context
IMGUI_CHECKVERSION();

@ -555,7 +555,7 @@ struct pci_bus {
int func;
};
void init_gpu_stats(uint32_t& vendorID, overlay_params& params)
void init_gpu_stats(uint32_t& vendorID, uint32_t reported_deviceID, overlay_params& params)
{
//if (!params.enabled[OVERLAY_PARAM_ENABLED_gpu_stats])
// return;
@ -618,12 +618,20 @@ void init_gpu_stats(uint32_t& vendorID, overlay_params& params)
string device = path + "/device/device";
if (fp = fopen(device.c_str(), "r")){
fscanf(fp, "%s", str);
deviceID = strtol(str, NULL, 16);
uint32_t temp = strtol(str, NULL, 16);
if (temp != reported_deviceID && deviceID != 0){
SPDLOG_DEBUG("DeviceID does not match vulkan report {}", reported_deviceID);
continue;
}
deviceID = temp;
fclose(fp);
}
string vendor = path + "/device/vendor";
if (fp = fopen(vendor.c_str(), "r")){
fscanf(fp, "%s", str);
uint32_t temp = strtol(str, NULL, 16);
if (temp != vendorID)
continue;
fclose(fp);
}
string line = str;

@ -147,7 +147,7 @@ void render_imgui(swapchain_stats& data, struct overlay_params& params, ImVec2&
void update_hud_info(struct swapchain_stats& sw_stats, struct overlay_params& params, uint32_t vendorID);
void update_hud_info_with_frametime(struct swapchain_stats& sw_stats, struct overlay_params& params, uint32_t vendorID, uint64_t frametime_ns);
void update_hw_info(struct swapchain_stats& sw_stats, struct overlay_params& params, uint32_t vendorID);
void init_gpu_stats(uint32_t& vendorID, overlay_params& params);
void init_gpu_stats(uint32_t& vendorID, uint32_t reported_deviceID, overlay_params& params);
void init_cpu_stats(overlay_params& params);
void check_keybinds(struct swapchain_stats& sw_stats, struct overlay_params& params, uint32_t vendorID);
void init_system_info(void);

@ -1795,7 +1795,7 @@ static VkResult overlay_CreateDevice(
if (!is_blacklisted()) {
device_map_queues(device_data, pCreateInfo);
init_gpu_stats(device_data->properties.vendorID, device_data->instance->params);
init_gpu_stats(device_data->properties.vendorID, device_data->properties.deviceID, device_data->instance->params);
}
return result;

Loading…
Cancel
Save