diff options
author | Michal Krol <michal@vmware.com> | 2010-02-15 21:33:22 +0100 |
---|---|---|
committer | Michal Krol <michal@vmware.com> | 2010-02-15 21:33:22 +0100 |
commit | ee67167358e91e9ffde8aa9e5b96e5def4c16904 (patch) | |
tree | 79f0fff02f5d476999a781e6fbe050e313ba1cdf /src/glsl/pp/sl_pp_context.h | |
parent | b90f265fbfc5ada2dde401e003c7c294dbeb15d7 (diff) |
glsl/pp: Fix handling of if/elif/else cases.
Once if/elif evalutes to true, all subsequent conditions are always false.
Diffstat (limited to 'src/glsl/pp/sl_pp_context.h')
-rw-r--r-- | src/glsl/pp/sl_pp_context.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/glsl/pp/sl_pp_context.h b/src/glsl/pp/sl_pp_context.h index 983a09c02a..b5419bc056 100644 --- a/src/glsl/pp/sl_pp_context.h +++ b/src/glsl/pp/sl_pp_context.h @@ -53,6 +53,15 @@ struct sl_pp_predefined { int value; }; +union sl_pp_if_state { + struct { + unsigned int condition:1; + unsigned int went_thru_else:1; + unsigned int had_true_cond:1; + } u; + unsigned int value; +}; + struct sl_pp_context { char *cstr_pool; unsigned int cstr_pool_max; @@ -68,7 +77,7 @@ struct sl_pp_context { struct sl_pp_predefined predefined[SL_PP_MAX_PREDEFINED]; unsigned int num_predefined; - unsigned int if_stack[SL_PP_MAX_IF_NESTING]; + union sl_pp_if_state if_stack[SL_PP_MAX_IF_NESTING]; unsigned int if_ptr; unsigned int if_value; |