libretro: Disable context caching

It's completely broken in RetroArch, see https://github.com/libretro/RetroArch/issues/11623
This commit is contained in:
Connor McLaughlin 2020-11-27 01:39:18 +10:00
parent f7a75941b5
commit b2de5945c4
4 changed files with 14 additions and 14 deletions

View file

@ -21,7 +21,7 @@ void LibretroD3D11HostDisplay::SetVSync(bool enabled)
bool LibretroD3D11HostDisplay::RequestHardwareRendererContext(retro_hw_render_callback* cb) bool LibretroD3D11HostDisplay::RequestHardwareRendererContext(retro_hw_render_callback* cb)
{ {
cb->cache_context = true; cb->cache_context = false;
cb->bottom_left_origin = false; cb->bottom_left_origin = false;
cb->context_type = RETRO_HW_CONTEXT_DIRECT3D; cb->context_type = RETRO_HW_CONTEXT_DIRECT3D;
cb->version_major = 11; cb->version_major = 11;

View file

@ -865,16 +865,15 @@ void LibretroHostInterface::UpdateSettings()
{ {
ReportMessage("Resolution changed, updating system AV info..."); ReportMessage("Resolution changed, updating system AV info...");
// this will probably recreate the device... so save the state first by switching to software
if (m_using_hardware_renderer)
SwitchToSoftwareRenderer();
UpdateSystemAVInfo(true); UpdateSystemAVInfo(true);
if (!m_hw_render_callback_valid) if (!g_settings.IsUsingSoftwareRenderer())
RequestHardwareRendererContext(); {
else if (!m_using_hardware_renderer) if (!m_hw_render_callback_valid)
SwitchToHardwareRenderer(); RequestHardwareRendererContext();
else if (!m_using_hardware_renderer)
SwitchToHardwareRenderer();
}
// Don't let the base class mess with the GPU. // Don't let the base class mess with the GPU.
old_settings.gpu_resolution_scale = g_settings.gpu_resolution_scale; old_settings.gpu_resolution_scale = g_settings.gpu_resolution_scale;
@ -1215,12 +1214,11 @@ void LibretroHostInterface::SwitchToHardwareRenderer()
void LibretroHostInterface::HardwareRendererContextDestroy() void LibretroHostInterface::HardwareRendererContextDestroy()
{ {
Log_InfoPrintf("Hardware context destroyed");
// switch back to software // switch back to software
if (g_libretro_host_interface.m_using_hardware_renderer) if (g_libretro_host_interface.m_using_hardware_renderer)
{
Log_InfoPrintf("Lost hardware renderer context, switching to software renderer");
g_libretro_host_interface.SwitchToSoftwareRenderer(); g_libretro_host_interface.SwitchToSoftwareRenderer();
}
if (g_libretro_host_interface.m_hw_render_display) if (g_libretro_host_interface.m_hw_render_display)
{ {
@ -1233,6 +1231,8 @@ void LibretroHostInterface::HardwareRendererContextDestroy()
void LibretroHostInterface::SwitchToSoftwareRenderer() void LibretroHostInterface::SwitchToSoftwareRenderer()
{ {
Log_InfoPrintf("Switching to software renderer");
// keep the hw renderer around in case we need it later // keep the hw renderer around in case we need it later
// but keep it active until we've recreated the GPU so we can save the state // but keep it active until we've recreated the GPU so we can save the state
std::unique_ptr<HostDisplay> save_display; std::unique_ptr<HostDisplay> save_display;

View file

@ -79,7 +79,7 @@ static bool TryESVersions(retro_hw_render_callback* cb)
bool LibretroOpenGLHostDisplay::RequestHardwareRendererContext(retro_hw_render_callback* cb, bool prefer_gles) bool LibretroOpenGLHostDisplay::RequestHardwareRendererContext(retro_hw_render_callback* cb, bool prefer_gles)
{ {
// Prefer a desktop OpenGL context where possible. If we can't get this, try OpenGL ES. // Prefer a desktop OpenGL context where possible. If we can't get this, try OpenGL ES.
cb->cache_context = true; cb->cache_context = false;
cb->bottom_left_origin = true; cb->bottom_left_origin = true;
if (!prefer_gles) if (!prefer_gles)

View file

@ -76,7 +76,7 @@ static retro_hw_render_context_negotiation_interface_vulkan s_vulkan_context_neg
bool LibretroVulkanHostDisplay::RequestHardwareRendererContext(retro_hw_render_callback* cb) bool LibretroVulkanHostDisplay::RequestHardwareRendererContext(retro_hw_render_callback* cb)
{ {
cb->cache_context = true; cb->cache_context = false;
cb->bottom_left_origin = false; cb->bottom_left_origin = false;
cb->context_type = RETRO_HW_CONTEXT_VULKAN; cb->context_type = RETRO_HW_CONTEXT_VULKAN;
return g_retro_environment_callback(RETRO_ENVIRONMENT_SET_HW_RENDER, cb) && return g_retro_environment_callback(RETRO_ENVIRONMENT_SET_HW_RENDER, cb) &&