From 22200bcafcc77ecdca0127ac72d68e75e2ad7aee Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Thu, 10 Dec 2009 12:58:21 +0100 Subject: glsl/pp: Add support for user-defined macros. --- src/glsl/pp/sl_pp_macro.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/glsl/pp/sl_pp_macro.c') 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++) { -- cgit v1.2.3