mirror of
https://github.com/cemu-project/Cemu.git
synced 2026-04-26 13:05:34 -06:00
give consistent config values for selecting graphic apis
This commit is contained in:
parent
46ab3966ff
commit
b6bcb954c4
@ -1230,7 +1230,7 @@ void GeneralSettings2::StoreConfig()
|
||||
}
|
||||
|
||||
// graphics
|
||||
config.graphic_api = (GraphicAPI)m_graphic_api->GetSelection();
|
||||
config.graphic_api = m_api_map[m_graphic_api->GetSelection()];
|
||||
|
||||
selection = m_graphic_device->GetSelection();
|
||||
#ifdef ENABLE_VULKAN
|
||||
@ -1898,7 +1898,14 @@ void GeneralSettings2::ApplyConfig()
|
||||
}
|
||||
|
||||
// graphics
|
||||
m_graphic_api->SetSelection((int)config.graphic_api);
|
||||
for (int i = 0; i < (int)m_api_map.size(); ++i)
|
||||
{
|
||||
if (m_api_map[i] == config.graphic_api)
|
||||
{
|
||||
m_graphic_api->SetSelection(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
m_vsync->SetSelection(config.vsync);
|
||||
m_overrideGamma->SetValue(config.overrideAppGammaPreference);
|
||||
m_overrideGammaValue->SetValue(config.overrideGammaValue);
|
||||
|
||||
@ -1606,47 +1606,18 @@ void MainWindow::CreateCanvas()
|
||||
m_game_panel->SetSizer(sizer);
|
||||
this->GetSizer()->Add(m_game_panel, 1, wxEXPAND);
|
||||
|
||||
GraphicAPI available_apis[GRAPHIC_API_COUNT];
|
||||
int count = 0;
|
||||
#ifdef ENABLE_OPENGL
|
||||
if (count < GRAPHIC_API_COUNT) available_apis[count++] = kOpenGL;
|
||||
#endif
|
||||
#ifdef ENABLE_VULKAN
|
||||
if (count < GRAPHIC_API_COUNT) available_apis[count++] = kVulkan;
|
||||
#endif
|
||||
#ifdef ENABLE_METAL
|
||||
if (count < GRAPHIC_API_COUNT) available_apis[count++] = kMetal;
|
||||
#endif
|
||||
cemu_assert(count > 0);
|
||||
|
||||
GraphicAPI selected = ActiveSettings::GetGraphicsAPI();
|
||||
bool found = false;
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
if (available_apis[i] == selected)
|
||||
{
|
||||
printf("Selected graphics API: %d\n", selected);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found)
|
||||
selected = available_apis[0];
|
||||
|
||||
// create canvas
|
||||
switch (selected)
|
||||
switch (ActiveSettings::GetGraphicsAPI())
|
||||
{
|
||||
case kVulkan:
|
||||
#if defined(ENABLE_VULKAN)
|
||||
m_render_canvas = new VulkanCanvas(m_game_panel, wxSize(1280, 720), true);
|
||||
break;
|
||||
#endif
|
||||
case kOpenGL:
|
||||
#if defined(ENABLE_OPENGL)
|
||||
m_render_canvas = GLCanvas_Create(m_game_panel, wxSize(1280, 720), true);
|
||||
break;
|
||||
#endif
|
||||
case kVulkan:
|
||||
#if defined(ENABLE_VULKAN)
|
||||
m_render_canvas = new VulkanCanvas(m_game_panel, wxSize(1280, 720), true);
|
||||
break;
|
||||
#endif
|
||||
case kMetal:
|
||||
#if defined(ENABLE_METAL)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user