1
0
Fork 0

Merge pull request #4738 from FearlessTobi/port-1020-new

Port yuzu-emu/yuzu#1020: "core: Namespace EmuWindow"
This commit is contained in:
James Rowe 2019-04-26 08:58:09 -06:00 committed by GitHub
commit 3f2c7eb471
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 39 additions and 20 deletions

View File

@ -10,7 +10,7 @@
struct SDL_Window; struct SDL_Window;
class EmuWindow_SDL2 : public EmuWindow { class EmuWindow_SDL2 : public Frontend::EmuWindow {
public: public:
explicit EmuWindow_SDL2(bool fullscreen); explicit EmuWindow_SDL2(bool fullscreen);
~EmuWindow_SDL2(); ~EmuWindow_SDL2();

View File

@ -103,7 +103,7 @@ signals:
void ErrorThrown(Core::System::ResultStatus, std::string); void ErrorThrown(Core::System::ResultStatus, std::string);
}; };
class GRenderWindow : public QWidget, public EmuWindow { class GRenderWindow : public QWidget, public Frontend::EmuWindow {
Q_OBJECT Q_OBJECT
public: public:

View File

@ -92,7 +92,7 @@ System::ResultStatus System::SingleStep() {
return RunLoop(false); return RunLoop(false);
} }
System::ResultStatus System::Load(EmuWindow& emu_window, const std::string& filepath) { System::ResultStatus System::Load(Frontend::EmuWindow& emu_window, const std::string& filepath) {
app_loader = Loader::GetLoader(filepath); app_loader = Loader::GetLoader(filepath);
if (!app_loader) { if (!app_loader) {
@ -167,7 +167,7 @@ void System::Reschedule() {
kernel->GetThreadManager().Reschedule(); kernel->GetThreadManager().Reschedule();
} }
System::ResultStatus System::Init(EmuWindow& emu_window, u32 system_mode) { System::ResultStatus System::Init(Frontend::EmuWindow& emu_window, u32 system_mode) {
LOG_DEBUG(HW_Memory, "initialized OK"); LOG_DEBUG(HW_Memory, "initialized OK");
memory = std::make_unique<Memory::MemorySystem>(); memory = std::make_unique<Memory::MemorySystem>();

View File

@ -14,9 +14,12 @@
#include "core/perf_stats.h" #include "core/perf_stats.h"
#include "core/telemetry_session.h" #include "core/telemetry_session.h"
class EmuWindow;
class ARM_Interface; class ARM_Interface;
namespace Frontend {
class EmuWindow;
}
namespace Memory { namespace Memory {
class MemorySystem; class MemorySystem;
} }
@ -121,7 +124,7 @@ public:
* @param filepath String path to the executable application to load on the host file system. * @param filepath String path to the executable application to load on the host file system.
* @returns ResultStatus code, indicating if the operation succeeded. * @returns ResultStatus code, indicating if the operation succeeded.
*/ */
ResultStatus Load(EmuWindow& emu_window, const std::string& filepath); ResultStatus Load(Frontend::EmuWindow& emu_window, const std::string& filepath);
/** /**
* Indicates if the emulated system is powered on (all subsystems initialized and able to run an * Indicates if the emulated system is powered on (all subsystems initialized and able to run an
@ -243,7 +246,7 @@ private:
* @param system_mode The system mode. * @param system_mode The system mode.
* @return ResultStatus code, indicating if the operation succeeded. * @return ResultStatus code, indicating if the operation succeeded.
*/ */
ResultStatus Init(EmuWindow& emu_window, u32 system_mode); ResultStatus Init(Frontend::EmuWindow& emu_window, u32 system_mode);
/// Reschedule the core emulation /// Reschedule the core emulation
void Reschedule(); void Reschedule();
@ -288,7 +291,7 @@ private:
ResultStatus status = ResultStatus::Success; ResultStatus status = ResultStatus::Success;
std::string status_details = ""; std::string status_details = "";
/// Saved variables for reset /// Saved variables for reset
EmuWindow* m_emu_window; Frontend::EmuWindow* m_emu_window;
std::string m_filepath; std::string m_filepath;
std::atomic<bool> reset_requested; std::atomic<bool> reset_requested;

View File

@ -8,6 +8,8 @@
#include "core/frontend/input.h" #include "core/frontend/input.h"
#include "core/settings.h" #include "core/settings.h"
namespace Frontend {
class EmuWindow::TouchState : public Input::Factory<Input::TouchDevice>, class EmuWindow::TouchState : public Input::Factory<Input::TouchDevice>,
public std::enable_shared_from_this<TouchState> { public std::enable_shared_from_this<TouchState> {
public: public:
@ -156,3 +158,5 @@ void EmuWindow::UpdateCurrentFramebufferLayout(unsigned width, unsigned height)
} }
NotifyFramebufferLayoutChanged(layout); NotifyFramebufferLayoutChanged(layout);
} }
} // namespace Frontend

View File

@ -10,6 +10,8 @@
#include "common/common_types.h" #include "common/common_types.h"
#include "core/frontend/framebuffer_layout.h" #include "core/frontend/framebuffer_layout.h"
namespace Frontend {
/** /**
* Abstraction class used to provide an interface between emulation code and the frontend * Abstraction class used to provide an interface between emulation code and the frontend
* (e.g. SDL, QGLWidget, GLFW, etc...). * (e.g. SDL, QGLWidget, GLFW, etc...).
@ -166,3 +168,5 @@ private:
*/ */
std::tuple<unsigned, unsigned> ClipToTouchScreen(unsigned new_x, unsigned new_y) const; std::tuple<unsigned, unsigned> ClipToTouchScreen(unsigned new_x, unsigned new_y) const;
}; };
} // namespace Frontend

View File

@ -9,7 +9,7 @@
#include "video_core/swrasterizer/swrasterizer.h" #include "video_core/swrasterizer/swrasterizer.h"
#include "video_core/video_core.h" #include "video_core/video_core.h"
RendererBase::RendererBase(EmuWindow& window) : render_window{window} {} RendererBase::RendererBase(Frontend::EmuWindow& window) : render_window{window} {}
RendererBase::~RendererBase() = default; RendererBase::~RendererBase() = default;
void RendererBase::UpdateCurrentFramebufferLayout() { void RendererBase::UpdateCurrentFramebufferLayout() {
const Layout::FramebufferLayout& layout = render_window.GetFramebufferLayout(); const Layout::FramebufferLayout& layout = render_window.GetFramebufferLayout();

View File

@ -9,14 +9,16 @@
#include "core/core.h" #include "core/core.h"
#include "video_core/rasterizer_interface.h" #include "video_core/rasterizer_interface.h"
namespace Frontend {
class EmuWindow; class EmuWindow;
}
class RendererBase : NonCopyable { class RendererBase : NonCopyable {
public: public:
/// Used to reference a framebuffer /// Used to reference a framebuffer
enum kFramebuffer { kFramebuffer_VirtualXFB = 0, kFramebuffer_EFB, kFramebuffer_Texture }; enum kFramebuffer { kFramebuffer_VirtualXFB = 0, kFramebuffer_EFB, kFramebuffer_Texture };
explicit RendererBase(EmuWindow& window); explicit RendererBase(Frontend::EmuWindow& window);
virtual ~RendererBase(); virtual ~RendererBase();
/// Swap buffers (render frame) /// Swap buffers (render frame)
@ -46,18 +48,18 @@ public:
return rasterizer.get(); return rasterizer.get();
} }
EmuWindow& GetRenderWindow() { Frontend::EmuWindow& GetRenderWindow() {
return render_window; return render_window;
} }
const EmuWindow& GetRenderWindow() const { const Frontend::EmuWindow& GetRenderWindow() const {
return render_window; return render_window;
} }
void RefreshRasterizerSetting(); void RefreshRasterizerSetting();
protected: protected:
EmuWindow& render_window; ///< Reference to the render window handle. Frontend::EmuWindow& render_window; ///< Reference to the render window handle.
std::unique_ptr<VideoCore::RasterizerInterface> rasterizer; std::unique_ptr<VideoCore::RasterizerInterface> rasterizer;
f32 m_current_fps = 0.0f; ///< Current framerate, should be set by the renderer 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 int m_current_frame = 0; ///< Current frame, should be set by the renderer

View File

@ -43,7 +43,7 @@ static bool IsVendorAmd() {
return gpu_vendor == "ATI Technologies Inc." || gpu_vendor == "Advanced Micro Devices, Inc."; return gpu_vendor == "ATI Technologies Inc." || gpu_vendor == "Advanced Micro Devices, Inc.";
} }
RasterizerOpenGL::RasterizerOpenGL(EmuWindow& window) RasterizerOpenGL::RasterizerOpenGL(Frontend::EmuWindow& window)
: is_amd(IsVendorAmd()), shader_dirty(true), : is_amd(IsVendorAmd()), shader_dirty(true),
vertex_buffer(GL_ARRAY_BUFFER, VERTEX_BUFFER_SIZE, is_amd), vertex_buffer(GL_ARRAY_BUFFER, VERTEX_BUFFER_SIZE, is_amd),
uniform_buffer(GL_UNIFORM_BUFFER, UNIFORM_BUFFER_SIZE, false), uniform_buffer(GL_UNIFORM_BUFFER, UNIFORM_BUFFER_SIZE, false),

View File

@ -29,14 +29,17 @@
#include "video_core/renderer_opengl/pica_to_gl.h" #include "video_core/renderer_opengl/pica_to_gl.h"
#include "video_core/shader/shader.h" #include "video_core/shader/shader.h"
namespace Frontend {
class EmuWindow; class EmuWindow;
}
class ShaderProgramManager; class ShaderProgramManager;
namespace OpenGL { namespace OpenGL {
class RasterizerOpenGL : public VideoCore::RasterizerInterface { class RasterizerOpenGL : public VideoCore::RasterizerInterface {
public: public:
explicit RasterizerOpenGL(EmuWindow& renderer); explicit RasterizerOpenGL(Frontend::EmuWindow& renderer);
~RasterizerOpenGL() override; ~RasterizerOpenGL() override;
void AddTriangle(const Pica::Shader::OutputVertex& v0, const Pica::Shader::OutputVertex& v1, void AddTriangle(const Pica::Shader::OutputVertex& v0, const Pica::Shader::OutputVertex& v1,
@ -261,7 +264,7 @@ private:
RasterizerCacheOpenGL res_cache; RasterizerCacheOpenGL res_cache;
EmuWindow& emu_window; Frontend::EmuWindow& emu_window;
std::vector<HardwareVertex> vertex_batch; std::vector<HardwareVertex> vertex_batch;

View File

@ -93,7 +93,7 @@ static std::array<GLfloat, 3 * 2> MakeOrthographicMatrix(const float width, cons
return matrix; return matrix;
} }
RendererOpenGL::RendererOpenGL(EmuWindow& window) : RendererBase{window} {} RendererOpenGL::RendererOpenGL(Frontend::EmuWindow& window) : RendererBase{window} {}
RendererOpenGL::~RendererOpenGL() = default; RendererOpenGL::~RendererOpenGL() = default;
/// Swap buffers (render frame) /// Swap buffers (render frame)

View File

@ -38,7 +38,7 @@ struct ScreenInfo {
class RendererOpenGL : public RendererBase { class RendererOpenGL : public RendererBase {
public: public:
explicit RendererOpenGL(EmuWindow& window); explicit RendererOpenGL(Frontend::EmuWindow& window);
~RendererOpenGL() override; ~RendererOpenGL() override;
/// Swap buffers (render frame) /// Swap buffers (render frame)

View File

@ -33,7 +33,7 @@ Layout::FramebufferLayout g_screenshot_framebuffer_layout;
Memory::MemorySystem* g_memory; Memory::MemorySystem* g_memory;
/// Initialize the video core /// Initialize the video core
Core::System::ResultStatus Init(EmuWindow& emu_window, Memory::MemorySystem& memory) { Core::System::ResultStatus Init(Frontend::EmuWindow& emu_window, Memory::MemorySystem& memory) {
g_memory = &memory; g_memory = &memory;
Pica::Init(); Pica::Init();

View File

@ -9,7 +9,10 @@
#include "core/core.h" #include "core/core.h"
#include "core/frontend/emu_window.h" #include "core/frontend/emu_window.h"
namespace Frontend {
class EmuWindow; class EmuWindow;
}
class RendererBase; class RendererBase;
namespace Memory { namespace Memory {
@ -40,7 +43,7 @@ extern Layout::FramebufferLayout g_screenshot_framebuffer_layout;
extern Memory::MemorySystem* g_memory; extern Memory::MemorySystem* g_memory;
/// Initialize the video core /// Initialize the video core
Core::System::ResultStatus Init(EmuWindow& emu_window, Memory::MemorySystem& memory); Core::System::ResultStatus Init(Frontend::EmuWindow& emu_window, Memory::MemorySystem& memory);
/// Shutdown the video core /// Shutdown the video core
void Shutdown(); void Shutdown();