Renderer: Expose present mode and allow to query/set it
This commit is contained in:
@@ -34,13 +34,17 @@ namespace Nz
|
||||
inline GL::Context& GetContext();
|
||||
const OpenGLFramebuffer& GetFramebuffer(std::size_t i) const override;
|
||||
std::size_t GetFramebufferCount() const override;
|
||||
PresentMode GetPresentMode() const override;
|
||||
const OpenGLRenderPass& GetRenderPass() const override;
|
||||
const Vector2ui& GetSize() const override;
|
||||
PresentModeFlags GetSupportedPresentModes() const override;
|
||||
|
||||
void NotifyResize(const Vector2ui& newSize) override;
|
||||
|
||||
void Present();
|
||||
|
||||
void SetPresentMode(PresentMode presentMode) override;
|
||||
|
||||
TransientResources& Transient() override;
|
||||
|
||||
private:
|
||||
@@ -49,6 +53,8 @@ namespace Nz
|
||||
std::vector<std::unique_ptr<OpenGLRenderImage>> m_renderImage;
|
||||
std::shared_ptr<GL::Context> m_context;
|
||||
OpenGLWindowFramebuffer m_framebuffer;
|
||||
PresentMode m_presentMode;
|
||||
PresentModeFlags m_supportedPresentModes;
|
||||
Vector2ui m_size;
|
||||
bool m_sizeInvalidated;
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user