3#include "pixelbullet/graphics/gpu_selection.h"
8namespace pixelbullet::application_internal
10inline constexpr std::string_view k_graphics_device_preference_token_values =
"auto|discrete|integrated|virtual|cpu";
12[[nodiscard]]
inline std::optional<GraphicsDevicePreference> parse_graphics_device_preference_token(
const std::string_view value)
noexcept
16 return GraphicsDevicePreference::Auto;
18 if (value ==
"discrete")
20 return GraphicsDevicePreference::Discrete;
22 if (value ==
"integrated")
24 return GraphicsDevicePreference::Integrated;
26 if (value ==
"virtual")
28 return GraphicsDevicePreference::Virtual;
32 return GraphicsDevicePreference::Cpu;
38[[nodiscard]]
inline std::optional<std::string_view> graphics_device_preference_token(
const GraphicsDevicePreference preference)
noexcept
42 case GraphicsDevicePreference::Auto:
44 case GraphicsDevicePreference::Discrete:
46 case GraphicsDevicePreference::Integrated:
48 case GraphicsDevicePreference::Virtual:
50 case GraphicsDevicePreference::Cpu:
57[[nodiscard]]
inline std::string_view graphics_device_preference_token_or_unknown(
const GraphicsDevicePreference preference)
noexcept
59 if (
const auto token = graphics_device_preference_token(preference); token.has_value())