16dc85575000127630489b407c50a4b3ea87c9acbKeith Whitwell/**
26dc85575000127630489b407c50a4b3ea87c9acbKeith Whitwell * \file extensions.h
36dc85575000127630489b407c50a4b3ea87c9acbKeith Whitwell * Extension handling.
46dc85575000127630489b407c50a4b3ea87c9acbKeith Whitwell *
56dc85575000127630489b407c50a4b3ea87c9acbKeith Whitwell * \if subset
66dc85575000127630489b407c50a4b3ea87c9acbKeith Whitwell * (No-op)
76dc85575000127630489b407c50a4b3ea87c9acbKeith Whitwell *
86dc85575000127630489b407c50a4b3ea87c9acbKeith Whitwell * \endif
96dc85575000127630489b407c50a4b3ea87c9acbKeith Whitwell */
106dc85575000127630489b407c50a4b3ea87c9acbKeith Whitwell
11afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cJochen Gerlach/*
12afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cJochen Gerlach * Mesa 3-D graphics library
135e3bc0c2a2bcdf59949410f94c9b705fc1281ce8Jouk Jansen *
148d214bc8044e5027e3fa9302b259d0c557270b00Brian Paul * Copyright (C) 1999-2006  Brian Paul   All Rights Reserved.
155e3bc0c2a2bcdf59949410f94c9b705fc1281ce8Jouk Jansen *
16afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cJochen Gerlach * Permission is hereby granted, free of charge, to any person obtaining a
17afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cJochen Gerlach * copy of this software and associated documentation files (the "Software"),
18afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cJochen Gerlach * to deal in the Software without restriction, including without limitation
19afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cJochen Gerlach * the rights to use, copy, modify, merge, publish, distribute, sublicense,
20afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cJochen Gerlach * and/or sell copies of the Software, and to permit persons to whom the
21afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cJochen Gerlach * Software is furnished to do so, subject to the following conditions:
225e3bc0c2a2bcdf59949410f94c9b705fc1281ce8Jouk Jansen *
23afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cJochen Gerlach * The above copyright notice and this permission notice shall be included
24afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cJochen Gerlach * in all copies or substantial portions of the Software.
255e3bc0c2a2bcdf59949410f94c9b705fc1281ce8Jouk Jansen *
26afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cJochen Gerlach * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
27afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cJochen Gerlach * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
28afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cJochen Gerlach * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
293d8d5b298a268b119d840bc9bae0ee9e0c9244a9Kenneth Graunke * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
303d8d5b298a268b119d840bc9bae0ee9e0c9244a9Kenneth Graunke * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
313d8d5b298a268b119d840bc9bae0ee9e0c9244a9Kenneth Graunke * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
323d8d5b298a268b119d840bc9bae0ee9e0c9244a9Kenneth Graunke * OTHER DEALINGS IN THE SOFTWARE.
33afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cJochen Gerlach */
34afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cJochen Gerlach
35afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cJochen Gerlach
36afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cJochen Gerlach#ifndef _EXTENSIONS_H_
37afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cJochen Gerlach#define _EXTENSIONS_H_
38afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cJochen Gerlach
39962967d080a1859bafc843ebdf374bcdfcff9271Vinson Lee#include "glheader.h"
40962967d080a1859bafc843ebdf374bcdfcff9271Vinson Lee
41f93c22109e281ee927c3bb349b94a43fd47ed9adJosé Fonseca#ifdef __cplusplus
42f93c22109e281ee927c3bb349b94a43fd47ed9adJosé Fonsecaextern "C" {
43f93c22109e281ee927c3bb349b94a43fd47ed9adJosé Fonseca#endif
44f93c22109e281ee927c3bb349b94a43fd47ed9adJosé Fonseca
45962967d080a1859bafc843ebdf374bcdfcff9271Vinson Leestruct gl_context;
46f5ca8c19727c76256785e1a9f44da058fdcfe891Jordan Justenstruct gl_extensions;
47afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cJochen Gerlach
48f9995b30756140724f41daf963fa06167912be7fKristian Høgsbergextern void _mesa_enable_sw_extensions(struct gl_context *ctx);
495a9026c65d260dc185e072163999f5d810015108Brian Paul
50f5ca8c19727c76256785e1a9f44da058fdcfe891Jordan Justenextern void _mesa_one_time_init_extension_overrides(void);
51f5ca8c19727c76256785e1a9f44da058fdcfe891Jordan Justen
52858452e54242011d77e4d0364ff05497795c3c4fMarek Olšákextern void _mesa_init_extensions(struct gl_extensions *extentions);
536975540db26309cdfa8f27b3b6dadf3dbf4a1746Brian Paul
54f9995b30756140724f41daf963fa06167912be7fKristian Høgsbergextern GLubyte *_mesa_make_extension_string(struct gl_context *ctx);
55afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cJochen Gerlach
56802b80893943cf129039a37fb2afe26444b09332Brian Paulextern GLuint
57f9995b30756140724f41daf963fa06167912be7fKristian Høgsberg_mesa_get_extension_count(struct gl_context *ctx);
58802b80893943cf129039a37fb2afe26444b09332Brian Paul
5956bdaca03e2289f56d1c88668d0a0f1dbd5abecaBrian Paulextern const GLubyte *
60f9995b30756140724f41daf963fa06167912be7fKristian Høgsberg_mesa_get_enabled_extension(struct gl_context *ctx, GLuint index);
6156bdaca03e2289f56d1c88668d0a0f1dbd5abecaBrian Paul
62ab129a44ae3a7515eb4642c068299673c890fb73Nanley Chery
63ab129a44ae3a7515eb4642c068299673c890fb73Nanley Chery/**
64ab129a44ae3a7515eb4642c068299673c890fb73Nanley Chery * \brief An element of the \c extension_table.
65ab129a44ae3a7515eb4642c068299673c890fb73Nanley Chery */
665645770742d21b0a2ae0fe3ecce135933cd9b4fcNanley Cherystruct mesa_extension {
67ab129a44ae3a7515eb4642c068299673c890fb73Nanley Chery   /** Name of extension, such as "GL_ARB_depth_clamp". */
68ab129a44ae3a7515eb4642c068299673c890fb73Nanley Chery   const char *name;
69ab129a44ae3a7515eb4642c068299673c890fb73Nanley Chery
70ab129a44ae3a7515eb4642c068299673c890fb73Nanley Chery   /** Offset (in bytes) of the corresponding member in struct gl_extensions. */
71ab129a44ae3a7515eb4642c068299673c890fb73Nanley Chery   size_t offset;
72ab129a44ae3a7515eb4642c068299673c890fb73Nanley Chery
73ab129a44ae3a7515eb4642c068299673c890fb73Nanley Chery   /** Minimum version the extension requires for the given API
74ab129a44ae3a7515eb4642c068299673c890fb73Nanley Chery    * (see gl_api defined in mtypes.h). The value is equal to:
75ab129a44ae3a7515eb4642c068299673c890fb73Nanley Chery    * 10 * major_version + minor_version
76ab129a44ae3a7515eb4642c068299673c890fb73Nanley Chery    */
77ab129a44ae3a7515eb4642c068299673c890fb73Nanley Chery   uint8_t version[API_OPENGL_LAST + 1];
78ab129a44ae3a7515eb4642c068299673c890fb73Nanley Chery
79ab129a44ae3a7515eb4642c068299673c890fb73Nanley Chery   /** Year the extension was proposed or approved.  Used to sort the
80ab129a44ae3a7515eb4642c068299673c890fb73Nanley Chery    * extension string chronologically. */
81ab129a44ae3a7515eb4642c068299673c890fb73Nanley Chery   uint16_t year;
822de2e1702b4fab73b1f577fa4a21b7bd0a7040ddBrian Paul};
832de2e1702b4fab73b1f577fa4a21b7bd0a7040ddBrian Paul
842de2e1702b4fab73b1f577fa4a21b7bd0a7040ddBrian Paulextern const struct mesa_extension _mesa_extension_table[];
85ab129a44ae3a7515eb4642c068299673c890fb73Nanley Chery
86ab129a44ae3a7515eb4642c068299673c890fb73Nanley Chery
87ab129a44ae3a7515eb4642c068299673c890fb73Nanley Chery/* Generate enums for the functions below */
88ab129a44ae3a7515eb4642c068299673c890fb73Nanley Cheryenum {
89ab129a44ae3a7515eb4642c068299673c890fb73Nanley Chery#define EXT(name_str, ...) MESA_EXTENSION_##name_str,
90ab129a44ae3a7515eb4642c068299673c890fb73Nanley Chery#include "extensions_table.h"
91ab129a44ae3a7515eb4642c068299673c890fb73Nanley Chery#undef EXT
92e483cb9a3add01dc552bd2a42763aff4be5808fcIlia MirkinMESA_EXTENSION_COUNT
93ab129a44ae3a7515eb4642c068299673c890fb73Nanley Chery};
94ab129a44ae3a7515eb4642c068299673c890fb73Nanley Chery
95ab129a44ae3a7515eb4642c068299673c890fb73Nanley Chery
96f876346cdd2e5d0357ed260eec642beaaa389948Andreas Boll/** Checks if the context supports a user-facing extension */
97ab129a44ae3a7515eb4642c068299673c890fb73Nanley Chery#define EXT(name_str, driver_cap, ...) \
98ab129a44ae3a7515eb4642c068299673c890fb73Nanley Cherystatic inline bool \
99ab129a44ae3a7515eb4642c068299673c890fb73Nanley Chery_mesa_has_##name_str(const struct gl_context *ctx) \
100ab129a44ae3a7515eb4642c068299673c890fb73Nanley Chery{ \
101a16ffb743ced9fde80b2485dfc2d86ae74e86f25Nanley Chery   return ctx->Extensions.driver_cap && (ctx->Extensions.Version >= \
1025645770742d21b0a2ae0fe3ecce135933cd9b4fcNanley Chery          _mesa_extension_table[MESA_EXTENSION_##name_str].version[ctx->API]); \
103ab129a44ae3a7515eb4642c068299673c890fb73Nanley Chery}
104ab129a44ae3a7515eb4642c068299673c890fb73Nanley Chery#include "extensions_table.h"
105ab129a44ae3a7515eb4642c068299673c890fb73Nanley Chery#undef EXT
106ab129a44ae3a7515eb4642c068299673c890fb73Nanley Chery
107f5ca8c19727c76256785e1a9f44da058fdcfe891Jordan Justenextern struct gl_extensions _mesa_extension_override_enables;
108f5ca8c19727c76256785e1a9f44da058fdcfe891Jordan Justenextern struct gl_extensions _mesa_extension_override_disables;
109f5ca8c19727c76256785e1a9f44da058fdcfe891Jordan Justen
110f93c22109e281ee927c3bb349b94a43fd47ed9adJosé Fonseca#ifdef __cplusplus
111f93c22109e281ee927c3bb349b94a43fd47ed9adJosé Fonseca}
112f93c22109e281ee927c3bb349b94a43fd47ed9adJosé Fonseca#endif
113f93c22109e281ee927c3bb349b94a43fd47ed9adJosé Fonseca
114afb833d4e89c312460a4ab9ed6a7a8ca4ebbfe1cJochen Gerlach#endif
115