From 8d5bcfa44a655e79350278d14585ba9161d5f0a1 Mon Sep 17 00:00:00 2001 From: Redacted Date: Wed, 7 May 2025 11:41:13 -0400 Subject: [PATCH] draw_instanced --- include/glad/glad.h | 26 +++++++++++++++++++++++--- src/glad.c | 26 +++++++++++++++++++++++--- 2 files changed, 46 insertions(+), 6 deletions(-) diff --git a/include/glad/glad.h b/include/glad/glad.h index 3e10ad0..8ddde67 100644 --- a/include/glad/glad.h +++ b/include/glad/glad.h @@ -1,6 +1,6 @@ /* - OpenGL loader generated by glad 0.1.36 on Thu Feb 13 06:39:18 2025. + OpenGL loader generated by glad 0.1.36 on Wed May 7 15:49:23 2025. Language/Generator: C/C++ Specification: gl @@ -8,7 +8,9 @@ Profile: compatibility Extensions: GL_ARB_depth_texture, + GL_ARB_draw_instanced, GL_ARB_framebuffer_object, + GL_ARB_instanced_arrays, GL_ARB_shadow, GL_ARB_texture_filter_anisotropic Loader: True @@ -17,9 +19,9 @@ Reproducible: False Commandline: - --profile="compatibility" --api="gl=2.1" --generator="c" --spec="gl" --extensions="GL_ARB_depth_texture,GL_ARB_framebuffer_object,GL_ARB_shadow,GL_ARB_texture_filter_anisotropic" + --profile="compatibility" --api="gl=2.1" --generator="c" --spec="gl" --extensions="GL_ARB_depth_texture,GL_ARB_draw_instanced,GL_ARB_framebuffer_object,GL_ARB_instanced_arrays,GL_ARB_shadow,GL_ARB_texture_filter_anisotropic" Online: - https://glad.dav1d.de/#profile=compatibility&language=c&specification=gl&loader=on&api=gl%3D2.1&extensions=GL_ARB_depth_texture&extensions=GL_ARB_framebuffer_object&extensions=GL_ARB_shadow&extensions=GL_ARB_texture_filter_anisotropic + https://glad.dav1d.de/#profile=compatibility&language=c&specification=gl&loader=on&api=gl%3D2.1&extensions=GL_ARB_depth_texture&extensions=GL_ARB_draw_instanced&extensions=GL_ARB_framebuffer_object&extensions=GL_ARB_instanced_arrays&extensions=GL_ARB_shadow&extensions=GL_ARB_texture_filter_anisotropic */ @@ -2771,6 +2773,7 @@ GLAPI PFNGLUNIFORMMATRIX4X3FVPROC glad_glUniformMatrix4x3fv; #define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE 0x8D56 #define GL_MAX_SAMPLES 0x8D57 #define GL_INDEX 0x8222 +#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB 0x88FE #define GL_TEXTURE_COMPARE_MODE_ARB 0x884C #define GL_TEXTURE_COMPARE_FUNC_ARB 0x884D #define GL_COMPARE_R_TO_TEXTURE_ARB 0x884E @@ -2780,6 +2783,16 @@ GLAPI PFNGLUNIFORMMATRIX4X3FVPROC glad_glUniformMatrix4x3fv; #define GL_ARB_depth_texture 1 GLAPI int GLAD_GL_ARB_depth_texture; #endif +#ifndef GL_ARB_draw_instanced +#define GL_ARB_draw_instanced 1 +GLAPI int GLAD_GL_ARB_draw_instanced; +typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDARBPROC)(GLenum mode, GLint first, GLsizei count, GLsizei primcount); +GLAPI PFNGLDRAWARRAYSINSTANCEDARBPROC glad_glDrawArraysInstancedARB; +#define glDrawArraysInstancedARB glad_glDrawArraysInstancedARB +typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDARBPROC)(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); +GLAPI PFNGLDRAWELEMENTSINSTANCEDARBPROC glad_glDrawElementsInstancedARB; +#define glDrawElementsInstancedARB glad_glDrawElementsInstancedARB +#endif #ifndef GL_ARB_framebuffer_object #define GL_ARB_framebuffer_object 1 GLAPI int GLAD_GL_ARB_framebuffer_object; @@ -2844,6 +2857,13 @@ typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYERPROC)(GLenum target, GLenum GLAPI PFNGLFRAMEBUFFERTEXTURELAYERPROC glad_glFramebufferTextureLayer; #define glFramebufferTextureLayer glad_glFramebufferTextureLayer #endif +#ifndef GL_ARB_instanced_arrays +#define GL_ARB_instanced_arrays 1 +GLAPI int GLAD_GL_ARB_instanced_arrays; +typedef void (APIENTRYP PFNGLVERTEXATTRIBDIVISORARBPROC)(GLuint index, GLuint divisor); +GLAPI PFNGLVERTEXATTRIBDIVISORARBPROC glad_glVertexAttribDivisorARB; +#define glVertexAttribDivisorARB glad_glVertexAttribDivisorARB +#endif #ifndef GL_ARB_shadow #define GL_ARB_shadow 1 GLAPI int GLAD_GL_ARB_shadow; diff --git a/src/glad.c b/src/glad.c index 50c6642..7929455 100644 --- a/src/glad.c +++ b/src/glad.c @@ -1,6 +1,6 @@ /* - OpenGL loader generated by glad 0.1.36 on Thu Feb 13 06:39:18 2025. + OpenGL loader generated by glad 0.1.36 on Wed May 7 15:49:23 2025. Language/Generator: C/C++ Specification: gl @@ -8,7 +8,9 @@ Profile: compatibility Extensions: GL_ARB_depth_texture, + GL_ARB_draw_instanced, GL_ARB_framebuffer_object, + GL_ARB_instanced_arrays, GL_ARB_shadow, GL_ARB_texture_filter_anisotropic Loader: True @@ -17,9 +19,9 @@ Reproducible: False Commandline: - --profile="compatibility" --api="gl=2.1" --generator="c" --spec="gl" --extensions="GL_ARB_depth_texture,GL_ARB_framebuffer_object,GL_ARB_shadow,GL_ARB_texture_filter_anisotropic" + --profile="compatibility" --api="gl=2.1" --generator="c" --spec="gl" --extensions="GL_ARB_depth_texture,GL_ARB_draw_instanced,GL_ARB_framebuffer_object,GL_ARB_instanced_arrays,GL_ARB_shadow,GL_ARB_texture_filter_anisotropic" Online: - https://glad.dav1d.de/#profile=compatibility&language=c&specification=gl&loader=on&api=gl%3D2.1&extensions=GL_ARB_depth_texture&extensions=GL_ARB_framebuffer_object&extensions=GL_ARB_shadow&extensions=GL_ARB_texture_filter_anisotropic + https://glad.dav1d.de/#profile=compatibility&language=c&specification=gl&loader=on&api=gl%3D2.1&extensions=GL_ARB_depth_texture&extensions=GL_ARB_draw_instanced&extensions=GL_ARB_framebuffer_object&extensions=GL_ARB_instanced_arrays&extensions=GL_ARB_shadow&extensions=GL_ARB_texture_filter_anisotropic */ #include @@ -818,9 +820,13 @@ PFNGLWINDOWPOS3IVPROC glad_glWindowPos3iv = NULL; PFNGLWINDOWPOS3SPROC glad_glWindowPos3s = NULL; PFNGLWINDOWPOS3SVPROC glad_glWindowPos3sv = NULL; int GLAD_GL_ARB_depth_texture = 0; +int GLAD_GL_ARB_draw_instanced = 0; int GLAD_GL_ARB_framebuffer_object = 0; +int GLAD_GL_ARB_instanced_arrays = 0; int GLAD_GL_ARB_shadow = 0; int GLAD_GL_ARB_texture_filter_anisotropic = 0; +PFNGLDRAWARRAYSINSTANCEDARBPROC glad_glDrawArraysInstancedARB = NULL; +PFNGLDRAWELEMENTSINSTANCEDARBPROC glad_glDrawElementsInstancedARB = NULL; PFNGLISRENDERBUFFERPROC glad_glIsRenderbuffer = NULL; PFNGLBINDRENDERBUFFERPROC glad_glBindRenderbuffer = NULL; PFNGLDELETERENDERBUFFERSPROC glad_glDeleteRenderbuffers = NULL; @@ -841,6 +847,7 @@ PFNGLGENERATEMIPMAPPROC glad_glGenerateMipmap = NULL; PFNGLBLITFRAMEBUFFERPROC glad_glBlitFramebuffer = NULL; PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC glad_glRenderbufferStorageMultisample = NULL; PFNGLFRAMEBUFFERTEXTURELAYERPROC glad_glFramebufferTextureLayer = NULL; +PFNGLVERTEXATTRIBDIVISORARBPROC glad_glVertexAttribDivisorARB = NULL; static void load_GL_VERSION_1_0(GLADloadproc load) { if(!GLAD_GL_VERSION_1_0) return; glad_glCullFace = (PFNGLCULLFACEPROC)load("glCullFace"); @@ -1416,6 +1423,11 @@ static void load_GL_VERSION_2_1(GLADloadproc load) { glad_glUniformMatrix3x4fv = (PFNGLUNIFORMMATRIX3X4FVPROC)load("glUniformMatrix3x4fv"); glad_glUniformMatrix4x3fv = (PFNGLUNIFORMMATRIX4X3FVPROC)load("glUniformMatrix4x3fv"); } +static void load_GL_ARB_draw_instanced(GLADloadproc load) { + if(!GLAD_GL_ARB_draw_instanced) return; + glad_glDrawArraysInstancedARB = (PFNGLDRAWARRAYSINSTANCEDARBPROC)load("glDrawArraysInstancedARB"); + glad_glDrawElementsInstancedARB = (PFNGLDRAWELEMENTSINSTANCEDARBPROC)load("glDrawElementsInstancedARB"); +} static void load_GL_ARB_framebuffer_object(GLADloadproc load) { if(!GLAD_GL_ARB_framebuffer_object) return; glad_glIsRenderbuffer = (PFNGLISRENDERBUFFERPROC)load("glIsRenderbuffer"); @@ -1439,10 +1451,16 @@ static void load_GL_ARB_framebuffer_object(GLADloadproc load) { glad_glRenderbufferStorageMultisample = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC)load("glRenderbufferStorageMultisample"); glad_glFramebufferTextureLayer = (PFNGLFRAMEBUFFERTEXTURELAYERPROC)load("glFramebufferTextureLayer"); } +static void load_GL_ARB_instanced_arrays(GLADloadproc load) { + if(!GLAD_GL_ARB_instanced_arrays) return; + glad_glVertexAttribDivisorARB = (PFNGLVERTEXATTRIBDIVISORARBPROC)load("glVertexAttribDivisorARB"); +} static int find_extensionsGL(void) { if (!get_exts()) return 0; GLAD_GL_ARB_depth_texture = has_ext("GL_ARB_depth_texture"); + GLAD_GL_ARB_draw_instanced = has_ext("GL_ARB_draw_instanced"); GLAD_GL_ARB_framebuffer_object = has_ext("GL_ARB_framebuffer_object"); + GLAD_GL_ARB_instanced_arrays = has_ext("GL_ARB_instanced_arrays"); GLAD_GL_ARB_shadow = has_ext("GL_ARB_shadow"); GLAD_GL_ARB_texture_filter_anisotropic = has_ext("GL_ARB_texture_filter_anisotropic"); free_exts(); @@ -1515,7 +1533,9 @@ int gladLoadGLLoader(GLADloadproc load) { load_GL_VERSION_2_1(load); if (!find_extensionsGL()) return 0; + load_GL_ARB_draw_instanced(load); load_GL_ARB_framebuffer_object(load); + load_GL_ARB_instanced_arrays(load); return GLVersion.major != 0 || GLVersion.minor != 0; }