mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-20 22:05:12 +00:00
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:
parent
4ca98e53a6
commit
75504b3f5e
7 changed files with 34 additions and 31 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue