Initial commit - some engine bugs stopping compiling

This commit is contained in:
Will
2026-03-29 15:52:42 +01:00
commit 3d573a200e
361 changed files with 332759 additions and 0 deletions

19
third-party/glad/test/README.md vendored Normal file
View File

@@ -0,0 +1,19 @@
Test
====
This directory contains integration tests ran by the [`/utility/test.sh`](../utility/test.sh) script.
These tests are mainly for testing the generators.
## Execution
There are a few requirements for actually running the test suite:
* Linux
* Python environment
* GCC
* glfw
* mingw
* wine
Depending on future generators being added there may be more.

View File

@@ -0,0 +1,82 @@
cmake_minimum_required(VERSION 3.8)
project(glad_all_versions C)
enable_testing()
set(GLAD_CMAKE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../../cmake")
add_subdirectory("${GLAD_CMAKE_PATH}" "glad_cmake")
set(egl_VERSIONS 1.0 1.1 1.2 1.3 1.4 1.5)
set(gl_VERSIONS 1.0 1.1 1.2 1.3 1.4 1.5 2.0 2.1 3.0 3.1 3.2 3.3 4.0 4.1 4.2 4.3 4.4 4.5 4.6)
set(gles1_VERSIONS 1.0)
set(gles2_VERSIONS 2.0 3.0 3.1 3.2)
set(glsc2_VERSIONS 2.0)
set(glx_VERSIONS 1.0 1.1 1.2 1.3 1.4)
set(vulkan_VERSIONS 1.0 1.1)
set(wgl_VERSIONS 1.0)
set(gl_PROFILES core compatibility)
set(egl_SYSTEMS Linux Windows Darwin)
set(gl_SYSTEMS Linux Windows Darwin)
set(gles1_SYSTEMS Linux Windows Darwin)
set(gles2_SYSTEMS Linux Windows Darwin)
set(glsc2_SYSTEMS Linux Windows Darwin)
set(glx_SYSTEMS Linux)
set(vulkan_SYSTEMS Linux Windows Darwin)
set(wgl_SYSTEMS Windows)
set(APIS egl gl gles1 gles2 glsc2 glx vulkan wgl)
macro(merge_version RESULT VERSION)
string(REPLACE "." "" "${RESULT}" "${VERSION}")
endmacro()
foreach(API ${APIS})
set(PROFILES "${${API}_PROFILES}")
if(NOT PROFILES)
set(PROFILES "X")
endif()
foreach(PROFILE ${PROFILES})
if(PROFILE STREQUAL "X")
set(PROFILE "")
endif()
foreach(VERSION ${${API}_VERSIONS})
set(APISTR "${API}")
string(REPLACE "." "" NAME_SUFFIX "${VERSION}")
if(PROFILE)
string(APPEND APISTR ":${PROFILE}")
string(APPEND NAME_SUFFIX "_${PROFILE}")
endif()
set(TARGET "glad_${API}_${NAME_SUFFIX}")
glad_add_library("${TARGET}" EXCLUDE_FROM_ALL
LOCATION "${PROJECT_BINARY_DIR}/external/glad_${API}_${NAME_SUFFIX}"
API ${APISTR}=${VERSION}
)
if(CMAKE_SYSTEM_NAME IN_LIST "${API}_SYSTEMS")
add_test(
NAME "${TARGET}"
COMMAND "${CMAKE_MAKE_PROGRAM}" "${TARGET}" VERBOSE=ON
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}"
)
endif()
endforeach()
endforeach()
endforeach()
foreach(glx_VERSION ${glx_VERSIONS})
string(REPLACE "." "" NAME_SUFFIX "${glx_VERSION}")
target_link_libraries(glad_glx_${NAME_SUFFIX}
PUBLIC
glad_gl_10_core
)
endforeach()
foreach(wgl_VERSION ${wgl_VERSIONS})
string(REPLACE "." "" NAME_SUFFIX "${wgl_VERSION}")
target_link_libraries(glad_wgl_${NAME_SUFFIX}
PUBLIC
glad_gl_10_core
)
endforeach()

View File

@@ -0,0 +1,5 @@
#!/bin/sh
# GLAD: true
# COMPILE: echo "$(pwd) - $tmp | $test_dir" && cd $tmp && cmake $test_dir
# RUN: ctest --no-compress-output -T Test --verbose

View File

@@ -0,0 +1,14 @@
/*
* Issue #362, aliasing func is not called.
* Note this does not actually verify the functions get properly initialized only that it compiles
*
* GLAD: $GLAD --out-path=$tmp --api="egl=" c --alias
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include $tmp/src/egl.c -ldl
* RUN: $tmp/test
*/
#include <glad/egl.h>
int main(void) {
return 0;
}

View File

@@ -0,0 +1,17 @@
/*
* Full EGL
*
* GLAD: $GLAD --out-path=$tmp --api="egl=" c --loader
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include $tmp/src/egl.c -ldl
* RUN: $tmp/test
*/
#include <glad/egl.h>
#include <stddef.h>
int main(void) {
EGLDisplay display = NULL;
(void) gladLoaderLoadEGL(display);
(void) gladLoaderUnloadEGL();
return 0;
}

View File

@@ -0,0 +1,17 @@
/*
* EGL 1.0
*
* GLAD: $GLAD --out-path=$tmp --api="egl=1.0" c --loader
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include $tmp/src/egl.c -ldl
* RUN: $tmp/test
*/
#include <glad/egl.h>
#include <stddef.h>
int main(void) {
EGLDisplay display = NULL;
(void) gladLoaderLoadEGL(display);
(void) gladLoaderUnloadEGL();
return 0;
}

View File

@@ -0,0 +1,17 @@
/*
* Full header only only EGL
*
* GLAD: $GLAD --out-path=$tmp --api="egl=" c --loader --header-only
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include -ldl
* RUN: $tmp/test
*/
#define GLAD_EGL_IMPLEMENTATION
#include <glad/egl.h>
int main(void) {
EGLDisplay display = NULL;
(void) gladLoaderLoadEGL(display);
(void) gladLoaderUnloadEGL();
return 0;
}

View File

@@ -0,0 +1,13 @@
/*
* Full on demand EGL
*
* GLAD: $GLAD --out-path=$tmp --api="egl" c --on-demand
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include $tmp/src/egl.c -ldl
* RUN: $tmp/test
*/
#include <glad/egl.h>
int main(void) {
return 0;
}

View File

@@ -0,0 +1,13 @@
/*
* Full on demand EGL with loader
*
* GLAD: $GLAD --out-path=$tmp --api="egl" c --on-demand --loader
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include $tmp/src/egl.c -ldl
* RUN: $tmp/test
*/
#include <glad/egl.h>
int main(void) {
return 0;
}

View File

@@ -0,0 +1,17 @@
/*
* Full compatibility GL, with aliasing
*
* GLAD: $GLAD --out-path=$tmp --api="gl:compatibility" c --loader --alias
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include $tmp/src/gl.c -ldl
* RUN: $tmp/test
*/
#include <glad/gl.h>
#ifndef GL_KHR_debug
#error
#endif
int main(void) {
return 0;
}

View File

@@ -0,0 +1,17 @@
/*
* Full core GL, with aliasing
*
* GLAD: $GLAD --out-path=$tmp --api="gl:core" c --loader --alias
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include $tmp/src/gl.c -ldl
* RUN: $tmp/test
*/
#include <glad/gl.h>
#ifndef GL_KHR_debug
#error
#endif
int main(void) {
return 0;
}

View File

@@ -0,0 +1,17 @@
/*
* No extensions compatibility GL, with aliasing
*
* GLAD: $GLAD --out-path=$tmp --api="gl:compatibility" --extensions="" c --loader --alias
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include $tmp/src/gl.c -ldl
* RUN: $tmp/test
*/
#include <glad/gl.h>
#ifndef GL_KHR_debug /* extension should be added by aliasing */
#error
#endif
int main(void) {
return 0;
}

View File

