Frontend PR fixes (#6378)

* citra_qt: Check if renderer is null

* core: Fix dynarmic use-after-free error

* bootmanager: Add current context check in DoneCurrent

* Loading a save state would destroy the frame dumper class, which contains a shared context. That context would call DoneCurrent without checking if it was actually bound or not, resulting in crashes when calling opengl functions

* externals: Correct glad readme

* common: Log renderer debug setting

* citra: Make lambda lower case

* Consistency with review comments on the PR

* video_core: Kill more global state

* GetResolutionScaleFactor would be called somewhere in the renderer constructor chain but it relies on the yet unitialized g_renderer, resulting in crashes when the resolution scale is set to auto. Rather than adding a workaround, let's kill this global state to fix this for good
This commit is contained in:
GPUCode 2023-03-30 14:24:49 +03:00 committed by GitHub
parent 5346ca27b5
commit ffc95eb59b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 102 additions and 93 deletions

View file

@ -176,7 +176,7 @@ public:
}
~OpenGLSharedContext() {
context->doneCurrent();
OpenGLSharedContext::DoneCurrent();
}
void SwapBuffers() override {
@ -196,7 +196,9 @@ public:
}
void DoneCurrent() override {
context->doneCurrent();
if (QOpenGLContext::currentContext() == context.get()) {
context->doneCurrent();
}
}
QOpenGLContext* GetShareContext() const {
@ -257,7 +259,9 @@ public:
}
context->MakeCurrent();
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
VideoCore::g_renderer->TryPresent(100, is_secondary);
if (VideoCore::g_renderer) {
VideoCore::g_renderer->TryPresent(100, is_secondary);
}
context->SwapBuffers();
glFinish();
}
@ -633,7 +637,7 @@ void GRenderWindow::ReleaseRenderTarget() {
void GRenderWindow::CaptureScreenshot(u32 res_scale, const QString& screenshot_path) {
if (res_scale == 0) {
res_scale = VideoCore::GetResolutionScaleFactor();
res_scale = VideoCore::g_renderer->GetResolutionScaleFactor();
}
const auto layout{Layout::FrameLayoutFromResolutionScale(res_scale, is_secondary)};