Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows: Update ANGLE surface size when window is resized #94428

Merged
merged 2 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions platform/windows/display_server_windows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4686,16 +4686,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
Expand Down Expand Up @@ -5403,6 +5403,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++;
}

Expand Down
1 change: 1 addition & 0 deletions platform/windows/display_server_windows.h
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,7 @@ class DisplayServerWindows : public DisplayServer {

Vector<Vector2> mpath;

bool create_completed = false;
bool pre_fs_valid = false;
RECT pre_fs_rect;
bool maximized = false;
Expand Down
5 changes: 5 additions & 0 deletions platform/windows/gl_manager_windows_angle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion platform/windows/gl_manager_windows_angle.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class GLManagerANGLE_Windows : public EGLManager {
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(){};
Expand Down
Loading