@@ -0,0 +1,17 @@
/*
* No extensions core GL, with aliasing
*
* GLAD: $GLAD --out-path=$tmp --api="gl:core" --extensions="" c --loader --alias
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include $tmp/src/gl.c -ldl
* RUN: $tmp/test
*/
#include <glad/gl.h>
#ifndef GL_KHR_debug /* extension should be added by aliasing */
#error
#endif
int main(void) {
return 0;
}

View File

@@ -0,0 +1,17 @@
/*
* GL 2.1 All extensions, with aliasing
*
* GLAD: $GLAD --out-path=$tmp --api="gl:compatibility=2.1" c --loader --alias
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include $tmp/src/gl.c -ldl
* RUN: $tmp/test
*/
#include <glad/gl.h>
#ifndef GL_KHR_debug
#error
#endif
int main(void) {
return 0;
}

View File

@@ -0,0 +1,17 @@
/*
* GL 2.1 No extensions, with aliasing
*
* GLAD: $GLAD --out-path=$tmp --api="gl:compatibility=2.1" --extensions="" c --loader --alias
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include $tmp/src/gl.c -ldl
* RUN: $tmp/test
*/
#include <glad/gl.h>
#ifndef GL_KHR_debug /* extension should be added by aliasing */
#error
#endif
int main(void) {
return 0;
}

View File

@@ -0,0 +1,14 @@
/*
* GL 4.6 No extensions, with aliasing
*
* GLAD: $GLAD --out-path=$tmp --api="gl:core=4.6" --extensions="" c --alias
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include $tmp/src/gl.c -ldl
* RUN: $tmp/test
*/
#include <glad/gl.h>
int main(void) {
(void) glActiveTextureARB;
return 0;
}

View File

@@ -0,0 +1,18 @@
/*
* Full compatibility debug GL
*
* GLAD: $GLAD --out-path=$tmp --api="gl:compatibility" c --loader --debug
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include $tmp/src/gl.c -ldl
* RUN: $tmp/test
*/
#include <glad/gl.h>
#include <stddef.h>
int main(void) {
gladSetGLPreCallback(NULL);
gladSetGLPostCallback(NULL);
gladInstallGLDebug();
gladUninstallGLDebug();
return 0;
}

View File

@@ -0,0 +1,13 @@
/*
* Full core debug GL
*
* GLAD: $GLAD --out-path=$tmp --api="gl:core" c --loader --debug
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include $tmp/src/gl.c -ldl
* RUN: $tmp/test
*/
#include <glad/gl.h>
int main(void) {
return 0;
}

View File

@@ -0,0 +1,13 @@
/*
* No extensions compatibility debug GL
*
* GLAD: $GLAD --out-path=$tmp --api="gl:compatibility" --extensions="" c --loader --debug
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include $tmp/src/gl.c -ldl
* RUN: $tmp/test
*/
#include <glad/gl.h>
int main(void) {
return 0;
}

View File

@@ -0,0 +1,13 @@
/*
* No extensions core debug GL
*
* GLAD: $GLAD --out-path=$tmp --api="gl:core" --extensions="" c --loader --debug
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include $tmp/src/gl.c -ldl
* RUN: $tmp/test
*/
#include <glad/gl.h>
int main(void) {
return 0;
}

View File

@@ -0,0 +1,13 @@
/*
* Debug GL 2.1 All extensions
*
* GLAD: $GLAD --out-path=$tmp --api="gl:compatibility=2.1" c --loader --debug
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include $tmp/src/gl.c -ldl
* RUN: $tmp/test
*/
#include <glad/gl.h>
int main(void) {
return 0;
}

View File

@@ -0,0 +1,13 @@
/*
* Debug GL 2.1 No extensions
*
* GLAD: $GLAD --out-path=$tmp --api="gl:compatibility=2.1" --extensions="" c --loader --debug
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include $tmp/src/gl.c -ldl
* RUN: $tmp/test
*/
#include <glad/gl.h>
int main(void) {
return 0;
}

View File

@@ -0,0 +1,17 @@
/*
* Full compatibility GL
*
* GLAD: $GLAD --out-path=$tmp --api="gl:compatibility" c --loader
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include $tmp/src/gl.c -ldl
* RUN: $tmp/test
*/
#include <glad/gl.h>
#ifndef GL_KHR_debug
#error
#endif
int main(void) {
return 0;
}

View File

@@ -0,0 +1,17 @@
/*
* Full core GL
*
* GLAD: $GLAD --out-path=$tmp --api="gl:core" c --loader
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include $tmp/src/gl.c -ldl
* RUN: $tmp/test
*/
#include <glad/gl.h>
#ifndef GL_KHR_debug
#error
#endif
int main(void) {
return 0;
}

View File

@@ -0,0 +1,17 @@
/*
* No extensions compatibility GL
*
* GLAD: $GLAD --out-path=$tmp --api="gl:compatibility" --extensions="" c --loader
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include $tmp/src/gl.c -ldl
* RUN: $tmp/test
*/
#include <glad/gl.h>
#ifdef GL_KHR_debug
#error
#endif
int main(void) {
return 0;
}

View File

@@ -0,0 +1,17 @@
/*
* No extensions core GL
*
* GLAD: $GLAD --out-path=$tmp --api="gl:core" --extensions="" c --loader
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include $tmp/src/gl.c -ldl
* RUN: $tmp/test
*/
#include <glad/gl.h>
#ifdef GL_KHR_debug
#error
#endif
int main(void) {
return 0;
}

View File

@@ -0,0 +1,17 @@
/*
* GL 2.1 All extensions
*
* GLAD: $GLAD --out-path=$tmp --api="gl:compatibility=2.1" c --loader
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include $tmp/src/gl.c -ldl
* RUN: $tmp/test
*/
#include <glad/gl.h>
#ifndef GL_KHR_debug
#error
#endif
int main(void) {
return 0;
}

View File

@@ -0,0 +1,17 @@
/*
* GL 2.1 No extensions
*
* GLAD: $GLAD --out-path=$tmp --api="gl:compatibility=2.1" --extensions="" c --loader
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include $tmp/src/gl.c -ldl
* RUN: $tmp/test
*/
#include <glad/gl.h>
#ifdef GL_KHR_debug
#error
#endif
int main(void) {
return 0;
}

View File

@@ -0,0 +1,22 @@
/*
* Issue #171. Enums being aliased, but the enum that they are aliased to
* do not exist (e.g. because they don't exist in this profile).
*
* GLAD: $GLAD --out-path=$tmp --api="gl:core=4.5" --extensions="" c --loader
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include $tmp/src/gl.c -ldl
* RUN: $tmp/test
*/
#include <glad/gl.h>
#if GL_CLIP_DISTANCE0 != 0x3000
#error
#endif
#if GL_MAX_CLIP_DISTANCES != 0x0D32
#error
#endif
int main(void) {
return 0;
}

View File

@@ -0,0 +1,16 @@
/*
* Full compatibility GL MX header only
*
* GLAD: $GLAD --out-path=$tmp --api="gl:compatibility" c --loader --mx --header-only
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include -ldl
* RUN: $tmp/test
*/
#define GLAD_GL_IMPLEMENTATION
#include <glad/gl.h>
int main(void) {
GladGLContext gl = {0};
(void) gladLoaderLoadGLContext(&gl);
return 0;
}

View File

@@ -0,0 +1,16 @@
/*
* Full core GL MX header only
*
* GLAD: $GLAD --out-path=$tmp --api="gl:core" c --loader --mx --header-only
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include -ldl
* RUN: $tmp/test
*/
#define GLAD_GL_IMPLEMENTATION
#include <glad/gl.h>
int main(void) {
GladGLContext gl = {0};
(void) gladLoaderLoadGLContext(&gl);
return 0;
}

View File

@@ -0,0 +1,16 @@
/*
* No extensions compatibility GL MX header only
*
* GLAD: $GLAD --out-path=$tmp --api="gl:compatibility" --extensions="" c --loader --mx --header-only
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include -ldl
* RUN: $tmp/test
*/
#define GLAD_GL_IMPLEMENTATION
#include <glad/gl.h>
int main(void) {
GladGLContext gl = {0};
(void) gladLoaderLoadGLContext(&gl);
return 0;
}

