forked from enlightenment/efl
be paranoid about gl context - reset it to "0" every frame.
SVN revision: 49065
This commit is contained in:
parent
6eabef2077
commit
8cc1f752d0
|
@ -139,7 +139,7 @@ struct _Evas_GL_Context
|
||||||
Eina_Bool clip : 1;
|
Eina_Bool clip : 1;
|
||||||
struct {
|
struct {
|
||||||
GLuint cur_prog;
|
GLuint cur_prog;
|
||||||
GLuint cur_tex, cur_texum, cur_texv;
|
GLuint cur_tex, cur_texu, cur_texv;
|
||||||
int render_op;
|
int render_op;
|
||||||
int cx, cy, cw, ch;
|
int cx, cy, cw, ch;
|
||||||
Eina_Bool smooth : 1;
|
Eina_Bool smooth : 1;
|
||||||
|
@ -286,6 +286,7 @@ void glerr(int err, const char *file, const char *func, int line, const char *op
|
||||||
Evas_GL_Context *evas_gl_common_context_new(void);
|
Evas_GL_Context *evas_gl_common_context_new(void);
|
||||||
void evas_gl_common_context_free(Evas_GL_Context *gc);
|
void evas_gl_common_context_free(Evas_GL_Context *gc);
|
||||||
void evas_gl_common_context_use(Evas_GL_Context *gc);
|
void evas_gl_common_context_use(Evas_GL_Context *gc);
|
||||||
|
void evas_gl_common_context_newframe(Evas_GL_Context *gc);
|
||||||
void evas_gl_common_context_resize(Evas_GL_Context *gc, int w, int h, int rot);
|
void evas_gl_common_context_resize(Evas_GL_Context *gc, int w, int h, int rot);
|
||||||
void evas_gl_common_context_target_surface_set(Evas_GL_Context *gc, Evas_GL_Image *surface);
|
void evas_gl_common_context_target_surface_set(Evas_GL_Context *gc, Evas_GL_Image *surface);
|
||||||
|
|
||||||
|
|
|
@ -369,6 +369,8 @@ evas_gl_common_context_new(void)
|
||||||
|
|
||||||
_evas_gl_common_context = gc;
|
_evas_gl_common_context = gc;
|
||||||
|
|
||||||
|
gc->shader.render_op = EVAS_RENDER_BLEND;
|
||||||
|
|
||||||
if (!shared)
|
if (!shared)
|
||||||
{
|
{
|
||||||
GLint linked;
|
GLint linked;
|
||||||
|
@ -597,11 +599,96 @@ evas_gl_common_context_free(Evas_GL_Context *gc)
|
||||||
void
|
void
|
||||||
evas_gl_common_context_use(Evas_GL_Context *gc)
|
evas_gl_common_context_use(Evas_GL_Context *gc)
|
||||||
{
|
{
|
||||||
// if (_evas_gl_common_context == gc) return;
|
if (_evas_gl_common_context == gc) return;
|
||||||
_evas_gl_common_context = gc;
|
_evas_gl_common_context = gc;
|
||||||
_evas_gl_common_viewport_set(gc);
|
_evas_gl_common_viewport_set(gc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
evas_gl_common_context_newframe(Evas_GL_Context *gc)
|
||||||
|
{
|
||||||
|
gc->clip.x = 0;
|
||||||
|
gc->clip.y = 0;
|
||||||
|
gc->clip.w = 0;
|
||||||
|
gc->clip.h = 0;
|
||||||
|
gc->clip.active = 0;
|
||||||
|
gc->shader.surface = NULL;
|
||||||
|
gc->shader.cur_prog = 0;
|
||||||
|
gc->shader.cur_tex = 0;
|
||||||
|
gc->shader.cur_texu = 0;
|
||||||
|
gc->shader.cur_texv = 0;
|
||||||
|
gc->shader.render_op = EVAS_RENDER_BLEND;
|
||||||
|
gc->shader.cx = 0;
|
||||||
|
gc->shader.cy = 0;
|
||||||
|
gc->shader.cw = 0;
|
||||||
|
gc->shader.ch = 0;
|
||||||
|
gc->shader.smooth = 0;
|
||||||
|
gc->shader.blend = 0;
|
||||||
|
gc->shader.clip = 0;
|
||||||
|
gc->shader.current.cur_prog = 0;
|
||||||
|
gc->shader.current.cur_tex = 0;
|
||||||
|
gc->shader.current.cur_texu = 0;
|
||||||
|
gc->shader.current.cur_texv = 0;
|
||||||
|
gc->shader.current.render_op = 0;
|
||||||
|
gc->shader.current.cx = 0;
|
||||||
|
gc->shader.current.cy = 0;
|
||||||
|
gc->shader.current.cw = 0;
|
||||||
|
gc->shader.current.ch = 0;
|
||||||
|
gc->shader.current.smooth = 0;
|
||||||
|
gc->shader.current.blend = 0;
|
||||||
|
gc->shader.current.clip = 0;
|
||||||
|
gc->change.size = 1;
|
||||||
|
|
||||||
|
glDisable(GL_SCISSOR_TEST);
|
||||||
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
||||||
|
glScissor(0, 0, 0, 0);
|
||||||
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
||||||
|
|
||||||
|
glDisable(GL_DEPTH_TEST);
|
||||||
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
||||||
|
glEnable(GL_DITHER);
|
||||||
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
||||||
|
glDisable(GL_BLEND);
|
||||||
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
||||||
|
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
||||||
|
// no dest alpha
|
||||||
|
// glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // dest alpha
|
||||||
|
// glBlendFunc(GL_SRC_ALPHA, GL_ONE); // ???
|
||||||
|
glDepthMask(GL_FALSE);
|
||||||
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
||||||
|
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||||
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||||
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||||
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||||
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
||||||
|
#ifdef GL_TEXTURE_MAX_ANISOTROPY_EXT
|
||||||
|
if (shared->info.anisotropic > 0.0)
|
||||||
|
{
|
||||||
|
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.0);
|
||||||
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
glEnableVertexAttribArray(SHAD_VERTEX);
|
||||||
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
||||||
|
glEnableVertexAttribArray(SHAD_COLOR);
|
||||||
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
||||||
|
glUseProgram(gc->shader.cur_prog);
|
||||||
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
||||||
|
|
||||||
|
glActiveTexture(GL_TEXTURE0);
|
||||||
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
||||||
|
glBindTexture(GL_TEXTURE_2D, gc->shader.cur_tex);
|
||||||
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
||||||
|
|
||||||
|
_evas_gl_common_viewport_set(gc);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
evas_gl_common_context_resize(Evas_GL_Context *gc, int w, int h, int rot)
|
evas_gl_common_context_resize(Evas_GL_Context *gc, int w, int h, int rot)
|
||||||
{
|
{
|
||||||
|
|
|
@ -492,9 +492,11 @@ eng_output_redraws_next_update_get(void *data, int *x, int *y, int *w, int *h, i
|
||||||
Render_Engine *re;
|
Render_Engine *re;
|
||||||
|
|
||||||
re = (Render_Engine *)data;
|
re = (Render_Engine *)data;
|
||||||
evas_gl_common_context_flush(re->win->gl_context);
|
|
||||||
/* get the upate rect surface - return engine data as dummy */
|
/* get the upate rect surface - return engine data as dummy */
|
||||||
if (!re->win->draw.redraw) return NULL;
|
if (!re->win->draw.redraw) return NULL;
|
||||||
|
evas_gl_common_context_flush(re->win->gl_context);
|
||||||
|
eng_window_use(re->win);
|
||||||
|
evas_gl_common_context_newframe(re->win->gl_context);
|
||||||
if (x) *x = re->win->draw.x1;
|
if (x) *x = re->win->draw.x1;
|
||||||
if (y) *y = re->win->draw.y1;
|
if (y) *y = re->win->draw.y1;
|
||||||
if (w) *w = re->win->draw.x2 - re->win->draw.x1 + 1;
|
if (w) *w = re->win->draw.x2 - re->win->draw.x1 + 1;
|
||||||
|
|
Loading…
Reference in New Issue