summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2018-08-11 00:39:37 +0200
committerLioncash <mathew1800@gmail.com>2018-08-11 01:00:09 +0200
commit20c2928c2b157b8a322a128732cd00cabbfa9d6d (patch)
treef7db86f1b27135d7cc352c6eb5de4f2949d7e0f4
parentrenderer_base: Remove unused kFramebuffer enumeration (diff)
downloadyuzu-20c2928c2b157b8a322a128732cd00cabbfa9d6d.tar
yuzu-20c2928c2b157b8a322a128732cd00cabbfa9d6d.tar.gz
yuzu-20c2928c2b157b8a322a128732cd00cabbfa9d6d.tar.bz2
yuzu-20c2928c2b157b8a322a128732cd00cabbfa9d6d.tar.lz
yuzu-20c2928c2b157b8a322a128732cd00cabbfa9d6d.tar.xz
yuzu-20c2928c2b157b8a322a128732cd00cabbfa9d6d.tar.zst
yuzu-20c2928c2b157b8a322a128732cd00cabbfa9d6d.zip
-rw-r--r--src/core/hle/service/nvflinger/buffer_queue.h1
-rw-r--r--src/core/settings.cpp6
-rw-r--r--src/video_core/gpu.cpp10
-rw-r--r--src/video_core/gpu.h10
-rw-r--r--src/video_core/renderer_base.cpp19
-rw-r--r--src/video_core/renderer_base.h21
-rw-r--r--src/video_core/video_core.cpp2
-rw-r--r--src/video_core/video_core.h5
8 files changed, 44 insertions, 30 deletions
diff --git a/src/core/hle/service/nvflinger/buffer_queue.h b/src/core/hle/service/nvflinger/buffer_queue.h
index f86e1056c..db2e17c0c 100644
--- a/src/core/hle/service/nvflinger/buffer_queue.h
+++ b/src/core/hle/service/nvflinger/buffer_queue.h
@@ -6,6 +6,7 @@
#include <vector>
#include <boost/optional.hpp>
+#include "common/common_funcs.h"
#include "common/math_util.h"
#include "common/swap.h"
#include "core/hle/kernel/event.h"
diff --git a/src/core/settings.cpp b/src/core/settings.cpp
index a4623223d..0da159559 100644
--- a/src/core/settings.cpp
+++ b/src/core/settings.cpp
@@ -7,22 +7,18 @@
#include "core/hle/service/hid/hid.h"
#include "core/settings.h"
#include "video_core/renderer_base.h"
-#include "video_core/video_core.h"
namespace Settings {
Values values = {};
void Apply() {
-
GDBStub::SetServerPort(values.gdbstub_port);
GDBStub::ToggleServer(values.use_gdbstub);
- VideoCore::g_toggle_framelimit_enabled = values.toggle_framelimit;
-
auto& system_instance = Core::System::GetInstance();
if (system_instance.IsPoweredOn()) {
- system_instance.Renderer().UpdateCurrentFramebufferLayout();
+ system_instance.Renderer().RefreshBaseSettings();
}
Service::HID::ReloadInputDevices();
diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp
index 4ff4d71c5..40d323956 100644
--- a/src/video_core/gpu.cpp
+++ b/src/video_core/gpu.cpp
@@ -2,6 +2,7 @@
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
+#include "common/assert.h"
#include "video_core/engines/fermi_2d.h"
#include "video_core/engines/maxwell_3d.h"
#include "video_core/engines/maxwell_compute.h"
@@ -11,6 +12,15 @@
namespace Tegra {
+u32 FramebufferConfig::BytesPerPixel(PixelFormat format) {
+ switch (format) {
+ case PixelFormat::ABGR8:
+ return 4;
+ }
+
+ UNREACHABLE();
+}
+
GPU::GPU(VideoCore::RasterizerInterface& rasterizer) {
memory_manager = std::make_unique<MemoryManager>();
maxwell_3d = std::make_unique<Engines::Maxwell3D>(rasterizer, *memory_manager);
diff --git a/src/video_core/gpu.h b/src/video_core/gpu.h
index 874eddd78..51c838540 100644
--- a/src/video_core/gpu.h
+++ b/src/video_core/gpu.h
@@ -6,7 +6,6 @@
#include <memory>
#include <unordered_map>
-#include <vector>
#include "common/common_types.h"
#include "core/hle/service/nvflinger/buffer_queue.h"
#include "video_core/memory_manager.h"
@@ -65,14 +64,7 @@ struct FramebufferConfig {
/**
* Returns the number of bytes per pixel.
*/
- static u32 BytesPerPixel(PixelFormat format) {
- switch (format) {
- case PixelFormat::ABGR8:
- return 4;
- }
-
- UNREACHABLE();
- }
+ static u32 BytesPerPixel(PixelFormat format);
VAddr address;
u32 offset;
diff --git a/src/video_core/renderer_base.cpp b/src/video_core/renderer_base.cpp
index 3ca350243..e87016429 100644
--- a/src/video_core/renderer_base.cpp
+++ b/src/video_core/renderer_base.cpp
@@ -4,18 +4,23 @@
#include <memory>
#include "core/frontend/emu_window.h"
+#include "core/settings.h"
#include "video_core/renderer_base.h"
#include "video_core/renderer_opengl/gl_rasterizer.h"
namespace VideoCore {
-RendererBase::RendererBase(EmuWindow& window) : render_window{window} {}
+RendererBase::RendererBase(EmuWindow& window) : render_window{window} {
+ RefreshBaseSettings();
+}
+
RendererBase::~RendererBase() = default;
-void RendererBase::UpdateCurrentFramebufferLayout() {
- const Layout::FramebufferLayout& layout = render_window.GetFramebufferLayout();
+void RendererBase::RefreshBaseSettings() {
+ RefreshRasterizerSetting();
+ UpdateCurrentFramebufferLayout();
- render_window.UpdateCurrentFramebufferLayout(layout.width, layout.height);
+ renderer_settings.use_framelimiter = Settings::values.toggle_framelimit;
}
void RendererBase::RefreshRasterizerSetting() {
@@ -24,4 +29,10 @@ void RendererBase::RefreshRasterizerSetting() {
}
}
+void RendererBase::UpdateCurrentFramebufferLayout() {
+ const Layout::FramebufferLayout& layout = render_window.GetFramebufferLayout();
+
+ render_window.UpdateCurrentFramebufferLayout(layout.width, layout.height);
+}
+
} // namespace VideoCore
diff --git a/src/video_core/renderer_base.h b/src/video_core/renderer_base.h
index 9dbea8b6d..fd8c47592 100644
--- a/src/video_core/renderer_base.h
+++ b/src/video_core/renderer_base.h
@@ -4,9 +4,9 @@
#pragma once
+#include <atomic>
#include <memory>
#include <boost/optional.hpp>
-#include "common/assert.h"
#include "common/common_types.h"
#include "video_core/gpu.h"
#include "video_core/rasterizer_interface.h"
@@ -15,6 +15,10 @@ class EmuWindow;
namespace VideoCore {
+struct RendererSettings {
+ std::atomic_bool use_framelimiter{false};
+};
+
class RendererBase : NonCopyable {
public:
explicit RendererBase(EmuWindow& window);
@@ -29,9 +33,6 @@ public:
/// Shutdown the renderer
virtual void ShutDown() = 0;
- /// Updates the framebuffer layout of the contained render window handle.
- void UpdateCurrentFramebufferLayout();
-
// Getter/setter functions:
// ------------------------
@@ -51,13 +52,23 @@ public:
return *rasterizer;
}
- void RefreshRasterizerSetting();
+ /// Refreshes the settings common to all renderers
+ void RefreshBaseSettings();
protected:
+ /// Refreshes settings specific to the rasterizer.
+ void RefreshRasterizerSetting();
+
EmuWindow& render_window; ///< Reference to the render window handle.
std::unique_ptr<RasterizerInterface> rasterizer;
f32 m_current_fps = 0.0f; ///< Current framerate, should be set by the renderer
int m_current_frame = 0; ///< Current frame, should be set by the renderer
+
+ RendererSettings renderer_settings;
+
+private:
+ /// Updates the framebuffer layout of the contained render window handle.
+ void UpdateCurrentFramebufferLayout();
};
} // namespace VideoCore
diff --git a/src/video_core/video_core.cpp b/src/video_core/video_core.cpp
index 5085ef96b..1e686b89e 100644
--- a/src/video_core/video_core.cpp
+++ b/src/video_core/video_core.cpp
@@ -9,8 +9,6 @@
namespace VideoCore {
-std::atomic<bool> g_toggle_framelimit_enabled;
-
std::unique_ptr<RendererBase> CreateRenderer(EmuWindow& emu_window) {
return std::make_unique<RendererOpenGL>(emu_window);
}
diff --git a/src/video_core/video_core.h b/src/video_core/video_core.h
index 9fbae8487..2dc07540f 100644
--- a/src/video_core/video_core.h
+++ b/src/video_core/video_core.h
@@ -4,7 +4,6 @@
#pragma once
-#include <atomic>
#include <memory>
class EmuWindow;
@@ -13,10 +12,6 @@ namespace VideoCore {
class RendererBase;
-// TODO: Wrap these in a user settings struct along with any other graphics settings (often set from
-// qt ui)
-extern std::atomic<bool> g_toggle_framelimit_enabled;
-
/**
* Creates a renderer instance.
*