summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineOpenGL
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2020-05-09 23:02:47 +0000
committerassiduous <assiduous@diligentgraphics.com>2020-05-09 23:02:47 +0000
commit3b7a595138c8cb4291c85b5770e625c1c62bc365 (patch)
tree0745416c23218bb11494385a6ddec9ce2ea110c3 /Graphics/GraphicsEngineOpenGL
parentAdded option to specify bind target when creating texture from GL handle (API... (diff)
downloadDiligentCore-3b7a595138c8cb4291c85b5770e625c1c62bc365.tar.gz
DiligentCore-3b7a595138c8cb4291c85b5770e625c1c62bc365.zip
Enabled swap interval control on Android/GLES
Diffstat (limited to 'Graphics/GraphicsEngineOpenGL')
-rw-r--r--Graphics/GraphicsEngineOpenGL/include/GLContextAndroid.hpp3
-rw-r--r--Graphics/GraphicsEngineOpenGL/src/GLContextAndroid.cpp9
2 files changed, 11 insertions, 1 deletions
diff --git a/Graphics/GraphicsEngineOpenGL/include/GLContextAndroid.hpp b/Graphics/GraphicsEngineOpenGL/include/GLContextAndroid.hpp
index d50c7e51..ed4e94b2 100644
--- a/Graphics/GraphicsEngineOpenGL/include/GLContextAndroid.hpp
+++ b/Graphics/GraphicsEngineOpenGL/include/GLContextAndroid.hpp
@@ -69,6 +69,9 @@ private:
int32_t screen_width_ = 0;
int32_t screen_height_ = 0;
+ EGLint min_swap_interval_ = 0;
+ EGLint max_swap_interval_ = 1;
+
//Flags
bool gles_initialized_ = false;
bool egl_context_initialized_ = false;
diff --git a/Graphics/GraphicsEngineOpenGL/src/GLContextAndroid.cpp b/Graphics/GraphicsEngineOpenGL/src/GLContextAndroid.cpp
index 233cc487..3a7e9003 100644
--- a/Graphics/GraphicsEngineOpenGL/src/GLContextAndroid.cpp
+++ b/Graphics/GraphicsEngineOpenGL/src/GLContextAndroid.cpp
@@ -127,6 +127,9 @@ bool GLContext::InitEGLSurface()
eglGetConfigAttrib(display_, config_, EGL_NATIVE_VISUAL_ID, &format);
ANativeWindow_setBuffersGeometry(window_, 0, 0, format);
+ eglGetConfigAttrib(display_, config_, EGL_MIN_SWAP_INTERVAL, &min_swap_interval_);
+ eglGetConfigAttrib(display_, config_, EGL_MAX_SWAP_INTERVAL, &max_swap_interval_);
+
return true;
}
@@ -248,7 +251,7 @@ GLContext::~GLContext()
Terminate();
}
-void GLContext::SwapBuffers(int /*SwapInterval*/)
+void GLContext::SwapBuffers(int SwapInterval)
{
if (surface_ == EGL_NO_SURFACE)
{
@@ -256,6 +259,10 @@ void GLContext::SwapBuffers(int /*SwapInterval*/)
return;
}
+ SwapInterval = std::max(SwapInterval, min_swap_interval_);
+ SwapInterval = std::min(SwapInterval, max_swap_interval_);
+ eglSwapInterval(display_, SwapInterval);
+
bool b = eglSwapBuffers(display_, surface_);
if (!b)
{