summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlvin Wong <alvinhochun@gmail.com>2024-07-16 16:58:27 +0800
committerAlvin Wong <alvinhochun@gmail.com>2024-07-16 17:01:42 +0800
commita1a0acff7c7eaddb0743f47fbcd73ffb081e0577 (patch)
tree181d5923103ee642de56565763db9602e3778154
parentd7f023ab732655a235155998f92a24b9812d2927 (diff)
downloadredot-engine-a1a0acff7c7eaddb0743f47fbcd73ffb081e0577.tar.gz
Windows: Update ANGLE surface size when window is resized
ANGLE needs to be told to resize the DXGI swap chain using `eglWaitNative`. Otherwise the resize will only happen in `eglSwapBuffers`, which causes some janky stretching during window resize.
-rw-r--r--platform/windows/gl_manager_windows_angle.cpp5
-rw-r--r--platform/windows/gl_manager_windows_angle.h2
2 files changed, 6 insertions, 1 deletions
diff --git a/platform/windows/gl_manager_windows_angle.cpp b/platform/windows/gl_manager_windows_angle.cpp
index 3086edc7f2..c52564676f 100644
--- a/platform/windows/gl_manager_windows_angle.cpp
+++ b/platform/windows/gl_manager_windows_angle.cpp
@@ -67,4 +67,9 @@ Vector<EGLint> GLManagerANGLE_Windows::_get_platform_context_attribs() const {
return ret;
}
+void GLManagerANGLE_Windows::window_resize(DisplayServer::WindowID p_window_id, int p_width, int p_height) {
+ window_make_current(p_window_id);
+ eglWaitNative(EGL_CORE_NATIVE_ENGINE);
+}
+
#endif // WINDOWS_ENABLED && GLES3_ENABLED
diff --git a/platform/windows/gl_manager_windows_angle.h b/platform/windows/gl_manager_windows_angle.h
index d8dc651cfd..f43a6fbe02 100644
--- a/platform/windows/gl_manager_windows_angle.h
+++ b/platform/windows/gl_manager_windows_angle.h
@@ -50,7 +50,7 @@ private:
virtual Vector<EGLint> _get_platform_context_attribs() const override;
public:
- void window_resize(DisplayServer::WindowID p_window_id, int p_width, int p_height) {}
+ void window_resize(DisplayServer::WindowID p_window_id, int p_width, int p_height);
GLManagerANGLE_Windows(){};
~GLManagerANGLE_Windows(){};