void *data;
} func;
unsigned char yinvert : 1;
+ unsigned char loose : 1;
} native;
unsigned char dirty : 1;
void evas_gl_common_rect_draw(Evas_GL_Context *gc, int x, int y, int w, int h);
Evas_GL_Texture *evas_gl_common_texture_new(Evas_GL_Context *gc, RGBA_Image *im);
-Evas_GL_Texture *evas_gl_common_texture_native_new(Evas_GL_Context *gc, int w, int h, int alpha);
+Evas_GL_Texture *evas_gl_common_texture_native_new(Evas_GL_Context *gc, int w, int h, int alpha, Evas_GL_Image *im);
Evas_GL_Texture *evas_gl_common_texture_render_new(Evas_GL_Context *gc, int w, int h, int alpha);
void evas_gl_common_texture_update(Evas_GL_Texture *tex, RGBA_Image *im);
void evas_gl_common_texture_free(Evas_GL_Texture *tex);
if (gc->shader.cur_tex != gc->shader.current.cur_tex)
{
+ if (gc->shader.cur_tex) glEnable(GL_TEXTURE_2D);
+ else glDisable(GL_TEXTURE_2D);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, gc->shader.cur_tex);
}
}
if (gc->shader.blend != gc->shader.current.blend)
{
- if (gc->shader.blend)
- glEnable(GL_BLEND);
- else
- glDisable(GL_BLEND);
+ if (gc->shader.blend) glEnable(GL_BLEND);
+ else glDisable(GL_BLEND);
}
if (gc->shader.smooth != gc->shader.current.smooth)
{
if (gc->array.im->native.func.unbind)
gc->array.im->native.func.unbind(gc->array.im->native.func.data,
gc->array.im);
+/*
+ gc->shader.cur_tex = 0;
+ glBindTexture(GL_TEXTURE_2D, gc->shader.cur_tex);
+ if (gc->shader.cur_tex) glEnable(GL_TEXTURE_2D);
+ else glDisable(GL_TEXTURE_2D);
+ */
}
gc->shader.current.cur_prog = gc->shader.cur_prog;
}
im->cs.space = EVAS_COLORSPACE_ARGB8888;
- im->tex = evas_gl_common_texture_native_new(im->gc, im->w, im->h, im->alpha);
+ im->tex = evas_gl_common_texture_native_new(im->gc, im->w, im->h, im->alpha, im);
im->tex_only = 1;
}
}
static Evas_GL_Texture_Pool *
-_pool_tex_native_new(Evas_GL_Context *gc, int w, int h, int intformat, int format)
+_pool_tex_native_new(Evas_GL_Context *gc, int w, int h, int intformat, int format, Evas_GL_Image *im)
{
Evas_GL_Texture_Pool *pt;
// is this really needed for gl-es?
// glTexImage2D(GL_TEXTURE_2D, 0, intformat, w, h, 0, format,
// GL_UNSIGNED_BYTE, 0);
+#else
+ if (im->native.loose)
+ {
+ if (im->native.func.bind)
+ im->native.func.bind(im->native.func.data, im);
+ }
#endif
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(GL_TEXTURE_2D, 0);
glBindTexture(GL_TEXTURE_2D, gc->shader.cur_tex);
return pt;
}
}
Evas_GL_Texture *
-evas_gl_common_texture_native_new(Evas_GL_Context *gc, int w, int h, int alpha)
+evas_gl_common_texture_native_new(Evas_GL_Context *gc, int w, int h, int alpha, Evas_GL_Image *im)
{
Evas_GL_Texture *tex;
Eina_List *l_after = NULL;
tex->references = 1;
tex->alpha = alpha;
if (alpha)
- tex->pt = _pool_tex_native_new(gc, w, h, rgba_ifmt, rgba_fmt);
+ tex->pt = _pool_tex_native_new(gc, w, h, rgba_ifmt, rgba_fmt, im);
else
- tex->pt = _pool_tex_native_new(gc, w, h, rgb_ifmt, rgb_fmt);
+ tex->pt = _pool_tex_native_new(gc, w, h, rgb_ifmt, rgb_fmt, im);
if (!tex->pt)
{
free(tex);
#endif
};
+// FIXME: this is enabled so updates happen - but its SLOOOOOOOOOOOOOOOW
+// (i am sure this is the reason) not to mention seemingly superfluous. but
+// i need to enable it for it to work on fglrx at least. havent tried nvidia.
+//
+// why is this the case? does anyone know? has anyone tried it on other gfx
+// drivers?
+//
+//#define GLX_TEX_PIXMAP_RECREATE 1
+
static void
_native_bind_cb(void *data, void *image)
{
# ifdef GLX_BIND_TO_TEXTURE_TARGETS_EXT
if (glsym_glXBindTexImage)
{
+#ifdef GLX_TEX_PIXMAP_RECREATE
const int pixmap_att[] =
{
GLX_TEXTURE_TARGET_EXT,
n->glx_pixmap = glXCreatePixmap(re->win->disp, n->fbc,
n->pixmap, pixmap_att);
- glsym_glXBindTexImage(re->win->disp, n->glx_pixmap,
- GLX_FRONT_LEFT_EXT, NULL);
+#endif
+ if (!im->native.loose)
+ glsym_glXBindTexImage(re->win->disp, n->glx_pixmap,
+ GLX_FRONT_LEFT_EXT, NULL);
}
# endif
#endif
# ifdef GLX_BIND_TO_TEXTURE_TARGETS_EXT
if (glsym_glXReleaseTexImage)
{
- glsym_glXReleaseTexImage(re->win->disp, n->glx_pixmap,
- GLX_FRONT_LEFT_EXT);
+ if (!im->native.loose)
+ glsym_glXReleaseTexImage(re->win->disp, n->glx_pixmap,
+ GLX_FRONT_LEFT_EXT);
+#ifdef GLX_TEX_PIXMAP_RECREATE
glXDestroyPixmap(re->win->disp, n->glx_pixmap);
n->glx_pixmap = 0;
+#endif
}
# endif
#endif
# ifdef GLX_BIND_TO_TEXTURE_TARGETS_EXT
if (n->glx_pixmap)
{
- glsym_glXReleaseTexImage(re->win->disp, n->glx_pixmap,
- GLX_FRONT_LEFT_EXT);
+ if (im->native.loose)
+ {
+ if (glsym_glXReleaseTexImage)
+ glsym_glXReleaseTexImage(re->win->disp, n->glx_pixmap,
+ GLX_FRONT_LEFT_EXT);
+ }
glXDestroyPixmap(re->win->disp, n->glx_pixmap);
n->glx_pixmap = 0;
}
eglChooseConfig(re->win->egl_disp, config_attrs,
&egl_config, 1, &num_config);
- n->egl_surface = eglCreatePixmapSurface(re->win->egl_disp,
- egl_config, pm,
- NULL);
- evas_gl_common_image_native_enable(im);
n->pixmap = pm;
n->visual = vis;
im->native.yinvert = 1;
+ im->native.loose = 0;
im->native.data = n;
im->native.func.data = re;
im->native.func.bind = _native_bind_cb;
im->native.func.unbind = _native_unbind_cb;
im->native.func.free = _native_free_cb;
+ n->egl_surface = eglCreatePixmapSurface(re->win->egl_disp,
+ egl_config, pm,
+ NULL);
+ evas_gl_common_image_native_enable(im);
}
}
#else
n = calloc(1, sizeof(Native));
if (n)
{
- evas_gl_common_image_native_enable(im);
+#ifndef GLX_TEX_PIXMAP_RECREATE
+ const int pixmap_att[] =
+ {
+ GLX_TEXTURE_TARGET_EXT,
+ GLX_TEXTURE_2D_EXT,
+ GLX_TEXTURE_FORMAT_EXT,
+ GLX_TEXTURE_FORMAT_RGBA_EXT,
+ 0
+ };
+#endif
memcpy(&(n->ns), ns, sizeof(Evas_Native_Surface));
n->pixmap = pm;
n->visual = vis;
memcpy(&(n->fbc), fbc, sizeof(GLXFBConfig));
n->fbc = *fbc;
im->native.yinvert = yinvert;
+ im->native.loose = 0;
im->native.data = n;
im->native.func.data = re;
im->native.func.bind = _native_bind_cb;
im->native.func.unbind = _native_unbind_cb;
im->native.func.free = _native_free_cb;
+#ifndef GLX_TEX_PIXMAP_RECREATE
+ n->glx_pixmap = glXCreatePixmap(re->win->disp, n->fbc,
+ n->pixmap, pixmap_att);
+#endif
+ evas_gl_common_image_native_enable(im);
}
}
}
}
// GLX
#else
-
-#if 1
if (!context)
context = glXCreateContext(disp, gw->visualinfo, NULL, GL_TRUE);
gw->context = context;
-#else
- gw->context = glXCreateContext(disp, gw->visualinfo, context, GL_TRUE);
- if (!context) context = gw->context;
-#endif
glXMakeCurrent(gw->disp, gw->win, gw->context);
#endif