Skip to content

Commit

Permalink
Examples: Vulkan: pick integrated GPU if nothing else is available. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
kimidaisuki22 authored and ocornut committed Apr 24, 2023
1 parent 0fbf288 commit 565aa0b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Other changes:
by context (Desktop 3.0, 3.1, or 3.2+ with compat bit). (#6333) [@GereonV]
- Examples: Added native Win32+OpenGL3 example. We don't recommend using this setup but we
provide it for completeness. (#3218, #5170, #6086, #2772, #2600, #2359, #2022, #1553) [@learn-more]

- Examples: Vulkan: Use integrated GPU if nothing else is available. (#6359) [@kimidaisuki22]


-----------------------------------------------------------------------
Expand Down
4 changes: 4 additions & 0 deletions examples/example_glfw_vulkan/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ static VkPhysicalDevice SetupVulkan_SelectPhysicalDevice()
if (properties.deviceType == VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU)
return device;
}

// Use first GPU (Integrated) is a Discrete one is not available.
if (gpu_count > 0)
return gpus[0];
return VK_NULL_HANDLE;
}

Expand Down
4 changes: 4 additions & 0 deletions examples/example_sdl2_vulkan/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ static VkPhysicalDevice SetupVulkan_SelectPhysicalDevice()
if (properties.deviceType == VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU)
return device;
}

// Use first GPU (Integrated) is a Discrete one is not available.
if (gpu_count > 0)
return gpus[0];
return VK_NULL_HANDLE;
}

Expand Down

0 comments on commit 565aa0b

Please sign in to comment.