1 /* Copyright © 2012, Intel Corporation
3 * Permission is hereby granted, free of charge, to any person obtaining a copy
4 * of this software and associated documentation files (the "Software"), to deal
5 * in the Software without restriction, including without limitation the rights
6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 * copies of the Software, and to permit persons to whom the Software is
8 * furnished to do so, subject to the following conditions:
10 * The above copyright notice and this permission notice shall be included in
11 * all copies or substantial portions of the Software.
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 #include "fips-dispatch-gl.h"
25 check_initialized (void)
27 if (fips_dispatch_initialized)
31 "Internal error: fips_dispatch_init must be called before\n"
32 "any OpenGL function supported via fips_dispatch.\n");
37 unsupported (const char *name)
39 fprintf (stderr, "Error: fips failed to find support for %s\n", name);
44 #define resolve(dispatch, name) \
45 dispatch = fips_dispatch_lookup (name); \
49 #define resolve2(dispatch, name_a, name_b) \
50 dispatch = fips_dispatch_lookup (name_a); \
52 dispatch = fips_dispatch_lookup (name_b); \
57 stub_glGenQueries (GLsizei n, GLuint *ids)
60 resolve2 (fips_dispatch_glGenQueries,
61 "glGenQueries", "glGenQueriesARB")
62 fips_dispatch_glGenQueries (n, ids);
65 PFNGLGENQUERIESPROC fips_dispatch_glGenQueries = stub_glGenQueries;
68 stub_glDeleteQueries (GLsizei n, const GLuint * ids)
71 resolve2 (fips_dispatch_glDeleteQueries,
72 "glDeleteQueries", "glDeleteQueriesARB");
73 fips_dispatch_glDeleteQueries (n, ids);
76 PFNGLDELETEQUERIESPROC fips_dispatch_glDeleteQueries = stub_glDeleteQueries;
79 stub_glBeginQuery (GLenum target, GLuint id)
82 resolve2 (fips_dispatch_glBeginQuery,
83 "glBeginQuery", "glBeginQueryARB");
84 fips_dispatch_glBeginQuery (target, id);
87 PFNGLBEGINQUERYPROC fips_dispatch_glBeginQuery = stub_glBeginQuery;
90 stub_glEndQuery (GLenum target)
93 resolve2 (fips_dispatch_glEndQuery, "glEndQuery", "glEndQueryARB");
94 fips_dispatch_glEndQuery (target);
97 PFNGLENDQUERYPROC fips_dispatch_glEndQuery = stub_glEndQuery;
100 stub_glGetQueryObjectuiv (GLuint id, GLenum pname, GLuint * params)
102 check_initialized ();
103 resolve2 (fips_dispatch_glGetQueryObjectuiv,
104 "glGetQueryObjectuiv", "glGetQueryObjectuivARB");
105 fips_dispatch_glGetQueryObjectuiv (id, pname, params);
108 PFNGLGETQUERYOBJECTUIVPROC fips_dispatch_glGetQueryObjectuiv =
109 stub_glGetQueryObjectuiv;