2012-11-15 00:39:56 +01:00
|
|
|
#include "stdafx.h"
|
2018-07-27 21:07:34 +02:00
|
|
|
#include "Emu/Memory/vm.h"
|
2014-06-02 19:27:24 +02:00
|
|
|
#include "Emu/System.h"
|
|
|
|
|
|
2012-11-15 00:39:56 +01:00
|
|
|
#include "GSRender.h"
|
|
|
|
|
|
2017-05-20 13:45:02 +02:00
|
|
|
GSRender::GSRender()
|
2015-10-05 02:42:48 +02:00
|
|
|
{
|
2017-05-20 13:45:02 +02:00
|
|
|
m_frame = Emu.GetCallbacks().get_gs_frame().release();
|
2015-10-05 02:42:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GSRender::~GSRender()
|
|
|
|
|
{
|
|
|
|
|
m_context = nullptr;
|
|
|
|
|
|
|
|
|
|
if (m_frame)
|
|
|
|
|
{
|
2015-11-26 09:06:29 +01:00
|
|
|
m_frame->hide();
|
2015-10-05 02:42:48 +02:00
|
|
|
m_frame->close();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-02-01 22:50:02 +01:00
|
|
|
void GSRender::on_init_rsx()
|
2015-10-05 02:42:48 +02:00
|
|
|
{
|
|
|
|
|
if (m_frame)
|
|
|
|
|
{
|
|
|
|
|
m_frame->show();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-11-26 09:06:29 +01:00
|
|
|
void GSRender::on_init_thread()
|
2015-10-05 02:42:48 +02:00
|
|
|
{
|
|
|
|
|
if (m_frame)
|
|
|
|
|
{
|
2017-11-03 18:43:11 +01:00
|
|
|
m_context = m_frame->make_context();
|
2015-10-05 02:42:48 +02:00
|
|
|
m_frame->set_current(m_context);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-11-03 18:43:11 +01:00
|
|
|
void GSRender::on_exit()
|
|
|
|
|
{
|
|
|
|
|
if (m_frame)
|
|
|
|
|
{
|
2018-01-17 04:51:58 +01:00
|
|
|
m_frame->disable_wm_event_queue();
|
|
|
|
|
m_frame->clear_wm_events();
|
2017-11-03 18:43:11 +01:00
|
|
|
m_frame->delete_context(m_context);
|
|
|
|
|
m_context = nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
rsx::thread::on_exit();
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-03 15:42:33 +02:00
|
|
|
void GSRender::flip(int buffer, bool emu_flip)
|
2015-10-05 02:42:48 +02:00
|
|
|
{
|
|
|
|
|
if (m_frame)
|
2015-11-26 09:06:29 +01:00
|
|
|
{
|
2015-10-05 02:42:48 +02:00
|
|
|
m_frame->flip(m_context);
|
2015-11-26 09:06:29 +01:00
|
|
|
}
|
2015-10-21 09:24:02 +02:00
|
|
|
}
|