rpcsx/rpcs3/rpcs3qt/gl_gs_frame.cpp
Megamouse 4dbc546e7b GUI: add custom config indicator (#3108)
* game_list: add custom config indicator

* icon resize: get rid of duplicate call (great performance boost)

* icon resize: only save on slider release or clicks (performance)

refactoring shenanigans

* game_list: skip filtered out games in Refresh (performance)

* settings_dialog: remove unnecessary show() that caused glitches

* gs_frame: add disableMouse setting

* fix travis warnings
2017-07-28 23:03:48 +03:00

58 lines
1.3 KiB
C++

#include "stdafx.h"
#include "gl_gs_frame.h"
#include "Emu/System.h"
#include <QOpenGLContext>
#include <QWindow>
gl_gs_frame::gl_gs_frame(int w, int h, QIcon appIcon, bool disableMouse)
: gs_frame("OpenGL", w, h, appIcon, disableMouse)
{
setSurfaceType(QSurface::OpenGLSurface);
m_format.setMajorVersion(4);
m_format.setMinorVersion(3);
m_format.setProfile(QSurfaceFormat::CoreProfile);
m_format.setDepthBufferSize(16);
m_format.setSwapBehavior(QSurfaceFormat::SwapBehavior::DoubleBuffer);
if (g_cfg.video.debug_output)
{
m_format.setOption(QSurfaceFormat::FormatOption::DebugContext);
}
setFormat(m_format);
}
void* gl_gs_frame::make_context()
{
auto context = new QOpenGLContext();
context->setFormat(m_format);
context->create();
return context;
}
void gl_gs_frame::set_current(draw_context_t ctx)
{
if (!((QOpenGLContext*)ctx.get())->makeCurrent(this))
{
create();
((QOpenGLContext*)ctx.get())->makeCurrent(this);
}
}
void gl_gs_frame::delete_context(void* ctx)
{
delete (QOpenGLContext*)ctx;
}
void gl_gs_frame::flip(draw_context_t context, bool skip_frame)
{
gs_frame::flip(context);
//Do not swap buffers if frame skip is active
if (skip_frame) return;
((QOpenGLContext*)context.get())->makeCurrent(this);
((QOpenGLContext*)context.get())->swapBuffers(this);
}