summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar bunnei2016-05-07 00:33:06 -0400
committerGravatar bunnei2016-05-07 00:33:06 -0400
commit8043a35cf948922a06f18d3978fc40617f313cb7 (patch)
treed77167f5b7fba155f73fd68af7e21f78b4f00de7 /src
parentMerge pull request #1764 from wwylele/how-can-i-find-this-if-i-have-only-decr... (diff)
parentFrontends, VideoCore: Move glad initialisation to the frontend (diff)
downloadyuzu-8043a35cf948922a06f18d3978fc40617f313cb7.tar.gz
yuzu-8043a35cf948922a06f18d3978fc40617f313cb7.tar.xz
yuzu-8043a35cf948922a06f18d3978fc40617f313cb7.zip
Merge pull request #1544 from linkmauve/move-glad-init
Move glad initialisation to the frontend
Diffstat (limited to 'src')
-rw-r--r--src/citra/emu_window/emu_window_sdl2.cpp7
-rw-r--r--src/citra_qt/main.cpp11
-rw-r--r--src/video_core/renderer_opengl/renderer_opengl.cpp6
3 files changed, 18 insertions, 6 deletions
diff --git a/src/citra/emu_window/emu_window_sdl2.cpp b/src/citra/emu_window/emu_window_sdl2.cpp
index 924189f4c..12cdd9d95 100644
--- a/src/citra/emu_window/emu_window_sdl2.cpp
+++ b/src/citra/emu_window/emu_window_sdl2.cpp
@@ -9,6 +9,8 @@
9#define SDL_MAIN_HANDLED 9#define SDL_MAIN_HANDLED
10#include <SDL.h> 10#include <SDL.h>
11 11
12#include <glad/glad.h>
13
12#include "common/key_map.h" 14#include "common/key_map.h"
13#include "common/logging/log.h" 15#include "common/logging/log.h"
14#include "common/scm_rev.h" 16#include "common/scm_rev.h"
@@ -98,6 +100,11 @@ EmuWindow_SDL2::EmuWindow_SDL2() {
98 exit(1); 100 exit(1);
99 } 101 }
100 102
103 if (!gladLoadGLLoader(static_cast<GLADloadproc>(SDL_GL_GetProcAddress))) {
104 LOG_CRITICAL(Frontend, "Failed to initialize GL functions! Exiting...");
105 exit(1);
106 }
107
101 OnResize(); 108 OnResize();
102 OnMinimalClientAreaChangeRequest(GetActiveConfig().min_client_area_size); 109 OnMinimalClientAreaChangeRequest(GetActiveConfig().min_client_area_size);
103 SDL_PumpEvents(); 110 SDL_PumpEvents();
diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp
index f1ab29755..a85c94a4b 100644
--- a/src/citra_qt/main.cpp
+++ b/src/citra_qt/main.cpp
@@ -6,6 +6,9 @@
6#include <memory> 6#include <memory>
7#include <thread> 7#include <thread>
8 8
9#include <glad/glad.h>
10
11#define QT_NO_OPENGL
9#include <QDesktopWidget> 12#include <QDesktopWidget>
10#include <QtGui> 13#include <QtGui>
11#include <QFileDialog> 14#include <QFileDialog>
@@ -240,6 +243,14 @@ bool GMainWindow::InitializeSystem() {
240 if (emu_thread != nullptr) 243 if (emu_thread != nullptr)
241 ShutdownGame(); 244 ShutdownGame();
242 245
246 render_window->MakeCurrent();
247 if (!gladLoadGL()) {
248 QMessageBox::critical(this, tr("Error while starting Citra!"),
249 tr("Failed to initialize the video core!\n\n"
250 "Please ensure that your GPU supports OpenGL 3.3 and that you have the latest graphics driver."));
251 return false;
252 }
253
243 // Initialize the core emulation 254 // Initialize the core emulation
244 System::Result system_result = System::Init(render_window); 255 System::Result system_result = System::Init(render_window);
245 if (System::Result::Success != system_result) { 256 if (System::Result::Success != system_result) {
diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp
index 0e9a0be8b..7fcd36409 100644
--- a/src/video_core/renderer_opengl/renderer_opengl.cpp
+++ b/src/video_core/renderer_opengl/renderer_opengl.cpp
@@ -473,12 +473,6 @@ static void DebugHandler(GLenum source, GLenum type, GLuint id, GLenum severity,
473bool RendererOpenGL::Init() { 473bool RendererOpenGL::Init() {
474 render_window->MakeCurrent(); 474 render_window->MakeCurrent();
475 475
476 // TODO: Make frontends initialize this, so they can use gladLoadGLLoader with their own loaders
477 if (!gladLoadGL()) {
478 LOG_CRITICAL(Render_OpenGL, "Failed to initialize GL functions! Exiting...");
479 exit(-1);
480 }
481
482 if (GLAD_GL_KHR_debug) { 476 if (GLAD_GL_KHR_debug) {
483 glEnable(GL_DEBUG_OUTPUT); 477 glEnable(GL_DEBUG_OUTPUT);
484 glDebugMessageCallback(DebugHandler, nullptr); 478 glDebugMessageCallback(DebugHandler, nullptr);