renderer_opengl: refactor context acquire

This commit is contained in:
Liam 2022-12-13 12:30:15 -05:00 committed by Alexander Orzechowski
parent b50948dd06
commit 2c6460d168
6 changed files with 62 additions and 38 deletions

View file

@ -223,8 +223,6 @@ struct GPU::Impl {
/// core timing events.
void Start() {
gpu_thread.StartThread(*renderer, renderer->Context(), *scheduler);
cpu_context = renderer->GetRenderWindow().CreateSharedContext();
cpu_context->MakeCurrent();
}
void NotifyShutdown() {
@ -235,6 +233,9 @@ struct GPU::Impl {
/// Obtain the CPU Context
void ObtainContext() {
if (!cpu_context) {
cpu_context = renderer->GetRenderWindow().CreateSharedContext();
}
cpu_context->MakeCurrent();
}