evas: Fix invalid current state (invalid bool value)

newframe() resets some of the gl context properties, so match them
to our shadow copy in the gc state.

target_surface_set() also resets some of those properties but only
in our shadow copy, not in the actual GL context. As a consequence
we can't rely on setting a bool to 0 or 1 unless we also call the
equivalent GL function. Expand bitfields to 2 bits allows us to
set a bool to the invalid value of -1 (yes, that's not a real bool).

Also there is no need to reset the target surface to NULL during
newframe. It will be reset during target_surface_set.

This fixes some issues I encounter while working on GL filters.
This commit is contained in:
Jean-Philippe Andre 2017-02-09 11:34:29 +09:00
parent 8e959890e7
commit 2a239c211c
2 changed files with 8 additions and 7 deletions

View File

@ -264,10 +264,10 @@ struct _Evas_Engine_GL_Context
int tex_target;
int cx, cy, cw, ch;
unsigned char render_op;
Eina_Bool smooth : 1;
Eina_Bool blend : 1;
Eina_Bool clip : 1;
Eina_Bool anti_alias : 1;
Eina_Bool smooth : 2;
Eina_Bool blend : 2;
Eina_Bool clip : 2;
Eina_Bool anti_alias : 2;
} current;
} state;

View File

@ -1440,7 +1440,7 @@ evas_gl_common_context_newframe(Evas_Engine_GL_Context *gc)
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.render_op = EVAS_RENDER_COPY;
gc->state.current.smooth = 0;
gc->state.current.blend = 0;
gc->state.current.clip = 0;
@ -1456,7 +1456,7 @@ evas_gl_common_context_newframe(Evas_Engine_GL_Context *gc)
gc->pipe[i].region.w = 0;
gc->pipe[i].region.h = 0;
gc->pipe[i].region.type = 0;
gc->pipe[i].shader.surface = NULL;
//gc->pipe[i].shader.surface = NULL;
gc->pipe[i].shader.prog = NULL;
gc->pipe[i].shader.cur_tex = 0;
gc->pipe[i].shader.cur_texu = 0;
@ -1464,7 +1464,7 @@ evas_gl_common_context_newframe(Evas_Engine_GL_Context *gc)
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.render_op = EVAS_RENDER_COPY;
gc->pipe[i].shader.smooth = 0;
gc->pipe[i].shader.blend = 0;
gc->pipe[i].shader.clip = 0;
@ -1596,6 +1596,7 @@ evas_gl_common_context_target_surface_set(Evas_Engine_GL_Context *gc,
gc->state.current.cy = -1;
gc->state.current.cw = -1;
gc->state.current.ch = -1;
gc->state.current.anti_alias = -1;
gc->pipe[0].shader.surface = surface;
gc->change.size = 1;