Changeset c324d6a in opengl-game for vulkan-utils.cpp
- Timestamp:
- Jan 2, 2021, 4:07:45 PM (4 years ago)
- Branches:
- feature/imgui-sdl, master
- Children:
- 3b7d497, ca188cc
- Parents:
- a2f62d7
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vulkan-utils.cpp
ra2f62d7 rc324d6a 145 145 VkPresentModeKHR bestMode = VK_PRESENT_MODE_FIFO_KHR; 146 146 147 /* This functions effectively selects present modes in this order, which allows for unlimited framerate: 148 * { VK_PRESENT_MODE_MAILBOX_KHR, VK_PRESENT_MODE_IMMEDIATE_KHR, VK_PRESENT_MODE_FIFO_KHR } 149 * 150 * To cap the framerate (I assume to the monitor refresh rate), just use: 151 * { VK_PRESENT_MODE_FIFO_KHR } 152 * 153 * Would be better to make a more generic function that takes a list of prefered modes ordered by preference. 154 * Example code: 155 * 156 * for (int request_i = 0; request_i < request_modes_count; request_i++) 157 * for (uint32_t avail_i = 0; avail_i < avail_count; avail_i++) 158 * if (request_modes[request_i] == avail_modes[avail_i]) 159 * return request_modes[request_i]; 160 */ 161 147 162 for (const auto& availablePresentMode : availablePresentModes) { 148 163 if (availablePresentMode == VK_PRESENT_MODE_MAILBOX_KHR) { 149 164 return availablePresentMode; 150 } 151 else if (availablePresentMode == VK_PRESENT_MODE_IMMEDIATE_KHR) { 165 } else if (availablePresentMode == VK_PRESENT_MODE_IMMEDIATE_KHR) { 152 166 bestMode = availablePresentMode; 153 167 }
Note:
See TracChangeset
for help on using the changeset viewer.