[evas_gl_thread] change mode of glTexImage2D to 'finish mode' in case of GLES1.1 64/128664/2
authorJoogab Yun <joogab.yun@samsung.com>
Thu, 11 May 2017 03:57:54 +0000 (12:57 +0900)
committerjoogab yun <joogab.yun@samsung.com>
Mon, 15 May 2017 00:57:34 +0000 (00:57 +0000)
Change-Id: Iafa9a886b3d5abbf9b41bea1c57ec50f0645de94

src/modules/evas/engines/gl_common/evas_gl_core.c
src/modules/evas/engines/gl_common/evas_gl_thread_gl.c

index e8a891a..3ee7e8d 100644 (file)
@@ -247,7 +247,7 @@ _texture_create(GLuint *tex)
 
 // Create and allocate 2D texture
 static void
-_texture_allocate_2d(GLuint tex, GLint ifmt, GLenum fmt, GLenum type, int w, int h)
+_texture_allocate_2d(GLuint tex, GLint ifmt, GLenum fmt, GLenum type, int w, int h, int version)
 {
    //if (!(*tex))
    //   glGenTextures(1, tex);
@@ -260,6 +260,9 @@ _texture_allocate_2d(GLuint tex, GLint ifmt, GLenum fmt, GLenum type, int w, int
    glTexParameteri_evgl_thread_cmd(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
    glTexParameteri_evgl_thread_cmd(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
    glTexParameteri_evgl_thread_cmd(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+   if (version == EVAS_GL_GLES_1_X)
+     glTexImage2DEVAS_evgl_thread_cmd(1, GL_TEXTURE_2D, 0, ifmt, w, h, 0, fmt, type, NULL);
+   else
    glTexImage2D_evgl_thread_cmd(GL_TEXTURE_2D, 0, ifmt, w, h, 0, fmt, type, NULL);
    glBindTexture_evgl_thread_cmd(GL_TEXTURE_2D, (GLuint)curr_tex);
 }
@@ -558,7 +561,7 @@ _fbo_surface_cap_test(GLint color_ifmt, GLenum color_fmt,
    if ((color_ifmt) && (color_fmt))
      {
         _texture_create(&color_buf);
-        _texture_allocate_2d(color_buf, color_ifmt, color_fmt, GL_UNSIGNED_BYTE, w, h);
+        _texture_allocate_2d(color_buf, color_ifmt, color_fmt, GL_UNSIGNED_BYTE, w, h, EVAS_GL_GLES_2_X);
         _texture_attach_2d(color_buf, GL_COLOR_ATTACHMENT0, 0, mult_samples, EVAS_GL_GLES_2_X);
      }
 
@@ -568,7 +571,7 @@ _fbo_surface_cap_test(GLint color_ifmt, GLenum color_fmt,
      {
         _texture_create(&depth_stencil_buf);
         _texture_allocate_2d(depth_stencil_buf, depth_fmt,
-                           depth_fmt, GL_UNSIGNED_INT_24_8_OES, w, h);
+                           depth_fmt, GL_UNSIGNED_INT_24_8_OES, w, h, EVAS_GL_GLES_2_X);
         _texture_attach_2d(depth_stencil_buf, GL_DEPTH_ATTACHMENT,
                            GL_STENCIL_ATTACHMENT, mult_samples, EVAS_GL_GLES_2_X);
         depth_stencil = 1;
@@ -1350,7 +1353,7 @@ _surface_buffers_allocate(void *eng_data EINA_UNUSED, EVGL_Surface *sfc, int w,
    if (sfc->color_fmt)
      {
         _texture_allocate_2d(sfc->color_buf, sfc->color_ifmt, sfc->color_fmt,
-                             GL_UNSIGNED_BYTE, w, h);
+                             GL_UNSIGNED_BYTE, w, h, version);
         if (sfc->egl_image)
           {
              _egl_image_destroy(sfc->egl_image);
@@ -1372,13 +1375,13 @@ _surface_buffers_allocate(void *eng_data EINA_UNUSED, EVGL_Surface *sfc, int w,
                {
                   _texture_allocate_2d(sfc->depth_stencil_buf, GL_DEPTH24_STENCIL8_OES,
                      sfc->depth_stencil_fmt, GL_UNSIGNED_INT_24_8_OES,
-                     w, h);
+                     w, h, version);
                }
              else
                {
                   _texture_allocate_2d(sfc->depth_stencil_buf, sfc->depth_stencil_fmt,
                      sfc->depth_stencil_fmt, GL_UNSIGNED_INT_24_8_OES,
-                     w, h);
+                     w, h, version);
                }
           }
         else
index b5b20f2..b4feeb3 100644 (file)
@@ -328,6 +328,60 @@ get_size(GLenum format, GLenum type)
 #include "evas_gl_thread_evgl_api_generated.c"
 
 EAPI void
+glTexImage2DEVAS_evgl_thread_cmd(int finish_mode, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels)
+{
+   if (!evas_evgl_thread_enabled())
+     {
+        glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
+        return;
+     }
+
+   int thread_mode = EVAS_GL_THREAD_MODE_FINISH;
+
+   EVGL_Thread_Command_glTexImage2D thread_data_local;
+   EVGL_Thread_Command_glTexImage2D *thread_data = &thread_data_local;
+
+   /* command_allocated flag init. */
+   thread_data->command_allocated = 0;
+
+   if (!evas_gl_thread_force_finish() && !finish_mode)
+     { /* _flush */
+        EVGL_Thread_Command_glTexImage2D *thread_data_new;
+        thread_data_new = eina_mempool_malloc(_mp_command,
+                                              sizeof(EVGL_Thread_Command_glTexImage2D));
+        if (thread_data_new)
+          {
+             thread_data = thread_data_new;
+             thread_data->command_allocated = 1;
+             thread_mode = EVAS_GL_THREAD_MODE_FLUSH;
+          }
+     }
+
+   thread_data->target = target;
+   thread_data->level = level;
+   thread_data->internalformat = internalformat;
+   thread_data->width = width;
+   thread_data->height = height;
+   thread_data->border = border;
+   thread_data->format = format;
+   thread_data->type = type;
+   thread_data->pixels = pixels;
+
+   GLTEXIMAGE2D_COPY_VARIABLE_INIT; /* TODO */
+
+   if (thread_mode == EVAS_GL_THREAD_MODE_FINISH)
+     goto finish;
+
+   GLTEXIMAGE2D_COPY_TO_MEMPOOL; /* TODO */
+
+finish:
+   evas_gl_thread_cmd_enqueue(EVAS_GL_THREAD_TYPE_EVGL,
+                              _evgl_thread_glTexImage2D,
+                              thread_data,
+                              thread_mode);
+}
+
+EAPI void
 glTexSubImage2DEVAS_thread_cmd(int thread_push, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels)
 {
    if (!evas_gl_thread_enabled())
@@ -397,6 +451,7 @@ finish:
 #include "evas_gl_thread_gl_link_generated.c"
 #include "evas_gl_thread_evgl_link_generated.c"
 
+void (*glTexImage2DEVAS_evgl_thread_cmd)(int finish_mode, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels) = NULL;
 void (*glTexSubImage2DEVAS_thread_cmd)(int thread_push, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels) = NULL;
 
 void