glx-multithread-texture: Avoid front-buffer rendering.
[piglit.git] / tests / util / piglit-dispatch.h
blobc96f57efffbb38cdf0d2f5b3e000c04cd09a59c5
1 /* Copyright 2012 Intel Corporation
3 * Permission is hereby granted, free of charge, to any person obtaining a
4 * copy of this software and associated documentation files (the "Software"),
5 * to deal in the Software without restriction, including without limitation
6 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 * and/or sell copies of the Software, and to permit persons to whom the
8 * Software is furnished to do so, subject to the following conditions:
10 * The above copyright notice and this permission notice (including the next
11 * paragraph) shall be included in all copies or substantial portions of the
12 * Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 * IN THE SOFTWARE.
23 /** \file piglit-dispatch.h
25 * Dispatch mechanism providing Piglit with access to:
27 * - Enum values defined by OpenGL, GLES, and extensions. The enums
28 * are declared as simple #defines.
30 * - Functions defined by OpenGL, GLES, and extensions. Each function
31 * is represented by a function pointer, which initially points to a
32 * stub function. When the stub function is called, it looks up the
33 * appropriate function in the GL or GLES implementation, and
34 * updates the function pointer to point to it. Then it defers to
35 * that function.
37 * The dispatch mechanism understands function aliases. So, for
38 * example, since glMapBuffer and glMapBufferARB are synonymous, you
39 * may safely call either function. The dispatch mechanism will
40 * transparently map to whichever function the implementation
41 * supports.
43 * You may also translate a function name to a function pointer at run
44 * time by calling piglit_dispatch_resolve_function().
46 * The dispatch mechanism must be initialized before its first use.
47 * The initialization function, piglit_dispatch_init(), allows the
48 * caller to specify which API is in use, how to look up function
49 * pointers, what to do in the event of an error, and what to do if an
50 * unsupported function is requested.
53 #ifndef __piglit_dispatch_h__
54 #define __piglit_dispatch_h__
56 #include <stdint.h>
57 #include <stddef.h>
59 #ifndef _WIN32
61 /* APIENTRY and GLAPIENTRY are not used on Linux or Mac. */
62 #define APIENTRY
63 #define GLAPIENTRY
65 #else /* _WIN32 */
67 #include <windows.h> // APIENTRY
69 #ifndef GLAPIENTRY
70 #define GLAPIENTRY APIENTRY
71 #endif
73 #ifndef GLAPI
74 #define GLAPI extern
75 #endif
77 #endif /* _WIN32 */
79 #ifdef __cplusplus
80 extern "C" {
81 #endif
83 typedef unsigned int GLenum;
84 typedef unsigned int GLbitfield;
85 typedef unsigned int GLuint;
86 typedef int GLint;
87 typedef int GLsizei;
88 typedef int GLfixed;
89 typedef unsigned char GLboolean;
90 typedef signed char GLbyte;
91 typedef short GLshort;
92 typedef unsigned char GLubyte;
93 typedef unsigned short GLushort;
94 typedef unsigned long GLulong;
95 typedef unsigned short GLhalf;
96 typedef float GLfloat;
97 typedef float GLclampf;
98 typedef double GLdouble;
99 typedef double GLclampd;
100 typedef int32_t GLclampx;
101 typedef void GLvoid;
102 typedef int64_t GLint64EXT;
103 typedef uint64_t GLuint64EXT;
104 typedef GLint64EXT GLint64;
105 typedef GLuint64EXT GLuint64;
106 typedef struct __GLsync *GLsync;
108 typedef char GLchar;
110 typedef ptrdiff_t GLintptr;
111 typedef ptrdiff_t GLsizeiptr;
113 typedef ptrdiff_t GLintptrARB;
114 typedef ptrdiff_t GLsizeiptrARB;
116 typedef char GLcharARB;
117 typedef unsigned int GLhandleARB;
119 struct _cl_context;
120 struct _cl_event;
122 typedef GLintptr GLvdpauSurfaceNV;
123 typedef unsigned short GLhalfNV;
125 typedef void *GLeglImageOES;
126 typedef void *GLeglClientBufferEXT;
128 typedef void (APIENTRY *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,GLvoid *userParam);
130 typedef void (APIENTRY *GLDEBUGPROCARB)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,GLvoid *userParam);
132 typedef void (APIENTRY *GLDEBUGPROCAMD)(GLuint id,GLenum category,GLenum severity,GLsizei length,const GLchar *message,GLvoid *userParam);
134 typedef void (APIENTRY *GLDEBUGPROCKHR)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,GLvoid *userParam);
136 typedef void (APIENTRY *GLVULKANPROCNV)(void);
138 typedef void (APIENTRY *piglit_dispatch_function_ptr)(void);
140 typedef piglit_dispatch_function_ptr (*piglit_get_core_proc_address_function_ptr)(const char *, int);
142 typedef piglit_dispatch_function_ptr (*piglit_get_ext_proc_address_function_ptr)(const char *);
144 typedef void (*piglit_error_function_ptr)(const char *);
146 typedef enum {
147 PIGLIT_DISPATCH_GL,
148 PIGLIT_DISPATCH_ES1,
149 PIGLIT_DISPATCH_ES2
150 } piglit_dispatch_api;
152 void piglit_dispatch_init(piglit_dispatch_api api,
153 piglit_get_core_proc_address_function_ptr get_core_proc,
154 piglit_get_ext_proc_address_function_ptr get_ext_proc,
155 piglit_error_function_ptr unsupported_proc,
156 piglit_error_function_ptr failure_proc);
158 piglit_dispatch_function_ptr
159 piglit_dispatch_resolve_function(const char *name);
161 #include "piglit-dispatch-gen.h"
163 void piglit_dispatch_default_init(piglit_dispatch_api api);
165 /* Prevent gl.h from being included, since it will attempt to define
166 * the functions we've already defined.
168 #define __gl_h_
169 #define __gltypes_h_
170 #define __glext_h_
172 #ifdef __cplusplus
173 } /* end extern "C" */
174 #endif
176 #endif /* __piglit_dispatch_h__ */