mirror of
https://github.com/libretro/mgba.git
synced 2024-11-27 02:00:42 +00:00
Qt: Fix black screen when starting with a game (fixes #2781)
This commit is contained in:
parent
89f8873df3
commit
a7c232b284
1
CHANGES
1
CHANGES
@ -24,6 +24,7 @@ Other fixes:
|
||||
- Qt: Fix a handful of edge cases with graphics viewers (fixes mgba.io/i/2827)
|
||||
- Qt: Fix full-buffer rewind
|
||||
- Qt: Fix crash if loading a shader fails
|
||||
- Qt: Fix black screen when starting with a game (fixes mgba.io/i/2781)
|
||||
- Scripting: Fix receiving packets for client sockets
|
||||
- Scripting: Fix empty receive calls returning unknown error on Windows
|
||||
Misc:
|
||||
|
@ -48,6 +48,11 @@ using QOpenGLFunctions_Baseline = QOpenGLFunctions_3_2_Core;
|
||||
|
||||
using namespace QGBA;
|
||||
|
||||
enum ThreadStartFrom {
|
||||
START = 1,
|
||||
PROXY = 2,
|
||||
};
|
||||
|
||||
QHash<QSurfaceFormat, bool> DisplayGL::s_supports;
|
||||
|
||||
uint qHash(const QSurfaceFormat& format, uint seed) {
|
||||
@ -235,7 +240,16 @@ void DisplayGL::startDrawing(std::shared_ptr<CoreController> controller) {
|
||||
messagePainter()->resize(size(), devicePixelRatio());
|
||||
#endif
|
||||
|
||||
CoreController::Interrupter interrupter(controller);
|
||||
startThread(ThreadStartFrom::START);
|
||||
}
|
||||
|
||||
void DisplayGL::startThread(int from) {
|
||||
m_threadStartPending |= from;
|
||||
if (m_threadStartPending < 3) {
|
||||
return;
|
||||
}
|
||||
|
||||
CoreController::Interrupter interrupter(m_context);
|
||||
QMetaObject::invokeMethod(m_painter.get(), "start");
|
||||
if (!m_gl) {
|
||||
if (shouldDisableUpdates()) {
|
||||
@ -310,6 +324,7 @@ void DisplayGL::stopDrawing() {
|
||||
hide();
|
||||
}
|
||||
setUpdatesEnabled(true);
|
||||
m_threadStartPending &= ~1;
|
||||
}
|
||||
m_context.reset();
|
||||
}
|
||||
@ -435,6 +450,7 @@ void DisplayGL::setupProxyThread() {
|
||||
#if defined(_WIN32) && defined(USE_EPOXY)
|
||||
epoxy_handle_external_wglMakeCurrent();
|
||||
#endif
|
||||
QMetaObject::invokeMethod(this, "startThread", Q_ARG(int, ThreadStartFrom::PROXY));
|
||||
});
|
||||
connect(m_painter.get(), &PainterGL::texSwapped, m_proxyContext.get(), [this]() {
|
||||
if (!m_context->hardwareAccelerated()) {
|
||||
|
@ -113,6 +113,7 @@ protected:
|
||||
virtual void resizeEvent(QResizeEvent*) override;
|
||||
|
||||
private slots:
|
||||
void startThread(int);
|
||||
void setupProxyThread();
|
||||
|
||||
private:
|
||||
@ -123,6 +124,7 @@ private:
|
||||
|
||||
bool m_isDrawing = false;
|
||||
bool m_hasStarted = false;
|
||||
int m_threadStartPending = 0;
|
||||
std::unique_ptr<PainterGL> m_painter;
|
||||
QThread m_drawThread;
|
||||
QThread m_proxyThread;
|
||||
|
Loading…
Reference in New Issue
Block a user