mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-07-24 19:14:40 +00:00
rewrite w\o std::zip usage
This commit is contained in:
parent
1ac807dc3a
commit
a97f881fbb
@ -48,12 +48,11 @@ Instance::Instance(Frontend::WindowSDL& window, s32 physical_device_index)
|
|||||||
ASSERT_MSG(num_physical_devices > 0, "No physical devices found");
|
ASSERT_MSG(num_physical_devices > 0, "No physical devices found");
|
||||||
|
|
||||||
if (physical_device_index < 0) {
|
if (physical_device_index < 0) {
|
||||||
std::vector<vk::PhysicalDeviceProperties2> properties2{};
|
std::vector<std::pair<size_t, vk::PhysicalDeviceProperties2>> properties2{};
|
||||||
for (auto const& physical : physical_devices) {
|
for (auto const& physical : physical_devices) {
|
||||||
properties2.emplace_back(physical.getProperties2());
|
properties2.emplace_back(properties2.size(), physical.getProperties2());
|
||||||
}
|
}
|
||||||
auto dev_prop2_pairs = std::views::zip(physical_devices, properties2);
|
std::sort(properties2.begin(), properties2.end(),
|
||||||
std::sort(dev_prop2_pairs.begin(), dev_prop2_pairs.end(),
|
|
||||||
[](const auto& left, const auto& right) {
|
[](const auto& left, const auto& right) {
|
||||||
if (std::get<1>(left).properties.deviceType ==
|
if (std::get<1>(left).properties.deviceType ==
|
||||||
std::get<1>(right).properties.deviceType) {
|
std::get<1>(right).properties.deviceType) {
|
||||||
@ -62,7 +61,7 @@ Instance::Instance(Frontend::WindowSDL& window, s32 physical_device_index)
|
|||||||
return std::get<1>(left).properties.deviceType ==
|
return std::get<1>(left).properties.deviceType ==
|
||||||
vk::PhysicalDeviceType::eDiscreteGpu;
|
vk::PhysicalDeviceType::eDiscreteGpu;
|
||||||
});
|
});
|
||||||
physical_device = std::get<0>(dev_prop2_pairs[0]);
|
physical_device = physical_devices[std::get<0>(properties2[0])];
|
||||||
} else {
|
} else {
|
||||||
ASSERT_MSG(physical_device_index < num_physical_devices,
|
ASSERT_MSG(physical_device_index < num_physical_devices,
|
||||||
"Invalid physical device index {} provided when only {} devices exist",
|
"Invalid physical device index {} provided when only {} devices exist",
|
||||||
|
Loading…
Reference in New Issue
Block a user