Merge pull request #90268 from RandomShaper/wtp_servers
Use WorkerThreadPool for Server threads (enhanced)
This commit is contained in:
commit
c951421c99
38 changed files with 462 additions and 394 deletions
|
|
@ -2962,7 +2962,7 @@ String DisplayServerWindows::keyboard_get_layout_name(int p_index) const {
|
|||
}
|
||||
|
||||
void DisplayServerWindows::process_events() {
|
||||
_THREAD_SAFE_METHOD_
|
||||
_THREAD_SAFE_LOCK_
|
||||
|
||||
MSG msg;
|
||||
|
||||
|
|
@ -2977,7 +2977,10 @@ void DisplayServerWindows::process_events() {
|
|||
|
||||
if (!drop_events) {
|
||||
_process_key_events();
|
||||
_THREAD_SAFE_UNLOCK_
|
||||
Input::get_singleton()->flush_buffered_events();
|
||||
} else {
|
||||
_THREAD_SAFE_UNLOCK_
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2990,9 +2993,14 @@ void DisplayServerWindows::force_process_and_drop_events() {
|
|||
}
|
||||
|
||||
void DisplayServerWindows::release_rendering_thread() {
|
||||
}
|
||||
|
||||
void DisplayServerWindows::make_rendering_thread() {
|
||||
#if defined(GLES3_ENABLED)
|
||||
if (gl_manager_angle) {
|
||||
gl_manager_angle->release_current();
|
||||
}
|
||||
if (gl_manager_native) {
|
||||
gl_manager_native->release_current();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void DisplayServerWindows::swap_buffers() {
|
||||
|
|
@ -3433,7 +3441,6 @@ void DisplayServerWindows::_dispatch_input_events(const Ref<InputEvent> &p_event
|
|||
}
|
||||
|
||||
void DisplayServerWindows::_dispatch_input_event(const Ref<InputEvent> &p_event) {
|
||||
_THREAD_SAFE_METHOD_
|
||||
if (in_dispatch_input_event) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -679,7 +679,6 @@ public:
|
|||
virtual void force_process_and_drop_events() override;
|
||||
|
||||
virtual void release_rendering_thread() override;
|
||||
virtual void make_rendering_thread() override;
|
||||
virtual void swap_buffers() override;
|
||||
|
||||
virtual void set_native_icon(const String &p_filename) override;
|
||||
|
|
|
|||
|
|
@ -427,10 +427,6 @@ Error GLManagerNative_Windows::window_create(DisplayServer::WindowID p_window_id
|
|||
return OK;
|
||||
}
|
||||
|
||||
void GLManagerNative_Windows::_internal_set_current_window(GLWindow *p_win) {
|
||||
_current_window = p_win;
|
||||
}
|
||||
|
||||
void GLManagerNative_Windows::window_destroy(DisplayServer::WindowID p_window_id) {
|
||||
GLWindow &win = get_window(p_window_id);
|
||||
if (_current_window == &win) {
|
||||
|
|
@ -447,6 +443,8 @@ void GLManagerNative_Windows::release_current() {
|
|||
if (!gd_wglMakeCurrent(_current_window->hDC, nullptr)) {
|
||||
ERR_PRINT("Could not detach OpenGL context from window marked current: " + format_error_message(GetLastError()));
|
||||
}
|
||||
|
||||
_current_window = nullptr;
|
||||
}
|
||||
|
||||
void GLManagerNative_Windows::window_make_current(DisplayServer::WindowID p_window_id) {
|
||||
|
|
@ -467,17 +465,7 @@ void GLManagerNative_Windows::window_make_current(DisplayServer::WindowID p_wind
|
|||
ERR_PRINT("Could not switch OpenGL context to other window: " + format_error_message(GetLastError()));
|
||||
}
|
||||
|
||||
_internal_set_current_window(&win);
|
||||
}
|
||||
|
||||
void GLManagerNative_Windows::make_current() {
|
||||
if (!_current_window) {
|
||||
return;
|
||||
}
|
||||
const GLDisplay &disp = get_current_display();
|
||||
if (!gd_wglMakeCurrent(_current_window->hDC, disp.hRC)) {
|
||||
ERR_PRINT("Could not switch OpenGL context to window marked current: " + format_error_message(GetLastError()));
|
||||
}
|
||||
_current_window = &win;
|
||||
}
|
||||
|
||||
void GLManagerNative_Windows::swap_buffers() {
|
||||
|
|
@ -491,7 +479,6 @@ Error GLManagerNative_Windows::initialize() {
|
|||
|
||||
void GLManagerNative_Windows::set_use_vsync(DisplayServer::WindowID p_window_id, bool p_use) {
|
||||
GLWindow &win = get_window(p_window_id);
|
||||
GLWindow *current = _current_window;
|
||||
|
||||
if (&win != _current_window) {
|
||||
window_make_current(p_window_id);
|
||||
|
|
@ -506,11 +493,6 @@ void GLManagerNative_Windows::set_use_vsync(DisplayServer::WindowID p_window_id,
|
|||
} else {
|
||||
WARN_PRINT("Could not set V-Sync mode. V-Sync is not supported.");
|
||||
}
|
||||
|
||||
if (current != _current_window) {
|
||||
_current_window = current;
|
||||
make_current();
|
||||
}
|
||||
}
|
||||
|
||||
bool GLManagerNative_Windows::is_using_vsync(DisplayServer::WindowID p_window_id) const {
|
||||
|
|
|
|||
|
|
@ -68,9 +68,6 @@ private:
|
|||
|
||||
PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT = nullptr;
|
||||
|
||||
// funcs
|
||||
void _internal_set_current_window(GLWindow *p_win);
|
||||
|
||||
GLWindow &get_window(unsigned int id) { return _windows[id]; }
|
||||
const GLWindow &get_window(unsigned int id) const { return _windows[id]; }
|
||||
|
||||
|
|
@ -91,7 +88,6 @@ public:
|
|||
void window_resize(DisplayServer::WindowID p_window_id, int p_width, int p_height) {}
|
||||
|
||||
void release_current();
|
||||
void make_current();
|
||||
void swap_buffers();
|
||||
|
||||
void window_make_current(DisplayServer::WindowID p_window_id);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue