When DirectX 12 is missing, the emulator thinks Vulkan = DirectX 12 because Vulkan takes DX12's place in the box (id=2), and therefore runs DX12 when Vulkan is selected, crashing the emulator with an unhandled exception.

Fixes it by translating renderer string value to the respective enum class before sending the value to config.h instead of just relying on the box's selected id -> cbox_gs_render->GetSelection()

Also changes the order of the renderers (for convinience, now DX12 is id=3) from
Null, OpenGL, DirectX 12, Vulkan
to
Null, OpenGL, Vulkan, DirectX 12
This commit is contained in:
AnnieL 2016-03-16 19:48:02 +00:00 committed by AnnieL
parent 45e48c2499
commit 5250911a40
2 changed files with 17 additions and 8 deletions

View File

@ -229,6 +229,7 @@ SettingsDialog::SettingsDialog(wxWindow *parent, rpcs3::config_t* cfg)
cbox_gs_render->Append("Null"); cbox_gs_render->Append("Null");
cbox_gs_render->Append("OpenGL"); cbox_gs_render->Append("OpenGL");
cbox_gs_render->Append("Vulkan");
#ifdef _MSC_VER #ifdef _MSC_VER
Microsoft::WRL::ComPtr<IDXGIFactory4> dxgiFactory; Microsoft::WRL::ComPtr<IDXGIFactory4> dxgiFactory;
@ -251,7 +252,6 @@ SettingsDialog::SettingsDialog(wxWindow *parent, rpcs3::config_t* cfg)
chbox_gs_overlay->Enable(false); chbox_gs_overlay->Enable(false);
} }
cbox_gs_render->Append("Vulkan");
#endif #endif
for (int i = 1; i < WXSIZEOF(ResolutionTable); ++i) for (int i = 1; i < WXSIZEOF(ResolutionTable); ++i)
@ -503,7 +503,16 @@ SettingsDialog::SettingsDialog(wxWindow *parent, rpcs3::config_t* cfg)
cfg->core.hook_st_func = chbox_core_hook_stfunc->GetValue(); cfg->core.hook_st_func = chbox_core_hook_stfunc->GetValue();
cfg->core.load_liblv2 = chbox_core_load_liblv2->GetValue(); cfg->core.load_liblv2 = chbox_core_load_liblv2->GetValue();
cfg->rsx.renderer = cbox_gs_render->GetSelection(); // Translates renderer string to enum class for config.h
if (cbox_gs_render->GetString(cbox_gs_render->GetSelection()) == "Null")
cfg->rsx.renderer = rsx_renderer_type::Null;
if (cbox_gs_render->GetString(cbox_gs_render->GetSelection()) == "OpenGL")
cfg->rsx.renderer = rsx_renderer_type::OpenGL;
if (cbox_gs_render->GetString(cbox_gs_render->GetSelection()) == "Vulkan")
cfg->rsx.renderer = rsx_renderer_type::Vulkan;
if (cbox_gs_render->GetString(cbox_gs_render->GetSelection()) == "DirectX 12")
cfg->rsx.renderer = rsx_renderer_type::DX12;
cfg->rsx.d3d12.adaptater = cbox_gs_d3d_adaptater->GetSelection(); cfg->rsx.d3d12.adaptater = cbox_gs_d3d_adaptater->GetSelection();
cfg->rsx.resolution = ResolutionNumToId(cbox_gs_resolution->GetSelection() + 1); cfg->rsx.resolution = ResolutionNumToId(cbox_gs_resolution->GetSelection() + 1);
cfg->rsx.aspect_ratio = cbox_gs_aspect->GetSelection() + 1; cfg->rsx.aspect_ratio = cbox_gs_aspect->GetSelection() + 1;

View File

@ -50,8 +50,8 @@ enum class rsx_renderer_type
{ {
Null, Null,
OpenGL, OpenGL,
DX12, Vulkan,
Vulkan DX12
}; };
enum class rsx_aspect_ratio enum class rsx_aspect_ratio
@ -93,8 +93,8 @@ namespace convert
{ {
case rsx_renderer_type::Null: return "Null"; case rsx_renderer_type::Null: return "Null";
case rsx_renderer_type::OpenGL: return "OpenGL"; case rsx_renderer_type::OpenGL: return "OpenGL";
case rsx_renderer_type::DX12: return "DX12";
case rsx_renderer_type::Vulkan: return "Vulkan"; case rsx_renderer_type::Vulkan: return "Vulkan";
case rsx_renderer_type::DX12: return "DX12";
} }
return "Unknown"; return "Unknown";
@ -112,12 +112,12 @@ namespace convert
if (value == "OpenGL") if (value == "OpenGL")
return rsx_renderer_type::OpenGL; return rsx_renderer_type::OpenGL;
if (value == "DX12")
return rsx_renderer_type::DX12;
if (value == "Vulkan") if (value == "Vulkan")
return rsx_renderer_type::Vulkan; return rsx_renderer_type::Vulkan;
if (value == "DX12")
return rsx_renderer_type::DX12;
return rsx_renderer_type::Null; return rsx_renderer_type::Null;
} }
}; };