summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukasz Kostyra <l.kostyra@samsung.com>2021-10-07 10:19:24 +0200
committerLukasz Kostyra <l.kostyra@samsung.com>2021-10-07 10:31:44 +0200
commitb15a556409d4b5155c0154b8c3ef0275e16ae231 (patch)
treebc8b1c45a130db1f42e9162177c4a568e9f75a29
parent65212b82865b89729019b44f427f37e572ae8409 (diff)
downloademulator-yagl-b15a556409d4b5155c0154b8c3ef0275e16ae231.tar.gz
emulator-yagl-b15a556409d4b5155c0154b8c3ef0275e16ae231.tar.bz2
emulator-yagl-b15a556409d4b5155c0154b8c3ef0275e16ae231.zip
When parsing non-array uniforms, there was a possibility that a parsed uniform was not a sampler. Despite that, set_last_sampler_array_count was called, which could trigger an assertion. This fixes boot issues on wearable image, as wearable image EFL was using some shaders exploiting this corner case. Change-Id: Icf3363f6c6622047ecbafa68a68e3bbc385e1471
-rw-r--r--GLESv2/yagl_glsl_parser.y7
-rw-r--r--GLESv2/yagl_glsl_state.c2
2 files changed, 5 insertions, 4 deletions
diff --git a/GLESv2/yagl_glsl_parser.y b/GLESv2/yagl_glsl_parser.y
index 74e5246..8043841 100644
--- a/GLESv2/yagl_glsl_parser.y
+++ b/GLESv2/yagl_glsl_parser.y
@@ -701,11 +701,12 @@ expression
}
yagl_glsl_state_add_sampler_ExternalOES(state, $4.value);
+ yagl_glsl_state_set_last_sampler_array_count(state, 1);
} else if (strcmp(type_resolved, "sampler2D") == 0) {
yagl_glsl_state_add_sampler_2D(state, $4.value);
+ yagl_glsl_state_set_last_sampler_array_count(state, 1);
}
- yagl_glsl_state_set_last_sampler_array_count(state, 1);
free(type_resolved);
}
}
@@ -736,11 +737,12 @@ expression
}
yagl_glsl_state_add_sampler_ExternalOES(state, $3.value);
+ yagl_glsl_state_set_last_sampler_array_count(state, 1);
} else if (strcmp(type_resolved, "sampler2D") == 0) {
yagl_glsl_state_add_sampler_2D(state, $3.value);
+ yagl_glsl_state_set_last_sampler_array_count(state, 1);
}
- yagl_glsl_state_set_last_sampler_array_count(state, 1);
free(type_resolved);
}
}
@@ -772,7 +774,6 @@ expression
state->have_samplerexternaloes = 1;
}
- // TODO add how many samplers are added too - check resolution_value
yagl_glsl_state_add_sampler_ExternalOES(state, $4.value);
yagl_glsl_state_pp_condition_parse_start(state);
} else if (strcmp(type_resolved, "sampler2D") == 0) {
diff --git a/GLESv2/yagl_glsl_state.c b/GLESv2/yagl_glsl_state.c
index 86190ec..72149ab 100644
--- a/GLESv2/yagl_glsl_state.c
+++ b/GLESv2/yagl_glsl_state.c
@@ -840,7 +840,7 @@ yagl_glsl_pp_condition_status yagl_glsl_state_pp_condition_resolve(struct yagl_g
res_cur++;
} else {
if (yagl_glsl_pp_expr_op_is_unary(state->pp_exprs[i].op)) {
- assert(res_cur > 0);
+ assert(res_cur >= 1);
if (!yagl_glsl_state_pp_solve_unary(state, state->pp_exprs[i].op, res_stack[res_cur - 1], &tmp_result)) {
YAGL_LOG_ERROR("Expression #%d: Unary operator %d (%s) failed", i, state->pp_exprs[i].op, glsl_pp_op_dbgstr[state->pp_exprs[i].op]);