GLuint vert, frag, prog;
int tex_count;
+ Eina_Bool reset;
};
struct _Evas_GL_Program_Source
// persp map
int foc, z0, px, py;
int ax, ay;
+ GLfloat proj[16];
};
typedef enum _Shader_Sampling Shader_Sampling;
struct {
int top_pipe;
struct {
- Evas_GL_Shader id; // debug info
+ Evas_GL_Shader id;
GLuint cur_prog;
GLuint cur_tex, cur_texu, cur_texv, cur_texa, cur_texm;
int render_op;
Eina_Bool active : 1;
} clip;
struct {
- Evas_GL_Shader id; // debug info
+ Evas_GL_Shader id;
Evas_GL_Image *surface;
GLuint cur_prog;
GLuint cur_tex, cur_texu, cur_texv, cur_texa, cur_texm;
static void
_evas_gl_common_viewport_set(Evas_Engine_GL_Context *gc)
{
- GLfloat proj[16];
unsigned int i;
int w = 1, h = 1, m = 1, rot = 1, foc = 0;
glViewport(0, 0, h, w);
// std matrix
if (m == 1)
- matrix_ortho(proj,
+ matrix_ortho(gc->shared->proj,
0, w, 0, h,
-1000000.0, 1000000.0,
rot, w, h,
1, 1.0);
// v flipped matrix for render-to-texture
else
- matrix_ortho(proj,
+ matrix_ortho(gc->shared->proj,
0, w, h, 0,
-1000000.0, 1000000.0,
rot, w, h,
else
glViewport(-2 * vy, -2 * vx, vh, vw);
if (m == 1)
- matrix_ortho(proj, 0, vw, 0, vh,
+ matrix_ortho(gc->shared->proj, 0, vw, 0, vh,
-1000000.0, 1000000.0,
rot, vw, vh,
foc, 0.0);
else
- matrix_ortho(proj, 0, vw, vh, 0,
+ matrix_ortho(gc->shared->proj, 0, vw, vh, 0,
-1000000.0, 1000000.0,
rot, vw, vh,
foc, 0.0);
for (i = 0; i < SHADER_LAST; ++i)
{
- glUseProgram(gc->shared->shader[i].prog);
- glUniformMatrix4fv(glGetUniformLocation(gc->shared->shader[i].prog, "mvp"), 1, GL_FALSE, proj);
+ gc->shared->shader[i].reset = EINA_TRUE;
}
if (gc->state.current.cur_prog == PRG_INVALID)
- glUseProgram(gc->shared->shader[0].prog);
- else glUseProgram(gc->state.current.cur_prog);
+ {
+ glUseProgram(gc->shared->shader[0].prog);
+ glUniformMatrix4fv(glGetUniformLocation(gc->shared->shader[0].prog, "mvp"), 1, GL_FALSE, gc->shared->proj);
+ gc->shared->shader[0].reset = EINA_FALSE;
+ }
+ else
+ {
+ glUseProgram(gc->state.current.cur_prog);
+ glUniformMatrix4fv(glGetUniformLocation(gc->state.current.cur_prog, "mvp"), 1, GL_FALSE, gc->shared->proj);
+ }
}
EAPI Evas_Engine_GL_Context *
if (gc->pipe[i].shader.cur_prog != gc->state.current.cur_prog)
{
glUseProgram(gc->pipe[i].shader.cur_prog);
+ if (gc->shared->shader[gc->pipe[i].shader.id].reset)
+ {
+ glUniformMatrix4fv(glGetUniformLocation(gc->pipe[i].shader.cur_prog, "mvp"), 1, GL_FALSE, gc->shared->proj);
+ gc->shared->shader[gc->pipe[i].shader.id].reset = EINA_FALSE;
+ }
}
if (gc->pipe[i].shader.cur_tex != gc->state.current.cur_tex)