Renderer: Expose present mode and allow to query/set it

This commit is contained in:
SirLynix
2023-08-13 18:16:03 +02:00
parent 28d69ab552
commit e8620894f7
21 changed files with 420 additions and 43 deletions

View File

@@ -148,8 +148,6 @@ namespace Nz::GL
inline bool DidLastCallSucceed() const;
virtual void EnableVerticalSync(bool enabled) = 0;
inline bool GetBoolean(GLenum name) const;
inline bool GetBoolean(GLenum name, GLuint index) const;
inline const OpenGLDevice* GetDevice() const;
@@ -159,6 +157,7 @@ namespace Nz::GL
template<typename T> T GetInteger(GLenum name) const;
template<typename T> T GetInteger(GLenum name, GLuint index) const;
inline const ContextParams& GetParams() const;
virtual PresentModeFlags GetSupportedPresentModes() const = 0;
inline const OpenGLVaoCache& GetVaoCache() const;
inline bool IsExtensionSupported(Extension extension) const;
@@ -183,6 +182,7 @@ namespace Nz::GL
inline void ResetStencilWriteMasks() const;
void SetCurrentTextureUnit(UInt32 textureUnit) const;
virtual void SetPresentMode(PresentMode presentMode) = 0;
void SetScissorBox(GLint x, GLint y, GLsizei width, GLsizei height) const;
void SetViewport(GLint x, GLint y, GLsizei width, GLsizei height) const;

View File

@@ -35,10 +35,12 @@ namespace Nz::GL
virtual bool Create(const ContextParams& params, WindowHandle window, const EGLContextBase* shareContext = nullptr);
virtual void Destroy();
void EnableVerticalSync(bool enabled) override;
PresentModeFlags GetSupportedPresentModes() const override;
inline bool HasPlatformExtension(const std::string& str) const;
void SetPresentMode(PresentMode presentMode) override;
void SwapBuffers() override;
EGLContextBase& operator=(const EGLContextBase&) = delete;
@@ -72,6 +74,8 @@ namespace Nz::GL
std::unordered_set<std::string> m_supportedPlatformExtensions;
EGLContext m_handle;
EGLint m_maxSwapInterval;
EGLint m_minSwapInterval;
bool m_ownsDisplay;
};
}

View File

@@ -17,6 +17,7 @@ NAZARA_OPENGLRENDERER_EGL_FUNC(eglCreatePbufferSurface, PFNEGLCREATEPBUFFERSURFA
NAZARA_OPENGLRENDERER_EGL_FUNC(eglCreateWindowSurface, PFNEGLCREATEWINDOWSURFACEPROC)
NAZARA_OPENGLRENDERER_EGL_FUNC(eglDestroyContext, PFNEGLDESTROYCONTEXTPROC)
NAZARA_OPENGLRENDERER_EGL_FUNC(eglDestroySurface, PFNEGLDESTROYSURFACEPROC)
NAZARA_OPENGLRENDERER_EGL_FUNC(eglGetConfigAttrib, PFNEGLGETCONFIGATTRIBPROC)
NAZARA_OPENGLRENDERER_EGL_FUNC(eglGetDisplay, PFNEGLGETDISPLAYPROC)
NAZARA_OPENGLRENDERER_EGL_FUNC(eglGetError, PFNEGLGETERRORPROC)
NAZARA_OPENGLRENDERER_EGL_FUNC(eglGetProcAddress, PFNEGLGETPROCADDRESSPROC)
@@ -24,6 +25,7 @@ NAZARA_OPENGLRENDERER_EGL_FUNC(eglInitialize, PFNEGLINITIALIZEPROC)
NAZARA_OPENGLRENDERER_EGL_FUNC(eglMakeCurrent, PFNEGLMAKECURRENTPROC)
NAZARA_OPENGLRENDERER_EGL_FUNC(eglQueryString, PFNEGLQUERYSTRINGPROC)
NAZARA_OPENGLRENDERER_EGL_FUNC(eglSwapBuffers, PFNEGLSWAPBUFFERSPROC)
NAZARA_OPENGLRENDERER_EGL_FUNC(eglSwapInterval, PFNEGLSWAPINTERVALPROC)
NAZARA_OPENGLRENDERER_EGL_FUNC(eglTerminate, PFNEGLTERMINATEPROC)
NAZARA_OPENGLRENDERER_EGL_FUNC_OPT(eglCreatePlatformWindowSurface, PFNEGLCREATEPLATFORMWINDOWSURFACEPROC)

View File

@@ -34,10 +34,12 @@ namespace Nz::GL
bool Create(const WGLContext* baseContext, const ContextParams& params, WindowHandle window, const WGLContext* shareContext = nullptr);
void Destroy();
void EnableVerticalSync(bool enabled) override;
PresentModeFlags GetSupportedPresentModes() const override;
inline bool HasPlatformExtension(const std::string& str) const;
void SetPresentMode(PresentMode presentMode) override;
void SwapBuffers() override;
WGLContext& operator=(const WGLContext&) = delete;

View File

@@ -6,7 +6,7 @@
namespace Nz::GL
{
inline GL::WGLContext::WGLContext(const OpenGLDevice* device, const WGLLoader& loader) :
inline WGLContext::WGLContext(const OpenGLDevice* device, const WGLLoader& loader) :
Context(device),
m_loader(loader),
m_handle(nullptr)

View File

@@ -33,10 +33,12 @@ namespace Nz::GL
virtual bool Create(const ContextParams& params, WindowHandle window, const WebContext* shareContext = nullptr);
virtual void Destroy();
void EnableVerticalSync(bool enabled) override;
PresentModeFlags GetSupportedPresentModes() const override;
inline bool HasPlatformExtension(const std::string& str) const;
void SetPresentMode(PresentMode presentMode) override;
void SwapBuffers() override;
WebContext& operator=(const WebContext&) = delete;