///////////////////////////////////////////////////////
| 548 | |
| 549 | //////////////////////////////////////////////////////////// |
| 550 | std::unique_ptr<GlContext> GlContext::create() |
| 551 | { |
| 552 | // Make sure that there's an active context (context creation may need extensions, and thus a valid context) |
| 553 | const auto sharedContext = SharedContext::get(); |
| 554 | |
| 555 | const std::lock_guard lock(sharedContext->mutex); |
| 556 | |
| 557 | std::unique_ptr<GlContext> context; |
| 558 | |
| 559 | // We don't use acquireTransientContext here since we have |
| 560 | // to ensure we have exclusive access to the shared context |
| 561 | // in order to make sure it is not active during context creation |
| 562 | sharedContext->context->setActive(true); |
| 563 | |
| 564 | // Create the context |
| 565 | context = std::make_unique<ContextType>(&sharedContext->context.value()); |
| 566 | |
| 567 | sharedContext->context->setActive(false); |
| 568 | |
| 569 | context->initialize(ContextSettings{}); |
| 570 | |
| 571 | return context; |
| 572 | } |
| 573 | |
| 574 | |
| 575 | //////////////////////////////////////////////////////////// |
nothing calls this directly
no test coverage detected