#define SL_PP_MAX_PREDEFINED 16
+enum sl_pp_extension_state {
+ SL_PP_EXTENSION_STATE_ENABLED,
+ SL_PP_EXTENSION_STATE_DISABLED,
+ SL_PP_EXTENSION_STATE_WARN,
+ SL_PP_EXTENSION_STATE_REQUIRE
+};
+
struct sl_pp_extension {
int name; /*< GL_VENDOR_extension_name */
- int enabled;
+ enum sl_pp_extension_state state;
};
struct sl_pp_predefined {
return -1;
}
- ext.enabled = 0;
+ ext.state = SL_PP_EXTENSION_STATE_DISABLED;
context->extensions[context->num_extensions++] = ext;
return 0;
}
+
+enum sl_pp_extension_state
+sl_pp_get_extension_state(const struct sl_pp_context *context,
+ int extension_name)
+{
+ unsigned i;
+
+ for (i = 0; i < context->num_extensions; i++) {
+ if (extension_name == context->extensions[i].name) {
+ return context->extensions[i].state;
+ }
+ }
+
+ assert(0 && "unknown extension");
+ return SL_PP_EXTENSION_STATE_DISABLED;
+}
+
+
/**
* Process a "#extension name: behavior" directive.
*/
if (extension_name != context->dict.all) {
assert(extension);
- extension->enabled = 1;
+ extension->state = SL_PP_EXTENSION_STATE_REQUIRE;
}
} else if (behavior == context->dict.enable) {
if (out.data.extension == -1) {
if (extension_name != context->dict.all) {
assert(extension);
- extension->enabled = 1;
+ extension->state = SL_PP_EXTENSION_STATE_ENABLED;
}
} else if (behavior == context->dict.warn) {
if (out.data.extension == -1) {
if (extension_name != context->dict.all) {
assert(extension);
- extension->enabled = 1;
+ extension->state = SL_PP_EXTENSION_STATE_WARN;
}
} else if (behavior == context->dict.disable) {
if (out.data.extension == -1) {
if (extension_name != context->dict.all) {
assert(extension);
- extension->enabled = 0;
+ extension->state = SL_PP_EXTENSION_STATE_DISABLED;
}
} else {
strcpy(context->error_msg, "unrecognised behavior name");
sl_pp_context_add_extension(struct sl_pp_context *context,
const char *name);
+enum sl_pp_extension_state
+sl_pp_get_extension_state(const struct sl_pp_context *context,
+ int extension_name);
+
int
sl_pp_context_add_predefined(struct sl_pp_context *context,
const char *name,