mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2026-07-09 17:24:49 -06:00
libretro: scope Vulkan case to fix MSVC C2360 (#2267)
MSVC with /permissive- /WX rejects the switch in retro_load_game: the static vk_negotiation initializer in the Vulkan case is crossed by the next case label (C2360, initialization skipped by case). Wrap the Vulkan case body in a block so its scope ends before that label, and add a comment noting why the braces are required there. The other cases are wrapped in blocks too for visual consistency, though only the Vulkan case strictly needs it. GCC/clang and the MXE cross-build accept the original; this only affects native MSVC builds. No behaviour change.
This commit is contained in:
parent
bda4671be6
commit
0c19c33bd3
@ -552,7 +552,7 @@ bool retro_load_game(const struct retro_game_info* info) {
|
|||||||
emu_instance->emu_window->UpdateLayout();
|
emu_instance->emu_window->UpdateLayout();
|
||||||
|
|
||||||
switch (Settings::values.graphics_api.GetValue()) {
|
switch (Settings::values.graphics_api.GetValue()) {
|
||||||
case Settings::GraphicsAPI::OpenGL:
|
case Settings::GraphicsAPI::OpenGL: {
|
||||||
#ifdef ENABLE_OPENGL
|
#ifdef ENABLE_OPENGL
|
||||||
LOG_INFO(Frontend, "Using OpenGL hw renderer");
|
LOG_INFO(Frontend, "Using OpenGL hw renderer");
|
||||||
LibRetro::SetHWSharedContext();
|
LibRetro::SetHWSharedContext();
|
||||||
@ -576,7 +576,12 @@ bool retro_load_game(const struct retro_game_info* info) {
|
|||||||
LibRetro::SetFramebufferCallback(emu_instance->hw_render.get_current_framebuffer);
|
LibRetro::SetFramebufferCallback(emu_instance->hw_render.get_current_framebuffer);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case Settings::GraphicsAPI::Vulkan:
|
}
|
||||||
|
case Settings::GraphicsAPI::Vulkan: {
|
||||||
|
// These braces are required (not only for consistency): vk_negotiation
|
||||||
|
// below is declared with an initializer, so without an explicit scope
|
||||||
|
// the following case label would jump past that initialization. MSVC
|
||||||
|
// rejects that as error C2360 under /permissive- /WX.
|
||||||
#ifdef ENABLE_VULKAN
|
#ifdef ENABLE_VULKAN
|
||||||
LOG_INFO(Frontend, "Using Vulkan hw renderer");
|
LOG_INFO(Frontend, "Using Vulkan hw renderer");
|
||||||
emu_instance->hw_render.context_type = RETRO_HW_CONTEXT_VULKAN;
|
emu_instance->hw_render.context_type = RETRO_HW_CONTEXT_VULKAN;
|
||||||
@ -601,13 +606,15 @@ bool retro_load_game(const struct retro_game_info* info) {
|
|||||||
LibRetro::SetHWRenderContextNegotiationInterface((void**)&vk_negotiation);
|
LibRetro::SetHWRenderContextNegotiationInterface((void**)&vk_negotiation);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case Settings::GraphicsAPI::Software:
|
}
|
||||||
|
case Settings::GraphicsAPI::Software: {
|
||||||
emu_instance->emu_window->CreateContext();
|
emu_instance->emu_window->CreateContext();
|
||||||
emu_instance->game_loaded = do_load_game();
|
emu_instance->game_loaded = do_load_game();
|
||||||
if (!emu_instance->game_loaded)
|
if (!emu_instance->game_loaded)
|
||||||
return false;
|
return false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
uint64_t quirks =
|
uint64_t quirks =
|
||||||
RETRO_SERIALIZATION_QUIRK_CORE_VARIABLE_SIZE | RETRO_SERIALIZATION_QUIRK_MUST_INITIALIZE;
|
RETRO_SERIALIZATION_QUIRK_CORE_VARIABLE_SIZE | RETRO_SERIALIZATION_QUIRK_MUST_INITIALIZE;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user