View File

@@ -0,0 +1,16 @@
/*
* No extensions core GL MX header only
*
* GLAD: $GLAD --out-path=$tmp --api="gl:core" --extensions="" c --loader --mx --header-only
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include -ldl
* RUN: $tmp/test
*/
#define GLAD_GL_IMPLEMENTATION
#include <glad/gl.h>
int main(void) {
GladGLContext gl = {0};
(void) gladLoaderLoadGLContext(&gl);
return 0;
}

View File

@@ -0,0 +1,16 @@
/*
* MX header only GL 2.1 All extensions
*
* GLAD: $GLAD --out-path=$tmp --api="gl:compatibility=2.1" c --loader --mx --header-only
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include -ldl
* RUN: $tmp/test
*/
#define GLAD_GL_IMPLEMENTATION
#include <glad/gl.h>
int main(void) {
GladGLContext gl = {0};
(void) gladLoaderLoadGLContext(&gl);
return 0;
}

View File

@@ -0,0 +1,16 @@
/*
* MX header only GL 2.1 No extensions
*
* GLAD: $GLAD --out-path=$tmp --api="gl:compatibility=2.1" --extensions="" c --loader --mx --header-only
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include -ldl
* RUN: $tmp/test
*/
#define GLAD_GL_IMPLEMENTATION
#include <glad/gl.h>
int main(void) {
GladGLContext gl = {0};
(void) gladLoaderLoadGLContext(&gl);
return 0;
}

View File

@@ -0,0 +1,32 @@
/*
* MX header only, global generation, should compile basic API
*
* GLAD: $GLAD --out-path=$tmp --api="gl:compatibility" c --loader --mx --header-only
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include -ldl
* RUN: $tmp/test
*/
#define GLAD_GL_IMPLEMENTATION
#include <glad/gl.h>
typedef void (*VOID_FUNCPTR)(void);
VOID_FUNCPTR loader_userptr(void *userptr, const char *name) {
(void) name;
(void) userptr;
return NULL;
}
VOID_FUNCPTR loader(const char *name) {
(void) name;
return NULL;
}
int main(void) {
GladGLContext gl = {0};
gladLoadGLContextUserPtr(&gl, loader_userptr, NULL);
gladLoaderLoadGLContext(&gl);
return 0;
}

View File

@@ -0,0 +1,15 @@
/*
* Full compatibility GL header only
*
* GLAD: $GLAD --out-path=$tmp --api="gl:compatibility" c --loader --header-only
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include -ldl
* RUN: $tmp/test
*/
#define GLAD_GL_IMPLEMENTATION
#include <glad/gl.h>
int main(void) {
(void) gladLoaderLoadGL();
return 0;
}

View File

@@ -0,0 +1,15 @@
/*
* Full core GL header only
*
* GLAD: $GLAD --out-path=$tmp --api="gl:core" c --loader --header-only
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include -ldl
* RUN: $tmp/test
*/
#define GLAD_GL_IMPLEMENTATION
#include <glad/gl.h>
int main(void) {
(void) gladLoaderLoadGL();
return 0;
}

View File

@@ -0,0 +1,15 @@
/*
* No extensions compatibility GL header only
*
* GLAD: $GLAD --out-path=$tmp --api="gl:compatibility" --extensions="" c --loader --header-only
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include -ldl
* RUN: $tmp/test
*/
#define GLAD_GL_IMPLEMENTATION
#include <glad/gl.h>
int main(void) {
(void) gladLoaderLoadGL();
return 0;
}

View File

@@ -0,0 +1,15 @@
/*
* No extensions core GL header only
*
* GLAD: $GLAD --out-path=$tmp --api="gl:core" --extensions="" c --loader --header-only
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include -ldl
* RUN: $tmp/test
*/
#define GLAD_GL_IMPLEMENTATION
#include <glad/gl.h>
int main(void) {
(void) gladLoaderLoadGL();
return 0;
}

View File

@@ -0,0 +1,15 @@
/*
* Header only GL 2.1 All extensions
*
* GLAD: $GLAD --out-path=$tmp --api="gl:compatibility=2.1" c --loader --header-only
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include -ldl
* RUN: $tmp/test
*/
#define GLAD_GL_IMPLEMENTATION
#include <glad/gl.h>
int main(void) {
(void) gladLoaderLoadGL();
return 0;
}

View File

@@ -0,0 +1,15 @@
/*
* Header only GL 2.1 No extensions
*
* GLAD: $GLAD --out-path=$tmp --api="gl:compatibility=2.1" --extensions="" c --loader --header-only
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include -ldl
* RUN: $tmp/test
*/
#define GLAD_GL_IMPLEMENTATION
#include <glad/gl.h>
int main(void) {
(void) gladLoaderLoadGL();
return 0;
}

View File

@@ -0,0 +1,16 @@
/*
* Full compatibility GL MX
*
* GLAD: $GLAD --out-path=$tmp --api="gl:compatibility" c --loader --mx --mx-global
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include $tmp/src/gl.c -ldl
* RUN: $tmp/test
*/
#include <glad/gl.h>
int main(void) {
GladGLContext gl = {0};
(void) gladLoaderLoadGL();
(void) gladLoaderLoadGLContext(&gl);
return 0;
}

View File

@@ -0,0 +1,16 @@
/*
* Full core GL MX
*
* GLAD: $GLAD --out-path=$tmp --api="gl:core" c --loader --mx --mx-global
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include $tmp/src/gl.c -ldl
* RUN: $tmp/test
*/
#include <glad/gl.h>
int main(void) {
GladGLContext gl = {0};
(void) gladLoaderLoadGL();
(void) gladLoaderLoadGLContext(&gl);
return 0;
}

View File

@@ -0,0 +1,16 @@
/*
* No extensions compatibility GL MX
*
* GLAD: $GLAD --out-path=$tmp --api="gl:compatibility" --extensions="" c --loader --mx --mx-global
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include $tmp/src/gl.c -ldl
* RUN: $tmp/test
*/
#include <glad/gl.h>
int main(void) {
GladGLContext gl = {0};
(void) gladLoaderLoadGL();
(void) gladLoaderLoadGLContext(&gl);
return 0;
}

View File

@@ -0,0 +1,16 @@
/*
* No extensions core GL MX
*
* GLAD: $GLAD --out-path=$tmp --api="gl:core" --extensions="" c --loader --mx --mx-global
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include $tmp/src/gl.c -ldl
* RUN: $tmp/test
*/
#include <glad/gl.h>
int main(void) {
GladGLContext gl = {0};
(void) gladLoaderLoadGL();
(void) gladLoaderLoadGLContext(&gl);
return 0;
}

View File

@@ -0,0 +1,16 @@
/*
* MX GL 2.1 All extensions
*
* GLAD: $GLAD --out-path=$tmp --api="gl:compatibility=2.1" c --loader --mx --mx-global
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include $tmp/src/gl.c -ldl
* RUN: $tmp/test
*/
#include <glad/gl.h>
int main(void) {
GladGLContext gl = {0};
(void) gladLoaderLoadGL();
(void) gladLoaderLoadGLContext(&gl);
return 0;
}

View File

@@ -0,0 +1,16 @@
/*
* MX GL 2.1 No extensions
*
* GLAD: $GLAD --out-path=$tmp --api="gl:compatibility=2.1" --extensions="" c --loader --mx --mx-global
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include $tmp/src/gl.c -ldl
* RUN: $tmp/test
*/
#include <glad/gl.h>
int main(void) {
GladGLContext gl = {0};
(void) gladLoaderLoadGL();
(void) gladLoaderLoadGLContext(&gl);
return 0;
}

View File

