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);
45 resolve_glGenQueries (void)
47 fips_dispatch_glGenQueries = fips_dispatch_lookup ("glGenQueries");
49 if (! fips_dispatch_glGenQueries)
50 fips_dispatch_glGenQueries = fips_dispatch_lookup ("glGenQueriesARB");
52 if (! fips_dispatch_glGenQueries)
53 unsupported ("GenQueries");
57 stub_glGenQueries (GLsizei n, GLuint *ids)
60 resolve_glGenQueries ();
61 fips_dispatch_glGenQueries (n, ids);
64 PFNGLGENQUERIESPROC fips_dispatch_glGenQueries = stub_glGenQueries;
67 resolve_glDeleteQueries (void)
69 fips_dispatch_glDeleteQueries = fips_dispatch_lookup ("glDeleteQueries");
71 if (! fips_dispatch_glDeleteQueries)
72 fips_dispatch_glDeleteQueries = fips_dispatch_lookup ("glDeleteQueriesARB");
74 if (! fips_dispatch_glDeleteQueries)
75 unsupported ("DeleteQueries");
79 stub_glDeleteQueries (GLsizei n, const GLuint * ids)
82 resolve_glDeleteQueries ();
83 fips_dispatch_glDeleteQueries (n, ids);
86 PFNGLDELETEQUERIESPROC fips_dispatch_glDeleteQueries = stub_glDeleteQueries;
89 resolve_glBeginQuery (void)
91 fips_dispatch_glBeginQuery = fips_dispatch_lookup ("glBeginQuery");
93 if (! fips_dispatch_glBeginQuery)
94 fips_dispatch_glBeginQuery = fips_dispatch_lookup ("glBeginQueryARB");
96 if (! fips_dispatch_glBeginQuery)
97 unsupported ("BeginQuery");
101 stub_glBeginQuery (GLenum target, GLuint id)
103 check_initialized ();
104 resolve_glBeginQuery ();
105 fips_dispatch_glBeginQuery (target, id);
108 PFNGLBEGINQUERYPROC fips_dispatch_glBeginQuery = stub_glBeginQuery;
111 resolve_glEndQuery (void)
113 fips_dispatch_glEndQuery = fips_dispatch_lookup ("glEndQuery");
115 if (! fips_dispatch_glEndQuery)
116 fips_dispatch_glEndQuery = fips_dispatch_lookup ("glEndQueryARB");
118 if (! fips_dispatch_glEndQuery)
119 unsupported ("EndQuery");
123 stub_glEndQuery (GLenum target)
125 check_initialized ();
126 resolve_glEndQuery ();
127 fips_dispatch_glEndQuery (target);
130 PFNGLENDQUERYPROC fips_dispatch_glEndQuery = stub_glEndQuery;
133 resolve_glGetQueryObjectuiv (void)
135 fips_dispatch_glGetQueryObjectuiv = (PFNGLGETQUERYOBJECTUIVPROC) fips_dispatch_lookup ("glGetQueryObjectuivARB");
137 if (! fips_dispatch_glGetQueryObjectuiv)
138 unsupported ("GetQueryObjectuiv");
142 stub_glGetQueryObjectuiv (GLuint id, GLenum pname, GLuint * params)
144 check_initialized ();
145 resolve_glGetQueryObjectuiv ();
146 fips_dispatch_glGetQueryObjectuiv (id, pname, params);
149 PFNGLGETQUERYOBJECTUIVPROC fips_dispatch_glGetQueryObjectuiv = stub_glGetQueryObjectuiv;