Backends: OpenGL3: Made our custom GL loader a bit more tolerant of use of another loader in same compilation unit. (#4445, #4514)

docking
ocornut 3 years ago
parent 607ad8c949
commit 755bf985d2

@ -1,3 +1,22 @@
//-----------------------------------------------------------------------------
// About imgui_impl_opengl3_loader.h:
//
// We embed our own OpenGL loader to not require user to provide their own or to have to use ours,
// which proved to be endless problems for users.
// Our loader is custom-generated, based on gl3w but automatically filtered to only include
// enums/functions that we use in our imgui_impl_opengl3.cpp source file in order to be small.
//
// YOU SHOULD NOT NEED TO INCLUDE/USE THIS DIRECTLY. THIS IS USED BY imgui_impl_opengl3.cpp ONLY.
// THE REST OF YOUR APP SHOULD USE A DIFFERENT GL LOADER: ANY GL LOADER OF YOUR CHOICE.
//
// Regenerate with:
// python gl3w_gen.py --output ../imgui/backends/imgui_impl_opengl3_loader.h --ref ../imgui/backends/imgui_impl_opengl3.cpp ./extra_symbols.txt
//
// More info:
// https://github.com/dearimgui/gl3w_stripped
// https://github.com/ocornut/imgui/issues/4445
//-----------------------------------------------------------------------------
/* /*
* This file was generated with gl3w_gen.py, part of imgl3w * This file was generated with gl3w_gen.py, part of imgl3w
* (hosted at https://github.com/dearimgui/gl3w_stripped) * (hosted at https://github.com/dearimgui/gl3w_stripped)
@ -26,14 +45,11 @@
* OTHER DEALINGS IN THE SOFTWARE. * OTHER DEALINGS IN THE SOFTWARE.
*/ */
// We embed our own OpenGL loader to not require user to provide their own or to have to use ours, which proved to be endless problems for users.
// Our loader is custom-generated, based on gl3w but automatically filtered to only include enums/functions that we use in this source file.
// Regenerate with: python gl3w_gen.py --imgui-dir /path/to/imgui/
// see https://github.com/dearimgui/gl3w_stripped for more info.
#ifndef __gl3w_h_ #ifndef __gl3w_h_
#define __gl3w_h_ #define __gl3w_h_
// Adapted from KHR/khrplatform.h to avoid including entire file. // Adapted from KHR/khrplatform.h to avoid including entire file.
#ifndef __khrplatform_h_
typedef float khronos_float_t; typedef float khronos_float_t;
typedef signed char khronos_int8_t; typedef signed char khronos_int8_t;
typedef unsigned char khronos_uint8_t; typedef unsigned char khronos_uint8_t;
@ -58,6 +74,7 @@ typedef uint64_t khronos_uint64_t;
typedef signed long long khronos_int64_t; typedef signed long long khronos_int64_t;
typedef unsigned long long khronos_uint64_t; typedef unsigned long long khronos_uint64_t;
#endif #endif
#endif // __khrplatform_h_
#ifndef __gl_glcorearb_h_ #ifndef __gl_glcorearb_h_
#define __gl_glcorearb_h_ 1 #define __gl_glcorearb_h_ 1
@ -162,6 +179,7 @@ typedef void (APIENTRYP PFNGLDISABLEPROC) (GLenum cap);
typedef void (APIENTRYP PFNGLENABLEPROC) (GLenum cap); typedef void (APIENTRYP PFNGLENABLEPROC) (GLenum cap);
typedef void (APIENTRYP PFNGLPIXELSTOREIPROC) (GLenum pname, GLint param); typedef void (APIENTRYP PFNGLPIXELSTOREIPROC) (GLenum pname, GLint param);
typedef void (APIENTRYP PFNGLREADPIXELSPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels); typedef void (APIENTRYP PFNGLREADPIXELSPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels);
typedef GLenum (APIENTRYP PFNGLGETERRORPROC) (void);
typedef void (APIENTRYP PFNGLGETINTEGERVPROC) (GLenum pname, GLint *data); typedef void (APIENTRYP PFNGLGETINTEGERVPROC) (GLenum pname, GLint *data);
typedef const GLubyte *(APIENTRYP PFNGLGETSTRINGPROC) (GLenum name); typedef const GLubyte *(APIENTRYP PFNGLGETSTRINGPROC) (GLenum name);
typedef GLboolean (APIENTRYP PFNGLISENABLEDPROC) (GLenum cap); typedef GLboolean (APIENTRYP PFNGLISENABLEDPROC) (GLenum cap);
@ -177,6 +195,7 @@ GLAPI void APIENTRY glDisable (GLenum cap);
GLAPI void APIENTRY glEnable (GLenum cap); GLAPI void APIENTRY glEnable (GLenum cap);
GLAPI void APIENTRY glPixelStorei (GLenum pname, GLint param); GLAPI void APIENTRY glPixelStorei (GLenum pname, GLint param);
GLAPI void APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels); GLAPI void APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels);
GLAPI GLenum APIENTRY glGetError (void);
GLAPI void APIENTRY glGetIntegerv (GLenum pname, GLint *data); GLAPI void APIENTRY glGetIntegerv (GLenum pname, GLint *data);
GLAPI const GLubyte *APIENTRY glGetString (GLenum name); GLAPI const GLubyte *APIENTRY glGetString (GLenum name);
GLAPI GLboolean APIENTRY glIsEnabled (GLenum cap); GLAPI GLboolean APIENTRY glIsEnabled (GLenum cap);
@ -416,7 +435,7 @@ GL3W_API GL3WglProc imgl3wGetProcAddress(const char *proc);
/* gl3w internal state */ /* gl3w internal state */
union GL3WProcs { union GL3WProcs {
GL3WglProc ptr[52]; GL3WglProc ptr[53];
struct { struct {
PFNGLACTIVETEXTUREPROC ActiveTexture; PFNGLACTIVETEXTUREPROC ActiveTexture;
PFNGLATTACHSHADERPROC AttachShader; PFNGLATTACHSHADERPROC AttachShader;
@ -448,6 +467,7 @@ union GL3WProcs {
PFNGLGENTEXTURESPROC GenTextures; PFNGLGENTEXTURESPROC GenTextures;
PFNGLGENVERTEXARRAYSPROC GenVertexArrays; PFNGLGENVERTEXARRAYSPROC GenVertexArrays;
PFNGLGETATTRIBLOCATIONPROC GetAttribLocation; PFNGLGETATTRIBLOCATIONPROC GetAttribLocation;
PFNGLGETERRORPROC GetError;
PFNGLGETINTEGERVPROC GetIntegerv; PFNGLGETINTEGERVPROC GetIntegerv;
PFNGLGETPROGRAMINFOLOGPROC GetProgramInfoLog; PFNGLGETPROGRAMINFOLOGPROC GetProgramInfoLog;
PFNGLGETPROGRAMIVPROC GetProgramiv; PFNGLGETPROGRAMIVPROC GetProgramiv;
@ -506,6 +526,7 @@ GL3W_API extern union GL3WProcs imgl3wProcs;
#define glGenTextures imgl3wProcs.gl.GenTextures #define glGenTextures imgl3wProcs.gl.GenTextures
#define glGenVertexArrays imgl3wProcs.gl.GenVertexArrays #define glGenVertexArrays imgl3wProcs.gl.GenVertexArrays
#define glGetAttribLocation imgl3wProcs.gl.GetAttribLocation #define glGetAttribLocation imgl3wProcs.gl.GetAttribLocation
#define glGetError imgl3wProcs.gl.GetError
#define glGetIntegerv imgl3wProcs.gl.GetIntegerv #define glGetIntegerv imgl3wProcs.gl.GetIntegerv
#define glGetProgramInfoLog imgl3wProcs.gl.GetProgramInfoLog #define glGetProgramInfoLog imgl3wProcs.gl.GetProgramInfoLog
#define glGetProgramiv imgl3wProcs.gl.GetProgramiv #define glGetProgramiv imgl3wProcs.gl.GetProgramiv
@ -691,6 +712,7 @@ static const char *proc_names[] = {
"glGenTextures", "glGenTextures",
"glGenVertexArrays", "glGenVertexArrays",
"glGetAttribLocation", "glGetAttribLocation",
"glGetError",
"glGetIntegerv", "glGetIntegerv",
"glGetProgramInfoLog", "glGetProgramInfoLog",
"glGetProgramiv", "glGetProgramiv",

@ -60,7 +60,7 @@ Other Changes:
- Fonts: imgui_freetype: Fixed crash when FT_Render_Glyph() fails to render a glyph and returns NULL - Fonts: imgui_freetype: Fixed crash when FT_Render_Glyph() fails to render a glyph and returns NULL
(which apparently happens with Freetype 2.11). (#4394, #4145?). (which apparently happens with Freetype 2.11). (#4394, #4145?).
- Fonts: Fixed ImFontAtlas::ClearInputData() marking atlas as not built. (#4455, #3487) - Fonts: Fixed ImFontAtlas::ClearInputData() marking atlas as not built. (#4455, #3487)
- Backends: OpenGL3: Fixed our new GL loader conflicting with user using GL3W. (#4445) - Backends: OpenGL3: Fixed our custom GL loader conflicting with user using GL3W. (#4445) [@rokups]
- Backends: WebGPU: Fixed for latest specs. (#4472) [@Kangz] - Backends: WebGPU: Fixed for latest specs. (#4472) [@Kangz]
- Backends: Metal: Fixed a crash when clipping rect larger than framebuffer is submitted via - Backends: Metal: Fixed a crash when clipping rect larger than framebuffer is submitted via
a direct unclipped PushClipRect() call. (#4464) a direct unclipped PushClipRect() call. (#4464)

Loading…
Cancel
Save