summaryrefslogtreecommitdiff
path: root/src/glsl/pp/sl_pp_macro.c
diff options
context:
space:
mode:
authorMichal Krol <michal@vmware.com>2009-12-10 12:58:21 +0100
committerMichal Krol <michal@vmware.com>2009-12-10 12:58:21 +0100
commit22200bcafcc77ecdca0127ac72d68e75e2ad7aee (patch)
treeb5fa3b278cda2f036bcff291cd86b4377ebcb379 /src/glsl/pp/sl_pp_macro.c
parentd1a09a9ba4a56067cc41e87d00fd7c395f0e7345 (diff)
glsl/pp: Add support for user-defined macros.
Diffstat (limited to 'src/glsl/pp/sl_pp_macro.c')
-rw-r--r--src/glsl/pp/sl_pp_macro.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/glsl/pp/sl_pp_macro.c b/src/glsl/pp/sl_pp_macro.c
index 05466c9a7c..08b44c7cbe 100644
--- a/src/glsl/pp/sl_pp_macro.c
+++ b/src/glsl/pp/sl_pp_macro.c
@@ -163,6 +163,23 @@ sl_pp_macro_expand(struct sl_pp_context *context,
return 0;
}
+ for (j = 0; j < context->num_predefined; j++) {
+ if (macro_name == context->predefined[j].name) {
+ if (!mute) {
+ struct sl_pp_token_info ti;
+
+ ti.token = SL_PP_UINT;
+ ti.data._uint = context->predefined[j].value;
+ if (sl_pp_process_out(state, &ti)) {
+ strcpy(context->error_msg, "out of memory");
+ return -1;
+ }
+ }
+ (*pi)++;
+ return 0;
+ }
+ }
+
/* Replace extension names with 1.
*/
for (j = 0; j < context->num_extensions; j++) {