mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-11 08:39:13 +01:00
839df31347
This branch is the final step of fully supporting both OpenGL and OpenGL ES in the same binary. This of course only applies to EGL and won't work for GLX/AGL/WGL since they don't really support GL ES. The changes here actually aren't too terrible, basically change every #ifdef USE_GLES to a runtime check. This adds a DetectMode() function to the EGL context backend. EGL will iterate through each of the configs and check for GL, GLES3_KHR, and GLES2 bits After that it'll change the mode from _DETECT to whichever one is the best supported. After that point we'll just create a context with the mode that was detected
57 lines
1.7 KiB
C
57 lines
1.7 KiB
C
// Copyright 2013 Dolphin Emulator Project
|
|
// Licensed under GPLv2
|
|
// Refer to the license.txt file included.
|
|
|
|
#ifndef _GLINIT_H_
|
|
#define _GLINIT_H_
|
|
|
|
#include "VideoConfig.h"
|
|
#include "MathUtil.h"
|
|
#include "GLInterface.h"
|
|
#include "GLExtensions/GLExtensions.h"
|
|
|
|
#ifndef GL_DEPTH24_STENCIL8_EXT // allows FBOs to support stencils
|
|
#define GL_DEPTH_STENCIL_EXT 0x84F9
|
|
#define GL_UNSIGNED_INT_24_8_EXT 0x84FA
|
|
#define GL_DEPTH24_STENCIL8_EXT 0x88F0
|
|
#define GL_TEXTURE_STENCIL_SIZE_EXT 0x88F1
|
|
#endif
|
|
|
|
#ifndef _WIN32
|
|
|
|
#include <sys/types.h>
|
|
|
|
#endif
|
|
void InitInterface();
|
|
|
|
// Helpers
|
|
GLuint OpenGL_CompileProgram(const char *vertexShader, const char *fragmentShader);
|
|
|
|
// Error reporting - use the convenient macros.
|
|
GLuint OpenGL_ReportGLError(const char *function, const char *file, int line);
|
|
bool OpenGL_ReportFBOError(const char *function, const char *file, int line);
|
|
|
|
#if defined(_DEBUG) || defined(DEBUGFAST)
|
|
#define GL_REPORT_ERROR() OpenGL_ReportGLError(__FUNCTION__, __FILE__, __LINE__)
|
|
#define GL_REPORT_ERRORD() OpenGL_ReportGLError(__FUNCTION__, __FILE__, __LINE__)
|
|
#define GL_REPORT_FBO_ERROR() OpenGL_ReportFBOError(__FUNCTION__, __FILE__, __LINE__)
|
|
#else
|
|
__forceinline GLenum GL_REPORT_ERROR() { return GL_NO_ERROR; }
|
|
#define GL_REPORT_ERRORD() (void)GL_NO_ERROR
|
|
#define GL_REPORT_FBO_ERROR() (void)true
|
|
#endif
|
|
|
|
// this should be removed in future, but as long as glsl is unstable, we should really read this messages
|
|
#if defined(_DEBUG) || defined(DEBUGFAST)
|
|
#define DEBUG_GLSL 1
|
|
#else
|
|
#define DEBUG_GLSL 0
|
|
#endif
|
|
|
|
// Isn't defined if we aren't using GLEW 1.6
|
|
#ifndef GL_ONE_MINUS_SRC1_ALPHA
|
|
#define GL_ONE_MINUS_SRC1_ALPHA 0x88FB
|
|
#endif
|
|
|
|
#endif // _GLINIT_H_
|