rsx: Rework context handling and stop leaking the GL ccontext

- GL contexts are external handles that require manual lifecycle management
This commit is contained in:
kd-11 2017-11-03 20:43:11 +03:00
parent 4ca98e53a6
commit 75504b3f5e
7 changed files with 34 additions and 31 deletions

View file

@ -4,16 +4,6 @@
#include "GSRender.h"
draw_context_t GSFrameBase::new_context()
{
if (void* context = make_context())
{
return std::shared_ptr<void>(context, [this](void* ctxt) { delete_context(ctxt); });
}
return nullptr;
}
GSRender::GSRender()
{
m_frame = Emu.GetCallbacks().get_gs_frame().release();
@ -42,11 +32,22 @@ void GSRender::on_init_thread()
{
if (m_frame)
{
m_context = m_frame->new_context();
m_context = m_frame->make_context();
m_frame->set_current(m_context);
}
}
void GSRender::on_exit()
{
if (m_frame)
{
m_frame->delete_context(m_context);
m_context = nullptr;
}
rsx::thread::on_exit();
}
void GSRender::flip(int buffer)
{
if (m_frame)