mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-23 11:13:19 +01:00
gl/qt: Catch segfaults in wglDeleteContext with SEH (AMD windows driver)
- In rare cases the driver derefs a nullptr and dies, taking the emulator with it - From testing, it seems the vram is indeed freed when this happens so its "safe" to continue
This commit is contained in:
parent
baa5a261a5
commit
242611aa46
@ -769,8 +769,6 @@ void GLGSRender::on_init_thread()
|
|||||||
|
|
||||||
void GLGSRender::on_exit()
|
void GLGSRender::on_exit()
|
||||||
{
|
{
|
||||||
glFinish();
|
|
||||||
|
|
||||||
m_prog_buffer.clear();
|
m_prog_buffer.clear();
|
||||||
|
|
||||||
if (draw_fbo)
|
if (draw_fbo)
|
||||||
@ -838,6 +836,9 @@ void GLGSRender::on_exit()
|
|||||||
glDeleteQueries(1, &query.handle);
|
glDeleteQueries(1, &query.handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
glFlush();
|
||||||
|
glFinish();
|
||||||
|
|
||||||
GSRender::on_exit();
|
GSRender::on_exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,9 +42,24 @@ void gl_gs_frame::set_current(draw_context_t ctx)
|
|||||||
|
|
||||||
void gl_gs_frame::delete_context(draw_context_t ctx)
|
void gl_gs_frame::delete_context(draw_context_t ctx)
|
||||||
{
|
{
|
||||||
|
|
||||||
auto gl_ctx = (QOpenGLContext*)ctx;
|
auto gl_ctx = (QOpenGLContext*)ctx;
|
||||||
gl_ctx->doneCurrent();
|
gl_ctx->doneCurrent();
|
||||||
|
|
||||||
|
#ifndef _WIN32
|
||||||
delete gl_ctx;
|
delete gl_ctx;
|
||||||
|
#else
|
||||||
|
//AMD driver crashes when executing wglDeleteContext
|
||||||
|
//Catch with SEH
|
||||||
|
__try
|
||||||
|
{
|
||||||
|
delete gl_ctx;
|
||||||
|
}
|
||||||
|
__except(GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH)
|
||||||
|
{
|
||||||
|
LOG_FATAL(RSX, "Your graphics driver just crashed whilst cleaning up. All consumed VRAM should have been released, but you may want to restart the emulator just in case");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void gl_gs_frame::flip(draw_context_t context, bool skip_frame)
|
void gl_gs_frame::flip(draw_context_t context, bool skip_frame)
|
||||||
|
Loading…
Reference in New Issue
Block a user