Fix a couple things

This commit is contained in:
offtkp 2024-08-09 01:41:18 +03:00
parent 2849cc3798
commit 9a852475c5
2 changed files with 9 additions and 8 deletions

View file

@ -606,29 +606,29 @@ void MainWindow::pollControllers() {
namespace AsyncCompiler {
void* createContext(void* mainContext) {
GL::Context* glContext = static_cast<GL::Context*>(mainContext);
GL::Context* glContext = (GL::Context*)mainContext;
// Unlike the SDL function, this doesn't make it current so we don't
// need to call MakeCurrent on the mainContext
WindowInfo wi = glContext->GetWindowInfo();
wi.type = WindowInfo::Type::Surfaceless;
std::unique_ptr<GL::Context>* newContext = new std::unique_ptr<GL::Context>(glContext->CreateSharedContext(wi));
std::unique_ptr<GL::Context> iLoveBeingForcedToUseRAII = glContext->CreateSharedContext(wi);
if (newContext->get() == nullptr) {
if (!iLoveBeingForcedToUseRAII) {
Helpers::panic("Failed to create shared GL context");
}
return newContext;
return iLoveBeingForcedToUseRAII.release();
}
void makeCurrent(void* mainContext, void* context) {
std::unique_ptr<GL::Context>* glContext = static_cast<std::unique_ptr<GL::Context>*>(context);
(*glContext)->MakeCurrent();
void makeCurrent(void* unused, void* context) {
GL::Context* glContext = (GL::Context*)context;
glContext->MakeCurrent();
}
void destroyContext(void* context) {
std::unique_ptr<GL::Context>* glContext = static_cast<std::unique_ptr<GL::Context>*>(context);
GL::Context* glContext = (GL::Context*)context;
delete glContext;
}
} // namespace AsyncCompiler

View file

@ -20,6 +20,7 @@ std::unique_ptr<Context> ContextEGLX11::CreateSharedContext(const WindowInfo& wi
{
std::unique_ptr<ContextEGLX11> context = std::make_unique<ContextEGLX11>(wi);
context->m_display = m_display;
context->m_supports_surfaceless = m_supports_surfaceless;
if (!context->CreateContextAndSurface(m_version, m_context, false))
return nullptr;