force scissor to always be on indicating partial gl update region so

gpu can.. do more sensible things.
This commit is contained in:
Carsten Haitzler 2013-05-03 19:31:28 +09:00
parent 08d81394aa
commit 1a81f0a8c2
3 changed files with 84 additions and 31 deletions

View File

@ -350,6 +350,11 @@ struct _Evas_Engine_GL_Context
int clip;
} current;
} state;
struct {
int x, y, w, h;
Eina_Bool enabled : 1;
} master_clip;
struct {
struct {

View File

@ -2571,7 +2571,7 @@ scissor_rot(Evas_Engine_GL_Context *gc EINA_UNUSED,
static void
shader_array_flush(Evas_Engine_GL_Context *gc)
{
int i, gw, gh, setclip, cy, fbo = 0, done = 0;
int i, gw, gh, setclip, fbo = 0, done = 0;
if (!gc->havestuff) return;
gw = gc->w;
@ -2719,47 +2719,89 @@ shader_array_flush(Evas_Engine_GL_Context *gc)
}
if (gc->pipe[i].shader.clip != gc->state.current.clip)
{
if (gc->pipe[i].shader.clip)
int cx, cy, cw, ch;
cx = gc->pipe[i].shader.cx;
cy = gc->pipe[i].shader.cy;
cw = gc->pipe[i].shader.cw;
ch = gc->pipe[i].shader.ch;
if ((gc->master_clip.enabled) && (!fbo))
{
if (gc->pipe[i].shader.clip)
{
RECTS_CLIP_TO_RECT(cx, cy, cw, ch,
gc->master_clip.x, gc->master_clip.y,
gc->master_clip.w, gc->master_clip.h);
}
else
{
cx = gc->master_clip.x;
cy = gc->master_clip.y;
cw = gc->master_clip.w;
ch = gc->master_clip.h;
}
}
if ((gc->pipe[i].shader.clip) || (gc->master_clip.enabled))
{
cy = gh - gc->pipe[i].shader.cy - gc->pipe[i].shader.ch;
if (fbo) cy = gc->pipe[i].shader.cy;
glEnable(GL_SCISSOR_TEST);
if (!fbo)
scissor_rot(gc, gc->rot, gw, gh,
gc->pipe[i].shader.cx,
cy,
gc->pipe[i].shader.cw,
gc->pipe[i].shader.ch);
scissor_rot(gc, gc->rot, gw, gh, cx, gh - cy - ch, cw, ch);
else
glScissor(gc->pipe[i].shader.cx, cy,
gc->pipe[i].shader.cw, gc->pipe[i].shader.ch);
glScissor(cx, cy, cw, ch);
setclip = 1;
gc->state.current.cx = cx;
gc->state.current.cy = cy;
gc->state.current.cw = cw;
gc->state.current.ch = ch;
}
else
{
glDisable(GL_SCISSOR_TEST);
glScissor(0, 0, 0, 0);
gc->state.current.cx = 0;
gc->state.current.cy = 0;
gc->state.current.cw = 0;
gc->state.current.ch = 0;
}
}
if ((gc->pipe[i].shader.clip) && (!setclip))
if (((gc->pipe[i].shader.clip) && (!setclip)) ||
(gc->master_clip.enabled))
{
if ((gc->pipe[i].shader.cx != gc->state.current.cx) ||
(gc->pipe[i].shader.cy != gc->state.current.cy) ||
(gc->pipe[i].shader.cw != gc->state.current.cw) ||
(gc->pipe[i].shader.ch != gc->state.current.ch))
int cx, cy, cw, ch;
cx = gc->pipe[i].shader.cx;
cy = gc->pipe[i].shader.cy;
cw = gc->pipe[i].shader.cw;
ch = gc->pipe[i].shader.ch;
if ((gc->master_clip.enabled) && (!fbo))
{
cy = gh - gc->pipe[i].shader.cy - gc->pipe[i].shader.ch;
if (fbo) cy = gc->pipe[i].shader.cy;
if (!fbo)
scissor_rot(gc, gc->rot, gw, gh,
gc->pipe[i].shader.cx,
cy,
gc->pipe[i].shader.cw,
gc->pipe[i].shader.ch);
if (gc->pipe[i].shader.clip)
{
RECTS_CLIP_TO_RECT(cx, cy, cw, ch,
gc->master_clip.x, gc->master_clip.y,
gc->master_clip.w, gc->master_clip.h);
}
else
glScissor(gc->pipe[i].shader.cx, cy,
gc->pipe[i].shader.cw, gc->pipe[i].shader.ch);
{
cx = gc->master_clip.x;
cy = gc->master_clip.y;
cw = gc->master_clip.w;
ch = gc->master_clip.h;
}
}
if ((cx != gc->state.current.cx) ||
(cy != gc->state.current.cy) ||
(cw != gc->state.current.cw) ||
(ch != gc->state.current.ch))
{
if (!fbo)
scissor_rot(gc, gc->rot, gw, gh, cx, gh - cy - ch, cw, ch);
else
glScissor(cx, cy, cw, ch);
gc->state.current.cx = cx;
gc->state.current.cy = cy;
gc->state.current.cw = cw;
gc->state.current.ch = ch;
}
}
@ -2976,10 +3018,10 @@ shader_array_flush(Evas_Engine_GL_Context *gc)
gc->state.current.cur_prog = gc->pipe[i].shader.cur_prog;
gc->state.current.cur_tex = gc->pipe[i].shader.cur_tex;
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;
gc->state.current.cw = gc->pipe[i].shader.cw;
gc->state.current.ch = gc->pipe[i].shader.ch;
// gc->state.current.cx = gc->pipe[i].shader.cx;
// gc->state.current.cy = gc->pipe[i].shader.cy;
// gc->state.current.cw = gc->pipe[i].shader.cw;
// gc->state.current.ch = gc->pipe[i].shader.ch;
gc->state.current.smooth = gc->pipe[i].shader.smooth;
gc->state.current.blend = gc->pipe[i].shader.blend;
gc->state.current.clip = gc->pipe[i].shader.clip;

View File

@ -1314,6 +1314,11 @@ eng_output_redraws_next_update_get(void *data, int *x, int *y, int *w, int *h, i
*cw = rect->w;
*ch = rect->h;
re->cur_rect = re->cur_rect->next;
re->win->gl_context->master_clip.enabled = EINA_TRUE;
re->win->gl_context->master_clip.x = rect->x;
re->win->gl_context->master_clip.y = rect->y;
re->win->gl_context->master_clip.w = rect->w;
re->win->gl_context->master_clip.h = rect->h;
break;
case MODE_FULL:
re->cur_rect = NULL;
@ -1325,6 +1330,7 @@ eng_output_redraws_next_update_get(void *data, int *x, int *y, int *w, int *h, i
if (cy) *cy = 0;
if (cw) *cw = re->win->w;
if (ch) *ch = re->win->h;
re->win->gl_context->master_clip.enabled = EINA_FALSE;
break;
default:
break;