diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2024-07-31 11:37:37 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2024-07-31 11:37:37 +0200 |
commit | 3fce5161556afa0eab17e66e9fb589d531fae305 (patch) | |
tree | 53c62e6baa97e046a837650bd27c4d270b4bf370 /platform | |
parent | 9fe4cb6a769b14ddf3d9974767115a5f686f5f10 (diff) | |
parent | a1a0acff7c7eaddb0743f47fbcd73ffb081e0577 (diff) | |
download | redot-engine-3fce5161556afa0eab17e66e9fb589d531fae305.tar.gz |
Merge pull request #94428 from alvinhochun/windows-angle-resize-sync
Windows: Update ANGLE surface size when window is resized
Diffstat (limited to 'platform')
-rw-r--r-- | platform/windows/display_server_windows.cpp | 7 | ||||
-rw-r--r-- | platform/windows/display_server_windows.h | 1 | ||||
-rw-r--r-- | platform/windows/gl_manager_windows_angle.cpp | 5 | ||||
-rw-r--r-- | platform/windows/gl_manager_windows_angle.h | 2 |
4 files changed, 11 insertions, 4 deletions
diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp index fa6ed81793..4003dcb5bf 100644 --- a/platform/windows/display_server_windows.cpp +++ b/platform/windows/display_server_windows.cpp @@ -4852,16 +4852,16 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA rect_changed = true; } #if defined(RD_ENABLED) - if (rendering_context && window.context_created) { + if (window.create_completed && rendering_context && window.context_created) { // Note: Trigger resize event to update swapchains when window is minimized/restored, even if size is not changed. rendering_context->window_set_size(window_id, window.width, window.height); } #endif #if defined(GLES3_ENABLED) - if (gl_manager_native) { + if (window.create_completed && gl_manager_native) { gl_manager_native->window_resize(window_id, window.width, window.height); } - if (gl_manager_angle) { + if (window.create_completed && gl_manager_angle) { gl_manager_angle->window_resize(window_id, window.width, window.height); } #endif @@ -5590,6 +5590,7 @@ DisplayServer::WindowID DisplayServerWindows::_create_window(WindowMode p_mode, SetWindowPos(wd.hWnd, HWND_TOP, srect.position.x, srect.position.y, srect.size.width, srect.size.height, SWP_NOZORDER | SWP_NOACTIVATE); } + wd.create_completed = true; window_id_counter++; } diff --git a/platform/windows/display_server_windows.h b/platform/windows/display_server_windows.h index 7b259def14..de5b813953 100644 --- a/platform/windows/display_server_windows.h +++ b/platform/windows/display_server_windows.h @@ -441,6 +441,7 @@ class DisplayServerWindows : public DisplayServer { Vector<Vector2> mpath; + bool create_completed = false; bool pre_fs_valid = false; RECT pre_fs_rect; bool maximized = false; 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(){}; |