Replace the previous OpenGL loader with a glad-generated 3.3 one

The main advantage of switching to glad from glLoadGen is that, apart
from being actively maintained, it supports a customizable entrypoint
loader function, which makes it possible to also support OpenGL ES.
This commit is contained in:
Yuri Kunde Schlesner 2015-08-30 03:37:42 -03:00
parent 58e9f78844
commit a1a5570e97
19 changed files with 3982 additions and 2815 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>

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"