Fix get_device_name, don't substr if no '[' in gpu name

pull/197/head
jackun 4 years ago
parent c25082b1dd
commit 40255b62f9
No known key found for this signature in database
GPG Key ID: 119DB3F1D05A9ED3

@ -2309,17 +2309,17 @@ static struct overlay_draw *before_present(struct swapchain_data *swapchain_data
return draw;
}
void get_device_name(int32_t vendorID, int32_t deviceID, struct swapchain_stats& sw_stats){
if (!pci_ids[vendorID].second[deviceID].desc.empty()){
size_t position = pci_ids[vendorID].second[deviceID].desc.find("[");
string desc = pci_ids[vendorID].second[deviceID].desc.substr(position);
void get_device_name(int32_t vendorID, int32_t deviceID, struct swapchain_stats& sw_stats)
{
string desc = pci_ids[vendorID].second[deviceID].desc;
size_t position = desc.find("[");
if (position != std::string::npos) {
desc = desc.substr(position);
string chars = "[]";
for (char c: chars)
desc.erase(remove(desc.begin(), desc.end(), c), desc.end());
sw_stats.gpuName = desc;
} else {
sw_stats.gpuName = "";
}
sw_stats.gpuName = desc;
}
static VkResult overlay_CreateSwapchainKHR(

Loading…
Cancel
Save