summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/mesa/main/context.h1
-rw-r--r--src/mesa/main/extensions.c23
-rw-r--r--src/mesa/main/extensions.h42
3 files changed, 44 insertions, 22 deletions
diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h
index 1e7a12c8a84..4798b1f9b43 100644
--- a/src/mesa/main/context.h
+++ b/src/mesa/main/context.h
@@ -50,6 +50,7 @@
#include "imports.h"
+#include "extensions.h"
#include "mtypes.h"
#include "vbo/vbo.h"
diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index c7609bea0f0..7ef79e58963 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -42,27 +42,6 @@ struct gl_extensions _mesa_extension_override_disables;
static char *extra_extensions = NULL;
static char *cant_disable_extensions = NULL;
-/**
- * \brief An element of the \c extension_table.
- */
-struct extension {
- /** Name of extension, such as "GL_ARB_depth_clamp". */
- const char *name;
-
- /** Offset (in bytes) of the corresponding member in struct gl_extensions. */
- size_t offset;
-
- /** Minimum version the extension requires for the given API
- * (see gl_api defined in mtypes.h). The value is equal to:
- * 10 * major_version + minor_version
- */
- uint8_t version[API_OPENGL_LAST + 1];
-
- /** Year the extension was proposed or approved. Used to sort the
- * extension string chronologically. */
- uint16_t year;
-};
-
/**
* Given a member \c x of struct gl_extensions, return offset of
@@ -74,7 +53,7 @@ struct extension {
/**
* \brief Table of supported OpenGL extensions for all API's.
*/
-static const struct extension extension_table[] = {
+const struct extension extension_table[] = {
#define EXT(name_str, driver_cap, gll_ver, glc_ver, gles_ver, gles2_ver, yyyy) \
{ .name = "GL_" #name_str, .offset = o(driver_cap), \
.version = { \
diff --git a/src/mesa/main/extensions.h b/src/mesa/main/extensions.h
index 595512a5d5c..6092eca36e7 100644
--- a/src/mesa/main/extensions.h
+++ b/src/mesa/main/extensions.h
@@ -55,6 +55,48 @@ _mesa_get_extension_count(struct gl_context *ctx);
extern const GLubyte *
_mesa_get_enabled_extension(struct gl_context *ctx, GLuint index);
+
+/**
+ * \brief An element of the \c extension_table.
+ */
+struct extension {
+ /** Name of extension, such as "GL_ARB_depth_clamp". */
+ const char *name;
+
+ /** Offset (in bytes) of the corresponding member in struct gl_extensions. */
+ size_t offset;
+
+ /** Minimum version the extension requires for the given API
+ * (see gl_api defined in mtypes.h). The value is equal to:
+ * 10 * major_version + minor_version
+ */
+ uint8_t version[API_OPENGL_LAST + 1];
+
+ /** Year the extension was proposed or approved. Used to sort the
+ * extension string chronologically. */
+ uint16_t year;
+} extern const extension_table[];
+
+
+/* Generate enums for the functions below */
+enum {
+#define EXT(name_str, ...) MESA_EXTENSION_##name_str,
+#include "extensions_table.h"
+#undef EXT
+};
+
+
+/** Checks if the context suports a user-facing extension */
+#define EXT(name_str, driver_cap, ...) \
+static inline bool \
+_mesa_has_##name_str(const struct gl_context *ctx) \
+{ \
+ return ctx->Extensions.driver_cap && (ctx->Version >= \
+ extension_table[MESA_EXTENSION_##name_str].version[ctx->API]); \
+}
+#include "extensions_table.h"
+#undef EXT
+
extern struct gl_extensions _mesa_extension_override_enables;
extern struct gl_extensions _mesa_extension_override_disables;