File tree Expand file tree Collapse file tree
03_Drawing_a_triangle/00_Setup Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -103,7 +103,7 @@ VkPhysicalDeviceFeatures deviceFeatures;
103103vkGetPhysicalDeviceFeatures(physicalDevice, &deviceFeatures);
104104```
105105
106- There more details that can be queried from devices that we'll discuss later
106+ There are more details that can be queried from devices that we'll discuss later
107107concerning device memory and queue families (see the next section).
108108
109109As an example, let's say we consider our application only usable for dedicated
@@ -137,16 +137,16 @@ void pickPhysicalDevice() {
137137 ...
138138
139139 // Use an ordered map to automatically sort candidates by increasing score
140- std::map <int, VkPhysicalDevice> candidates;
140+ std::multimap <int, VkPhysicalDevice> candidates;
141141
142142 for (const auto& device : devices) {
143143 int score = rateDeviceSuitability(device);
144- candidates[ score] = device;
144+ candidates.insert(std::make_pair( score, device)) ;
145145 }
146146
147147 // Check if the best candidate is suitable at all
148- if (candidates.begin ()->first > 0) {
149- physicalDevice = candidates.begin ()->second;
148+ if (candidates.rbegin ()->first > 0) {
149+ physicalDevice = candidates.rbegin ()->second;
150150 } else {
151151 throw std::runtime_error("failed to find a suitable GPU!");
152152 }
You can’t perform that action at this time.
0 commit comments