Revert "[evas-gl] change dyn.target & delete api" 32/82932/2
authorsunghyun kim <scholb.kim@samsung.com>
Mon, 8 Aug 2016 07:51:32 +0000 (00:51 -0700)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Mon, 8 Aug 2016 08:00:24 +0000 (01:00 -0700)
This reverts commit a1cb67bdb9007b58c9b506989a3aacf640b36c53.

Change-Id: I95e64920dab5cdd9283dea717bf6e2993988f9ad

src/modules/evas/engines/gl_common/evas_gl_common.h
src/modules/evas/engines/gl_common/evas_gl_context.c
src/modules/evas/engines/gl_common/evas_gl_texture.c

index 922a899..9461b8f 100755 (executable)
@@ -687,6 +687,9 @@ Evas_GL_Polygon  *evas_gl_common_poly_point_add(Evas_GL_Polygon *poly, int x, in
 Evas_GL_Polygon  *evas_gl_common_poly_points_clear(Evas_GL_Polygon *poly);
 void              evas_gl_common_poly_draw(Evas_Engine_GL_Context *gc, Evas_GL_Polygon *poly, int x, int y);
 
+void              evas_gl_common_texture_shared_specific(Evas_Engine_GL_Context *gc, Evas_GL_Texture_Pool *pt, int i);
+void              evas_gl_common_texture_shared_back(Evas_Engine_GL_Context *gc, Evas_GL_Texture_Pool *pt);
+
 void              evas_gl_common_line_draw(Evas_Engine_GL_Context *gc, int x1, int y1, int x2, int y2);
 
 extern void       (*glsym_glGenFramebuffers)      (GLsizei a, GLuint *b);
index 41cd657..1e8c4a1 100644 (file)
@@ -1151,7 +1151,7 @@ evas_gl_common_context_newframe(Evas_Engine_GL_Context *gc)
      glUseProgram(gc->state.current.prog->prog);
 
    glActiveTexture(GL_TEXTURE0);
-   glBindTexture(gc->pipe[0].shader.tex_target, gc->pipe[0].shader.cur_tex);
+   evas_gl_common_texture_shared_back(gc, NULL);
 
    _evas_gl_common_viewport_set(gc,1);
 }
@@ -3176,7 +3176,7 @@ shader_array_flush(Evas_Engine_GL_Context *gc)
                }
 #endif
              glActiveTexture(GL_TEXTURE0);
-             glBindTexture(gc->pipe[i].shader.tex_target, gc->pipe[i].shader.cur_tex);
+             evas_gl_common_texture_shared_specific(gc, NULL, i);
           }
         if (gc->pipe[i].array.im)
           {
index 3f88a9d..c2d3d8d 100755 (executable)
@@ -161,6 +161,31 @@ _evas_gl_texture_search_format(Eina_Bool alpha, Eina_Bool bgra, Evas_Colorspace
    return -1;
 }
 
+void
+evas_gl_common_texture_shared_specific(Evas_Engine_GL_Context *gc, Evas_GL_Texture_Pool *pt, int i)
+{
+   if (!pt || pt->texture != gc->pipe[i].shader.cur_tex)
+     {
+        if (gc->pipe[i].array.im)
+          {
+             if (gc->pipe[i].array.im->tex->pt->dyn.img)
+               gc->pipe[i].shader.tex_target = gc->pipe[i].array.im->tex->pt->dyn.target;
+             else
+               gc->pipe[i].shader.tex_target = gc->pipe[i].array.im->native.target;
+          }
+        else
+          gc->pipe[i].shader.tex_target = GL_TEXTURE_2D;
+
+        glBindTexture(gc->pipe[i].shader.tex_target, gc->pipe[i].shader.cur_tex);
+     }
+}
+
+void
+evas_gl_common_texture_shared_back(Evas_Engine_GL_Context *gc, Evas_GL_Texture_Pool *pt)
+{
+   evas_gl_common_texture_shared_specific(gc, pt, 0);
+}
+
 static void
 _print_tex_count(void)
 {
@@ -746,7 +771,10 @@ _pool_tex_dynamic_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, i
 
    _print_tex_count();
 
-   pt->dyn.target = GL_TEXTURE_2D;
+   if (gc->shared->info.sec_tbm_surface)
+     pt->dyn.target = GL_TEXTURE_EXTERNAL_OES;
+   else
+     pt->dyn.target = GL_TEXTURE_2D;
 
    glGenTextures(1, &(pt->texture));
    glBindTexture(pt->dyn.target, pt->texture);