summaryrefslogtreecommitdiff
path: root/GLESv2/yagl_glsl_state.c
diff options
context:
space:
mode:
authorbyungchul.so <byungchul.so@samsung.com>2022-07-06 12:44:21 +0900
committerbyungchul.so <byungchul.so@samsung.com>2022-07-06 19:09:37 +0900
commit5e6045b893cc337da60d320dfd37777027d4a8c5 (patch)
tree251772208f62ad3ec5252bb113edb7c350ed9cde /GLESv2/yagl_glsl_state.c
parente5cd1eebcaca37b515e6cb52111730d08587e5a2 (diff)
downloademulator-yagl-5e6045b893cc337da60d320dfd37777027d4a8c5.tar.gz
emulator-yagl-5e6045b893cc337da60d320dfd37777027d4a8c5.tar.bz2
emulator-yagl-5e6045b893cc337da60d320dfd37777027d4a8c5.zip
- 'state->pp_current_expr > 0' is added to ensure always 'token' is put on the top of expression stack. - Increase the priority of yagl_glsl_pp_op_defined to ensure yagl_glsl_pp_op_defined is ahead of yagl_glsl_pp_op_not - With this patch, #if !defined(TOKEN) is parsed from ['not', 'token', 'defined'] to ['token', 'defined', 'not']. Change-Id: I8298c9cb2f36dd5412dde270deeaf2101bc5087d
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];