@@ -0,0 +1,40 @@
/*
* MX global generation, should compile basic API
*
* GLAD: $GLAD --out-path=$tmp --api="gl:compatibility" c --loader --mx --mx-global
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include $tmp/src/gl.c -ldl
* RUN: $tmp/test
*/
#include <glad/gl.h>
#include <stddef.h>
typedef void (*VOID_FUNCPTR)(void);
VOID_FUNCPTR loader_userptr(void *userptr, const char *name) {
(void) name;
(void) userptr;
return NULL;
}
VOID_FUNCPTR loader(const char *name) {
(void) name;
return NULL;
}
int main(void) {
GladGLContext gl = {0};
gladLoadGLContextUserPtr(&gl, loader_userptr, NULL);
gladLoadGLContext(&gl, loader);
gladLoaderLoadGLContext(&gl);
gladLoadGLUserPtr(loader_userptr, NULL);
gladLoadGL(loader);
gladLoaderLoadGL();
gladSetGLContext(&gl);
(void) gladGetGLContext();
return 0;
}

View File

@@ -0,0 +1,14 @@
/*
* Full compatibility GL MX should not contain any symbols in COMMON section,
* to prevent linking issues with OSX.
*
* Only tested here under the assumption that this build contains the most symbols.
*
* See: https://github.com/Dav1dde/glad/issues/158
*
* GLAD: $GLAD --out-path=$tmp --api="gl:compatibility" c --loader --mx --mx-global
* COMPILE: $GCC -c -o $tmp/test.o -I$tmp/include $tmp/src/gl.c -ldl
* RUN: [ "$(nm $tmp/test.o | grep ' C ' | wc -l)" -eq "0" ]
*/
#error "this testfile should not be compiled"

View File

@@ -0,0 +1,13 @@
/*
* Full on demand GL
*
* GLAD: $GLAD --out-path=$tmp --api="gl:core" c --on-demand
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include $tmp/src/gl.c -ldl
* RUN: $tmp/test
*/
#include <glad/gl.h>
int main(void) {
return 0;
}

View File

@@ -0,0 +1,14 @@
/*
* Full on demand GL with loader
*
* GLAD: $GLAD --out-path=$tmp --api="gl:core" c --on-demand --loader
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include $tmp/src/gl.c -ldl
* RUN: $tmp/test
*/
#include <glad/gl.h>
int main(void) {
return 0;
}

View File

@@ -0,0 +1,13 @@
/*
* Full GLES1
*
* GLAD: $GLAD --out-path=$tmp --api="gles1" c
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include $tmp/src/gles1.c -ldl
* RUN: $tmp/test
*/
#include <glad/gles1.h>
int main(void) {
return 0;
}

View File

@@ -0,0 +1,13 @@
/*
* Full GLES1 with loader
*
* GLAD: $GLAD --out-path=$tmp --api="egl,gles1" c --loader
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include $tmp/src/egl.c $tmp/src/gles1.c -ldl
* RUN: $tmp/test
*/
#include <glad/gles1.h>
int main(void) {
return 0;
}

View File

@@ -0,0 +1,13 @@
/*
* Full on demand GLES1
*
* GLAD: $GLAD --out-path=$tmp --api="gles1" c --on-demand
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include $tmp/src/gles1.c -ldl
* RUN: $tmp/test
*/
#include <glad/gles1.h>
int main(void) {
return 0;
}

View File

@@ -0,0 +1,13 @@
/*
* Full on demand GLES1 with loader
*
* GLAD: $GLAD --out-path=$tmp --api="gles1,egl" c --on-demand --loader
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include $tmp/src/gles1.c $tmp/src/egl.c -ldl
* RUN: $tmp/test
*/
#include <glad/gles1.h>
int main(void) {
return 0;
}

View File

@@ -0,0 +1,16 @@
/*
* GLES2 No extensions, with aliasing
*
* Issue: https://github.com/Dav1dde/glad/issues/334
*
* GLAD: $GLAD --out-path=$tmp --api="gles2=3.2" --extensions="" c --alias
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include $tmp/src/gles2.c -ldl
* RUN: $tmp/test
*/
#include <glad/gles2.h>
int main(void) {
(void) glGenVertexArraysOES;
return 0;
}

View File

@@ -0,0 +1,13 @@
/*
* Full GLES2
*
* GLAD: $GLAD --out-path=$tmp --api="gles2" c
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include $tmp/src/gles2.c -ldl
* RUN: $tmp/test
*/
#include <glad/gles2.h>
int main(void) {
return 0;
}

View File

@@ -0,0 +1,13 @@
/*
* Full GLES2 with loader
*
* GLAD: $GLAD --out-path=$tmp --api="egl,gles2" c --loader
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include $tmp/src/egl.c $tmp/src/gles2.c -ldl
* RUN: $tmp/test
*/
#include <glad/gles2.h>
int main(void) {
return 0;
}

View File

@@ -0,0 +1,24 @@
/*
* Emscripten GLES2 + EGL header only.
* Related Issues: #387
*
* GLAD: $GLAD --out-path=$tmp --api="egl,gles2" c --loader --header-only
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include -ldl
* RUN: $tmp/test
*/
#include <stddef.h>
#define GLAD_GLES2_IMPLEMENTATION
#define GLAD_PLATFORM_EMSCRIPTEN 1
#include <glad/egl.h> /* egl before gles2 */
#include <glad/gles2.h>
__eglMustCastToProperFunctionPointerType emscripten_GetProcAddress(const char *name) {
GLAD_UNUSED(name);
return GLAD_GNUC_EXTENSION (__eglMustCastToProperFunctionPointerType) NULL;
}
int main(void) {
return 0;
}

View File

@@ -0,0 +1,28 @@
/*
* Emscripten GLES2 + header only. See also 003.
* Related Issues: #387
*
* GLAD: $GLAD --out-path=$tmp --api="egl,gles2" c --loader --header-only
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include -ldl -Wno-pedantic
* RUN: $tmp/test
*/
#include <stddef.h>
#define GLAD_GLES2_IMPLEMENTATION
#define GLAD_PLATFORM_EMSCRIPTEN 1
#include <glad/gles2.h>
/*
* egl after gles2
* this is not correct, that's why we disable pedantic but it should still compile without
*/
#include <glad/egl.h>
__eglMustCastToProperFunctionPointerType emscripten_GetProcAddress(const char *name) {
GLAD_UNUSED(name);
return GLAD_GNUC_EXTENSION (__eglMustCastToProperFunctionPointerType) NULL;
}
int main(void) {
return 0;
}

View File

@@ -0,0 +1,23 @@
/*
* Emscripten GLES2 + header only. See also 003.
* Related Issues: #387
*
* GLAD: $GLAD --out-path=$tmp --api="gles2" c --loader --header-only
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include -ldl
* RUN: $tmp/test
*/
#include <stddef.h>
#define GLAD_GLES2_IMPLEMENTATION
#define GLAD_PLATFORM_EMSCRIPTEN 1
#include <glad/gles2.h>
__eglMustCastToProperFunctionPointerType emscripten_GetProcAddress(const char *name) {
GLAD_UNUSED(name);
return GLAD_GNUC_EXTENSION (__eglMustCastToProperFunctionPointerType) NULL;
}
int main(void) {
return 0;
}

View File

@@ -0,0 +1,13 @@
/*
* Full on demand GLES2
*
* GLAD: $GLAD --out-path=$tmp --api="gles2" c --on-demand
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include $tmp/src/gles2.c -ldl
* RUN: $tmp/test
*/
#include <glad/gles2.h>
int main(void) {
return 0;
}

View File

@@ -0,0 +1,13 @@
/*
* Full on demand GLES2 with loader
*
* GLAD: $GLAD --out-path=$tmp --api="gles2,egl" c --on-demand --loader
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include $tmp/src/gles2.c $tmp/src/egl.c -ldl
* RUN: $tmp/test
*/
#include <glad/gles2.h>
int main(void) {
return 0;
}

View File

@@ -0,0 +1,14 @@
/*
* Issue #362, aliasing func is not called.
* Note this does not actually verify the functions get properly initialized only that it compiles
*
* GLAD: $GLAD --out-path=$tmp --api="glx,gl:core" c --alias
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include $tmp/src/glx.c -ldl -lX11
* RUN: $tmp/test
*/
#include <glad/glx.h>
int main(void) {
return 0;
}

View File

