add opengl 2.1 support, update imgui, update premake script
This commit is contained in:
1804
external/glad_4/glad.c
vendored
Normal file
1804
external/glad_4/glad.c
vendored
Normal file
File diff suppressed because it is too large
Load Diff
3659
external/glad_4/glad.h
vendored
Normal file
3659
external/glad_4/glad.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
312
external/glad_4/glad_glx.c
vendored
Normal file
312
external/glad_4/glad_glx.c
vendored
Normal file
@ -0,0 +1,312 @@
|
||||
/*
|
||||
|
||||
GLX loader generated by glad 0.1.12a0 on Tue Dec 20 17:04:11 2016.
|
||||
|
||||
Language/Generator: C/C++
|
||||
Specification: glx
|
||||
APIs: glx=1.4
|
||||
Profile: -
|
||||
Extensions:
|
||||
|
||||
Loader: True
|
||||
Local files: False
|
||||
Omit khrplatform: False
|
||||
|
||||
Commandline:
|
||||
--api="glx=1.4" --generator="c" --spec="glx" --extensions=""
|
||||
Online:
|
||||
http://glad.dav1d.de/#language=c&specification=glx&loader=on&api=glx%3D1.4
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <glad/glad_glx.h>
|
||||
|
||||
static void* get_proc(const char *namez);
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
static HMODULE libGL;
|
||||
|
||||
typedef void* (APIENTRYP PFNWGLGETPROCADDRESSPROC_PRIVATE)(const char*);
|
||||
PFNWGLGETPROCADDRESSPROC_PRIVATE gladGetProcAddressPtr;
|
||||
|
||||
static
|
||||
int open_gl(void) {
|
||||
libGL = LoadLibraryW(L"opengl32.dll");
|
||||
if(libGL != NULL) {
|
||||
gladGetProcAddressPtr = (PFNWGLGETPROCADDRESSPROC_PRIVATE)GetProcAddress(
|
||||
libGL, "wglGetProcAddress");
|
||||
return gladGetProcAddressPtr != NULL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static
|
||||
void close_gl(void) {
|
||||
if(libGL != NULL) {
|
||||
FreeLibrary(libGL);
|
||||
libGL = NULL;
|
||||
}
|
||||
}
|
||||
#else
|
||||
#include <dlfcn.h>
|
||||
static void* libGL;
|
||||
|
||||
#ifndef __APPLE__
|
||||
typedef void* (APIENTRYP PFNGLXGETPROCADDRESSPROC_PRIVATE)(const char*);
|
||||
PFNGLXGETPROCADDRESSPROC_PRIVATE gladGetProcAddressPtr;
|
||||
#endif
|
||||
|
||||
static
|
||||
int open_gl(void) {
|
||||
#ifdef __APPLE__
|
||||
static const char *NAMES[] = {
|
||||
"../Frameworks/OpenGL.framework/OpenGL",
|
||||
"/Library/Frameworks/OpenGL.framework/OpenGL",
|
||||
"/System/Library/Frameworks/OpenGL.framework/OpenGL",
|
||||
"/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL"
|
||||
};
|
||||
#else
|
||||
static const char *NAMES[] = {"libGL.so.1", "libGL.so"};
|
||||
#endif
|
||||
|
||||
unsigned int index = 0;
|
||||
for(index = 0; index < (sizeof(NAMES) / sizeof(NAMES[0])); index++) {
|
||||
libGL = dlopen(NAMES[index], RTLD_NOW | RTLD_GLOBAL);
|
||||
|
||||
if(libGL != NULL) {
|
||||
#ifdef __APPLE__
|
||||
return 1;
|
||||
#else
|
||||
gladGetProcAddressPtr = (PFNGLXGETPROCADDRESSPROC_PRIVATE)dlsym(libGL,
|
||||
"glXGetProcAddressARB");
|
||||
return gladGetProcAddressPtr != NULL;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static
|
||||
void close_gl() {
|
||||
if(libGL != NULL) {
|
||||
dlclose(libGL);
|
||||
libGL = NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static
|
||||
void* get_proc(const char *namez) {
|
||||
void* result = NULL;
|
||||
if(libGL == NULL) return NULL;
|
||||
|
||||
#ifndef __APPLE__
|
||||
if(gladGetProcAddressPtr != NULL) {
|
||||
result = gladGetProcAddressPtr(namez);
|
||||
}
|
||||
#endif
|
||||
if(result == NULL) {
|
||||
#ifdef _WIN32
|
||||
result = (void*)GetProcAddress(libGL, namez);
|
||||
#else
|
||||
result = dlsym(libGL, namez);
|
||||
#endif
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
int gladLoadGLX(Display *dpy, int screen) {
|
||||
int status = 0;
|
||||
|
||||
if(open_gl()) {
|
||||
status = gladLoadGLXLoader((GLADloadproc)get_proc, dpy, screen);
|
||||
close_gl();
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
static Display *GLADGLXDisplay = 0;
|
||||
static int GLADGLXscreen = 0;
|
||||
|
||||
static int get_exts(void) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void free_exts(void) {
|
||||
return;
|
||||
}
|
||||
|
||||
static int has_ext(const char *ext) {
|
||||
const char *terminator;
|
||||
const char *loc;
|
||||
const char *extensions;
|
||||
|
||||
if(!GLAD_GLX_VERSION_1_1)
|
||||
return 0;
|
||||
|
||||
extensions = glXQueryExtensionsString(GLADGLXDisplay, GLADGLXscreen);
|
||||
|
||||
if(extensions == NULL || ext == NULL)
|
||||
return 0;
|
||||
|
||||
while(1) {
|
||||
loc = strstr(extensions, ext);
|
||||
if(loc == NULL)
|
||||
break;
|
||||
|
||||
terminator = loc + strlen(ext);
|
||||
if((loc == extensions || *(loc - 1) == ' ') &&
|
||||
(*terminator == ' ' || *terminator == '\0'))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
extensions = terminator;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int GLAD_GLX_VERSION_1_0;
|
||||
int GLAD_GLX_VERSION_1_1;
|
||||
int GLAD_GLX_VERSION_1_2;
|
||||
int GLAD_GLX_VERSION_1_3;
|
||||
int GLAD_GLX_VERSION_1_4;
|
||||
PFNGLXGETSELECTEDEVENTPROC glad_glXGetSelectedEvent;
|
||||
PFNGLXQUERYEXTENSIONPROC glad_glXQueryExtension;
|
||||
PFNGLXMAKECURRENTPROC glad_glXMakeCurrent;
|
||||
PFNGLXSELECTEVENTPROC glad_glXSelectEvent;
|
||||
PFNGLXCREATECONTEXTPROC glad_glXCreateContext;
|
||||
PFNGLXCREATEGLXPIXMAPPROC glad_glXCreateGLXPixmap;
|
||||
PFNGLXQUERYVERSIONPROC glad_glXQueryVersion;
|
||||
PFNGLXGETCURRENTREADDRAWABLEPROC glad_glXGetCurrentReadDrawable;
|
||||
PFNGLXDESTROYPIXMAPPROC glad_glXDestroyPixmap;
|
||||
PFNGLXGETCURRENTCONTEXTPROC glad_glXGetCurrentContext;
|
||||
PFNGLXGETPROCADDRESSPROC glad_glXGetProcAddress;
|
||||
PFNGLXWAITGLPROC glad_glXWaitGL;
|
||||
PFNGLXISDIRECTPROC glad_glXIsDirect;
|
||||
PFNGLXDESTROYWINDOWPROC glad_glXDestroyWindow;
|
||||
PFNGLXCREATEWINDOWPROC glad_glXCreateWindow;
|
||||
PFNGLXCOPYCONTEXTPROC glad_glXCopyContext;
|
||||
PFNGLXCREATEPBUFFERPROC glad_glXCreatePbuffer;
|
||||
PFNGLXSWAPBUFFERSPROC glad_glXSwapBuffers;
|
||||
PFNGLXGETCURRENTDISPLAYPROC glad_glXGetCurrentDisplay;
|
||||
PFNGLXGETCURRENTDRAWABLEPROC glad_glXGetCurrentDrawable;
|
||||
PFNGLXQUERYCONTEXTPROC glad_glXQueryContext;
|
||||
PFNGLXCHOOSEVISUALPROC glad_glXChooseVisual;
|
||||
PFNGLXQUERYSERVERSTRINGPROC glad_glXQueryServerString;
|
||||
PFNGLXDESTROYCONTEXTPROC glad_glXDestroyContext;
|
||||
PFNGLXDESTROYGLXPIXMAPPROC glad_glXDestroyGLXPixmap;
|
||||
PFNGLXGETFBCONFIGATTRIBPROC glad_glXGetFBConfigAttrib;
|
||||
PFNGLXUSEXFONTPROC glad_glXUseXFont;
|
||||
PFNGLXDESTROYPBUFFERPROC glad_glXDestroyPbuffer;
|
||||
PFNGLXCHOOSEFBCONFIGPROC glad_glXChooseFBConfig;
|
||||
PFNGLXCREATENEWCONTEXTPROC glad_glXCreateNewContext;
|
||||
PFNGLXMAKECONTEXTCURRENTPROC glad_glXMakeContextCurrent;
|
||||
PFNGLXGETCONFIGPROC glad_glXGetConfig;
|
||||
PFNGLXGETFBCONFIGSPROC glad_glXGetFBConfigs;
|
||||
PFNGLXCREATEPIXMAPPROC glad_glXCreatePixmap;
|
||||
PFNGLXWAITXPROC glad_glXWaitX;
|
||||
PFNGLXGETVISUALFROMFBCONFIGPROC glad_glXGetVisualFromFBConfig;
|
||||
PFNGLXQUERYDRAWABLEPROC glad_glXQueryDrawable;
|
||||
PFNGLXQUERYEXTENSIONSSTRINGPROC glad_glXQueryExtensionsString;
|
||||
PFNGLXGETCLIENTSTRINGPROC glad_glXGetClientString;
|
||||
static void load_GLX_VERSION_1_0(GLADloadproc load) {
|
||||
if(!GLAD_GLX_VERSION_1_0) return;
|
||||
glad_glXChooseVisual = (PFNGLXCHOOSEVISUALPROC)load("glXChooseVisual");
|
||||
glad_glXCreateContext = (PFNGLXCREATECONTEXTPROC)load("glXCreateContext");
|
||||
glad_glXDestroyContext = (PFNGLXDESTROYCONTEXTPROC)load("glXDestroyContext");
|
||||
glad_glXMakeCurrent = (PFNGLXMAKECURRENTPROC)load("glXMakeCurrent");
|
||||
glad_glXCopyContext = (PFNGLXCOPYCONTEXTPROC)load("glXCopyContext");
|
||||
glad_glXSwapBuffers = (PFNGLXSWAPBUFFERSPROC)load("glXSwapBuffers");
|
||||
glad_glXCreateGLXPixmap = (PFNGLXCREATEGLXPIXMAPPROC)load("glXCreateGLXPixmap");
|
||||
glad_glXDestroyGLXPixmap = (PFNGLXDESTROYGLXPIXMAPPROC)load("glXDestroyGLXPixmap");
|
||||
glad_glXQueryExtension = (PFNGLXQUERYEXTENSIONPROC)load("glXQueryExtension");
|
||||
glad_glXQueryVersion = (PFNGLXQUERYVERSIONPROC)load("glXQueryVersion");
|
||||
glad_glXIsDirect = (PFNGLXISDIRECTPROC)load("glXIsDirect");
|
||||
glad_glXGetConfig = (PFNGLXGETCONFIGPROC)load("glXGetConfig");
|
||||
glad_glXGetCurrentContext = (PFNGLXGETCURRENTCONTEXTPROC)load("glXGetCurrentContext");
|
||||
glad_glXGetCurrentDrawable = (PFNGLXGETCURRENTDRAWABLEPROC)load("glXGetCurrentDrawable");
|
||||
glad_glXWaitGL = (PFNGLXWAITGLPROC)load("glXWaitGL");
|
||||
glad_glXWaitX = (PFNGLXWAITXPROC)load("glXWaitX");
|
||||
glad_glXUseXFont = (PFNGLXUSEXFONTPROC)load("glXUseXFont");
|
||||
}
|
||||
static void load_GLX_VERSION_1_1(GLADloadproc load) {
|
||||
if(!GLAD_GLX_VERSION_1_1) return;
|
||||
glad_glXQueryExtensionsString = (PFNGLXQUERYEXTENSIONSSTRINGPROC)load("glXQueryExtensionsString");
|
||||
glad_glXQueryServerString = (PFNGLXQUERYSERVERSTRINGPROC)load("glXQueryServerString");
|
||||
glad_glXGetClientString = (PFNGLXGETCLIENTSTRINGPROC)load("glXGetClientString");
|
||||
}
|
||||
static void load_GLX_VERSION_1_2(GLADloadproc load) {
|
||||
if(!GLAD_GLX_VERSION_1_2) return;
|
||||
glad_glXGetCurrentDisplay = (PFNGLXGETCURRENTDISPLAYPROC)load("glXGetCurrentDisplay");
|
||||
}
|
||||
static void load_GLX_VERSION_1_3(GLADloadproc load) {
|
||||
if(!GLAD_GLX_VERSION_1_3) return;
|
||||
glad_glXGetFBConfigs = (PFNGLXGETFBCONFIGSPROC)load("glXGetFBConfigs");
|
||||
glad_glXChooseFBConfig = (PFNGLXCHOOSEFBCONFIGPROC)load("glXChooseFBConfig");
|
||||
glad_glXGetFBConfigAttrib = (PFNGLXGETFBCONFIGATTRIBPROC)load("glXGetFBConfigAttrib");
|
||||
glad_glXGetVisualFromFBConfig = (PFNGLXGETVISUALFROMFBCONFIGPROC)load("glXGetVisualFromFBConfig");
|
||||
glad_glXCreateWindow = (PFNGLXCREATEWINDOWPROC)load("glXCreateWindow");
|
||||
glad_glXDestroyWindow = (PFNGLXDESTROYWINDOWPROC)load("glXDestroyWindow");
|
||||
glad_glXCreatePixmap = (PFNGLXCREATEPIXMAPPROC)load("glXCreatePixmap");
|
||||
glad_glXDestroyPixmap = (PFNGLXDESTROYPIXMAPPROC)load("glXDestroyPixmap");
|
||||
glad_glXCreatePbuffer = (PFNGLXCREATEPBUFFERPROC)load("glXCreatePbuffer");
|
||||
glad_glXDestroyPbuffer = (PFNGLXDESTROYPBUFFERPROC)load("glXDestroyPbuffer");
|
||||
glad_glXQueryDrawable = (PFNGLXQUERYDRAWABLEPROC)load("glXQueryDrawable");
|
||||
glad_glXCreateNewContext = (PFNGLXCREATENEWCONTEXTPROC)load("glXCreateNewContext");
|
||||
glad_glXMakeContextCurrent = (PFNGLXMAKECONTEXTCURRENTPROC)load("glXMakeContextCurrent");
|
||||
glad_glXGetCurrentReadDrawable = (PFNGLXGETCURRENTREADDRAWABLEPROC)load("glXGetCurrentReadDrawable");
|
||||
glad_glXQueryContext = (PFNGLXQUERYCONTEXTPROC)load("glXQueryContext");
|
||||
glad_glXSelectEvent = (PFNGLXSELECTEVENTPROC)load("glXSelectEvent");
|
||||
glad_glXGetSelectedEvent = (PFNGLXGETSELECTEDEVENTPROC)load("glXGetSelectedEvent");
|
||||
}
|
||||
static void load_GLX_VERSION_1_4(GLADloadproc load) {
|
||||
if(!GLAD_GLX_VERSION_1_4) return;
|
||||
glad_glXGetProcAddress = (PFNGLXGETPROCADDRESSPROC)load("glXGetProcAddress");
|
||||
}
|
||||
static int find_extensionsGLX(void) {
|
||||
if (!get_exts()) return 0;
|
||||
free_exts();
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void find_coreGLX(Display *dpy, int screen) {
|
||||
int major = 0, minor = 0;
|
||||
if(dpy == 0 && GLADGLXDisplay == 0) {
|
||||
dpy = XOpenDisplay(0);
|
||||
screen = XScreenNumberOfScreen(XDefaultScreenOfDisplay(dpy));
|
||||
} else if(dpy == 0) {
|
||||
dpy = GLADGLXDisplay;
|
||||
screen = GLADGLXscreen;
|
||||
}
|
||||
glXQueryVersion(dpy, &major, &minor);
|
||||
GLADGLXDisplay = dpy;
|
||||
GLADGLXscreen = screen;
|
||||
GLAD_GLX_VERSION_1_0 = (major == 1 && minor >= 0) || major > 1;
|
||||
GLAD_GLX_VERSION_1_1 = (major == 1 && minor >= 1) || major > 1;
|
||||
GLAD_GLX_VERSION_1_2 = (major == 1 && minor >= 2) || major > 1;
|
||||
GLAD_GLX_VERSION_1_3 = (major == 1 && minor >= 3) || major > 1;
|
||||
GLAD_GLX_VERSION_1_4 = (major == 1 && minor >= 4) || major > 1;
|
||||
}
|
||||
|
||||
int gladLoadGLXLoader(GLADloadproc load, Display *dpy, int screen) {
|
||||
glXQueryVersion = (PFNGLXQUERYVERSIONPROC)load("glXQueryVersion");
|
||||
if(glXQueryVersion == NULL) return 0;
|
||||
find_coreGLX(dpy, screen);
|
||||
load_GLX_VERSION_1_0(load);
|
||||
load_GLX_VERSION_1_1(load);
|
||||
load_GLX_VERSION_1_2(load);
|
||||
load_GLX_VERSION_1_3(load);
|
||||
load_GLX_VERSION_1_4(load);
|
||||
|
||||
if (!find_extensionsGLX()) return 0;
|
||||
return 1;
|
||||
}
|
||||
|
433
external/glad_4/glad_glx.h
vendored
Normal file
433
external/glad_4/glad_glx.h
vendored
Normal file
@ -0,0 +1,433 @@
|
||||
/*
|
||||
|
||||
GLX loader generated by glad 0.1.12a0 on Tue Dec 20 17:04:11 2016.
|
||||
|
||||
Language/Generator: C/C++
|
||||
Specification: glx
|
||||
APIs: glx=1.4
|
||||
Profile: -
|
||||
Extensions:
|
||||
|
||||
Loader: True
|
||||
Local files: False
|
||||
Omit khrplatform: False
|
||||
|
||||
Commandline:
|
||||
--api="glx=1.4" --generator="c" --spec="glx" --extensions=""
|
||||
Online:
|
||||
http://glad.dav1d.de/#language=c&specification=glx&loader=on&api=glx%3D1.4
|
||||
*/
|
||||
|
||||
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <glad/glad.h>
|
||||
|
||||
#ifndef __glad_glxext_h_
|
||||
|
||||
#ifdef __glxext_h_
|
||||
#error GLX header already included, remove this include, glad already provides it
|
||||
#endif
|
||||
|
||||
#define __glad_glxext_h_
|
||||
#define __glxext_h_
|
||||
|
||||
#ifndef APIENTRY
|
||||
#define APIENTRY
|
||||
#endif
|
||||
#ifndef APIENTRYP
|
||||
#define APIENTRYP APIENTRY *
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef void* (* GLADloadproc)(const char *name);
|
||||
|
||||
#ifndef GLAPI
|
||||
# if defined(GLAD_GLAPI_EXPORT)
|
||||
# if defined(WIN32) || defined(__CYGWIN__)
|
||||
# if defined(GLAD_GLAPI_EXPORT_BUILD)
|
||||
# if defined(__GNUC__)
|
||||
# define GLAPI __attribute__ ((dllexport)) extern
|
||||
# else
|
||||
# define GLAPI __declspec(dllexport) extern
|
||||
# endif
|
||||
# else
|
||||
# if defined(__GNUC__)
|
||||
# define GLAPI __attribute__ ((dllimport)) extern
|
||||
# else
|
||||
# define GLAPI __declspec(dllimport) extern
|
||||
# endif
|
||||
# endif
|
||||
# elif defined(__GNUC__) && defined(GLAD_GLAPI_EXPORT_BUILD)
|
||||
# define GLAPI __attribute__ ((visibility ("default"))) extern
|
||||
# else
|
||||
# define GLAPI extern
|
||||
# endif
|
||||
# else
|
||||
# define GLAPI extern
|
||||
# endif
|
||||
#endif
|
||||
|
||||
GLAPI int gladLoadGLX(Display *dpy, int screen);
|
||||
|
||||
GLAPI int gladLoadGLXLoader(GLADloadproc, Display *dpy, int screen);
|
||||
|
||||
#ifndef GLEXT_64_TYPES_DEFINED
|
||||
/* This code block is duplicated in glext.h, so must be protected */
|
||||
#define GLEXT_64_TYPES_DEFINED
|
||||
/* Define int32_t, int64_t, and uint64_t types for UST/MSC */
|
||||
/* (as used in the GLX_OML_sync_control extension). */
|
||||
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
||||
#include <inttypes.h>
|
||||
#elif defined(__sun__) || defined(__digital__)
|
||||
#include <inttypes.h>
|
||||
#if defined(__STDC__)
|
||||
#if defined(__arch64__) || defined(_LP64)
|
||||
typedef long int int64_t;
|
||||
typedef unsigned long int uint64_t;
|
||||
#else
|
||||
typedef long long int int64_t;
|
||||
typedef unsigned long long int uint64_t;
|
||||
#endif /* __arch64__ */
|
||||
#endif /* __STDC__ */
|
||||
#elif defined( __VMS ) || defined(__sgi)
|
||||
#include <inttypes.h>
|
||||
#elif defined(__SCO__) || defined(__USLC__)
|
||||
#include <stdint.h>
|
||||
#elif defined(__UNIXOS2__) || defined(__SOL64__)
|
||||
typedef long int int32_t;
|
||||
typedef long long int int64_t;
|
||||
typedef unsigned long long int uint64_t;
|
||||
#elif defined(_WIN32) && defined(__GNUC__)
|
||||
#include <stdint.h>
|
||||
#elif defined(_WIN32)
|
||||
typedef __int32 int32_t;
|
||||
typedef __int64 int64_t;
|
||||
typedef unsigned __int64 uint64_t;
|
||||
#else
|
||||
/* Fallback if nothing above works */
|
||||
#include <inttypes.h>
|
||||
#endif
|
||||
#endif
|
||||
typedef XID GLXFBConfigID;
|
||||
typedef struct __GLXFBConfigRec *GLXFBConfig;
|
||||
typedef XID GLXContextID;
|
||||
typedef struct __GLXcontextRec *GLXContext;
|
||||
typedef XID GLXPixmap;
|
||||
typedef XID GLXDrawable;
|
||||
typedef XID GLXWindow;
|
||||
typedef XID GLXPbuffer;
|
||||
typedef void (APIENTRY *__GLXextFuncPtr)(void);
|
||||
typedef XID GLXVideoCaptureDeviceNV;
|
||||
typedef unsigned int GLXVideoDeviceNV;
|
||||
typedef XID GLXVideoSourceSGIX;
|
||||
typedef XID GLXFBConfigIDSGIX;
|
||||
typedef struct __GLXFBConfigRec *GLXFBConfigSGIX;
|
||||
typedef XID GLXPbufferSGIX;
|
||||
typedef struct {
|
||||
int event_type; /* GLX_DAMAGED or GLX_SAVED */
|
||||
int draw_type; /* GLX_WINDOW or GLX_PBUFFER */
|
||||
unsigned long serial; /* # of last request processed by server */
|
||||
Bool send_event; /* true if this came for SendEvent request */
|
||||
Display *display; /* display the event was read from */
|
||||
GLXDrawable drawable; /* XID of Drawable */
|
||||
unsigned int buffer_mask; /* mask indicating which buffers are affected */
|
||||
unsigned int aux_buffer; /* which aux buffer was affected */
|
||||
int x, y;
|
||||
int width, height;
|
||||
int count; /* if nonzero, at least this many more */
|
||||
} GLXPbufferClobberEvent;
|
||||
typedef struct {
|
||||
int type;
|
||||
unsigned long serial; /* # of last request processed by server */
|
||||
Bool send_event; /* true if this came from a SendEvent request */
|
||||
Display *display; /* Display the event was read from */
|
||||
GLXDrawable drawable; /* drawable on which event was requested in event mask */
|
||||
int event_type;
|
||||
int64_t ust;
|
||||
int64_t msc;
|
||||
int64_t sbc;
|
||||
} GLXBufferSwapComplete;
|
||||
typedef union __GLXEvent {
|
||||
GLXPbufferClobberEvent glxpbufferclobber;
|
||||
GLXBufferSwapComplete glxbufferswapcomplete;
|
||||
long pad[24];
|
||||
} GLXEvent;
|
||||
typedef struct {
|
||||
int type;
|
||||
unsigned long serial;
|
||||
Bool send_event;
|
||||
Display *display;
|
||||
int extension;
|
||||
int evtype;
|
||||
GLXDrawable window;
|
||||
Bool stereo_tree;
|
||||
} GLXStereoNotifyEventEXT;
|
||||
typedef struct {
|
||||
int type;
|
||||
unsigned long serial; /* # of last request processed by server */
|
||||
Bool send_event; /* true if this came for SendEvent request */
|
||||
Display *display; /* display the event was read from */
|
||||
GLXDrawable drawable; /* i.d. of Drawable */
|
||||
int event_type; /* GLX_DAMAGED_SGIX or GLX_SAVED_SGIX */
|
||||
int draw_type; /* GLX_WINDOW_SGIX or GLX_PBUFFER_SGIX */
|
||||
unsigned int mask; /* mask indicating which buffers are affected*/
|
||||
int x, y;
|
||||
int width, height;
|
||||
int count; /* if nonzero, at least this many more */
|
||||
} GLXBufferClobberEventSGIX;
|
||||
typedef struct {
|
||||
char pipeName[80]; /* Should be [GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX] */
|
||||
int networkId;
|
||||
} GLXHyperpipeNetworkSGIX;
|
||||
typedef struct {
|
||||
char pipeName[80]; /* Should be [GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX] */
|
||||
int channel;
|
||||
unsigned int participationType;
|
||||
int timeSlice;
|
||||
} GLXHyperpipeConfigSGIX;
|
||||
typedef struct {
|
||||
char pipeName[80]; /* Should be [GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX] */
|
||||
int srcXOrigin, srcYOrigin, srcWidth, srcHeight;
|
||||
int destXOrigin, destYOrigin, destWidth, destHeight;
|
||||
} GLXPipeRect;
|
||||
typedef struct {
|
||||
char pipeName[80]; /* Should be [GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX] */
|
||||
int XOrigin, YOrigin, maxHeight, maxWidth;
|
||||
} GLXPipeRectLimits;
|
||||
#define GLX_EXTENSION_NAME "GLX"
|
||||
#define GLX_PbufferClobber 0
|
||||
#define GLX_BufferSwapComplete 1
|
||||
#define __GLX_NUMBER_EVENTS 17
|
||||
#define GLX_BAD_SCREEN 1
|
||||
#define GLX_BAD_ATTRIBUTE 2
|
||||
#define GLX_NO_EXTENSION 3
|
||||
#define GLX_BAD_VISUAL 4
|
||||
#define GLX_BAD_CONTEXT 5
|
||||
#define GLX_BAD_VALUE 6
|
||||
#define GLX_BAD_ENUM 7
|
||||
#define GLX_USE_GL 1
|
||||
#define GLX_BUFFER_SIZE 2
|
||||
#define GLX_LEVEL 3
|
||||
#define GLX_RGBA 4
|
||||
#define GLX_DOUBLEBUFFER 5
|
||||
#define GLX_STEREO 6
|
||||
#define GLX_AUX_BUFFERS 7
|
||||
#define GLX_RED_SIZE 8
|
||||
#define GLX_GREEN_SIZE 9
|
||||
#define GLX_BLUE_SIZE 10
|
||||
#define GLX_ALPHA_SIZE 11
|
||||
#define GLX_DEPTH_SIZE 12
|
||||
#define GLX_STENCIL_SIZE 13
|
||||
#define GLX_ACCUM_RED_SIZE 14
|
||||
#define GLX_ACCUM_GREEN_SIZE 15
|
||||
#define GLX_ACCUM_BLUE_SIZE 16
|
||||
#define GLX_ACCUM_ALPHA_SIZE 17
|
||||
#define GLX_VENDOR 0x1
|
||||
#define GLX_VERSION 0x2
|
||||
#define GLX_EXTENSIONS 0x3
|
||||
#define GLX_WINDOW_BIT 0x00000001
|
||||
#define GLX_PIXMAP_BIT 0x00000002
|
||||
#define GLX_PBUFFER_BIT 0x00000004
|
||||
#define GLX_RGBA_BIT 0x00000001
|
||||
#define GLX_COLOR_INDEX_BIT 0x00000002
|
||||
#define GLX_PBUFFER_CLOBBER_MASK 0x08000000
|
||||
#define GLX_FRONT_LEFT_BUFFER_BIT 0x00000001
|
||||
#define GLX_FRONT_RIGHT_BUFFER_BIT 0x00000002
|
||||
#define GLX_BACK_LEFT_BUFFER_BIT 0x00000004
|
||||
#define GLX_BACK_RIGHT_BUFFER_BIT 0x00000008
|
||||
#define GLX_AUX_BUFFERS_BIT 0x00000010
|
||||
#define GLX_DEPTH_BUFFER_BIT 0x00000020
|
||||
#define GLX_STENCIL_BUFFER_BIT 0x00000040
|
||||
#define GLX_ACCUM_BUFFER_BIT 0x00000080
|
||||
#define GLX_CONFIG_CAVEAT 0x20
|
||||
#define GLX_X_VISUAL_TYPE 0x22
|
||||
#define GLX_TRANSPARENT_TYPE 0x23
|
||||
#define GLX_TRANSPARENT_INDEX_VALUE 0x24
|
||||
#define GLX_TRANSPARENT_RED_VALUE 0x25
|
||||
#define GLX_TRANSPARENT_GREEN_VALUE 0x26
|
||||
#define GLX_TRANSPARENT_BLUE_VALUE 0x27
|
||||
#define GLX_TRANSPARENT_ALPHA_VALUE 0x28
|
||||
#define GLX_DONT_CARE 0xFFFFFFFF
|
||||
#define GLX_NONE 0x8000
|
||||
#define GLX_SLOW_CONFIG 0x8001
|
||||
#define GLX_TRUE_COLOR 0x8002
|
||||
#define GLX_DIRECT_COLOR 0x8003
|
||||
#define GLX_PSEUDO_COLOR 0x8004
|
||||
#define GLX_STATIC_COLOR 0x8005
|
||||
#define GLX_GRAY_SCALE 0x8006
|
||||
#define GLX_STATIC_GRAY 0x8007
|
||||
#define GLX_TRANSPARENT_RGB 0x8008
|
||||
#define GLX_TRANSPARENT_INDEX 0x8009
|
||||
#define GLX_VISUAL_ID 0x800B
|
||||
#define GLX_SCREEN 0x800C
|
||||
#define GLX_NON_CONFORMANT_CONFIG 0x800D
|
||||
#define GLX_DRAWABLE_TYPE 0x8010
|
||||
#define GLX_RENDER_TYPE 0x8011
|
||||
#define GLX_X_RENDERABLE 0x8012
|
||||
#define GLX_FBCONFIG_ID 0x8013
|
||||
#define GLX_RGBA_TYPE 0x8014
|
||||
#define GLX_COLOR_INDEX_TYPE 0x8015
|
||||
#define GLX_MAX_PBUFFER_WIDTH 0x8016
|
||||
#define GLX_MAX_PBUFFER_HEIGHT 0x8017
|
||||
#define GLX_MAX_PBUFFER_PIXELS 0x8018
|
||||
#define GLX_PRESERVED_CONTENTS 0x801B
|
||||
#define GLX_LARGEST_PBUFFER 0x801C
|
||||
#define GLX_WIDTH 0x801D
|
||||
#define GLX_HEIGHT 0x801E
|
||||
#define GLX_EVENT_MASK 0x801F
|
||||
#define GLX_DAMAGED 0x8020
|
||||
#define GLX_SAVED 0x8021
|
||||
#define GLX_WINDOW 0x8022
|
||||
#define GLX_PBUFFER 0x8023
|
||||
#define GLX_PBUFFER_HEIGHT 0x8040
|
||||
#define GLX_PBUFFER_WIDTH 0x8041
|
||||
#define GLX_SAMPLE_BUFFERS 100000
|
||||
#define GLX_SAMPLES 100001
|
||||
#ifndef GLX_VERSION_1_0
|
||||
#define GLX_VERSION_1_0 1
|
||||
GLAPI int GLAD_GLX_VERSION_1_0;
|
||||
typedef XVisualInfo * (APIENTRYP PFNGLXCHOOSEVISUALPROC)(Display *dpy, int screen, int *attribList);
|
||||
GLAPI PFNGLXCHOOSEVISUALPROC glad_glXChooseVisual;
|
||||
#define glXChooseVisual glad_glXChooseVisual
|
||||
typedef GLXContext (APIENTRYP PFNGLXCREATECONTEXTPROC)(Display *dpy, XVisualInfo *vis, GLXContext shareList, Bool direct);
|
||||
GLAPI PFNGLXCREATECONTEXTPROC glad_glXCreateContext;
|
||||
#define glXCreateContext glad_glXCreateContext
|
||||
typedef void (APIENTRYP PFNGLXDESTROYCONTEXTPROC)(Display *dpy, GLXContext ctx);
|
||||
GLAPI PFNGLXDESTROYCONTEXTPROC glad_glXDestroyContext;
|
||||
#define glXDestroyContext glad_glXDestroyContext
|
||||
typedef Bool (APIENTRYP PFNGLXMAKECURRENTPROC)(Display *dpy, GLXDrawable drawable, GLXContext ctx);
|
||||
GLAPI PFNGLXMAKECURRENTPROC glad_glXMakeCurrent;
|
||||
#define glXMakeCurrent glad_glXMakeCurrent
|
||||
typedef void (APIENTRYP PFNGLXCOPYCONTEXTPROC)(Display *dpy, GLXContext src, GLXContext dst, unsigned long mask);
|
||||
GLAPI PFNGLXCOPYCONTEXTPROC glad_glXCopyContext;
|
||||
#define glXCopyContext glad_glXCopyContext
|
||||
typedef void (APIENTRYP PFNGLXSWAPBUFFERSPROC)(Display *dpy, GLXDrawable drawable);
|
||||
GLAPI PFNGLXSWAPBUFFERSPROC glad_glXSwapBuffers;
|
||||
#define glXSwapBuffers glad_glXSwapBuffers
|
||||
typedef GLXPixmap (APIENTRYP PFNGLXCREATEGLXPIXMAPPROC)(Display *dpy, XVisualInfo *visual, Pixmap pixmap);
|
||||
GLAPI PFNGLXCREATEGLXPIXMAPPROC glad_glXCreateGLXPixmap;
|
||||
#define glXCreateGLXPixmap glad_glXCreateGLXPixmap
|
||||
typedef void (APIENTRYP PFNGLXDESTROYGLXPIXMAPPROC)(Display *dpy, GLXPixmap pixmap);
|
||||
GLAPI PFNGLXDESTROYGLXPIXMAPPROC glad_glXDestroyGLXPixmap;
|
||||
#define glXDestroyGLXPixmap glad_glXDestroyGLXPixmap
|
||||
typedef Bool (APIENTRYP PFNGLXQUERYEXTENSIONPROC)(Display *dpy, int *errorb, int *event);
|
||||
GLAPI PFNGLXQUERYEXTENSIONPROC glad_glXQueryExtension;
|
||||
#define glXQueryExtension glad_glXQueryExtension
|
||||
typedef Bool (APIENTRYP PFNGLXQUERYVERSIONPROC)(Display *dpy, int *maj, int *min);
|
||||
GLAPI PFNGLXQUERYVERSIONPROC glad_glXQueryVersion;
|
||||
#define glXQueryVersion glad_glXQueryVersion
|
||||
typedef Bool (APIENTRYP PFNGLXISDIRECTPROC)(Display *dpy, GLXContext ctx);
|
||||
GLAPI PFNGLXISDIRECTPROC glad_glXIsDirect;
|
||||
#define glXIsDirect glad_glXIsDirect
|
||||
typedef int (APIENTRYP PFNGLXGETCONFIGPROC)(Display *dpy, XVisualInfo *visual, int attrib, int *value);
|
||||
GLAPI PFNGLXGETCONFIGPROC glad_glXGetConfig;
|
||||
#define glXGetConfig glad_glXGetConfig
|
||||
typedef GLXContext (APIENTRYP PFNGLXGETCURRENTCONTEXTPROC)();
|
||||
GLAPI PFNGLXGETCURRENTCONTEXTPROC glad_glXGetCurrentContext;
|
||||
#define glXGetCurrentContext glad_glXGetCurrentContext
|
||||
typedef GLXDrawable (APIENTRYP PFNGLXGETCURRENTDRAWABLEPROC)();
|
||||
GLAPI PFNGLXGETCURRENTDRAWABLEPROC glad_glXGetCurrentDrawable;
|
||||
#define glXGetCurrentDrawable glad_glXGetCurrentDrawable
|
||||
typedef void (APIENTRYP PFNGLXWAITGLPROC)();
|
||||
GLAPI PFNGLXWAITGLPROC glad_glXWaitGL;
|
||||
#define glXWaitGL glad_glXWaitGL
|
||||
typedef void (APIENTRYP PFNGLXWAITXPROC)();
|
||||
GLAPI PFNGLXWAITXPROC glad_glXWaitX;
|
||||
#define glXWaitX glad_glXWaitX
|
||||
typedef void (APIENTRYP PFNGLXUSEXFONTPROC)(Font font, int first, int count, int list);
|
||||
GLAPI PFNGLXUSEXFONTPROC glad_glXUseXFont;
|
||||
#define glXUseXFont glad_glXUseXFont
|
||||
#endif
|
||||
#ifndef GLX_VERSION_1_1
|
||||
#define GLX_VERSION_1_1 1
|
||||
GLAPI int GLAD_GLX_VERSION_1_1;
|
||||
typedef const char * (APIENTRYP PFNGLXQUERYEXTENSIONSSTRINGPROC)(Display *dpy, int screen);
|
||||
GLAPI PFNGLXQUERYEXTENSIONSSTRINGPROC glad_glXQueryExtensionsString;
|
||||
#define glXQueryExtensionsString glad_glXQueryExtensionsString
|
||||
typedef const char * (APIENTRYP PFNGLXQUERYSERVERSTRINGPROC)(Display *dpy, int screen, int name);
|
||||
GLAPI PFNGLXQUERYSERVERSTRINGPROC glad_glXQueryServerString;
|
||||
#define glXQueryServerString glad_glXQueryServerString
|
||||
typedef const char * (APIENTRYP PFNGLXGETCLIENTSTRINGPROC)(Display *dpy, int name);
|
||||
GLAPI PFNGLXGETCLIENTSTRINGPROC glad_glXGetClientString;
|
||||
#define glXGetClientString glad_glXGetClientString
|
||||
#endif
|
||||
#ifndef GLX_VERSION_1_2
|
||||
#define GLX_VERSION_1_2 1
|
||||
GLAPI int GLAD_GLX_VERSION_1_2;
|
||||
typedef Display * (APIENTRYP PFNGLXGETCURRENTDISPLAYPROC)();
|
||||
GLAPI PFNGLXGETCURRENTDISPLAYPROC glad_glXGetCurrentDisplay;
|
||||
#define glXGetCurrentDisplay glad_glXGetCurrentDisplay
|
||||
#endif
|
||||
#ifndef GLX_VERSION_1_3
|
||||
#define GLX_VERSION_1_3 1
|
||||
GLAPI int GLAD_GLX_VERSION_1_3;
|
||||
typedef GLXFBConfig * (APIENTRYP PFNGLXGETFBCONFIGSPROC)(Display *dpy, int screen, int *nelements);
|
||||
GLAPI PFNGLXGETFBCONFIGSPROC glad_glXGetFBConfigs;
|
||||
#define glXGetFBConfigs glad_glXGetFBConfigs
|
||||
typedef GLXFBConfig * (APIENTRYP PFNGLXCHOOSEFBCONFIGPROC)(Display *dpy, int screen, const int *attrib_list, int *nelements);
|
||||
GLAPI PFNGLXCHOOSEFBCONFIGPROC glad_glXChooseFBConfig;
|
||||
#define glXChooseFBConfig glad_glXChooseFBConfig
|
||||
typedef int (APIENTRYP PFNGLXGETFBCONFIGATTRIBPROC)(Display *dpy, GLXFBConfig config, int attribute, int *value);
|
||||
GLAPI PFNGLXGETFBCONFIGATTRIBPROC glad_glXGetFBConfigAttrib;
|
||||
#define glXGetFBConfigAttrib glad_glXGetFBConfigAttrib
|
||||
typedef XVisualInfo * (APIENTRYP PFNGLXGETVISUALFROMFBCONFIGPROC)(Display *dpy, GLXFBConfig config);
|
||||
GLAPI PFNGLXGETVISUALFROMFBCONFIGPROC glad_glXGetVisualFromFBConfig;
|
||||
#define glXGetVisualFromFBConfig glad_glXGetVisualFromFBConfig
|
||||
typedef GLXWindow (APIENTRYP PFNGLXCREATEWINDOWPROC)(Display *dpy, GLXFBConfig config, Window win, const int *attrib_list);
|
||||
GLAPI PFNGLXCREATEWINDOWPROC glad_glXCreateWindow;
|
||||
#define glXCreateWindow glad_glXCreateWindow
|
||||
typedef void (APIENTRYP PFNGLXDESTROYWINDOWPROC)(Display *dpy, GLXWindow win);
|
||||
GLAPI PFNGLXDESTROYWINDOWPROC glad_glXDestroyWindow;
|
||||
#define glXDestroyWindow glad_glXDestroyWindow
|
||||
typedef GLXPixmap (APIENTRYP PFNGLXCREATEPIXMAPPROC)(Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attrib_list);
|
||||
GLAPI PFNGLXCREATEPIXMAPPROC glad_glXCreatePixmap;
|
||||
#define glXCreatePixmap glad_glXCreatePixmap
|
||||
typedef void (APIENTRYP PFNGLXDESTROYPIXMAPPROC)(Display *dpy, GLXPixmap pixmap);
|
||||
GLAPI PFNGLXDESTROYPIXMAPPROC glad_glXDestroyPixmap;
|
||||
#define glXDestroyPixmap glad_glXDestroyPixmap
|
||||
typedef GLXPbuffer (APIENTRYP PFNGLXCREATEPBUFFERPROC)(Display *dpy, GLXFBConfig config, const int *attrib_list);
|
||||
GLAPI PFNGLXCREATEPBUFFERPROC glad_glXCreatePbuffer;
|
||||
#define glXCreatePbuffer glad_glXCreatePbuffer
|
||||
typedef void (APIENTRYP PFNGLXDESTROYPBUFFERPROC)(Display *dpy, GLXPbuffer pbuf);
|
||||
GLAPI PFNGLXDESTROYPBUFFERPROC glad_glXDestroyPbuffer;
|
||||
#define glXDestroyPbuffer glad_glXDestroyPbuffer
|
||||
typedef void (APIENTRYP PFNGLXQUERYDRAWABLEPROC)(Display *dpy, GLXDrawable draw, int attribute, unsigned int *value);
|
||||
GLAPI PFNGLXQUERYDRAWABLEPROC glad_glXQueryDrawable;
|
||||
#define glXQueryDrawable glad_glXQueryDrawable
|
||||
typedef GLXContext (APIENTRYP PFNGLXCREATENEWCONTEXTPROC)(Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct);
|
||||
GLAPI PFNGLXCREATENEWCONTEXTPROC glad_glXCreateNewContext;
|
||||
#define glXCreateNewContext glad_glXCreateNewContext
|
||||
typedef Bool (APIENTRYP PFNGLXMAKECONTEXTCURRENTPROC)(Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx);
|
||||
GLAPI PFNGLXMAKECONTEXTCURRENTPROC glad_glXMakeContextCurrent;
|
||||
#define glXMakeContextCurrent glad_glXMakeContextCurrent
|
||||
typedef GLXDrawable (APIENTRYP PFNGLXGETCURRENTREADDRAWABLEPROC)();
|
||||
GLAPI PFNGLXGETCURRENTREADDRAWABLEPROC glad_glXGetCurrentReadDrawable;
|
||||
#define glXGetCurrentReadDrawable glad_glXGetCurrentReadDrawable
|
||||
typedef int (APIENTRYP PFNGLXQUERYCONTEXTPROC)(Display *dpy, GLXContext ctx, int attribute, int *value);
|
||||
GLAPI PFNGLXQUERYCONTEXTPROC glad_glXQueryContext;
|
||||
#define glXQueryContext glad_glXQueryContext
|
||||
typedef void (APIENTRYP PFNGLXSELECTEVENTPROC)(Display *dpy, GLXDrawable draw, unsigned long event_mask);
|
||||
GLAPI PFNGLXSELECTEVENTPROC glad_glXSelectEvent;
|
||||
#define glXSelectEvent glad_glXSelectEvent
|
||||
typedef void (APIENTRYP PFNGLXGETSELECTEDEVENTPROC)(Display *dpy, GLXDrawable draw, unsigned long *event_mask);
|
||||
GLAPI PFNGLXGETSELECTEDEVENTPROC glad_glXGetSelectedEvent;
|
||||
#define glXGetSelectedEvent glad_glXGetSelectedEvent
|
||||
#endif
|
||||
#ifndef GLX_VERSION_1_4
|
||||
#define GLX_VERSION_1_4 1
|
||||
GLAPI int GLAD_GLX_VERSION_1_4;
|
||||
typedef __GLXextFuncPtr (APIENTRYP PFNGLXGETPROCADDRESSPROC)(const GLubyte *procName);
|
||||
GLAPI PFNGLXGETPROCADDRESSPROC glad_glXGetProcAddress;
|
||||
#define glXGetProcAddress glad_glXGetProcAddress
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
285
external/glad_4/khrplatform.h
vendored
Normal file
285
external/glad_4/khrplatform.h
vendored
Normal file
@ -0,0 +1,285 @@
|
||||
#ifndef __khrplatform_h_
|
||||
#define __khrplatform_h_
|
||||
|
||||
/*
|
||||
** Copyright (c) 2008-2009 The Khronos Group Inc.
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person obtaining a
|
||||
** copy of this software and/or associated documentation files (the
|
||||
** "Materials"), to deal in the Materials without restriction, including
|
||||
** without limitation the rights to use, copy, modify, merge, publish,
|
||||
** distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
** permit persons to whom the Materials are furnished to do so, subject to
|
||||
** the following conditions:
|
||||
**
|
||||
** The above copyright notice and this permission notice shall be included
|
||||
** in all copies or substantial portions of the Materials.
|
||||
**
|
||||
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
*/
|
||||
|
||||
/* Khronos platform-specific types and definitions.
|
||||
*
|
||||
* $Revision: 32517 $ on $Date: 2016-03-11 02:41:19 -0800 (Fri, 11 Mar 2016) $
|
||||
*
|
||||
* Adopters may modify this file to suit their platform. Adopters are
|
||||
* encouraged to submit platform specific modifications to the Khronos
|
||||
* group so that they can be included in future versions of this file.
|
||||
* Please submit changes by sending them to the public Khronos Bugzilla
|
||||
* (http://khronos.org/bugzilla) by filing a bug against product
|
||||
* "Khronos (general)" component "Registry".
|
||||
*
|
||||
* A predefined template which fills in some of the bug fields can be
|
||||
* reached using http://tinyurl.com/khrplatform-h-bugreport, but you
|
||||
* must create a Bugzilla login first.
|
||||
*
|
||||
*
|
||||
* See the Implementer's Guidelines for information about where this file
|
||||
* should be located on your system and for more details of its use:
|
||||
* http://www.khronos.org/registry/implementers_guide.pdf
|
||||
*
|
||||
* This file should be included as
|
||||
* #include <KHR/khrplatform.h>
|
||||
* by Khronos client API header files that use its types and defines.
|
||||
*
|
||||
* The types in khrplatform.h should only be used to define API-specific types.
|
||||
*
|
||||
* Types defined in khrplatform.h:
|
||||
* khronos_int8_t signed 8 bit
|
||||
* khronos_uint8_t unsigned 8 bit
|
||||
* khronos_int16_t signed 16 bit
|
||||
* khronos_uint16_t unsigned 16 bit
|
||||
* khronos_int32_t signed 32 bit
|
||||
* khronos_uint32_t unsigned 32 bit
|
||||
* khronos_int64_t signed 64 bit
|
||||
* khronos_uint64_t unsigned 64 bit
|
||||
* khronos_intptr_t signed same number of bits as a pointer
|
||||
* khronos_uintptr_t unsigned same number of bits as a pointer
|
||||
* khronos_ssize_t signed size
|
||||
* khronos_usize_t unsigned size
|
||||
* khronos_float_t signed 32 bit floating point
|
||||
* khronos_time_ns_t unsigned 64 bit time in nanoseconds
|
||||
* khronos_utime_nanoseconds_t unsigned time interval or absolute time in
|
||||
* nanoseconds
|
||||
* khronos_stime_nanoseconds_t signed time interval in nanoseconds
|
||||
* khronos_boolean_enum_t enumerated boolean type. This should
|
||||
* only be used as a base type when a client API's boolean type is
|
||||
* an enum. Client APIs which use an integer or other type for
|
||||
* booleans cannot use this as the base type for their boolean.
|
||||
*
|
||||
* Tokens defined in khrplatform.h:
|
||||
*
|
||||
* KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values.
|
||||
*
|
||||
* KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0.
|
||||
* KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0.
|
||||
*
|
||||
* Calling convention macros defined in this file:
|
||||
* KHRONOS_APICALL
|
||||
* KHRONOS_APIENTRY
|
||||
* KHRONOS_APIATTRIBUTES
|
||||
*
|
||||
* These may be used in function prototypes as:
|
||||
*
|
||||
* KHRONOS_APICALL void KHRONOS_APIENTRY funcname(
|
||||
* int arg1,
|
||||
* int arg2) KHRONOS_APIATTRIBUTES;
|
||||
*/
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Definition of KHRONOS_APICALL
|
||||
*-------------------------------------------------------------------------
|
||||
* This precedes the return type of the function in the function prototype.
|
||||
*/
|
||||
#if defined(_WIN32) && !defined(__SCITECH_SNAP__)
|
||||
# define KHRONOS_APICALL __declspec(dllimport)
|
||||
#elif defined (__SYMBIAN32__)
|
||||
# define KHRONOS_APICALL IMPORT_C
|
||||
#elif defined(__ANDROID__)
|
||||
# include <sys/cdefs.h>
|
||||
# define KHRONOS_APICALL __attribute__((visibility("default"))) __NDK_FPABI__
|
||||
#else
|
||||
# define KHRONOS_APICALL
|
||||
#endif
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Definition of KHRONOS_APIENTRY
|
||||
*-------------------------------------------------------------------------
|
||||
* This follows the return type of the function and precedes the function
|
||||
* name in the function prototype.
|
||||
*/
|
||||
#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__)
|
||||
/* Win32 but not WinCE */
|
||||
# define KHRONOS_APIENTRY __stdcall
|
||||
#else
|
||||
# define KHRONOS_APIENTRY
|
||||
#endif
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Definition of KHRONOS_APIATTRIBUTES
|
||||
*-------------------------------------------------------------------------
|
||||
* This follows the closing parenthesis of the function prototype arguments.
|
||||
*/
|
||||
#if defined (__ARMCC_2__)
|
||||
#define KHRONOS_APIATTRIBUTES __softfp
|
||||
#else
|
||||
#define KHRONOS_APIATTRIBUTES
|
||||
#endif
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* basic type definitions
|
||||
*-----------------------------------------------------------------------*/
|
||||
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__)
|
||||
|
||||
|
||||
/*
|
||||
* Using <stdint.h>
|
||||
*/
|
||||
#include <stdint.h>
|
||||
typedef int32_t khronos_int32_t;
|
||||
typedef uint32_t khronos_uint32_t;
|
||||
typedef int64_t khronos_int64_t;
|
||||
typedef uint64_t khronos_uint64_t;
|
||||
#define KHRONOS_SUPPORT_INT64 1
|
||||
#define KHRONOS_SUPPORT_FLOAT 1
|
||||
|
||||
#elif defined(__VMS ) || defined(__sgi)
|
||||
|
||||
/*
|
||||
* Using <inttypes.h>
|
||||
*/
|
||||
#include <inttypes.h>
|
||||
typedef int32_t khronos_int32_t;
|
||||
typedef uint32_t khronos_uint32_t;
|
||||
typedef int64_t khronos_int64_t;
|
||||
typedef uint64_t khronos_uint64_t;
|
||||
#define KHRONOS_SUPPORT_INT64 1
|
||||
#define KHRONOS_SUPPORT_FLOAT 1
|
||||
|
||||
#elif defined(_WIN32) && !defined(__SCITECH_SNAP__)
|
||||
|
||||
/*
|
||||
* Win32
|
||||
*/
|
||||
typedef __int32 khronos_int32_t;
|
||||
typedef unsigned __int32 khronos_uint32_t;
|
||||
typedef __int64 khronos_int64_t;
|
||||
typedef unsigned __int64 khronos_uint64_t;
|
||||
#define KHRONOS_SUPPORT_INT64 1
|
||||
#define KHRONOS_SUPPORT_FLOAT 1
|
||||
|
||||
#elif defined(__sun__) || defined(__digital__)
|
||||
|
||||
/*
|
||||
* Sun or Digital
|
||||
*/
|
||||
typedef int khronos_int32_t;
|
||||
typedef unsigned int khronos_uint32_t;
|
||||
#if defined(__arch64__) || defined(_LP64)
|
||||
typedef long int khronos_int64_t;
|
||||
typedef unsigned long int khronos_uint64_t;
|
||||
#else
|
||||
typedef long long int khronos_int64_t;
|
||||
typedef unsigned long long int khronos_uint64_t;
|
||||
#endif /* __arch64__ */
|
||||
#define KHRONOS_SUPPORT_INT64 1
|
||||
#define KHRONOS_SUPPORT_FLOAT 1
|
||||
|
||||
#elif 0
|
||||
|
||||
/*
|
||||
* Hypothetical platform with no float or int64 support
|
||||
*/
|
||||
typedef int khronos_int32_t;
|
||||
typedef unsigned int khronos_uint32_t;
|
||||
#define KHRONOS_SUPPORT_INT64 0
|
||||
#define KHRONOS_SUPPORT_FLOAT 0
|
||||
|
||||
#else
|
||||
|
||||
/*
|
||||
* Generic fallback
|
||||
*/
|
||||
#include <stdint.h>
|
||||
typedef int32_t khronos_int32_t;
|
||||
typedef uint32_t khronos_uint32_t;
|
||||
typedef int64_t khronos_int64_t;
|
||||
typedef uint64_t khronos_uint64_t;
|
||||
#define KHRONOS_SUPPORT_INT64 1
|
||||
#define KHRONOS_SUPPORT_FLOAT 1
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Types that are (so far) the same on all platforms
|
||||
*/
|
||||
typedef signed char khronos_int8_t;
|
||||
typedef unsigned char khronos_uint8_t;
|
||||
typedef signed short int khronos_int16_t;
|
||||
typedef unsigned short int khronos_uint16_t;
|
||||
|
||||
/*
|
||||
* Types that differ between LLP64 and LP64 architectures - in LLP64,
|
||||
* pointers are 64 bits, but 'long' is still 32 bits. Win64 appears
|
||||
* to be the only LLP64 architecture in current use.
|
||||
*/
|
||||
#ifdef _WIN64
|
||||
typedef signed long long int khronos_intptr_t;
|
||||
typedef unsigned long long int khronos_uintptr_t;
|
||||
typedef signed long long int khronos_ssize_t;
|
||||
typedef unsigned long long int khronos_usize_t;
|
||||
#else
|
||||
typedef signed long int khronos_intptr_t;
|
||||
typedef unsigned long int khronos_uintptr_t;
|
||||
typedef signed long int khronos_ssize_t;
|
||||
typedef unsigned long int khronos_usize_t;
|
||||
#endif
|
||||
|
||||
#if KHRONOS_SUPPORT_FLOAT
|
||||
/*
|
||||
* Float type
|
||||
*/
|
||||
typedef float khronos_float_t;
|
||||
#endif
|
||||
|
||||
#if KHRONOS_SUPPORT_INT64
|
||||
/* Time types
|
||||
*
|
||||
* These types can be used to represent a time interval in nanoseconds or
|
||||
* an absolute Unadjusted System Time. Unadjusted System Time is the number
|
||||
* of nanoseconds since some arbitrary system event (e.g. since the last
|
||||
* time the system booted). The Unadjusted System Time is an unsigned
|
||||
* 64 bit value that wraps back to 0 every 584 years. Time intervals
|
||||
* may be either signed or unsigned.
|
||||
*/
|
||||
typedef khronos_uint64_t khronos_utime_nanoseconds_t;
|
||||
typedef khronos_int64_t khronos_stime_nanoseconds_t;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Dummy value used to pad enum types to 32 bits.
|
||||
*/
|
||||
#ifndef KHRONOS_MAX_ENUM
|
||||
#define KHRONOS_MAX_ENUM 0x7FFFFFFF
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Enumerated boolean type
|
||||
*
|
||||
* Values other than zero should be considered to be true. Therefore
|
||||
* comparisons should not be made against KHRONOS_TRUE.
|
||||
*/
|
||||
typedef enum {
|
||||
KHRONOS_FALSE = 0,
|
||||
KHRONOS_TRUE = 1,
|
||||
KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM
|
||||
} khronos_boolean_enum_t;
|
||||
|
||||
#endif /* __khrplatform_h_ */
|
Reference in New Issue
Block a user