some major re-jig to get multiple render pipes in gl at once... some

chunky speedups to be had in real-life cases by avoiding more array
flushes.



SVN revision: 50917
This commit is contained in:
Carsten Haitzler 2010-08-09 03:27:59 +00:00
parent 224f7d3b55
commit 66cace4f44
3 changed files with 1009 additions and 570 deletions

View File

@ -57,6 +57,9 @@
#define SHAD_TEXUV2 3
#define SHAD_TEXUV3 4
//#define MAX_PIPES 1
#define MAX_PIPES 32
typedef struct _Evas_GL_Program Evas_GL_Program;
typedef struct _Evas_GL_Program_Source Evas_GL_Program_Source;
typedef struct _Evas_GL_Shared Evas_GL_Shared;
@ -120,6 +123,14 @@ struct _Evas_GL_Shared
int rot;
};
#define RTYPE_RECT 1
#define RTYPE_IMAGE 2
#define RTYPE_FONT 3
#define RTYPE_YUV 4
#define RTYPE_MAP 5 /* need to merge with image */
struct _Evas_GL_Context
{
int references;
@ -128,19 +139,10 @@ struct _Evas_GL_Context
RGBA_Draw_Context *dc;
Evas_GL_Shared *shared;
int flushnum;
struct {
int x, y, w, h;
Eina_Bool active : 1;
} clip;
struct {
Evas_GL_Image *surface;
GLuint cur_prog;
GLuint cur_tex, cur_texu, cur_texv;
int render_op;
int cx, cy, cw, ch;
Eina_Bool smooth : 1;
Eina_Bool blend : 1;
Eina_Bool clip : 1;
int top_pipe;
struct {
GLuint cur_prog;
GLuint cur_tex, cur_texu, cur_texv;
@ -150,23 +152,44 @@ struct _Evas_GL_Context
Eina_Bool blend : 1;
Eina_Bool clip : 1;
} current;
} shader;
} state;
struct {
int num;
int alloc;
GLshort *vertex;
GLubyte *color;
GLfloat *texuv;
GLfloat *texuv2;
GLfloat *texuv3;
Eina_Bool line : 1;
Eina_Bool use_vertex : 1;
Eina_Bool use_color : 1;
Eina_Bool use_texuv : 1;
Eina_Bool use_texuv2 : 1;
Eina_Bool use_texuv3 : 1;
Evas_GL_Image *im;
} array;
struct {
int x, y, w, h;
int type;
} region;
struct {
int x, y, w, h;
Eina_Bool active : 1;
} clip;
struct {
Evas_GL_Image *surface;
GLuint cur_prog;
GLuint cur_tex, cur_texu, cur_texv;
int render_op;
int cx, cy, cw, ch;
Eina_Bool smooth : 1;
Eina_Bool blend : 1;
Eina_Bool clip : 1;
} shader;
struct {
int num, alloc;
GLshort *vertex;
GLubyte *color;
GLfloat *texuv;
GLfloat *texuv2;
GLfloat *texuv3;
Eina_Bool line : 1;
Eina_Bool use_vertex : 1;
Eina_Bool use_color : 1;
Eina_Bool use_texuv : 1;
Eina_Bool use_texuv2 : 1;
Eina_Bool use_texuv3 : 1;
Evas_GL_Image *im;
} array;
} pipe[MAX_PIPES];
struct {
Eina_Bool size : 1;
} change;

File diff suppressed because it is too large Load Diff

View File

@ -123,7 +123,7 @@ _pool_tex_new(Evas_GL_Context *gc, int w, int h, int intformat, int format)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
_tex_2d(pt->intformat, w, h, pt->format, pt->dataformat);
glBindTexture(GL_TEXTURE_2D, gc->shader.cur_tex);
glBindTexture(GL_TEXTURE_2D, gc->pipe[0].shader.cur_tex);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
return pt;
}
@ -337,7 +337,7 @@ _pool_tex_render_new(Evas_GL_Context *gc, int w, int h, int intformat, int forma
glsym_glBindFramebuffer(GL_FRAMEBUFFER, 0);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glBindTexture(GL_TEXTURE_2D, gc->shader.cur_tex);
glBindTexture(GL_TEXTURE_2D, gc->pipe[0].shader.cur_tex);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
return pt;
}
@ -391,7 +391,7 @@ _pool_tex_native_new(Evas_GL_Context *gc, int w, int h, int intformat, int forma
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glBindTexture(im->native.target, 0);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glBindTexture(im->native.target, gc->shader.cur_tex);
glBindTexture(im->native.target, gc->pipe[0].shader.cur_tex);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
return pt;
}
@ -581,9 +581,9 @@ evas_gl_common_texture_update(Evas_GL_Texture *tex, RGBA_Image *im)
1, 1,
fmt, tex->pt->dataformat,
im->image.data + ((im->cache_entry.h - 1) * im->cache_entry.w) + (im->cache_entry.w - 1));
if (tex->pt->texture != tex->gc->shader.cur_tex)
if (tex->pt->texture != tex->gc->pipe[0].shader.cur_tex)
{
glBindTexture(GL_TEXTURE_2D, tex->gc->shader.cur_tex);
glBindTexture(GL_TEXTURE_2D, tex->gc->pipe[0].shader.cur_tex);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
}
}
@ -660,9 +660,9 @@ evas_gl_common_texture_alpha_update(Evas_GL_Texture *tex, DATA8 *pixels,
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
_tex_sub_2d(tex->x, tex->y, w, h, tex->pt->format, tex->pt->dataformat,
pixels);
if (tex->pt->texture != tex->gc->shader.cur_tex)
if (tex->pt->texture != tex->gc->pipe[0].shader.cur_tex)
{
glBindTexture(GL_TEXTURE_2D, tex->gc->shader.cur_tex);
glBindTexture(GL_TEXTURE_2D, tex->gc->pipe[0].shader.cur_tex);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
}
}
@ -787,9 +787,9 @@ evas_gl_common_texture_yuv_update(Evas_GL_Texture *tex, DATA8 **rows, int w, int
_tex_sub_2d(0, y, w / 2, 1, tex->ptv->format, tex->ptv->dataformat, rows[h + (h / 2) + y]);
}
#endif
if (tex->pt->texture != tex->gc->shader.cur_tex)
if (tex->pt->texture != tex->gc->pipe[0].shader.cur_tex)
{
glBindTexture(GL_TEXTURE_2D, tex->gc->shader.cur_tex);
glBindTexture(GL_TEXTURE_2D, tex->gc->pipe[0].shader.cur_tex);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
}
}