@@ -0,0 +1,16 @@
/*
* Full GLX
*
* GLAD: $GLAD --out-path=$tmp --api="glx,gl:core" c --loader
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include $tmp/src/glx.c -ldl -lX11
* RUN: $tmp/test
*/
#include <glad/glx.h>
int main(void) {
Display *display = NULL;
(void) gladLoaderLoadGLX(display, 0);
(void) gladLoaderUnloadGLX();
return 0;
}

View File

@@ -0,0 +1,16 @@
/*
* Full GLX, without X11 as dependency
*
* GLAD: $GLAD --out-path=$tmp --api="glx,gl:core" c --loader
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include $tmp/src/glx.c -ldl -DGLAD_GLX_NO_X11
* RUN: $tmp/test
*/
#include <glad/glx.h>
int main(void) {
Display *display = NULL;
(void) gladLoaderLoadGLX(display, 0);
(void) gladLoaderUnloadGLX();
return 0;
}

View File

@@ -0,0 +1,16 @@
/*
* GLX 1.0
*
* GLAD: $GLAD --out-path=$tmp --api="glx=1.0,gl:core" c --loader
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include $tmp/src/glx.c -ldl -DGLAD_GLX_NO_X11
* RUN: $tmp/test
*/
#include <glad/glx.h>
int main(void) {
Display *display = NULL;
(void) gladLoaderLoadGLX(display, 0);
(void) gladLoaderUnloadGLX();
return 0;
}

View File

@@ -0,0 +1,17 @@
/*
* Full header only only GLX
*
* GLAD: $GLAD --out-path=$tmp --api="glx,gl:core" c --loader --header-only
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include -ldl -lX11
* RUN: $tmp/test
*/
#define GLAD_GLX_IMPLEMENTATION
#include <glad/glx.h>
int main(void) {
Display *display = NULL;
(void) gladLoaderLoadGLX(display, 0);
(void) gladLoaderUnloadGLX();
return 0;
}

View File

@@ -0,0 +1,17 @@
/*
* Full header only only GLX, without X11 as dependency
*
* GLAD: $GLAD --out-path=$tmp --api="glx,gl:core" c --loader --header-only
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include -ldl -DGLAD_GLX_NO_X11
* RUN: $tmp/test
*/
#define GLAD_GLX_IMPLEMENTATION
#include <glad/glx.h>
int main(void) {
Display *display = NULL;
(void) gladLoaderLoadGLX(display, 0);
(void) gladLoaderUnloadGLX();
return 0;
}

View File

@@ -0,0 +1,13 @@
/*
* Full on demand GLX
*
* GLAD: $GLAD --out-path=$tmp --api="glx,gl:core" c --on-demand
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include $tmp/src/glx.c -ldl
* RUN: $tmp/test
*/
#include <glad/glx.h>
int main(void) {
return 0;
}

View File

@@ -0,0 +1,13 @@
/*
* Full on demand GLX with loader
*
* GLAD: $GLAD --out-path=$tmp --api="glx,gl:core" c --on-demand --loader
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include $tmp/src/glx.c -ldl
* RUN: $tmp/test
*/
#include <glad/glx.h>
int main(void) {
return 0;
}

View File

@@ -0,0 +1,18 @@
/*
* Full Vulkan with aliasing
*
* GLAD: $GLAD --out-path=$tmp --api="vulkan" c --loader --alias
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include $tmp/src/vulkan.c -ldl
* RUN: $tmp/test
*/
#include <glad/vulkan.h>
#if !defined(VK_EXT_debug_report) || !defined(VK_VERSION_1_0)
#error
#endif
int main(void) {
(void) gladLoaderLoadVulkan(NULL, NULL, NULL);
return 0;
}

View File

@@ -0,0 +1,18 @@
/*
* Full Vulkan with aliasing and without extensions
*
* GLAD: $GLAD --out-path=$tmp --api="vulkan" --extensions="" c --loader --alias
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include $tmp/src/vulkan.c -ldl
* RUN: $tmp/test
*/
#include <glad/vulkan.h>
#if defined(VK_EXT_debug_report) || !defined(VK_VERSION_1_0)
#error
#endif
int main(void) {
(void) gladLoaderLoadVulkan(NULL, NULL, NULL);
return 0;
}

View File

@@ -0,0 +1,13 @@
/*
* Issue #335. Debug functions are not guarded/protected by platform.
*
* GLAD: $GLAD --out-path=$tmp --api="vulkan=1.1" --extensions=VK_KHR_external_memory_win32 c --debug
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include $tmp/src/vulkan.c -ldl
* RUN: $tmp/test
*/
#include <glad/vulkan.h>
int main(void) {
return 0;
}

View File

@@ -0,0 +1,14 @@
/*
* Full Vulkan
*
* GLAD: $GLAD --out-path=$tmp --api="vulkan" c --loader
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include $tmp/src/vulkan.c -ldl
* RUN: $tmp/test
*/
#include <glad/vulkan.h>
int main(void) {
(void) gladLoaderLoadVulkan(NULL, NULL, NULL);
return 0;
}

View File

@@ -0,0 +1,14 @@
/*
* Full Vulkan without extensions
*
* GLAD: $GLAD --out-path=$tmp --api="vulkan" --extensions="" c --loader
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include $tmp/src/vulkan.c -ldl
* RUN: $tmp/test
*/
#include <glad/vulkan.h>
int main(void) {
(void) gladLoaderLoadVulkan(NULL, NULL, NULL);
return 0;
}

View File

@@ -0,0 +1,14 @@
/*
* Vulkan 1.0 without extensions
*
* GLAD: $GLAD --out-path=$tmp --api="vulkan=1.0" --extensions="" c --loader
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include $tmp/src/vulkan.c -ldl
* RUN: $tmp/test
*/
#include <glad/vulkan.h>
int main(void) {
(void) gladLoaderLoadVulkan(NULL, NULL, NULL);
return 0;
}

View File

@@ -0,0 +1,15 @@
/*
* Vulkan 1.0 with extensions
*
* GLAD: $GLAD --out-path=$tmp --api="vulkan=1.0" c --loader
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include $tmp/src/vulkan.c -ldl
* RUN: $tmp/test
*/
#include <glad/vulkan.h>
#include <stddef.h>
int main(void) {
(void) gladLoaderLoadVulkan(NULL, NULL, NULL);
return 0;
}

View File

@@ -0,0 +1,22 @@
/*
* Issue #171. Enums being aliased, but the enum that they are aliased to
* do not exist (e.g. because they don't exist in this profile).
* This is to make sure Vulkan handles the enums correctly as well (since
* the vulkan specification only specifies the alias and no value).
*
* See also c/compile/gl/default/007
*
* GLAD: $GLAD --out-path=$tmp --api="vulkan=1.1" --extensions="VK_KHR_external_memory_capabilities" c
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include $tmp/src/vulkan.c -ldl
* RUN: $tmp/test
*/
#include <glad/vulkan.h>
#if VK_LUID_SIZE_KHR != 8
#error
#endif
int main(void) {
return 0;
}

View File

@@ -0,0 +1,17 @@
/*
* Issue #350, missing ENUM_MAX values
*
* GLAD: $GLAD --out-path=$tmp --api="vulkan=1.1" c
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include $tmp/src/vulkan.c -ldl
* RUN: $tmp/test
*/
#include <glad/vulkan.h>
int main(void) {
VkDeviceGroupPresentModeFlagBitsKHR a = VK_DEVICE_GROUP_PRESENT_MODE_FLAG_BITS_MAX_ENUM_KHR;
VkSubgroupFeatureFlagBits b = VK_SUBGROUP_FEATURE_FLAG_BITS_MAX_ENUM;
(void) a;
(void) b;
return 0;
}

View File

