Merge pull request #1087 from yuriks/opengl-glad

Replace the previous OpenGL loader with a glad-generated 3.3 one
This commit is contained in:
Yuri Kunde Schlesner 2015-09-03 15:07:01 -03:00
commit cc19a76656
20 changed files with 3984 additions and 2817 deletions

View file

@ -15,7 +15,7 @@ create_directory_groups(${SRCS} ${HEADERS})
add_executable(citra ${SRCS} ${HEADERS})
target_link_libraries(citra core video_core common)
target_link_libraries(citra ${GLFW_LIBRARIES} ${OPENGL_gl_LIBRARY} inih)
target_link_libraries(citra ${GLFW_LIBRARIES} ${OPENGL_gl_LIBRARY} inih glad)
if (MSVC)
target_link_libraries(citra getopt)
endif()
@ -23,4 +23,4 @@ target_link_libraries(citra ${PLATFORM_LIBRARIES})
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD|OpenBSD|NetBSD")
install(TARGETS citra RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
endif()
endif()

View file

@ -7,7 +7,7 @@
#include <string>
// Lets use our own GL header, instead of one from GLFW.
#include "video_core/renderer_opengl/generated/gl_3_2_core.h"
#include <glad/glad.h>
#define GLFW_INCLUDE_NONE
#include <GLFW/glfw3.h>
@ -89,7 +89,7 @@ EmuWindow_GLFW::EmuWindow_GLFW() {
exit(1);
}
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
// GLFW on OSX requires these window hints to be set to create a 3.2+ GL context.
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);

View file

@ -109,7 +109,7 @@ GRenderWindow::GRenderWindow(QWidget* parent, EmuThread* emu_thread) :
// TODO: One of these flags might be interesting: WA_OpaquePaintEvent, WA_NoBackground, WA_DontShowOnScreen, WA_DeleteOnClose
QGLFormat fmt;
fmt.setVersion(3,2);
fmt.setVersion(3,3);
fmt.setProfile(QGLFormat::CoreProfile);
// Requests a forward-compatible context, which is required to get a 3.2+ context on OS X
fmt.setOption(QGL::NoDeprecatedFunctions);

View file

@ -1,5 +1,4 @@
set(SRCS
renderer_opengl/generated/gl_3_2_core.c
renderer_opengl/gl_rasterizer.cpp
renderer_opengl/gl_rasterizer_cache.cpp
renderer_opengl/gl_shader_util.cpp
@ -19,7 +18,6 @@ set(SRCS
set(HEADERS
debug_utils/debug_utils.h
renderer_opengl/generated/gl_3_2_core.h
renderer_opengl/gl_rasterizer.h
renderer_opengl/gl_rasterizer_cache.h
renderer_opengl/gl_resource_manager.h
@ -53,6 +51,7 @@ endif()
create_directory_groups(${SRCS} ${HEADERS})
add_library(video_core STATIC ${SRCS} ${HEADERS})
target_link_libraries(video_core glad)
if (PNG_FOUND)
target_link_libraries(video_core ${PNG_LIBRARIES})

View file

@ -1,5 +0,0 @@
These file were generated by the [glLoadGen](https://bitbucket.org/alfonse/glloadgen/wiki/Home) OpenGL loader generator and have been checked in as-is. You can re-generate them using version 2.0.2 of glLoadGen and executing the following command:
```
lua LoadGen.lua -version 3.2 -profile core -indent space 3_2_core
```

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -5,6 +5,8 @@
#include <cstring>
#include <memory>
#include <glad/glad.h>
#include "common/color.h"
#include "common/math_util.h"
#include "common/microprofile.h"
@ -21,8 +23,6 @@
#include "video_core/renderer_opengl/gl_shader_util.h"
#include "video_core/renderer_opengl/pica_to_gl.h"
#include "generated/gl_3_2_core.h"
static bool IsPassThroughTevStage(const Pica::Regs::TevStageConfig& stage) {
return (stage.color_op == Pica::Regs::TevStageConfig::Operation::Replace &&
stage.alpha_op == Pica::Regs::TevStageConfig::Operation::Replace &&

View file

@ -6,9 +6,10 @@
#include <utility>
#include <glad/glad.h>
#include "common/common_types.h"
#include "video_core/renderer_opengl/generated/gl_3_2_core.h"
#include "video_core/renderer_opengl/gl_shader_util.h"
#include "video_core/renderer_opengl/gl_state.h"

View file

@ -4,7 +4,7 @@
#pragma once
#include "generated/gl_3_2_core.h"
#include <glad/glad.h>
namespace ShaderUtil {

View file

@ -4,7 +4,7 @@
#pragma once
#include "generated/gl_3_2_core.h"
#include <glad/glad.h>
class OpenGLState {
public:

View file

@ -4,12 +4,12 @@
#pragma once
#include <glad/glad.h>
#include "common/common_types.h"
#include "video_core/pica.h"
#include "generated/gl_3_2_core.h"
namespace PicaToGL {
inline GLenum TextureFilterMode(Pica::Regs::TextureConfig::TextureFilter mode) {

View file

@ -373,8 +373,8 @@ void RendererOpenGL::SetWindow(EmuWindow* window) {
void RendererOpenGL::Init() {
render_window->MakeCurrent();
int err = ogl_LoadFunctions();
if (ogl_LOAD_SUCCEEDED != err) {
// 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);
}

View file

@ -6,7 +6,7 @@
#include <array>
#include "generated/gl_3_2_core.h"
#include <glad/glad.h>
#include "common/math_util.h"