OpenGL ES Renderer: Use the proper ES extension header, and also avoid double #defining some of the tokens.

This commit is contained in:
rogerman 2024-07-10 21:53:49 -07:00
parent bb3011c262
commit 00dd6fb97a
1 changed files with 14 additions and 8 deletions

22
desmume/src/OGLRender.h Executable file → Normal file
View File

@ -32,9 +32,9 @@
#define OPENGL_VARIANT_ES #define OPENGL_VARIANT_ES
#define _NO_SDL_TYPES #define _NO_SDL_TYPES
#include <GLES3/gl3.h> #include <GLES3/gl3.h>
#include <GLES3/gl3ext.h> #define __gles2_gl2_h_ // Guard against including the gl2.h file.
#include <GLES2/gl2ext.h> // "gl3ext.h" is just a stub file. The real extension header is "gl2ext.h".
#include <EGL/egl.h> #include <EGL/egl.h>
//#include "opengl.h"
// Ignore dynamic linking // Ignore dynamic linking
#define OGLEXT(procPtr, func) #define OGLEXT(procPtr, func)
@ -273,7 +273,18 @@ EXTERNOGLEXT(PFNGLDELETERENDERBUFFERSEXTPROC, glDeleteRenderbuffersEXT)
// In practice, class objects for more modern variants like 3.2 Core Profile and ES 3.0 should // In practice, class objects for more modern variants like 3.2 Core Profile and ES 3.0 should
// override all the methods that would use FBOs so that only the ARB versions are actually used. // override all the methods that would use FBOs so that only the ARB versions are actually used.
#ifndef GL_EXT_draw_buffers
#define GL_MAX_COLOR_ATTACHMENTS_EXT GL_MAX_COLOR_ATTACHMENTS #define GL_MAX_COLOR_ATTACHMENTS_EXT GL_MAX_COLOR_ATTACHMENTS
#define GL_COLOR_ATTACHMENT0_EXT GL_COLOR_ATTACHMENT0
#define GL_COLOR_ATTACHMENT1_EXT GL_COLOR_ATTACHMENT1
#define GL_COLOR_ATTACHMENT2_EXT GL_COLOR_ATTACHMENT2
#define GL_COLOR_ATTACHMENT3_EXT GL_COLOR_ATTACHMENT3
#endif
#ifndef GL_EXT_multisampled_render_to_texture
#define GL_MAX_SAMPLES_EXT GL_MAX_SAMPLES
#endif
#define GL_DEPTH24_STENCIL8_EXT GL_DEPTH24_STENCIL8 #define GL_DEPTH24_STENCIL8_EXT GL_DEPTH24_STENCIL8
#define GL_DEPTH_STENCIL_EXT GL_DEPTH_STENCIL #define GL_DEPTH_STENCIL_EXT GL_DEPTH_STENCIL
#define GL_UNSIGNED_INT_24_8_EXT GL_UNSIGNED_INT_24_8 #define GL_UNSIGNED_INT_24_8_EXT GL_UNSIGNED_INT_24_8
@ -284,11 +295,6 @@ EXTERNOGLEXT(PFNGLDELETERENDERBUFFERSEXTPROC, glDeleteRenderbuffersEXT)
#define GL_RENDERBUFFER_EXT GL_RENDERBUFFER #define GL_RENDERBUFFER_EXT GL_RENDERBUFFER
#define GL_DRAW_FRAMEBUFFER_EXT GL_DRAW_FRAMEBUFFER #define GL_DRAW_FRAMEBUFFER_EXT GL_DRAW_FRAMEBUFFER
#define GL_READ_FRAMEBUFFER_EXT GL_READ_FRAMEBUFFER #define GL_READ_FRAMEBUFFER_EXT GL_READ_FRAMEBUFFER
#define GL_COLOR_ATTACHMENT0_EXT GL_COLOR_ATTACHMENT0
#define GL_COLOR_ATTACHMENT1_EXT GL_COLOR_ATTACHMENT1
#define GL_COLOR_ATTACHMENT2_EXT GL_COLOR_ATTACHMENT2
#define GL_COLOR_ATTACHMENT3_EXT GL_COLOR_ATTACHMENT3
#define GL_MAX_SAMPLES_EXT GL_MAX_SAMPLES
#define glGenFramebuffersEXT(n, framebuffers) glGenFramebuffers(n, framebuffers) #define glGenFramebuffersEXT(n, framebuffers) glGenFramebuffers(n, framebuffers)
#define glBindFramebufferEXT(target, framebuffer) glBindFramebuffer(target, framebuffer) #define glBindFramebufferEXT(target, framebuffer) glBindFramebuffer(target, framebuffer)
@ -309,7 +315,7 @@ EXTERNOGLEXT(PFNGLDELETERENDERBUFFERSEXTPROC, glDeleteRenderbuffersEXT)
// Some headers, such as the OpenGL ES headers, may not include this macro. // Some headers, such as the OpenGL ES headers, may not include this macro.
// Add it manually to avoid compiling issues. // Add it manually to avoid compiling issues.
#ifndef GL_BGRA #ifndef GL_BGRA
#define GL_BGRA 0x80E1 #define GL_BGRA GL_BGRA_EXT
#endif #endif
// OPENGL CORE EQUIVALENTS FOR LEGACY FUNCTIONS // OPENGL CORE EQUIVALENTS FOR LEGACY FUNCTIONS