@@ -0,0 +1,22 @@
/*
* Full vulkan, header only, mx
*
* GLAD: $GLAD --out-path=$tmp --api="vulkan" c --loader --header-only --mx
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include -ldl
* RUN: $tmp/test
*/
#define GLAD_VULKAN_IMPLEMENTATION
#include <glad/vulkan.h>
typedef void (*VOID_FUNCPTR)(void);
VOID_FUNCPTR loader_userptr(void *userptr, const char *name) { (void) name; (void) userptr; return NULL; }
VOID_FUNCPTR loader(const char *name) { (void) name; return NULL; }
int main(void) {
GladVulkanContext context = {0};
(void) gladLoadVulkanContextUserPtr(&context, NULL, loader_userptr, NULL);
(void) gladLoadVulkanContext(&context, NULL, loader);
(void) gladLoaderLoadVulkanContext(&context, NULL, NULL, NULL);
return 0;
}

View File

@@ -0,0 +1,23 @@
/*
* Full vulkan without extensions, header only, mx
*
* GLAD: $GLAD --out-path=$tmp --api="vulkan" --extensions="" c --loader --header-only --mx
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include -ldl
* RUN: $tmp/test
*/
#define GLAD_VULKAN_IMPLEMENTATION
#include <glad/vulkan.h>
typedef void (*VOID_FUNCPTR)(void);
VOID_FUNCPTR loader_userptr(void *userptr, const char *name) { (void) name; (void) userptr; return NULL; }
VOID_FUNCPTR loader(const char *name) { (void) name; return NULL; }
int main(void) {
GladVulkanContext context = {0};
(void) gladLoadVulkanContextUserPtr(&context, NULL, loader_userptr, NULL);
(void) gladLoadVulkanContext(&context, NULL, loader);
(void) gladLoaderLoadVulkanContext(&context, NULL, NULL, NULL);
return 0;
}

View File

@@ -0,0 +1,19 @@
/*
* Full Vulkan header only
*
* GLAD: $GLAD --out-path=$tmp --api="vulkan" c --loader --header-only
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include -ldl
* RUN: $tmp/test
*/
#define GLAD_VULKAN_IMPLEMENTATION
#include <glad/vulkan.h>
#if !defined(VK_EXT_debug_report) || !defined(VK_VERSION_1_0)
#error
#endif
int main(void) {
(void) gladLoaderLoadVulkan(NULL, NULL, NULL);
return 0;
}

View File

@@ -0,0 +1,19 @@
/*
* Full Vulkan without extensions, header only
*
* GLAD: $GLAD --out-path=$tmp --api="vulkan" --extensions="" c --loader --header-only
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include -ldl
* RUN: $tmp/test
*/
#define GLAD_VULKAN_IMPLEMENTATION
#include <glad/vulkan.h>
#if defined(VK_EXT_debug_report) || !defined(VK_VERSION_1_0)
#error
#endif
int main(void) {
(void) gladLoaderLoadVulkan(NULL, NULL, NULL);
return 0;
}

View File

@@ -0,0 +1,25 @@
/*
* Full vulkan, mx
*
* GLAD: $GLAD --out-path=$tmp --api="vulkan" c --loader --mx --mx-global
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include $tmp/src/vulkan.c -ldl
* RUN: $tmp/test
*/
#include <glad/vulkan.h>
typedef void (*VOID_FUNCPTR)(void);
VOID_FUNCPTR loader_userptr(void *userptr, const char *name) { (void) name; (void) userptr; return NULL; }
VOID_FUNCPTR loader(const char *name) { (void) name; return NULL; }
int main(void) {
GladVulkanContext context = {0};
(void) gladLoadVulkanUserPtr(NULL, loader_userptr, NULL);
(void) gladLoadVulkanContextUserPtr(&context, NULL, loader_userptr, NULL);
(void) gladLoadVulkan(NULL, loader);
(void) gladLoadVulkanContext(&context, NULL, loader);
(void) gladLoaderLoadVulkan(NULL, NULL, NULL);
(void) gladLoaderLoadVulkanContext(&context, NULL, NULL, NULL);
return 0;
}

View File

@@ -0,0 +1,25 @@
/*
* Full vulkan without extensions, mx
*
* GLAD: $GLAD --out-path=$tmp --api="vulkan" --extensions="" c --loader --mx --mx-global
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include $tmp/src/vulkan.c -ldl -g
* RUN: $tmp/test
*/
#include <glad/vulkan.h>
typedef void (*VOID_FUNCPTR)(void);
VOID_FUNCPTR loader_userptr(void *userptr, const char *name) { (void) name; (void) userptr; return NULL; }
VOID_FUNCPTR loader(const char *name) { (void) name; return NULL; }
int main(void) {
GladVulkanContext context = {0};
(void) gladLoadVulkanUserPtr(NULL, loader_userptr, NULL);
(void) gladLoadVulkanContextUserPtr(&context, NULL, loader_userptr, NULL);
(void) gladLoadVulkan(NULL, loader);
(void) gladLoadVulkanContext(&context, NULL, loader);
(void) gladLoaderLoadVulkan(NULL, NULL, NULL);
(void) gladLoaderLoadVulkanContext(&context, NULL, NULL, NULL);
return 0;
}

View File

@@ -0,0 +1,13 @@
/*
* Full on demand Vulkan
*
* GLAD: $GLAD --out-path=$tmp --api="vulkan" c --on-demand
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include $tmp/src/vulkan.c -ldl
* RUN: $tmp/test
*/
#include <glad/vulkan.h>
int main(void) {
return 0;
}

View File

@@ -0,0 +1,13 @@
/*
* Full on demand Vulkan with loader
*
* GLAD: $GLAD --out-path=$tmp --api="vulkan" c --on-demand --loader
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include $tmp/src/vulkan.c -ldl
* RUN: $tmp/test
*/
#include <glad/vulkan.h>
int main(void) {
return 0;
}

View File

@@ -0,0 +1,20 @@
/*
* GL_VERTEX_ARRAY was removed in gl:core=3.2 and later reintroduced in gl=4.3.
* Test checks if the symbol exists in the generated code.
* Related Issues: #137, #139
*
* GLAD: $GLAD --out-path=$tmp --api="gl:core=4.3" --extensions="" c
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include $tmp/src/gl.c -ldl
* RUN: $tmp/test
*/
#include <glad/gl.h>
int main(void) {
if (GL_VERTEX_ARRAY == 0x8074) {
return 0;
}
return 1;
}

View File

@@ -0,0 +1,18 @@
/*
* VK_NV_ray_tracing depends on a type which depends on an aliased type.
* The aliased type is not part of the feature set.
* Make sure the aliased type is part generated, since the alias is done through a typedef.
*
* GLAD: $GLAD --out-path=$tmp --api="vulkan=1.1" --extensions="VK_NV_ray_tracing" c
* COMPILE: $GCC $test -o $tmp/test -I$tmp/include $tmp/src/vulkan.c -ldl
* RUN: $tmp/test
*/
#include <glad/vulkan.h>
int main(void) {
/* make sure something is referenced so stuff doesn't just get optimized away */
VkAccelerationStructureMemoryRequirementsInfoNV unused;
(void) unused;
return 0;
}

View File

@@ -0,0 +1,18 @@
/*
* The GL_KHR_debug has suffixed symbols for GLES but symbols without suffix for GL.
* Make sure only the suffixed symbols appear in the generated output for gles.
* Related Issues: #281
*
* See also: 004
*
* GLAD: $GLAD --out-path=$tmp --api="gles2=3.1" --extensions="GL_KHR_debug" c
* COMPILE: ! $GCC $test -o $tmp/test -I$tmp/include $tmp/src/gles2.c -ldl
* RUN: true
*/
#include <glad/gles2.h>
int main(void) {
(void) glObjectLabel;
return 0;
}

View File

@@ -0,0 +1,18 @@
/*
* The GL_KHR_debug has suffixed symbols for GLES but symbols without suffix for GL.
* Make sure only the symbols without suffix appear in the generated output for gl.
* Related Issues: #281
*
* See also: 003
*
* GLAD: $GLAD --out-path=$tmp --api="gl:core=3.3" --extensions="GL_KHR_debug" c
* COMPILE: ! $GCC $test -o $tmp/test -I$tmp/include $tmp/src/gl.c -ldl
* RUN: true
*/
#include <glad/gl.h>
int main(void) {
(void) glObjectLabelKHR;
return 0;
}

View File

