summaryrefslogtreecommitdiff
path: root/GLESv2
diff options
context:
space:
mode:
authorVasiliy Ulyanov <v.ulyanov@samsung.com>2016-02-01 18:32:47 +0300
committerVasiliy Ulyanov <v.ulyanov@samsung.com>2016-05-24 14:34:36 +0300
commitd98c8ec78b523aec19bab5a1125fbe0ca7939e32 (patch)
tree35998751ed4d9e317b0024c67ed80fafed0b88f6 /GLESv2
parent917838c32271ac715870c17c4bced682c432e965 (diff)
downloademulator-yagl-d98c8ec78b523aec19bab5a1125fbe0ca7939e32.tar.gz
emulator-yagl-d98c8ec78b523aec19bab5a1125fbe0ca7939e32.tar.bz2
emulator-yagl-d98c8ec78b523aec19bab5a1125fbe0ca7939e32.zip
YaGL: Implement GL_OES_EGL_image_external extension
Currently external textures are handled as 2d textures since host will unlikely recognize GL_TEXTURE_EXTERNAL_OES as a valid target. The same applies to GLSL (i.e. sampler2D is used instead of samplerExternalOES). Color conversion is performed in software and it is done when glEGLImageTargetTexture2DOES function is called. It is an initial implementation and at the moment it is not fully conformant. Change-Id: I6a781d1062a2f5373e8ff507a5279c58ed29b042 Signed-off-by: Vasiliy Ulyanov <v.ulyanov@samsung.com>
Diffstat (limited to 'GLESv2')
-rw-r--r--GLESv2/yagl_gles2_context.c2
-rw-r--r--GLESv2/yagl_glsl_lexer.l6
-rw-r--r--GLESv2/yagl_glsl_parser.y6
3 files changed, 14 insertions, 0 deletions
diff --git a/GLESv2/yagl_gles2_context.c b/GLESv2/yagl_gles2_context.c
index f9591e2..0949ccf 100644
--- a/GLESv2/yagl_gles2_context.c
+++ b/GLESv2/yagl_gles2_context.c
@@ -67,6 +67,7 @@
#define GL_VERTEX_ATTRIB_ARRAY_INTEGER 0x88FD
static const GLchar *egl_image_ext = "GL_OES_EGL_image";
+static const GLchar *egl_image_external_ext = "GL_OES_EGL_image_external";
static const GLchar *depth24_ext = "GL_OES_depth24";
static const GLchar *depth32_ext = "GL_OES_depth32";
static const GLchar *texture_float_ext = "GL_OES_texture_float";
@@ -343,6 +344,7 @@ const GLchar **yagl_gles2_context_get_extensions(struct yagl_gles2_context *ctx,
extensions = yagl_malloc(100 * sizeof(*extensions));
extensions[i++] = egl_image_ext;
+ extensions[i++] = egl_image_external_ext;
extensions[i++] = depth24_ext;
extensions[i++] = depth32_ext;
extensions[i++] = texture_float_ext;
diff --git a/GLESv2/yagl_glsl_lexer.l b/GLESv2/yagl_glsl_lexer.l
index b3508d6..fdca03e 100644
--- a/GLESv2/yagl_glsl_lexer.l
+++ b/GLESv2/yagl_glsl_lexer.l
@@ -193,6 +193,12 @@ 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 9f71e0f..93049a7 100644
--- a/GLESv2/yagl_glsl_parser.y
+++ b/GLESv2/yagl_glsl_parser.y
@@ -69,6 +69,7 @@ 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
%%
@@ -590,4 +591,9 @@ 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");
+}
;