all repos — mgba @ 903a8a654d4a7648e55f2b2e42525b89fda509b4

mGBA Game Boy Advance Emulator

Qt: Use GLES2 if enabled and GL isn't found
Jeffrey Pfau jeffrey@endrift.com
Thu, 30 Jul 2015 15:14:19 -0700
commit

903a8a654d4a7648e55f2b2e42525b89fda509b4

parent

46e24e84da8e4a98bee6dcd673a6ad39b0de9758

3 files changed, 18 insertions(+), 0 deletions(-)

jump to
M src/platform/qt/CMakeLists.txtsrc/platform/qt/CMakeLists.txt

@@ -38,7 +38,13 @@ set(BUILD_QT OFF PARENT_SCOPE)

return() endif() +if(BUILD_GL) list(APPEND PLATFORM_SRC ${PLATFORM_SRC} ${CMAKE_SOURCE_DIR}/src/platform/opengl/gl.c) +endif() + +if(BUILD_GLES2) +list(APPEND PLATFORM_SRC ${PLATFORM_SRC} ${CMAKE_SOURCE_DIR}/src/platform/opengl/gles2.c) +endif() get_target_property(QT_TYPE Qt5::Core TYPE) if(QT_TYPE STREQUAL STATIC_LIBRARY)
M src/platform/qt/DisplayGL.cppsrc/platform/qt/DisplayGL.cpp

@@ -135,7 +135,11 @@ , m_active(false)

, m_context(nullptr) , m_messagePainter(nullptr) { +#ifdef BUILD_GL GBAGLContextCreate(&m_backend); +#elif defined(BUILD_GLES2) + GBAGLES2ContextCreate(&m_backend); +#endif m_backend.d.swap = [](VideoBackend* v) { PainterGL* painter = static_cast<PainterGL*>(v->user); painter->m_gl->swapBuffers();
M src/platform/qt/DisplayGL.hsrc/platform/qt/DisplayGL.h

@@ -14,7 +14,11 @@ #include <QThread>

#include <QTimer> extern "C" { +#ifdef BUILD_GL #include "platform/opengl/gl.h" +#elif defined(BUILD_GLES2) +#include "platform/opengl/gles2.h" +#endif } struct GBAThread;

@@ -90,7 +94,11 @@ QPainter m_painter;

QGLWidget* m_gl; bool m_active; GBAThread* m_context; +#ifdef BUILD_GL GBAGLContext m_backend; +#elif defined(BUILD_GLES2) + GBAGLES2Context m_backend; +#endif QSize m_size; MessagePainter* m_messagePainter; };