diff --git a/externals/glad/Readme.md b/externals/glad/Readme.md index 5c16ed29ea..e503ac7a34 100644 --- a/externals/glad/Readme.md +++ b/externals/glad/Readme.md @@ -1,5 +1,5 @@ These files were generated by the [glad](https://github.com/Dav1dde/glad) OpenGL loader generator and have been checked in as-is. You can re-generate them using glad with the following command: ``` -python -m glad --profile core --out-path glad/ --api "gl=4.6,gles2=3.2" --generator=c +python -m glad --profile core --out-path glad/ --api "gl=4.3,gles2=3.2" --generator=c ``` diff --git a/src/citra/citra.cpp b/src/citra/citra.cpp index ea3e6b1029..f8ab9c55aa 100644 --- a/src/citra/citra.cpp +++ b/src/citra/citra.cpp @@ -364,8 +364,8 @@ int main(int argc, char** argv) { EmuWindow_SDL2::InitializeSDL2(); - const auto CreateEmuWindow = [](bool fullscreen, - bool is_secondary) -> std::unique_ptr { + const auto create_emu_window = [](bool fullscreen, + bool is_secondary) -> std::unique_ptr { switch (Settings::values.graphics_api.GetValue()) { case Settings::GraphicsAPI::OpenGL: return std::make_unique(fullscreen, is_secondary); @@ -374,11 +374,11 @@ int main(int argc, char** argv) { } }; - const auto emu_window{CreateEmuWindow(fullscreen, false)}; + const auto emu_window{create_emu_window(fullscreen, false)}; const bool use_secondary_window{ Settings::values.layout_option.GetValue() == Settings::LayoutOption::SeparateWindows && Settings::values.graphics_api.GetValue() != Settings::GraphicsAPI::Software}; - const auto secondary_window = use_secondary_window ? CreateEmuWindow(false, true) : nullptr; + const auto secondary_window = use_secondary_window ? create_emu_window(false, true) : nullptr; const auto scope = emu_window->Acquire(); @@ -448,8 +448,8 @@ int main(int argc, char** argv) { Core::Movie::GetInstance().StartRecording(movie_record, movie_record_author); } if (!dump_video.empty()) { - Layout::FramebufferLayout layout{ - Layout::FrameLayoutFromResolutionScale(VideoCore::GetResolutionScaleFactor())}; + Layout::FramebufferLayout layout{Layout::FrameLayoutFromResolutionScale( + VideoCore::g_renderer->GetResolutionScaleFactor())}; system.VideoDumper().StartDumping(dump_video, layout); } diff --git a/src/citra_qt/bootmanager.cpp b/src/citra_qt/bootmanager.cpp index be58060b13..3cb1c904d5 100644 --- a/src/citra_qt/bootmanager.cpp +++ b/src/citra_qt/bootmanager.cpp @@ -176,7 +176,7 @@ public: } ~OpenGLSharedContext() { - context->doneCurrent(); + OpenGLSharedContext::DoneCurrent(); } void SwapBuffers() override { @@ -196,7 +196,9 @@ public: } void DoneCurrent() override { - context->doneCurrent(); + if (QOpenGLContext::currentContext() == context.get()) { + context->doneCurrent(); + } } QOpenGLContext* GetShareContext() const { @@ -257,7 +259,9 @@ public: } context->MakeCurrent(); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0); - VideoCore::g_renderer->TryPresent(100, is_secondary); + if (VideoCore::g_renderer) { + VideoCore::g_renderer->TryPresent(100, is_secondary); + } context->SwapBuffers(); glFinish(); } @@ -633,7 +637,7 @@ void GRenderWindow::ReleaseRenderTarget() { void GRenderWindow::CaptureScreenshot(u32 res_scale, const QString& screenshot_path) { if (res_scale == 0) { - res_scale = VideoCore::GetResolutionScaleFactor(); + res_scale = VideoCore::g_renderer->GetResolutionScaleFactor(); } const auto layout{Layout::FrameLayoutFromResolutionScale(res_scale, is_secondary)}; diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index efa6c81165..35e6aa23aa 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp @@ -1173,8 +1173,8 @@ void GMainWindow::BootGame(const QString& filename) { } if (video_dumping_on_start) { - Layout::FramebufferLayout layout{ - Layout::FrameLayoutFromResolutionScale(VideoCore::GetResolutionScaleFactor())}; + Layout::FramebufferLayout layout{Layout::FrameLayoutFromResolutionScale( + VideoCore::g_renderer->GetResolutionScaleFactor())}; if (!Core::System::GetInstance().VideoDumper().StartDumping( video_dumping_path.toStdString(), layout)) { @@ -2195,8 +2195,8 @@ void GMainWindow::OnStartVideoDumping() { } const auto path = dialog.GetFilePath(); if (emulation_running) { - Layout::FramebufferLayout layout{ - Layout::FrameLayoutFromResolutionScale(VideoCore::GetResolutionScaleFactor())}; + Layout::FramebufferLayout layout{Layout::FrameLayoutFromResolutionScale( + VideoCore::g_renderer->GetResolutionScaleFactor())}; if (!Core::System::GetInstance().VideoDumper().StartDumping(path.toStdString(), layout)) { QMessageBox::critical( this, tr("Citra"), diff --git a/src/common/settings.cpp b/src/common/settings.cpp index 46aa2e8e1c..d10c729324 100644 --- a/src/common/settings.cpp +++ b/src/common/settings.cpp @@ -55,7 +55,6 @@ void Apply() { VideoCore::g_hw_shader_enabled = values.use_hw_shader.GetValue(); VideoCore::g_separable_shader_enabled = values.separable_shader.GetValue(); VideoCore::g_hw_shader_accurate_mul = values.shaders_accurate_mul.GetValue(); - VideoCore::g_use_disk_shader_cache = values.use_disk_shader_cache.GetValue(); #ifndef ANDROID if (VideoCore::g_renderer) { @@ -63,10 +62,13 @@ void Apply() { } #endif - VideoCore::g_renderer_bg_color_update_requested = true; - VideoCore::g_renderer_sampler_update_requested = true; - VideoCore::g_renderer_shader_update_requested = true; - VideoCore::g_texture_filter_update_requested = true; + if (VideoCore::g_renderer) { + auto& settings = VideoCore::g_renderer->Settings(); + settings.bg_color_update_requested = true; + settings.sampler_update_requested = true; + settings.shader_update_requested = true; + settings.texture_filter_update_requested = true; + } auto& system = Core::System::GetInstance(); if (system.IsPoweredOn()) { @@ -114,6 +116,7 @@ void LogSettings() { log_setting("Core_CPUClockPercentage", values.cpu_clock_percentage.GetValue()); log_setting("Renderer_UseGLES", values.use_gles.GetValue()); log_setting("Renderer_GraphicsAPI", GetGraphicsAPIName(values.graphics_api.GetValue())); + log_setting("Renderer_Debug", values.renderer_debug.GetValue()); log_setting("Renderer_UseHwShader", values.use_hw_shader.GetValue()); log_setting("Renderer_SeparableShader", values.separable_shader.GetValue()); log_setting("Renderer_ShadersAccurateMul", values.shaders_accurate_mul.GetValue()); diff --git a/src/common/settings.h b/src/common/settings.h index bd25c1b13b..9180a52c9e 100644 --- a/src/common/settings.h +++ b/src/common/settings.h @@ -429,7 +429,7 @@ struct Values { SwitchableSetting shaders_accurate_mul{true, "shaders_accurate_mul"}; SwitchableSetting use_vsync_new{true, "use_vsync_new"}; Setting use_shader_jit{true, "use_shader_jit"}; - SwitchableSetting resolution_factor{1, 0, 10, "resolution_factor"}; + SwitchableSetting resolution_factor{1, 0, 10, "resolution_factor"}; SwitchableSetting frame_limit{100, 0, 1000, "frame_limit"}; SwitchableSetting texture_filter_name{"none", "texture_filter_name"}; diff --git a/src/core/core.cpp b/src/core/core.cpp index 39bafcd404..4151cb4c6f 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -74,8 +74,7 @@ System::~System() = default; System::ResultStatus System::RunLoop(bool tight_loop) { status = ResultStatus::Success; - if (std::any_of(cpu_cores.begin(), cpu_cores.end(), - [](std::shared_ptr ptr) { return ptr == nullptr; })) { + if (!IsPoweredOn()) { return ResultStatus::ErrorNotInitialized; } @@ -435,7 +434,7 @@ System::ResultStatus System::Init(Frontend::EmuWindow& emu_window, LOG_DEBUG(Core, "Initialized OK"); - initalized = true; + is_powered_on = true; return ResultStatus::Success; } @@ -537,6 +536,8 @@ void System::Shutdown(bool is_deserializing) { perf_stats ? perf_stats->GetMeanFrametime() : 0); // Shutdown emulation session + is_powered_on = false; + VideoCore::Shutdown(); HW::Shutdown(); if (!is_deserializing) { diff --git a/src/core/core.h b/src/core/core.h index 978186eaa1..d5b82b98ec 100644 --- a/src/core/core.h +++ b/src/core/core.h @@ -4,6 +4,7 @@ #pragma once +#include #include #include #include @@ -151,10 +152,7 @@ public: * @returns True if the emulated system is powered on, otherwise false. */ [[nodiscard]] bool IsPoweredOn() const { - return cpu_cores.size() > 0 && - std::all_of(cpu_cores.begin(), cpu_cores.end(), - [](std::shared_ptr ptr) { return ptr != nullptr; }); - ; + return is_powered_on; } /** @@ -383,7 +381,7 @@ private: private: static System s_instance; - bool initalized = false; + std::atomic_bool is_powered_on{}; ResultStatus status = ResultStatus::Success; std::string status_details = ""; diff --git a/src/video_core/rasterizer_cache/rasterizer_cache.cpp b/src/video_core/rasterizer_cache/rasterizer_cache.cpp index 394bcca003..1855f58259 100644 --- a/src/video_core/rasterizer_cache/rasterizer_cache.cpp +++ b/src/video_core/rasterizer_cache/rasterizer_cache.cpp @@ -9,6 +9,7 @@ #include "common/microprofile.h" #include "video_core/pica_state.h" #include "video_core/rasterizer_cache/rasterizer_cache.h" +#include "video_core/renderer_base.h" #include "video_core/renderer_opengl/gl_format_reinterpreter.h" #include "video_core/renderer_opengl/texture_downloader_es.h" #include "video_core/renderer_opengl/texture_filters/texture_filterer.h" @@ -239,8 +240,9 @@ static Surface FindMatch(const SurfaceCache& surface_cache, const SurfaceParams& return match_surface; } -RasterizerCacheOpenGL::RasterizerCacheOpenGL() { - resolution_scale_factor = VideoCore::GetResolutionScaleFactor(); +RasterizerCacheOpenGL::RasterizerCacheOpenGL(VideoCore::RendererBase& renderer_) + : renderer{renderer_} { + resolution_scale_factor = renderer.GetResolutionScaleFactor(); texture_filterer = std::make_unique( Settings::values.texture_filter_name.GetValue(), resolution_scale_factor); format_reinterpreter = std::make_unique(); @@ -588,15 +590,14 @@ SurfaceSurfaceRect_Tuple RasterizerCacheOpenGL::GetFramebufferSurfaces( const auto& config = regs.framebuffer.framebuffer; // Update resolution_scale_factor and reset cache if changed - const bool resolution_scale_changed = - resolution_scale_factor != VideoCore::GetResolutionScaleFactor(); + const u32 scale_factor = renderer.GetResolutionScaleFactor(); + const bool resolution_scale_changed = resolution_scale_factor != scale_factor; const bool texture_filter_changed = - VideoCore::g_texture_filter_update_requested.exchange(false) && - texture_filterer->Reset(Settings::values.texture_filter_name.GetValue(), - VideoCore::GetResolutionScaleFactor()); + renderer.Settings().texture_filter_update_requested.exchange(false) && + texture_filterer->Reset(Settings::values.texture_filter_name.GetValue(), scale_factor); if (resolution_scale_changed || texture_filter_changed) { - resolution_scale_factor = VideoCore::GetResolutionScaleFactor(); + resolution_scale_factor = scale_factor; FlushAll(); while (!surface_cache.empty()) UnregisterSurface(*surface_cache.begin()->second.begin()); diff --git a/src/video_core/rasterizer_cache/rasterizer_cache.h b/src/video_core/rasterizer_cache/rasterizer_cache.h index 2305dff860..a3b974e7f2 100644 --- a/src/video_core/rasterizer_cache/rasterizer_cache.h +++ b/src/video_core/rasterizer_cache/rasterizer_cache.h @@ -9,6 +9,10 @@ #include "video_core/rasterizer_cache/surface_params.h" #include "video_core/texture/texture_decode.h" +namespace VideoCore { +class RendererBase; +} + namespace OpenGL { enum class ScaleMatch { @@ -23,7 +27,7 @@ class FormatReinterpreterOpenGL; class RasterizerCacheOpenGL : NonCopyable { public: - RasterizerCacheOpenGL(); + RasterizerCacheOpenGL(VideoCore::RendererBase& renderer); ~RasterizerCacheOpenGL(); /// Blit one surface's texture to another @@ -108,6 +112,7 @@ private: /// Increase/decrease the number of surface in pages touching the specified region void UpdatePagesCachedCount(PAddr addr, u32 size, int delta); + VideoCore::RendererBase& renderer; TextureRuntime runtime; SurfaceCache surface_cache; PageMap cached_pages; diff --git a/src/video_core/renderer_base.cpp b/src/video_core/renderer_base.cpp index 90be75287a..d8fb904dd3 100644 --- a/src/video_core/renderer_base.cpp +++ b/src/video_core/renderer_base.cpp @@ -16,6 +16,18 @@ RendererBase::RendererBase(Core::System& system_, Frontend::EmuWindow& window, RendererBase::~RendererBase() = default; +u32 RendererBase::GetResolutionScaleFactor() { + const auto graphics_api = Settings::values.graphics_api.GetValue(); + if (graphics_api == Settings::GraphicsAPI::Software) { + // Software renderer always render at native resolution + return 1; + } + + const u32 scale_factor = Settings::values.resolution_factor.GetValue(); + return scale_factor != 0 ? scale_factor + : render_window.GetFramebufferLayout().GetScalingRatio(); +} + void RendererBase::UpdateCurrentFramebufferLayout(bool is_portrait_mode) { const auto update_layout = [is_portrait_mode](Frontend::EmuWindow& window) { const Layout::FramebufferLayout& layout = window.GetFramebufferLayout(); @@ -43,19 +55,19 @@ void RendererBase::EndFrame() { } bool RendererBase::IsScreenshotPending() const { - return renderer_settings.screenshot_requested; + return settings.screenshot_requested; } void RendererBase::RequestScreenshot(void* data, std::function callback, const Layout::FramebufferLayout& layout) { - if (renderer_settings.screenshot_requested) { + if (settings.screenshot_requested) { LOG_ERROR(Render, "A screenshot is already requested or in progress, ignoring the request"); return; } - renderer_settings.screenshot_bits = data; - renderer_settings.screenshot_complete_callback = callback; - renderer_settings.screenshot_framebuffer_layout = layout; - renderer_settings.screenshot_requested = true; + settings.screenshot_bits = data; + settings.screenshot_complete_callback = callback; + settings.screenshot_framebuffer_layout = layout; + settings.screenshot_requested = true; } } // namespace VideoCore diff --git a/src/video_core/renderer_base.h b/src/video_core/renderer_base.h index ab9c4d3336..c03800b398 100644 --- a/src/video_core/renderer_base.h +++ b/src/video_core/renderer_base.h @@ -24,6 +24,11 @@ struct RendererSettings { void* screenshot_bits{}; std::function screenshot_complete_callback; Layout::FramebufferLayout screenshot_framebuffer_layout; + // Renderer + std::atomic_bool texture_filter_update_requested{false}; + std::atomic_bool bg_color_update_requested{false}; + std::atomic_bool sampler_update_requested{false}; + std::atomic_bool shader_update_requested{false}; }; class RendererBase : NonCopyable { @@ -54,6 +59,9 @@ public: /// Synchronizes fixed function renderer state virtual void Sync() {} + /// Returns the resolution scale factor relative to the native 3DS screen resolution + u32 GetResolutionScaleFactor(); + /// Updates the framebuffer layout of the contained render window handle. void UpdateCurrentFramebufferLayout(bool is_portrait_mode = {}); @@ -80,11 +88,11 @@ public: } [[nodiscard]] RendererSettings& Settings() { - return renderer_settings; + return settings; } [[nodiscard]] const RendererSettings& Settings() const { - return renderer_settings; + return settings; } /// Returns true if a screenshot is being processed @@ -96,7 +104,7 @@ public: protected: Core::System& system; - RendererSettings renderer_settings; + RendererSettings settings; Frontend::EmuWindow& render_window; ///< Reference to the render window handle. Frontend::EmuWindow* secondary_window; ///< Reference to the secondary render window handle. f32 current_fps = 0.0f; ///< Current framerate, should be set by the renderer diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index 1cf3f47605..19f076dc9b 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp @@ -64,11 +64,10 @@ GLenum MakeAttributeType(Pica::PipelineRegs::VertexAttributeFormat format) { } // Anonymous namespace -RasterizerOpenGL::RasterizerOpenGL(Memory::MemorySystem& memory, Frontend::EmuWindow& emu_window, +RasterizerOpenGL::RasterizerOpenGL(Memory::MemorySystem& memory, VideoCore::RendererBase& renderer, Driver& driver_) - : VideoCore::RasterizerAccelerated{memory}, driver{driver_}, vertex_buffer{driver, - GL_ARRAY_BUFFER, - VERTEX_BUFFER_SIZE}, + : VideoCore::RasterizerAccelerated{memory}, driver{driver_}, res_cache{renderer}, + vertex_buffer{driver, GL_ARRAY_BUFFER, VERTEX_BUFFER_SIZE}, uniform_buffer{driver, GL_UNIFORM_BUFFER, UNIFORM_BUFFER_SIZE}, index_buffer{driver, GL_ELEMENT_ARRAY_BUFFER, INDEX_BUFFER_SIZE}, texture_buffer{driver, GL_TEXTURE_BUFFER, TEXTURE_BUFFER_SIZE}, texture_lf_buffer{ @@ -167,12 +166,14 @@ RasterizerOpenGL::RasterizerOpenGL(Memory::MemorySystem& memory, Frontend::EmuWi #ifdef __APPLE__ if (driver.GetVendor() == Vendor::Intel) { shader_program_manager = std::make_unique( - emu_window, driver, VideoCore::g_separable_shader_enabled); + renderer.GetRenderWindow(), driver, VideoCore::g_separable_shader_enabled); } else { - shader_program_manager = std::make_unique(emu_window, driver, true); + shader_program_manager = + std::make_unique(renderer.GetRenderWindow(), driver, true); } #else - shader_program_manager = std::make_unique(emu_window, driver, !GLES); + shader_program_manager = + std::make_unique(renderer.GetRenderWindow(), driver, !GLES); #endif glEnable(GL_BLEND); diff --git a/src/video_core/renderer_opengl/gl_rasterizer.h b/src/video_core/renderer_opengl/gl_rasterizer.h index 6f44e58506..575420df01 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.h +++ b/src/video_core/renderer_opengl/gl_rasterizer.h @@ -14,8 +14,8 @@ #include "video_core/renderer_opengl/gl_stream_buffer.h" #include "video_core/shader/shader.h" -namespace Frontend { -class EmuWindow; +namespace VideoCore { +class RendererBase; } namespace OpenGL { @@ -25,7 +25,7 @@ class ShaderProgramManager; class RasterizerOpenGL : public VideoCore::RasterizerAccelerated { public: - explicit RasterizerOpenGL(Memory::MemorySystem& memory, Frontend::EmuWindow& emu_window, + explicit RasterizerOpenGL(Memory::MemorySystem& memory, VideoCore::RendererBase& renderer, Driver& driver); ~RasterizerOpenGL() override; diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp index cd1c20a984..f6f204b538 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.cpp +++ b/src/video_core/renderer_opengl/renderer_opengl.cpp @@ -360,7 +360,7 @@ RendererOpenGL::RendererOpenGL(Core::System& system, Frontend::EmuWindow& window } frame_dumper.mailbox = std::make_unique(); InitOpenGLObjects(); - rasterizer = std::make_unique(system.Memory(), render_window, driver); + rasterizer = std::make_unique(system.Memory(), *this, driver); } RendererOpenGL::~RendererOpenGL() = default; @@ -401,7 +401,7 @@ void RendererOpenGL::SwapBuffers() { } void RendererOpenGL::RenderScreenshot() { - if (renderer_settings.screenshot_requested.exchange(false)) { + if (settings.screenshot_requested.exchange(false)) { // Draw this frame to the screenshot framebuffer screenshot_framebuffer.Create(); GLuint old_read_fb = state.draw.read_framebuffer; @@ -409,7 +409,7 @@ void RendererOpenGL::RenderScreenshot() { state.draw.read_framebuffer = state.draw.draw_framebuffer = screenshot_framebuffer.handle; state.Apply(); - const auto layout{renderer_settings.screenshot_framebuffer_layout}; + const Layout::FramebufferLayout layout{settings.screenshot_framebuffer_layout}; GLuint renderbuffer; glGenRenderbuffers(1, &renderbuffer); @@ -421,7 +421,7 @@ void RendererOpenGL::RenderScreenshot() { DrawScreens(layout, false); glReadPixels(0, 0, layout.width, layout.height, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, - renderer_settings.screenshot_bits); + settings.screenshot_bits); screenshot_framebuffer.Release(); state.draw.read_framebuffer = old_read_fb; @@ -429,7 +429,7 @@ void RendererOpenGL::RenderScreenshot() { state.Apply(); glDeleteRenderbuffers(1, &renderbuffer); - renderer_settings.screenshot_complete_callback(); + settings.screenshot_complete_callback(); } } @@ -808,7 +808,7 @@ void RendererOpenGL::DrawSingleScreenRotated(const ScreenInfo& screen_info, floa // As this is the "DrawSingleScreenRotated" function, the output resolution dimensions have been // swapped. If a non-rotated draw-screen function were to be added for book-mode games, those // should probably be set to the standard (w, h, 1.0 / w, 1.0 / h) ordering. - const u16 scale_factor = VideoCore::GetResolutionScaleFactor(); + const u32 scale_factor = GetResolutionScaleFactor(); glUniform4f(uniform_i_resolution, static_cast(screen_info.texture.width * scale_factor), static_cast(screen_info.texture.height * scale_factor), 1.0f / static_cast(screen_info.texture.width * scale_factor), @@ -837,7 +837,7 @@ void RendererOpenGL::DrawSingleScreen(const ScreenInfo& screen_info, float x, fl ScreenRectVertex(x + w, y + h, texcoords.top, texcoords.left), }}; - const u16 scale_factor = VideoCore::GetResolutionScaleFactor(); + const u32 scale_factor = GetResolutionScaleFactor(); glUniform4f(uniform_i_resolution, static_cast(screen_info.texture.width * scale_factor), static_cast(screen_info.texture.height * scale_factor), 1.0f / static_cast(screen_info.texture.width * scale_factor), @@ -871,7 +871,7 @@ void RendererOpenGL::DrawSingleScreenStereoRotated(const ScreenInfo& screen_info ScreenRectVertex(x + w, y + h, texcoords.top, texcoords.right), }}; - const u16 scale_factor = VideoCore::GetResolutionScaleFactor(); + const u32 scale_factor = GetResolutionScaleFactor(); glUniform4f(uniform_i_resolution, static_cast(screen_info_l.texture.width * scale_factor), static_cast(screen_info_l.texture.height * scale_factor), @@ -906,7 +906,7 @@ void RendererOpenGL::DrawSingleScreenStereo(const ScreenInfo& screen_info_l, ScreenRectVertex(x + w, y + h, texcoords.top, texcoords.left), }}; - const u16 scale_factor = VideoCore::GetResolutionScaleFactor(); + const u32 scale_factor = GetResolutionScaleFactor(); glUniform4f(uniform_i_resolution, static_cast(screen_info_l.texture.width * scale_factor), static_cast(screen_info_l.texture.height * scale_factor), @@ -933,18 +933,18 @@ void RendererOpenGL::DrawSingleScreenStereo(const ScreenInfo& screen_info_l, * Draws the emulated screens to the emulator window. */ void RendererOpenGL::DrawScreens(const Layout::FramebufferLayout& layout, bool flipped) { - if (VideoCore::g_renderer_bg_color_update_requested.exchange(false)) { + if (settings.bg_color_update_requested.exchange(false)) { // Update background color before drawing glClearColor(Settings::values.bg_red.GetValue(), Settings::values.bg_green.GetValue(), Settings::values.bg_blue.GetValue(), 0.0f); } - if (VideoCore::g_renderer_sampler_update_requested.exchange(false)) { + if (settings.sampler_update_requested.exchange(false)) { // Set the new filtering mode for the sampler ReloadSampler(); } - if (VideoCore::g_renderer_shader_update_requested.exchange(false)) { + if (settings.shader_update_requested.exchange(false)) { // Update fragment shader before drawing shader.Release(); // Link shaders and get variable locations diff --git a/src/video_core/video_core.cpp b/src/video_core/video_core.cpp index 9b2caac226..32ae4e8af7 100644 --- a/src/video_core/video_core.cpp +++ b/src/video_core/video_core.cpp @@ -26,11 +26,6 @@ std::atomic g_shader_jit_enabled; std::atomic g_hw_shader_enabled; std::atomic g_separable_shader_enabled; std::atomic g_hw_shader_accurate_mul; -std::atomic g_use_disk_shader_cache; -std::atomic g_renderer_bg_color_update_requested; -std::atomic g_renderer_sampler_update_requested; -std::atomic g_renderer_shader_update_requested; -std::atomic g_texture_filter_update_requested; Memory::MemorySystem* g_memory; @@ -64,18 +59,6 @@ void Shutdown() { LOG_DEBUG(Render, "shutdown OK"); } -u16 GetResolutionScaleFactor() { - const auto graphics_api = Settings::values.graphics_api.GetValue(); - if (graphics_api == Settings::GraphicsAPI::Software) { - // Software renderer always render at native resolution - return 1; - } - - return Settings::values.resolution_factor.GetValue() - ? Settings::values.resolution_factor.GetValue() - : g_renderer->GetRenderWindow().GetFramebufferLayout().GetScalingRatio(); -} - template void serialize(Archive& ar, const unsigned int) { ar& Pica::g_state; diff --git a/src/video_core/video_core.h b/src/video_core/video_core.h index c91e241f40..47de337af9 100644 --- a/src/video_core/video_core.h +++ b/src/video_core/video_core.h @@ -37,11 +37,6 @@ extern std::atomic g_shader_jit_enabled; extern std::atomic g_hw_shader_enabled; extern std::atomic g_separable_shader_enabled; extern std::atomic g_hw_shader_accurate_mul; -extern std::atomic g_use_disk_shader_cache; -extern std::atomic g_renderer_bg_color_update_requested; -extern std::atomic g_renderer_sampler_update_requested; -extern std::atomic g_renderer_shader_update_requested; -extern std::atomic g_texture_filter_update_requested; extern Memory::MemorySystem* g_memory; @@ -52,8 +47,6 @@ void Init(Frontend::EmuWindow& emu_window, Frontend::EmuWindow* secondary_window /// Shutdown the video core void Shutdown(); -u16 GetResolutionScaleFactor(); - template void serialize(Archive& ar, const unsigned int file_version);