rpcsx/rpcs3/Emu/RSX/GSRender.cpp
kd-11 e0005ec347 rsx: Refactoring and improvement
- Separate displayed statistics from actual backend statistics.
  Allows asynchronous flipping to work correctly as it just uses display stats.
  The real stats are used by the frame scope marker to determine behavior like engaging the FIFO optimizer or skipping draw calls correctly.
2019-09-19 23:10:09 +03:00

65 lines
811 B
C++

#include "stdafx.h"
#include "Emu/Memory/vm.h"
#include "Emu/System.h"
#include "GSRender.h"
GSRender::GSRender()
{
if (auto gs_frame = Emu.GetCallbacks().get_gs_frame())
{
m_frame = gs_frame.release();
}
else
{
m_frame = nullptr;
}
}
GSRender::~GSRender()
{
m_context = nullptr;
if (m_frame)
{
m_frame->hide();
m_frame->close();
}
}
void GSRender::on_init_rsx()
{
if (m_frame)
{
m_frame->show();
}
}
void GSRender::on_init_thread()
{
if (m_frame)
{
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(const rsx::display_flip_info_t& info)
{
if (m_frame)
{
m_frame->flip(m_context);
}
}