mirror of
https://github.com/citra-mirror/citra.git
synced 2024-08-20 18:33:24 +02:00
Merge pull request #1544 from linkmauve/move-glad-init
Move glad initialisation to the frontend
This commit is contained in:
commit
8043a35cf9
@ -9,6 +9,8 @@
|
|||||||
#define SDL_MAIN_HANDLED
|
#define SDL_MAIN_HANDLED
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
|
|
||||||
|
#include <glad/glad.h>
|
||||||
|
|
||||||
#include "common/key_map.h"
|
#include "common/key_map.h"
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "common/scm_rev.h"
|
#include "common/scm_rev.h"
|
||||||
@ -98,6 +100,11 @@ EmuWindow_SDL2::EmuWindow_SDL2() {
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!gladLoadGLLoader(static_cast<GLADloadproc>(SDL_GL_GetProcAddress))) {
|
||||||
|
LOG_CRITICAL(Frontend, "Failed to initialize GL functions! Exiting...");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
OnResize();
|
OnResize();
|
||||||
OnMinimalClientAreaChangeRequest(GetActiveConfig().min_client_area_size);
|
OnMinimalClientAreaChangeRequest(GetActiveConfig().min_client_area_size);
|
||||||
SDL_PumpEvents();
|
SDL_PumpEvents();
|
||||||
|
@ -6,6 +6,9 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
|
#include <glad/glad.h>
|
||||||
|
|
||||||
|
#define QT_NO_OPENGL
|
||||||
#include <QDesktopWidget>
|
#include <QDesktopWidget>
|
||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
@ -240,6 +243,14 @@ bool GMainWindow::InitializeSystem() {
|
|||||||
if (emu_thread != nullptr)
|
if (emu_thread != nullptr)
|
||||||
ShutdownGame();
|
ShutdownGame();
|
||||||
|
|
||||||
|
render_window->MakeCurrent();
|
||||||
|
if (!gladLoadGL()) {
|
||||||
|
QMessageBox::critical(this, tr("Error while starting Citra!"),
|
||||||
|
tr("Failed to initialize the video core!\n\n"
|
||||||
|
"Please ensure that your GPU supports OpenGL 3.3 and that you have the latest graphics driver."));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Initialize the core emulation
|
// Initialize the core emulation
|
||||||
System::Result system_result = System::Init(render_window);
|
System::Result system_result = System::Init(render_window);
|
||||||
if (System::Result::Success != system_result) {
|
if (System::Result::Success != system_result) {
|
||||||
|
@ -473,12 +473,6 @@ static void DebugHandler(GLenum source, GLenum type, GLuint id, GLenum severity,
|
|||||||
bool RendererOpenGL::Init() {
|
bool RendererOpenGL::Init() {
|
||||||
render_window->MakeCurrent();
|
render_window->MakeCurrent();
|
||||||
|
|
||||||
// TODO: Make frontends initialize this, so they can use gladLoadGLLoader with their own loaders
|
|
||||||
if (!gladLoadGL()) {
|
|
||||||
LOG_CRITICAL(Render_OpenGL, "Failed to initialize GL functions! Exiting...");
|
|
||||||
exit(-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GLAD_GL_KHR_debug) {
|
if (GLAD_GL_KHR_debug) {
|
||||||
glEnable(GL_DEBUG_OUTPUT);
|
glEnable(GL_DEBUG_OUTPUT);
|
||||||
glDebugMessageCallback(DebugHandler, nullptr);
|
glDebugMessageCallback(DebugHandler, nullptr);
|
||||||
|
Loading…
Reference in New Issue
Block a user