diff --git a/src/common/vulkan/swap_chain.cpp b/src/common/vulkan/swap_chain.cpp index 5a2163e8..c392bcc4 100644 --- a/src/common/vulkan/swap_chain.cpp +++ b/src/common/vulkan/swap_chain.cpp @@ -764,16 +764,6 @@ bool SwapChain::RecreateSwapChain() return true; } -bool SwapChain::SetVSync(bool enabled) -{ - if (m_vsync_enabled == enabled) - return true; - - // Recreate the swap chain with the new present mode. - m_vsync_enabled = enabled; - return RecreateSwapChain(); -} - bool SwapChain::RecreateSurface(const WindowInfo& new_wi) { // Destroy the old swap chain, images, and surface. diff --git a/src/common/vulkan/swap_chain.h b/src/common/vulkan/swap_chain.h index 02360145..b1501f74 100644 --- a/src/common/vulkan/swap_chain.h +++ b/src/common/vulkan/swap_chain.h @@ -63,9 +63,6 @@ public: bool ResizeSwapChain(u32 new_width = 0, u32 new_height = 0); bool RecreateSwapChain(); - // Change vsync enabled state. This may fail as it causes a swapchain recreation. - bool SetVSync(bool enabled); - private: bool SelectSurfaceFormat(); bool SelectPresentMode(); diff --git a/src/core/host_display.h b/src/core/host_display.h index f5f04971..e5c7df12 100644 --- a/src/core/host_display.h +++ b/src/core/host_display.h @@ -123,8 +123,6 @@ public: virtual bool RenderScreenshot(u32 width, u32 height, std::vector* out_pixels, u32* out_stride, HostDisplayPixelFormat* out_format) = 0; - virtual void SetVSync(bool enabled) = 0; - const void* GetDisplayTextureHandle() const { return m_display_texture_handle; } const s32 GetDisplayTopMargin() const { return m_display_top_margin; } const s32 GetDisplayWidth() const { return m_display_width; } diff --git a/src/libretro/libretro_d3d11_host_display.cpp b/src/libretro/libretro_d3d11_host_display.cpp index 5b61d808..d69a80bf 100644 --- a/src/libretro/libretro_d3d11_host_display.cpp +++ b/src/libretro/libretro_d3d11_host_display.cpp @@ -214,12 +214,6 @@ void LibretroD3D11HostDisplay::EndSetDisplayPixels() m_context->Unmap(m_display_pixels_texture.GetD3DTexture(), 0); } -void LibretroD3D11HostDisplay::SetVSync(bool enabled) -{ - // The libretro frontend controls this. - Log_DevPrintf("Ignoring SetVSync(%u)", BoolToUInt32(enabled)); -} - bool LibretroD3D11HostDisplay::RequestHardwareRendererContext(retro_hw_render_callback* cb) { cb->cache_context = false; diff --git a/src/libretro/libretro_d3d11_host_display.h b/src/libretro/libretro_d3d11_host_display.h index eb611ab5..32382068 100644 --- a/src/libretro/libretro_d3d11_host_display.h +++ b/src/libretro/libretro_d3d11_host_display.h @@ -53,8 +53,6 @@ public: u32* out_pitch) override; void EndSetDisplayPixels() override; - void SetVSync(bool enabled) override; - bool Render() override; bool RenderScreenshot(u32 width, u32 height, std::vector* out_pixels, u32* out_stride, HostDisplayPixelFormat* out_format) override; diff --git a/src/libretro/libretro_host_display.cpp b/src/libretro/libretro_host_display.cpp index 1e123ecf..22458d70 100644 --- a/src/libretro/libretro_host_display.cpp +++ b/src/libretro/libretro_host_display.cpp @@ -1,12 +1,10 @@ #include "libretro_host_display.h" #include "common/align.h" #include "common/assert.h" -#include "common/log.h" #include "libretro_host_interface.h" #include #include #include -Log_SetChannel(LibretroHostDisplay); static retro_pixel_format GetRetroPixelFormat(HostDisplayPixelFormat format) { @@ -22,16 +20,15 @@ static retro_pixel_format GetRetroPixelFormat(HostDisplayPixelFormat format) return RETRO_PIXEL_FORMAT_0RGB1555; default: - return RETRO_PIXEL_FORMAT_UNKNOWN; + break; } + return RETRO_PIXEL_FORMAT_UNKNOWN; } LibretroHostDisplay::LibretroHostDisplay() { retro_pixel_format pf = RETRO_PIXEL_FORMAT_RGB565; - if (!g_retro_environment_callback(RETRO_ENVIRONMENT_SET_PIXEL_FORMAT, &pf)) - Log_ErrorPrint("Failed to set pixel format to RGB565"); - else + if (g_retro_environment_callback(RETRO_ENVIRONMENT_SET_PIXEL_FORMAT, &pf)) m_current_pixel_format = pf; } @@ -43,11 +40,7 @@ bool LibretroHostDisplay::CheckPixelFormat(retro_pixel_format new_format) return true; if (!g_retro_environment_callback(RETRO_ENVIRONMENT_SET_PIXEL_FORMAT, &new_format)) - { - Log_ErrorPrintf("g_retro_environment_callback(RETRO_ENVIRONMENT_SET_PIXEL_FORMAT, %u) failed", - static_cast(new_format)); return false; - } if (!g_libretro_host_interface.UpdateSystemAVInfo(false)) return false; @@ -260,12 +253,6 @@ void LibretroHostDisplay::EndSetDisplayPixels() // noop } -void LibretroHostDisplay::SetVSync(bool enabled) -{ - // The libretro frontend controls this. - Log_DevPrintf("Ignoring SetVSync(%u)", BoolToUInt32(enabled)); -} - bool LibretroHostDisplay::Render() { if (HasDisplayTexture()) @@ -277,9 +264,7 @@ bool LibretroHostDisplay::Render() ClearDisplayTexture(); } else - { g_retro_video_refresh_callback(nullptr, 0, 0, 0); - } return true; } diff --git a/src/libretro/libretro_host_display.h b/src/libretro/libretro_host_display.h index 05c1ef84..ffcfcce0 100644 --- a/src/libretro/libretro_host_display.h +++ b/src/libretro/libretro_host_display.h @@ -45,8 +45,6 @@ public: bool DownloadTexture(const void* texture_handle, HostDisplayPixelFormat texture_format, u32 x, u32 y, u32 width, u32 height, void* out_data, u32 out_data_stride) override; - void SetVSync(bool enabled) override; - bool Render() override; bool RenderScreenshot(u32 width, u32 height, std::vector* out_pixels, u32* out_stride, HostDisplayPixelFormat* out_format) override; diff --git a/src/libretro/libretro_host_interface.cpp b/src/libretro/libretro_host_interface.cpp index ab411e70..a9ce6925 100644 --- a/src/libretro/libretro_host_interface.cpp +++ b/src/libretro/libretro_host_interface.cpp @@ -321,10 +321,6 @@ void LibretroHostInterface::retro_get_system_av_info(struct retro_system_av_info const bool use_resolution_scale = (g_settings.gpu_renderer != GPURenderer::Software); GetSystemAVInfo(info, use_resolution_scale); m_last_aspect_ratio = info->geometry.aspect_ratio; - - Log_InfoPrintf("base = %ux%u, max = %ux%u, aspect ratio = %.2f, fps = %.2f", info->geometry.base_width, - info->geometry.base_height, info->geometry.max_width, info->geometry.max_height, - info->geometry.aspect_ratio, info->timing.fps); } void LibretroHostInterface::GetSystemAVInfo(struct retro_system_av_info* info, bool use_resolution_scale) @@ -347,16 +343,8 @@ bool LibretroHostInterface::UpdateSystemAVInfo(bool use_resolution_scale) { struct retro_system_av_info avi; GetSystemAVInfo(&avi, use_resolution_scale); - - Log_InfoPrintf("base = %ux%u, max = %ux%u, aspect ratio = %.2f, fps = %.2f", avi.geometry.base_width, - avi.geometry.base_height, avi.geometry.max_width, avi.geometry.max_height, avi.geometry.aspect_ratio, - avi.timing.fps); - if (!g_retro_environment_callback(RETRO_ENVIRONMENT_SET_SYSTEM_AV_INFO, &avi)) - { - Log_ErrorPrintf("Failed to update system AV info on resolution change"); return false; - } m_display->ResizeRenderWindow(avi.geometry.base_width, avi.geometry.base_height); m_last_aspect_ratio = avi.geometry.aspect_ratio; @@ -369,11 +357,7 @@ void LibretroHostInterface::UpdateGeometry() const bool use_resolution_scale = (g_settings.gpu_renderer != GPURenderer::Software); GetSystemAVInfo(&avi, use_resolution_scale); - Log_InfoPrintf("base = %ux%u, max = %ux%u, aspect ratio = %.2f", avi.geometry.base_width, avi.geometry.base_height, - avi.geometry.max_width, avi.geometry.max_height, avi.geometry.aspect_ratio); - - if (!g_retro_environment_callback(RETRO_ENVIRONMENT_SET_GEOMETRY, &avi.geometry)) - Log_WarningPrint("RETRO_ENVIRONMENT_SET_GEOMETRY failed"); + g_retro_environment_callback(RETRO_ENVIRONMENT_SET_GEOMETRY, &avi.geometry); m_display->ResizeRenderWindow(avi.geometry.base_width, avi.geometry.base_height); m_last_aspect_ratio = avi.geometry.aspect_ratio; @@ -625,11 +609,7 @@ bool LibretroHostInterface::retro_serialize(void* data, size_t size) { std::unique_ptr stream = ByteStream_CreateMemoryStream(data, static_cast(size)); if (!System::SaveState(stream.get(), 0)) - { - Log_ErrorPrintf("Failed to save state to memory stream"); return false; - } - return true; } @@ -637,11 +617,7 @@ bool LibretroHostInterface::retro_unserialize(const void* data, size_t size) { std::unique_ptr stream = ByteStream_CreateReadOnlyMemoryStream(data, static_cast(size)); if (!System::LoadState(stream.get(), false)) - { - Log_ErrorPrintf("Failed to load save state from memory stream"); return false; - } - return true; } @@ -983,38 +959,31 @@ void LibretroHostInterface::LoadSettings() case RETRO_DEVICE_JOYPAD: case RETRO_DEVICE_PS_CONTROLLER: g_settings.controller_types[i] = ControllerType::DigitalController; - Log_InfoPrintf("Port %u = Digital Controller (Gamepad)", (i + 1)); break; case RETRO_DEVICE_PS_DUALSHOCK: g_settings.controller_types[i] = ControllerType::AnalogController; - Log_InfoPrintf("Port %u = Analog Controller (DualShock)", (i + 1)); break; case RETRO_DEVICE_PS_ANALOG_JOYSTICK: g_settings.controller_types[i] = ControllerType::AnalogJoystick; - Log_InfoPrintf("Port %u = Analog Joystick", (i + 1)); break; case RETRO_DEVICE_PS_NEGCON: g_settings.controller_types[i] = ControllerType::NeGcon; - Log_InfoPrintf("Port %u = NeGcon", (i + 1)); break; case RETRO_DEVICE_PS_GUNCON: g_settings.controller_types[i] = ControllerType::NamcoGunCon; - Log_InfoPrintf("Port %u = Namco GunCon", (i + 1)); break; case RETRO_DEVICE_PS_MOUSE: g_settings.controller_types[i] = ControllerType::PlayStationMouse; - Log_InfoPrintf("Port %u = PlayStation Mouse", (i + 1)); break; case RETRO_DEVICE_NONE: default: g_settings.controller_types[i] = ControllerType::None; - Log_InfoPrintf("Port %u = None", (i + 1)); break; } } diff --git a/src/libretro/libretro_opengl_host_display.cpp b/src/libretro/libretro_opengl_host_display.cpp index 2979d62f..1d04e071 100644 --- a/src/libretro/libretro_opengl_host_display.cpp +++ b/src/libretro/libretro_opengl_host_display.cpp @@ -226,12 +226,6 @@ bool LibretroOpenGLHostDisplay::SetDisplayPixels(HostDisplayPixelFormat format, return true; } -void LibretroOpenGLHostDisplay::SetVSync(bool enabled) -{ - // The libretro frontend controls this. - Log_DevPrintf("Ignoring SetVSync(%u)", BoolToUInt32(enabled)); -} - const char* LibretroOpenGLHostDisplay::GetGLSLVersionString() const { if (GetRenderAPI() == RenderAPI::OpenGLES) @@ -407,15 +401,10 @@ bool LibretroOpenGLHostDisplay::InitializeRenderDevice(std::string_view shader_c glDebugMessageCallback(GLDebugCallback, nullptr); glEnable(GL_DEBUG_OUTPUT); - // glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS); } if (!CreateResources()) return false; - - // Start with vsync on. - SetVSync(true); - return true; } diff --git a/src/libretro/libretro_opengl_host_display.h b/src/libretro/libretro_opengl_host_display.h index 58c2956f..60746f20 100644 --- a/src/libretro/libretro_opengl_host_display.h +++ b/src/libretro/libretro_opengl_host_display.h @@ -65,8 +65,6 @@ public: void EndSetDisplayPixels() override; bool SetDisplayPixels(HostDisplayPixelFormat format, u32 width, u32 height, const void* buffer, u32 pitch) override; - void SetVSync(bool enabled) override; - bool Render() override; bool RenderScreenshot(u32 width, u32 height, std::vector* out_pixels, u32* out_stride, HostDisplayPixelFormat* out_format) override; diff --git a/src/libretro/libretro_vulkan_host_display.cpp b/src/libretro/libretro_vulkan_host_display.cpp index f539f6db..c243feed 100644 --- a/src/libretro/libretro_vulkan_host_display.cpp +++ b/src/libretro/libretro_vulkan_host_display.cpp @@ -243,12 +243,6 @@ void LibretroVulkanHostDisplay::EndSetDisplayPixels() static_cast(m_display_texture_view_height)); } -void LibretroVulkanHostDisplay::SetVSync(bool enabled) -{ - // The libretro frontend controls this. - Log_DevPrintf("Ignoring SetVSync(%u)", BoolToUInt32(enabled)); -} - static bool RetroCreateVulkanDevice(struct retro_vulkan_context* context, VkInstance instance, VkPhysicalDevice gpu, VkSurfaceKHR surface, PFN_vkGetInstanceProcAddr get_instance_proc_addr, const char** required_device_extensions, unsigned num_required_device_extensions, @@ -669,10 +663,7 @@ void LibretroVulkanHostDisplay::RenderDisplay(s32 left, s32 top, s32 width, s32 VkDescriptorSet ds = g_vulkan_context->AllocateDescriptorSet(m_descriptor_set_layout); if (ds == VK_NULL_HANDLE) - { - Log_ErrorPrintf("Skipping rendering display because of no descriptor set"); return; - } { const Vulkan::Texture* vktex = static_cast(texture_handle); diff --git a/src/libretro/libretro_vulkan_host_display.h b/src/libretro/libretro_vulkan_host_display.h index 4a7c9cc5..f0e980a7 100644 --- a/src/libretro/libretro_vulkan_host_display.h +++ b/src/libretro/libretro_vulkan_host_display.h @@ -57,8 +57,6 @@ public: u32* out_pitch) override; void EndSetDisplayPixels() override; - void SetVSync(bool enabled) override; - bool Render() override; bool RenderScreenshot(u32 width, u32 height, std::vector* out_pixels, u32* out_stride, HostDisplayPixelFormat* out_format) override; diff --git a/src/libretro/main.cpp b/src/libretro/main.cpp index 1ec9d94c..ba5bb300 100644 --- a/src/libretro/main.cpp +++ b/src/libretro/main.cpp @@ -1,8 +1,6 @@ #include "common/assert.h" -#include "common/log.h" #include "libretro_host_interface.h" #include "scmversion/scmversion.h" -Log_SetChannel(Main); RETRO_API unsigned retro_api_version(void) { @@ -51,7 +49,6 @@ RETRO_API void retro_set_controller_port_device(unsigned port, unsigned device) RETRO_API void retro_reset(void) { - Log_InfoPrint("retro_reset()"); g_libretro_host_interface.ResetSystem(); } @@ -77,25 +74,21 @@ RETRO_API bool retro_unserialize(const void* data, size_t size) RETRO_API void retro_cheat_reset(void) { - Log_InfoPrint("retro_cheat_reset()"); g_libretro_host_interface.retro_cheat_reset(); } RETRO_API void retro_cheat_set(unsigned index, bool enabled, const char* code) { - Log_InfoPrintf("retro_cheat_set(%u, %u, %s)", index, enabled, code); g_libretro_host_interface.retro_cheat_set(index, enabled, code); } RETRO_API bool retro_load_game(const struct retro_game_info* game) { - Log_InfoPrintf("retro_load_game(%s)", game->path); return g_libretro_host_interface.retro_load_game(game); } RETRO_API bool retro_load_game_special(unsigned game_type, const struct retro_game_info* info, size_t num_info) { - Log_ErrorPrintf("retro_load_game_special()"); return false; }