mirror of
				https://git.suyu.dev/suyu/suyu
				synced 2025-11-03 16:39:01 -06:00 
			
		
		
		
	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:
		@@ -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})
 | 
			
		||||
 
 | 
			
		||||
@@ -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
											
										
									
								
							@@ -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 &&
 | 
			
		||||
 
 | 
			
		||||
@@ -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"
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -4,7 +4,7 @@
 | 
			
		||||
 | 
			
		||||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include "generated/gl_3_2_core.h"
 | 
			
		||||
#include <glad/glad.h>
 | 
			
		||||
 | 
			
		||||
namespace ShaderUtil {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -4,7 +4,7 @@
 | 
			
		||||
 | 
			
		||||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include "generated/gl_3_2_core.h"
 | 
			
		||||
#include <glad/glad.h>
 | 
			
		||||
 | 
			
		||||
class OpenGLState {
 | 
			
		||||
public:
 | 
			
		||||
 
 | 
			
		||||
@@ -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) {
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -6,7 +6,7 @@
 | 
			
		||||
 | 
			
		||||
#include <array>
 | 
			
		||||
 | 
			
		||||
#include "generated/gl_3_2_core.h"
 | 
			
		||||
#include <glad/glad.h>
 | 
			
		||||
 | 
			
		||||
#include "common/math_util.h"
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user