@@ -0,0 +1,99 @@
/*
* Core 3.3 debug profile using glfw to load
*
* GLAD: $GLAD --out-path=$tmp --api="gl:core" --extensions="" c --debug
* COMPILE: $GCC -Wno-pedantic $test -o $tmp/test -I$tmp/include $tmp/src/gl.c -ldl -lglfw
* RUN: $tmp/test
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <glad/gl.h>
#include <GLFW/glfw3.h>
#define ASSERT(expression, message, args...) if(!(expression)) { fprintf(stderr, "%s(%d): " message "\n", __FILE__, __LINE__, ##args); exit(1); }
#define WIDTH 50
#define HEIGHT 50
static int pre = 0;
static int post = 0;
static void pre_call_gl_callback(const char *name, GLADapiproc apiproc, int len_args, ...) {
ASSERT(strcmp(name, "glClear") == 0, "got %s expected glClear", name);
ASSERT(apiproc != NULL, "glClear proc is null");
ASSERT((void*) apiproc == (void*) glad_glClear, "passed in proc is not actual implementation");
ASSERT((void*) apiproc != (void*) glad_debug_glClear, "passed in proc is debug implementation");
ASSERT(len_args == 1, "expected only one argument, got %d", len_args);
++pre;
va_list args;
va_start(args, len_args);
int value = va_arg(args, int);
va_end(args);
ASSERT(value == GL_COLOR_BUFFER_BIT || value == GL_DEPTH_BUFFER_BIT, "invalid argument in debug callback");
}
static void post_call_gl_callback(void *ret, const char *name, GLADapiproc apiproc, int len_args, ...) {
ASSERT(strcmp(name, "glClear") == 0, "got %s expected glClear", name);
ASSERT(apiproc != NULL, "glClear proc is null");
ASSERT((void*) apiproc == (void*) glad_glClear, "passed in proc is not actual implementation");
ASSERT((void*) apiproc != (void*) glad_debug_glClear, "passed in proc is debug implementation");
ASSERT(len_args == 1, "expected only one argument, got %d", len_args);
ASSERT(ret == NULL, "return value not null");
++post;
va_list args;
va_start(args, len_args);
int value = va_arg(args, int);
va_end(args);
ASSERT(value == GL_COLOR_BUFFER_BIT || value == GL_DEPTH_BUFFER_BIT, "invalid argument in debug callback");
}
int main(void) {
ASSERT(glfwInit(), "glfw init failed");
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
GLFWwindow* window = glfwCreateWindow(WIDTH, HEIGHT, "<test>", NULL, NULL);
ASSERT(window != NULL, "glfw window creation failed");
glfwMakeContextCurrent(window);
int version = gladLoadGL(glfwGetProcAddress);
ASSERT(version >= 3003, "glad version %d < 3003", version);
ASSERT(GLAD_VERSION_MAJOR(version) >= 3, "glad major version %d < 3", GLAD_VERSION_MAJOR(version));
ASSERT(GLAD_VERSION_MAJOR(version) > 3 || GLAD_VERSION_MINOR(version) >= 3, "glad minor version %d < 3", GLAD_VERSION_MINOR(version));
ASSERT(GLAD_GL_VERSION_3_3, "GL_VERSION_3_3 not set");
glViewport(0, 0, WIDTH, HEIGHT);
glClearColor(0.2f, 0.3f, 0.3f, 1.0f);
gladSetGLPreCallback(pre_call_gl_callback);
gladSetGLPostCallback(post_call_gl_callback);
glClear(GL_COLOR_BUFFER_BIT);
/* make sure install/uninstall is working as expected */
gladUninstallGLDebug();
glViewport(0, 0, WIDTH, HEIGHT);
glClear(GL_COLOR_BUFFER_BIT);
gladInstallGLDebug();
glClear(GL_DEPTH_BUFFER_BIT);
ASSERT(pre == 2, "pre callback called %d times, expected twice", pre);
ASSERT(post == 2, "post callback called %d times, expected twice", post);
glfwSwapBuffers(window);
glfwTerminate();
return 0;
}

View File

