summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVasiliy Ulyanov <v.ulyanov@samsung.com>2016-05-26 13:12:03 +0300
committerVasiliy Ulyanov <v.ulyanov@samsung.com>2016-05-26 15:20:30 +0300
commitba1628f473045ec0f30bd617de57c6a90aeef5bf (patch)
tree87b6f84b1565326f26a67c7b8f0a2c2891931ad8
parent3ebe62f47fa1e765c633425403bb6915ce87b89d (diff)
downloademulator-yagl-ba1628f473045ec0f30bd617de57c6a90aeef5bf.tar.gz
emulator-yagl-ba1628f473045ec0f30bd617de57c6a90aeef5bf.tar.bz2
emulator-yagl-ba1628f473045ec0f30bd617de57c6a90aeef5bf.zip
The former external sampler hadnling did not work correctly with statements like bellow: #define SamplerType samplerExternalOES Using a #define construct in the header for samplerExternalOES seems more appropriate rather than substituing every occurrence. Change-Id: If1c654046ad78011a5148013889f5dc93882a6a9 Signed-off-by: Vasiliy Ulyanov <v.ulyanov@samsung.com>
-rw-r--r--GLESv2/yagl_glsl_lexer.l6
-rw-r--r--GLESv2/yagl_glsl_parser.y6
-rw-r--r--GLESv2/yagl_glsl_state.c8
-rw-r--r--GLESv2/yagl_glsl_state.h2
4 files changed, 9 insertions, 13 deletions
diff --git a/GLESv2/yagl_glsl_lexer.l b/GLESv2/yagl_glsl_lexer.l
index fdca03e..b3508d6 100644
--- a/GLESv2/yagl_glsl_lexer.l
+++ b/GLESv2/yagl_glsl_lexer.l
@@ -193,12 +193,6 @@ STRING [^ \r\t\v\f\n()\[\]{},;?:/%*&|^!+\-=<>\.]+
return TOK_GLFRAGCOLOR;
}
-"samplerExternalOES" {
- struct yagl_glsl_state *state = yagl_glsl_lexer_get_extra(yyscanner);
- yagl_glsl_state_new_str_token(state, yylval, yytext);
- return TOK_SAMPLEREXTERNALOES;
-}
-
{PRECISION} {
struct yagl_glsl_state *state = yagl_glsl_lexer_get_extra(yyscanner);
yagl_glsl_state_new_str_token(state, yylval, yytext);
diff --git a/GLESv2/yagl_glsl_parser.y b/GLESv2/yagl_glsl_parser.y
index 93049a7..9f71e0f 100644
--- a/GLESv2/yagl_glsl_parser.y
+++ b/GLESv2/yagl_glsl_parser.y
@@ -69,7 +69,6 @@ static int yagl_glsl_lex(union YYSTYPE *val, struct yagl_glsl_state *state)
%token <str> TOK_TEXTURECUBE
%token <str> TOK_TEXTURECUBELOD
%token <str> TOK_GLFRAGCOLOR
-%token <str> TOK_SAMPLEREXTERNALOES
%%
@@ -591,9 +590,4 @@ expression
yagl_glsl_state_append_output(state, $1.value);
}
}
-| TOK_SAMPLEREXTERNALOES
-{
- yagl_glsl_state_flush_pending(state, $1.index);
- yagl_glsl_state_append_output(state, "sampler2D");
-}
;
diff --git a/GLESv2/yagl_glsl_state.c b/GLESv2/yagl_glsl_state.c
index 6934c54..eaebb59 100644
--- a/GLESv2/yagl_glsl_state.c
+++ b/GLESv2/yagl_glsl_state.c
@@ -43,13 +43,15 @@ static void yagl_glsl_state_flush_version(struct yagl_glsl_state *state)
{
int have_version = state->have_version;
int have_extensions = state->have_extensions;
+ int have_samplerexternaloes = state->have_samplerexternaloes;
- if (have_version && have_extensions) {
+ if (have_version && have_extensions && have_samplerexternaloes) {
return;
}
state->have_version = 1;
state->have_extensions = 1;
+ state->have_samplerexternaloes = 1;
if (!have_version) {
switch (state->patch_version) {
@@ -76,6 +78,10 @@ static void yagl_glsl_state_flush_version(struct yagl_glsl_state *state)
break;
}
}
+
+ if(!have_samplerexternaloes) {
+ yagl_glsl_state_append_header(state, "#define samplerExternalOES sampler2D\n\n");
+ }
}
static void yagl_glsl_state_move_pending(struct yagl_glsl_state *state)
diff --git a/GLESv2/yagl_glsl_state.h b/GLESv2/yagl_glsl_state.h
index 606a547..d371d10 100644
--- a/GLESv2/yagl_glsl_state.h
+++ b/GLESv2/yagl_glsl_state.h
@@ -86,6 +86,8 @@ struct yagl_glsl_state
int have_extensions;
+ int have_samplerexternaloes;
+
int frag_color_declared;
int texture1d_declared;
int texture1dproj_declared;