OpenGL: Fix crash with "Thread Model" set to "Separate"

This commit is contained in:
David Snopek 2025-07-28 13:02:46 -05:00
parent 2d113cc224
commit a590be0cb2

View file

@ -376,8 +376,12 @@ Size2i RenderingServerDefault::get_maximum_viewport_size() const {
void RenderingServerDefault::_assign_mt_ids(WorkerThreadPool::TaskID p_pump_task_id) {
server_thread = Thread::get_caller_id();
server_task_id = p_pump_task_id;
// This is needed because the main RD is created on the main thread.
RenderingDevice::get_singleton()->make_current();
RenderingDevice *rd = RenderingDevice::get_singleton();
if (rd) {
// This is needed because the main RD is created on the main thread.
rd->make_current();
}
}
void RenderingServerDefault::_thread_exit() {