gc->state.current.cur_texv = 0;
gc->state.current.cur_texa = 0;
gc->state.current.cur_texm = 0;
+ gc->state.current.tex_target = GL_TEXTURE_2D;
gc->state.current.render_op = 0;
gc->state.current.smooth = 0;
gc->state.current.blend = 0;
gc->pipe[i].shader.cur_texv = 0;
gc->pipe[i].shader.cur_texa = 0;
gc->pipe[i].shader.cur_texm = 0;
+ gc->pipe[i].shader.tex_target = GL_TEXTURE_2D;
gc->pipe[i].shader.render_op = EVAS_RENDER_BLEND;
gc->pipe[i].shader.smooth = 0;
gc->pipe[i].shader.blend = 0;
glUseProgram(gc->state.current.prog->prog);
glActiveTexture(GL_TEXTURE0);
- glBindTexture(GL_TEXTURE_2D, gc->pipe[0].shader.cur_tex);
+ glBindTexture(gc->pipe[0].shader.tex_target, gc->pipe[0].shader.cur_tex);
_evas_gl_common_viewport_set(gc);
}
gc->state.current.cur_texv = 0;
gc->state.current.cur_texa = 0;
gc->state.current.cur_texm = 0;
+ gc->state.current.tex_target = GL_TEXTURE_2D;
gc->state.current.render_op = -1;
gc->state.current.smooth = -1;
gc->state.current.blend = -1;
Shader_Sampling sam = 0, masksam = 0;
int yinvert = 0;
Shader_Type shd_in = SHD_IMAGE;
+ int tex_target = GL_TEXTURE_2D;
- if ((tex->im) && (tex->im->native.data))
- shd_in = SHD_IMAGENATIVE;
+ if (tex->im)
+ {
+ if (tex->im->native.data)
+ shd_in = SHD_IMAGENATIVE;
+ if (tex->im->native.target == GL_TEXTURE_EXTERNAL_OES)
+ tex_target = GL_TEXTURE_EXTERNAL_OES;
+ }
if (!!mtex)
{
gc->pipe[pn].shader.prog = prog;
gc->pipe[pn].shader.cur_tex = pt->texture;
gc->pipe[pn].shader.cur_texm = mtex ? mtex->pt->texture : 0;
+ gc->pipe[pn].shader.tex_target = tex_target;
gc->pipe[pn].shader.smooth = smooth;
gc->pipe[pn].shader.mask_smooth = mask_smooth;
gc->pipe[pn].shader.blend = blend;
}
#endif
glActiveTexture(GL_TEXTURE0);
- glBindTexture(GL_TEXTURE_2D, gc->pipe[i].shader.cur_tex);
+ glBindTexture(gc->pipe[i].shader.tex_target, gc->pipe[i].shader.cur_tex);
}
if (gc->pipe[i].array.im)
{
if (gc->pipe[i].array.im->tex->pt->dyn.img)
{
secsym_glEGLImageTargetTexture2DOES
- (GL_TEXTURE_2D, gc->pipe[i].array.im->tex->pt->dyn.img);
+ (gc->pipe[i].array.im->tex->pt->dyn.target, gc->pipe[i].array.im->tex->pt->dyn.img);
}
else
#endif
gc->state.current.cur_texa = gc->pipe[i].shader.cur_texa;
gc->state.current.cur_texu = gc->pipe[i].shader.cur_texu;
gc->state.current.cur_texv = gc->pipe[i].shader.cur_texv;
+ gc->state.current.tex_target = gc->pipe[i].shader.tex_target;
gc->state.current.render_op = gc->pipe[i].shader.render_op;
// gc->state.current.cx = gc->pipe[i].shader.cx;
// gc->state.current.cy = gc->pipe[i].shader.cy;
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
ok = _tex_2d(gc, pt->intformat, w, h, pt->format, pt->dataformat);
- glBindTexture(GL_TEXTURE_2D, gc->state.current.cur_tex);
+ glBindTexture(gc->state.current.tex_target, gc->state.current.cur_tex);
if (!ok)
{
glDeleteTextures(1, &(pt->texture));
}
glsym_glBindFramebuffer(GL_FRAMEBUFFER, fnum);
- glBindTexture(GL_TEXTURE_2D, gc->state.current.cur_tex);
+ glBindTexture(gc->state.current.tex_target, gc->state.current.cur_tex);
if (!ok)
{
glTexParameteri(im->native.target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(im->native.target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glBindTexture(im->native.target, 0);
- glBindTexture(im->native.target, gc->state.current.cur_tex);
+ glBindTexture(gc->state.current.tex_target, gc->state.current.cur_tex);
texinfo.n.num++;
texinfo.n.pix += pt->w * pt->h;
_print_tex_count();
+ pt->dyn.target = GL_TEXTURE_2D;
+
glGenTextures(1, &(pt->texture));
- glBindTexture(GL_TEXTURE_2D, pt->texture);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+ glBindTexture(pt->dyn.target, pt->texture);
+ glTexParameteri(pt->dyn.target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ glTexParameteri(pt->dyn.target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ glTexParameteri(pt->dyn.target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ glTexParameteri(pt->dyn.target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
egldisplay = pt->gc->egldisp;
{
tbm_format buffer_format = TBM_FORMAT_RGBA8888;
tbm_surface_info_s info;
- int attr[] =
- {
- EGL_IMAGE_PRESERVED_KHR, EGL_TRUE,
- EGL_NONE,
- };
switch (intformat)
{
pt->dyn.img = secsym_eglCreateImage(egldisplay,
EGL_NO_CONTEXT,
EGL_NATIVE_SURFACE_TIZEN,
- pt->dyn.buffer, attr);
+ pt->dyn.buffer, NULL);
if (!pt->dyn.img)
{
secsym_tbm_surface_destroy(pt->dyn.buffer);
goto error;
}
- glBindTexture(GL_TEXTURE_2D, gc->state.current.cur_tex);
+ glBindTexture(gc->state.current.tex_target, gc->state.current.cur_tex);
#else
if (gc + w + h + intformat + format) return pt;
#endif
secsym_eglDestroyImage(egldisplay, pt->dyn.img);
pt->dyn.img = NULL;
}
- glBindTexture(GL_TEXTURE_2D, 0);
+ glBindTexture(pt->dyn.target, 0);
glDeleteTextures(1, &(pt->texture));
if (pt->eina_pool)
eina_rectangle_pool_free(pt->eina_pool);
}
//glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
if (tex->pt->texture != tex->gc->state.current.cur_tex)
- glBindTexture(GL_TEXTURE_2D, tex->gc->state.current.cur_tex);
+ glBindTexture(tex->gc->state.current.tex_target, tex->gc->state.current.cur_tex);
}
void
if (tex->pt->texture != tex->gc->state.current.cur_tex)
{
- glBindTexture(GL_TEXTURE_2D, tex->gc->state.current.cur_tex);
+ glBindTexture(tex->gc->state.current.tex_target, tex->gc->state.current.cur_tex);
}
return;
}
// Switch back to current texture
if (tex->ptt->texture != tex->gc->state.current.cur_tex)
- glBindTexture(GL_TEXTURE_2D, tex->gc->state.current.cur_tex);
+ glBindTexture(tex->gc->state.current.tex_target, tex->gc->state.current.cur_tex);
// Now prepare uploading the main texture before returning;
async = malloc(sizeof (Evas_GL_Texture_Async_Preload));
_tex_sub_2d(tex->gc, tex->x, tex->y, w, h, tex->pt->format,
tex->pt->dataformat, pixels);
if (tex->pt->texture != tex->gc->state.current.cur_tex)
- glBindTexture(GL_TEXTURE_2D, tex->gc->state.current.cur_tex);
+ glBindTexture(tex->gc->state.current.tex_target, tex->gc->state.current.cur_tex);
}
Evas_GL_Texture *
}
}
on_error:
- glBindTexture(GL_TEXTURE_2D, tex->gc->state.current.cur_tex);
+ glBindTexture(tex->gc->state.current.tex_target, tex->gc->state.current.cur_tex);
}
Evas_GL_Texture *
}
}
if (tex->pt->texture != tex->gc->state.current.cur_tex)
- glBindTexture(GL_TEXTURE_2D, tex->gc->state.current.cur_tex);
+ glBindTexture(tex->gc->state.current.tex_target, tex->gc->state.current.cur_tex);
}
static Evas_GL_Texture *
}
if (tex->pt->texture != tex->gc->state.current.cur_tex)
- glBindTexture(GL_TEXTURE_2D, tex->gc->state.current.cur_tex);
+ glBindTexture(tex->gc->state.current.tex_target, tex->gc->state.current.cur_tex);
}
void
}
}
if (tex->pt->texture != tex->gc->state.current.cur_tex)
- glBindTexture(GL_TEXTURE_2D, tex->gc->state.current.cur_tex);
+ glBindTexture(tex->gc->state.current.tex_target, tex->gc->state.current.cur_tex);
}
void
{
if (glsym_glEGLImageTargetTexture2DOES)
{
- glsym_glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, n->surface);
+ glsym_glEGLImageTargetTexture2DOES(im->native.target, n->surface);
GLERRV("glsym_glEGLImageTargetTexture2DOES");
}
else
}
else if (n->ns.type == EVAS_NATIVE_SURFACE_OPENGL)
{
- glBindTexture(GL_TEXTURE_2D, n->ns.data.opengl.texture_id);
+ glBindTexture(im->native.target, n->ns.data.opengl.texture_id);
}
else if (n->ns.type == EVAS_NATIVE_SURFACE_TBM)
{
{
if (glsym_glEGLImageTargetTexture2DOES)
{
- glsym_glEGLImageTargetTexture2DOES(GL_TEXTURE_EXTERNAL_OES, n->surface);
+ glsym_glEGLImageTargetTexture2DOES(im->native.target, n->surface);
GLERRV("glsym_glEGLImageTargetTexture2DOES");
}
else
#ifdef GL_GLES
if (glsym_glEGLImageTargetTexture2DOES)
{
- glsym_glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, buffer);
+ glsym_glEGLImageTargetTexture2DOES(im->native.target, buffer);
GLERRV("glsym_glEGLImageTargetTexture2DOES");
}
else
}
else if (n->ns.type == EVAS_NATIVE_SURFACE_OPENGL)
{
- glBindTexture(GL_TEXTURE_2D, 0);
+ glBindTexture(im->native.target, 0);
}
else if (n->ns.type == EVAS_NATIVE_SURFACE_TBM)
{