@@ -0,0 +1,45 @@
/*
* Core 3.3 profile using glfw to load
*
* GLAD: $GLAD --out-path=$tmp --api="gl:core" c
* COMPILE: $GCC -Wno-pedantic $test -o $tmp/test -I$tmp/include $tmp/src/gl.c -ldl -lglfw
* RUN: $tmp/test
*/
#include <stdio.h>
#include <stdlib.h>
#include <glad/gl.h>
#include <GLFW/glfw3.h>
#define ASSERT(expression, message, args...) if(!(expression)) { fprintf(stderr, "%s(%d): " message "\n", __FILE__, __LINE__, ##args); exit(1); }
#define WIDTH 50
#define HEIGHT 50
int main(void) {
ASSERT(glfwInit(), "glfw init failed");
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
GLFWwindow* window = glfwCreateWindow(WIDTH, HEIGHT, "<test>", NULL, NULL);
ASSERT(window != NULL, "glfw window creation failed");
glfwMakeContextCurrent(window);
int version = gladLoadGL(glfwGetProcAddress);
ASSERT(version >= 3003, "glad version %d < 3003", version);
ASSERT(GLAD_VERSION_MAJOR(version) >= 3, "glad major version %d < 3", GLAD_VERSION_MAJOR(version));
ASSERT(GLAD_VERSION_MAJOR(version) > 3 || GLAD_VERSION_MINOR(version) >= 3, "glad minor version %d < 3", GLAD_VERSION_MINOR(version));
ASSERT(GLAD_GL_VERSION_3_3, "GL_VERSION_3_3 not set");
ASSERT(GLAD_GL_KHR_debug == 1, "KHR_debug not available");
glViewport(0, 0, WIDTH, HEIGHT);
glClearColor(0.2f, 0.3f, 0.3f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
glfwSwapBuffers(window);
glfwTerminate();
return 0;
}

View File

@@ -0,0 +1,45 @@
/*
* Core 3.3 profile using internal loader to load
*
* GLAD: $GLAD --out-path=$tmp --api="gl:core" c --loader
* COMPILE: $GCC -Wno-pedantic $test -o $tmp/test -I$tmp/include $tmp/src/gl.c -ldl -lglfw
* RUN: $tmp/test
*/
#include <stdio.h>
#include <stdlib.h>
#include <glad/gl.h>
#include <GLFW/glfw3.h>
#define ASSERT(expression, message, args...) if(!(expression)) { fprintf(stderr, "%s(%d): " message "\n", __FILE__, __LINE__, ##args); exit(1); }
#define WIDTH 50
#define HEIGHT 50
int main(void) {
ASSERT(glfwInit(), "glfw init failed");
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
GLFWwindow* window = glfwCreateWindow(WIDTH, HEIGHT, "<test>", NULL, NULL);
ASSERT(window != NULL, "glfw window creation failed");
glfwMakeContextCurrent(window);
int version = gladLoaderLoadGL();
ASSERT(version >= 3003, "glad version %d < 3003", version);
ASSERT(GLAD_VERSION_MAJOR(version) >= 3, "glad major version %d < 3", GLAD_VERSION_MAJOR(version));
ASSERT(GLAD_VERSION_MAJOR(version) > 3 || GLAD_VERSION_MINOR(version) >= 3, "glad minor version %d < 3", GLAD_VERSION_MINOR(version));
ASSERT(GLAD_GL_VERSION_3_3, "GL_VERSION_3_3 not set");
ASSERT(GLAD_GL_KHR_debug == 1, "KHR_debug not available");
glViewport(0, 0, WIDTH, HEIGHT);
glClearColor(0.2f, 0.3f, 0.3f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
glfwSwapBuffers(window);
glfwTerminate();
return 0;
}

View File

@@ -0,0 +1,44 @@
/*
* 2.1 using internal loader to load
*
* GLAD: $GLAD --out-path=$tmp --api="gl:core=2.1" c --loader
* COMPILE: $GCC -Wno-pedantic $test -o $tmp/test -I$tmp/include $tmp/src/gl.c -ldl -lglfw
* RUN: $tmp/test
*/
#include <stdio.h>
#include <stdlib.h>
#include <glad/gl.h>
#include <GLFW/glfw3.h>
#define ASSERT(expression, message, args...) if(!(expression)) { fprintf(stderr, "%s(%d): " message "\n", __FILE__, __LINE__, ##args); exit(1); }
#define WIDTH 50
#define HEIGHT 50
int main(void) {
ASSERT(glfwInit(), "glfw init failed");
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1);
GLFWwindow* window = glfwCreateWindow(WIDTH, HEIGHT, "<test>", NULL, NULL);
ASSERT(window != NULL, "glfw window creation failed");
glfwMakeContextCurrent(window);
int version = gladLoaderLoadGL();
ASSERT(version >= 2001, "glad version %d < 2001", version);
ASSERT(GLAD_VERSION_MAJOR(version) >= 2, "glad major version %d < 2", GLAD_VERSION_MAJOR(version));
ASSERT(GLAD_VERSION_MAJOR(version) > 2 || GLAD_VERSION_MINOR(version) >= 1, "glad minor version %d < 1", GLAD_VERSION_MINOR(version));
ASSERT(GLAD_GL_VERSION_2_1, "GL_VERSION_2_1 not set");
ASSERT(GLAD_GL_KHR_debug == 1, "KHR_debug not available");
glViewport(0, 0, WIDTH, HEIGHT);
glClearColor(0.2f, 0.3f, 0.3f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
glfwSwapBuffers(window);
glfwTerminate();
return 0;
}

View File

@@ -0,0 +1,59 @@
/*
* MX Core 3.3 profile using glfw to load
*
* GLAD: $GLAD --out-path=$tmp --api="gl:core" c --mx
* COMPILE: $GCC -Wno-pedantic $test -o $tmp/test -I$tmp/include $tmp/src/gl.c -ldl -lglfw
* RUN: $tmp/test
*/
#include <stdio.h>
#include <stdlib.h>
#include <glad/gl.h>
#include <GLFW/glfw3.h>
#define ASSERT(expression, message, args...) if(!(expression)) { fprintf(stderr, "%s(%d): " message "\n", __FILE__, __LINE__, ##args); exit(1); }
#define WIDTH 50
#define HEIGHT 50
GLFWwindow* create_window(void) {
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
GLFWwindow *window = glfwCreateWindow(WIDTH, HEIGHT, "<test>", NULL, NULL);
ASSERT(window != NULL, "glfw window creation failed");
return window;
}
void run(GLFWwindow *window) {
GladGLContext context = {0};
glfwMakeContextCurrent(window);
int version = gladLoadGLContext(&context, glfwGetProcAddress);
ASSERT(version >= 3003, "glad version %d < 3003", version);
ASSERT(GLAD_VERSION_MAJOR(version) >= 3, "glad major version %d < 3", GLAD_VERSION_MAJOR(version));
ASSERT(GLAD_VERSION_MAJOR(version) > 3 || GLAD_VERSION_MINOR(version) >= 3, "glad minor version %d < 3", GLAD_VERSION_MINOR(version));
ASSERT(context.VERSION_3_3, "GL_VERSION_3_3 not set");
ASSERT(context.KHR_debug, "KHR_debug not available");
context.Viewport(0, 0, WIDTH, HEIGHT);
context.ClearColor(0.2f, 0.3f, 0.3f, 1.0f);
context.Clear(GL_COLOR_BUFFER_BIT);
glfwSwapBuffers(window);
}
int main(void) {
ASSERT(glfwInit(), "glfw init failed");
GLFWwindow *window1 = create_window();
GLFWwindow *window2 = create_window();
run(window1);
run(window2);
glfwTerminate();
return 0;
}

View File

@@ -0,0 +1,59 @@
/*
* MX Core 3.3 profile using internal loader
*
* GLAD: $GLAD --out-path=$tmp --api="gl:core" c --mx --loader
* COMPILE: $GCC -Wno-pedantic $test -o $tmp/test -I$tmp/include $tmp/src/gl.c -ldl -lglfw
* RUN: $tmp/test
*/
#include <stdio.h>
#include <stdlib.h>
#include <glad/gl.h>
#include <GLFW/glfw3.h>
#define ASSERT(expression, message, args...) if(!(expression)) { fprintf(stderr, "%s(%d): " message "\n", __FILE__, __LINE__, ##args); exit(1); }
#define WIDTH 50
#define HEIGHT 50
GLFWwindow* create_window(void) {
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
GLFWwindow *window = glfwCreateWindow(WIDTH, HEIGHT, "<test>", NULL, NULL);
ASSERT(window != NULL, "glfw window creation failed");
return window;
}
void run(GLFWwindow *window) {
GladGLContext context = {0};
glfwMakeContextCurrent(window);
int version = gladLoaderLoadGLContext(&context);
ASSERT(version >= 3003, "glad version %d < 3003", version);
ASSERT(GLAD_VERSION_MAJOR(version) >= 3, "glad major version %d < 3", GLAD_VERSION_MAJOR(version));
ASSERT(GLAD_VERSION_MAJOR(version) > 3 || GLAD_VERSION_MINOR(version) >= 3, "glad minor version %d < 3", GLAD_VERSION_MINOR(version));
ASSERT(context.VERSION_3_3, "GL_VERSION_3_3 not set");
ASSERT(context.KHR_debug, "KHR_debug not available");
context.Viewport(0, 0, WIDTH, HEIGHT);
context.ClearColor(0.2f, 0.3f, 0.3f, 1.0f);
context.Clear(GL_COLOR_BUFFER_BIT);
glfwSwapBuffers(window);
}
int main(void) {
ASSERT(glfwInit(), "glfw init failed");
GLFWwindow *window1 = create_window();
GLFWwindow *window2 = create_window();
run(window1);
run(window2);
glfwTerminate();
return 0;
}

View File

@@ -0,0 +1,63 @@
/*
* MX Core 3.3 profile using glfw to load.
* Using MX Global for GL calls.
*
* GLAD: $GLAD --out-path=$tmp --api="gl:core" c --mx --mx-global
* COMPILE: $GCC -Wno-pedantic $test -o $tmp/test -I$tmp/include $tmp/src/gl.c -ldl -lglfw
* RUN: $tmp/test
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <glad/gl.h>
#include <GLFW/glfw3.h>
#define ASSERT(expression, message, args...) if(!(expression)) { fprintf(stderr, "%s(%d): " message "\n", __FILE__, __LINE__, ##args); exit(1); }
#define WIDTH 50
#define HEIGHT 50
GLFWwindow* create_window(void) {
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
GLFWwindow *window = glfwCreateWindow(WIDTH, HEIGHT, "<test>", NULL, NULL);
ASSERT(window != NULL, "glfw window creation failed");
return window;
}
void run(GLFWwindow *window) {
GladGLContext context = {0};
context.userptr = (void*) &context;
glfwMakeContextCurrent(window);
int version = gladLoadGLContext(&context, glfwGetProcAddress);
ASSERT(memcmp(&context, gladGetGLContext(), sizeof(GladGLContext)) == 0, "invalid global context");
ASSERT(version >= 3003, "glad version %d < 3003", version);
ASSERT(GLAD_VERSION_MAJOR(version) >= 3, "glad major version %d < 3", GLAD_VERSION_MAJOR(version));
ASSERT(GLAD_VERSION_MAJOR(version) > 3 || GLAD_VERSION_MINOR(version) >= 3, "glad minor version %d < 3", GLAD_VERSION_MINOR(version));
ASSERT(context.VERSION_3_3, "GL_VERSION_3_3 not set");
ASSERT(context.KHR_debug, "KHR_debug not available");
glViewport(0, 0, WIDTH, HEIGHT);
glClearColor(0.2f, 0.3f, 0.3f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
glfwSwapBuffers(window);
}
int main(void) {
ASSERT(glfwInit(), "glfw init failed");
GLFWwindow *window1 = create_window();
GLFWwindow *window2 = create_window();
run(window1);
run(window2);
glfwTerminate();
return 0;
}

Some files were not shown because too many files have changed in this diff Show More