summaryrefslogtreecommitdiff
path: root/GLESv2/yagl_glsl_state.c
diff options
context:
space:
mode:
Diffstat (limited to 'GLESv2/yagl_glsl_state.c')
-rw-r--r--GLESv2/yagl_glsl_state.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/GLESv2/yagl_glsl_state.c b/GLESv2/yagl_glsl_state.c
index a60785d..a9a74db 100644
--- a/GLESv2/yagl_glsl_state.c
+++ b/GLESv2/yagl_glsl_state.c
@@ -67,7 +67,7 @@ const int glsl_pp_op_prio[] = {
11, // yagl_glsl_pp_op_bit_not
11, // yagl_glsl_pp_op_negative
11, // yagl_glsl_pp_op_positive
- 11, // yagl_glsl_pp_op_defined
+ 12, // yagl_glsl_pp_op_defined
0, // yagl_glsl_pp_op_par_open - lowest priority because of special handling
0, // yagl_glsl_pp_op_par_close - lowest priority because of special handling
};
@@ -665,7 +665,7 @@ void yagl_glsl_state_pp_condition_parse_add_op(struct yagl_glsl_state *state, ya
}
// move higher or equal priority operations to expression stack
- while (state->pp_current_op > 0 &&
+ while (state->pp_current_op > 0 && state->pp_current_expr > 0 &&
glsl_pp_op_prio[op] <= glsl_pp_op_prio[state->pp_ops[state->pp_current_op - 1]]) {
assert(state->pp_current_expr < YAGL_GLSL_PP_EXPRESSION_STACK_SIZE);
state->pp_current_op--;
@@ -834,7 +834,7 @@ yagl_glsl_pp_condition_status yagl_glsl_state_pp_condition_resolve(struct yagl_g
assert(state->pp_condition_parse_started);
// empty op stack into expression stack
- while (state->pp_current_op > 0) {
+ while (state->pp_current_op > 0 && state->pp_current_expr > 0) {
assert(state->pp_current_expr < YAGL_GLSL_PP_EXPRESSION_STACK_SIZE);
state->pp_current_op--;
state->pp_exprs[state->pp_current_expr].op = state->pp_ops[state->pp_current_op];