diff options
Diffstat (limited to 'src/GPU_OpenGL.h')
-rw-r--r-- | src/GPU_OpenGL.h | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/src/GPU_OpenGL.h b/src/GPU_OpenGL.h index 68462a9..9c04096 100644 --- a/src/GPU_OpenGL.h +++ b/src/GPU_OpenGL.h @@ -21,51 +21,51 @@ #include "OpenGLSupport.h" #include <array> -#include <memory> +#include <optional> namespace melonDS { class GPU; struct RenderSettings; - +class GLRenderer; class GLCompositor { public: - static std::unique_ptr<GLCompositor> New(melonDS::GPU& gpu) noexcept; + static std::optional<GLCompositor> New() noexcept; GLCompositor(const GLCompositor&) = delete; GLCompositor& operator=(const GLCompositor&) = delete; + GLCompositor(GLCompositor&&) noexcept; + GLCompositor& operator=(GLCompositor&&) noexcept; ~GLCompositor(); - void Reset(); - - void SetRenderSettings(const RenderSettings& settings) noexcept; + void SetScaleFactor(int scale) noexcept; + [[nodiscard]] int GetScaleFactor() const noexcept { return Scale; } - void Stop(); - void RenderFrame(); + void Stop(const GPU& gpu) noexcept; + void RenderFrame(const GPU& gpu, GLRenderer& renderer) noexcept; void BindOutputTexture(int buf); private: - GLCompositor(std::array<GLuint, 3> CompShader, melonDS::GPU& gpu) noexcept; - melonDS::GPU& GPU; - int Scale; - int ScreenH, ScreenW; + GLCompositor(std::array<GLuint, 3> CompShader) noexcept; + int Scale = 0; + int ScreenH = 0, ScreenW = 0; - std::array<GLuint, 3> CompShader; - GLuint CompScaleLoc; - GLuint Comp3DXPosLoc; + std::array<GLuint, 3> CompShader {}; + GLuint CompScaleLoc = 0; + GLuint Comp3DXPosLoc = 0; - GLuint CompVertexBufferID; - GLuint CompVertexArrayID; + GLuint CompVertexBufferID = 0; + GLuint CompVertexArrayID = 0; struct CompVertex { - float Position[2]; - float Texcoord[2]; + std::array<float, 2> Position {}; + std::array<float, 2> Texcoord {}; }; - CompVertex CompVertices[2 * 3*2]; + std::array<CompVertex, 2*3*2> CompVertices {}; - GLuint CompScreenInputTex; - GLuint CompScreenOutputTex[2]; - GLuint CompScreenOutputFB[2]; + GLuint CompScreenInputTex = 0; + std::array<GLuint, 2> CompScreenOutputTex {}; + std::array<GLuint, 2> CompScreenOutputFB {}; }; } |