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_TEXUV2 3
#define SHAD_TEXUV3 4 #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 Evas_GL_Program;
typedef struct _Evas_GL_Program_Source Evas_GL_Program_Source; typedef struct _Evas_GL_Program_Source Evas_GL_Program_Source;
typedef struct _Evas_GL_Shared Evas_GL_Shared; typedef struct _Evas_GL_Shared Evas_GL_Shared;
@ -120,6 +123,14 @@ struct _Evas_GL_Shared
int rot; 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 struct _Evas_GL_Context
{ {
int references; int references;
@ -128,19 +139,10 @@ struct _Evas_GL_Context
RGBA_Draw_Context *dc; RGBA_Draw_Context *dc;
Evas_GL_Shared *shared; Evas_GL_Shared *shared;
int flushnum;
struct { struct {
int x, y, w, h; int top_pipe;
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;
struct { struct {
GLuint cur_prog; GLuint cur_prog;
GLuint cur_tex, cur_texu, cur_texv; GLuint cur_tex, cur_texu, cur_texv;
@ -150,23 +152,44 @@ struct _Evas_GL_Context
Eina_Bool blend : 1; Eina_Bool blend : 1;
Eina_Bool clip : 1; Eina_Bool clip : 1;
} current; } current;
} shader; } state;
struct { struct {
int num; struct {
int alloc; int x, y, w, h;
GLshort *vertex; int type;
GLubyte *color; } region;
GLfloat *texuv; struct {
GLfloat *texuv2; int x, y, w, h;
GLfloat *texuv3; Eina_Bool active : 1;
Eina_Bool line : 1; } clip;
Eina_Bool use_vertex : 1; struct {
Eina_Bool use_color : 1; Evas_GL_Image *surface;
Eina_Bool use_texuv : 1; GLuint cur_prog;
Eina_Bool use_texuv2 : 1; GLuint cur_tex, cur_texu, cur_texv;
Eina_Bool use_texuv3 : 1; int render_op;
Evas_GL_Image *im; int cx, cy, cw, ch;
} array; 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 { struct {
Eina_Bool size : 1; Eina_Bool size : 1;
} change; } 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); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
_tex_2d(pt->intformat, w, h, pt->format, pt->dataformat); _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__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
return pt; 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); glsym_glBindFramebuffer(GL_FRAMEBUFFER, 0);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); 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__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
return pt; 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__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glBindTexture(im->native.target, 0); glBindTexture(im->native.target, 0);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); 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__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
return pt; return pt;
} }
@ -581,9 +581,9 @@ evas_gl_common_texture_update(Evas_GL_Texture *tex, RGBA_Image *im)
1, 1, 1, 1,
fmt, tex->pt->dataformat, fmt, tex->pt->dataformat,
im->image.data + ((im->cache_entry.h - 1) * im->cache_entry.w) + (im->cache_entry.w - 1)); 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__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
} }
} }
@ -660,9 +660,9 @@ evas_gl_common_texture_alpha_update(Evas_GL_Texture *tex, DATA8 *pixels,
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
_tex_sub_2d(tex->x, tex->y, w, h, tex->pt->format, tex->pt->dataformat, _tex_sub_2d(tex->x, tex->y, w, h, tex->pt->format, tex->pt->dataformat,
pixels); 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__, ""); 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]); _tex_sub_2d(0, y, w / 2, 1, tex->ptv->format, tex->ptv->dataformat, rows[h + (h / 2) + y]);
} }
#endif #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__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
} }
} }