Enlightenment CVS committal
Author : raster
Project : e17
Module : libs/evas
Dir : e17/libs/evas/src/modules/engines/gl_common
Modified Files:
evas_gl_common.h evas_gl_context.c evas_gl_image.c
evas_gl_texture.c
Log Message:
1. gustavo';s fuzzy rect implementation for updates. fixed so del's work,
tuned for best performance on my core2 duo desktop - for now. will check
more. also make the yuv colorspace code be a bit more robust and fix leak in
gl engine with shaders.
===================================================================
RCS file: /cvs/e/e17/libs/evas/src/modules/engines/gl_common/evas_gl_common.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- evas_gl_common.h 16 Apr 2007 02:01:11 -0000 1.11
+++ evas_gl_common.h 2 Jun 2007 15:30:58 -0000 1.12
@@ -86,6 +86,10 @@
Evas_List *tex_pool;
RGBA_Draw_Context *dc;
+
+ struct {
+ GLhandleARB prog, fshad;
+ } yuv422p;
};
struct _Evas_GL_Texture
@@ -96,7 +100,6 @@
int uw, uh;
GLuint texture, texture2, texture3;
- GLhandleARB prog;
unsigned char smooth : 1;
unsigned char changed : 1;
@@ -106,6 +109,7 @@
unsigned char opt : 1;
int references;
+ GLhandleARB prog;
};
struct _Evas_GL_Image
===================================================================
RCS file: /cvs/e/e17/libs/evas/src/modules/engines/gl_common/evas_gl_context.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- evas_gl_context.c 2 Jan 2007 02:43:11 -0000 1.8
+++ evas_gl_context.c 2 Jun 2007 15:30:58 -0000 1.9
@@ -39,6 +39,41 @@
gc->change.clip = 1;
gc->change.buf = 1;
gc->change.other = 1;
+
+ gc->yuv422p.prog = glCreateProgramObjectARB();
+// on an nv 6600gt this is fast - but on a 5500fx its DEAD SLOW!!!!!
+// if (!gc->ext.arb_texture_non_power_of_two) return NULL;
+ /* BEGIN LEAK */
+ gc->yuv422p.fshad = glCreateShaderObjectARB(GL_FRAGMENT_SHADER_ARB);
+ {
+ const char *code =
+ "uniform sampler2D ytex, utex, vtex;\n"
+ "void main(void) {\n"
+ " float r, g, b, y, u, v;\n"
+ " y = texture2D(ytex, gl_TexCoord[0].st).r;\n"
+ " u = texture2D(utex, gl_TexCoord[0].st).r;\n"
+ " v = texture2D(vtex, gl_TexCoord[0].st).r;\n"
+ " y = (y - 0.0625) * 1.164;\n"
+ " u = u - 0.5;\n"
+ " v = v - 0.5;\n"
+ " r = y + (1.402 * v);\n"
+ " g = y - (0.34414 * u) - (0.71414 * v);\n"
+ " b = y + (1.772 * u);\n"
+ " gl_FragColor = vec4(r * gl_Color.r * gl_Color.a, g * gl_Color.g *
gl_Color.a, b * gl_Color.b * gl_Color.a, gl_Color.a);\n"
+ "}\n";
+ glShaderSourceARB(gc->yuv422p.fshad, 1, &code, NULL);
+ }
+ glCompileShaderARB(gc->yuv422p.fshad);
+ glAttachObjectARB(gc->yuv422p.prog, gc->yuv422p.fshad);
+ /* END LEAK - something in the above leaks... beats me what. */
+ glLinkProgramARB(gc->yuv422p.prog);
+
+ glUseProgramObjectARB(gc->yuv422p.prog);
+ glUniform1iARB(glGetUniformLocationARB(gc->yuv422p.prog, "ytex"), 0);
+ glUniform1iARB(glGetUniformLocationARB(gc->yuv422p.prog, "utex"), 1);
+ glUniform1iARB(glGetUniformLocationARB(gc->yuv422p.prog, "vtex"), 2);
+ glUseProgramObjectARB(0);
+
return gc;
}
@@ -47,7 +82,15 @@
{
gc->references--;
if (gc->references > 0) return;
-
+ if (gc->yuv422p.fshad)
+ {
+ glDeleteObjectARB(gc->yuv422p.fshad);
+ }
+ if (gc->yuv422p.prog)
+ {
+ glDeleteObjectARB(gc->yuv422p.prog);
+ }
+
if (gc == _evas_gl_common_context) _evas_gl_common_context = NULL;
free(gc);
}
===================================================================
RCS file: /cvs/e/e17/libs/evas/src/modules/engines/gl_common/evas_gl_image.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- evas_gl_image.c 4 Mar 2007 16:18:06 -0000 1.7
+++ evas_gl_image.c 2 Jun 2007 15:30:58 -0000 1.8
@@ -105,6 +105,7 @@
im->cached = 1;
gc->images = evas_list_prepend(gc->images, im);
*/
+ printf("new im cs = %i\n", im->cs.space);
return im;
}
@@ -166,6 +167,33 @@
free(im);
return NULL;
}
+ im->gc = gc;
+ im->cs.space = cspace;
+ if (alpha)
+ im->im->flags |= RGBA_IMAGE_HAS_ALPHA;
+ else
+ im->im->flags &= ~RGBA_IMAGE_HAS_ALPHA;
+ switch (cspace)
+ {
+ case EVAS_COLORSPACE_ARGB8888:
+// if (data)
+// memcpy(im->im->image->data, data, w * h * sizeof(DATA32));
+ break;
+ case EVAS_COLORSPACE_YCBCR422P601_PL:
+ case EVAS_COLORSPACE_YCBCR422P709_PL:
+ evas_common_image_surface_dealloc(im->im->image);
+ im->im->image->data = NULL;
+// if (im->tex) evas_gl_common_texture_free(im->tex);
+ im->tex = NULL;
+ im->cs.no_free = 0;
+ im->cs.data = calloc(1, im->im->image->h * sizeof(unsigned char *) *
2);
+// if ((data) && (im->cs.data))
+// memcpy(im->cs.data, data, im->im->image->h * sizeof(unsigned char *)
* 2);
+ break;
+ default:
+ abort();
+ break;
+ }
return im;
}
@@ -215,6 +243,7 @@
r = g = b = a = 255;
}
evas_common_load_image_data_from_file(im->im);
+/* leak in this switch */
switch (im->cs.space)
{
case EVAS_COLORSPACE_ARGB8888:
@@ -251,7 +280,9 @@
im->dirty = 0;
}
if ((!im->tex) && (im->cs.data) && (*((unsigned char **)im->cs.data)))
- im->tex = evas_gl_common_ycbcr601pl_texture_new(gc, im->cs.data,
im->im->image->w, im->im->image->h, smooth);
+ {
+ im->tex = evas_gl_common_ycbcr601pl_texture_new(gc, im->cs.data,
im->im->image->w, im->im->image->h, smooth);
+ }
if (!im->tex) return;
ow = (dw * im->tex->tw) / sw;
oh = (dh * im->tex->th) / sh;
@@ -270,11 +301,13 @@
ty2 = (double)(sy + sh) / (double)(im->tex->h);
}
evas_gl_common_context_texture_set(gc, im->tex, smooth, ow, oh);
+
break;
default:
abort();
break;
}
+
// if ((!im->tex->have_mipmaps) && (smooth) &&
// ((im->tex->uw < im->tex->tw) || (im->tex->uh < im->tex->th)) &&
// (!gc->ext.sgis_generate_mipmap))
===================================================================
RCS file: /cvs/e/e17/libs/evas/src/modules/engines/gl_common/evas_gl_texture.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- evas_gl_texture.c 2 Jan 2007 02:43:11 -0000 1.8
+++ evas_gl_texture.c 2 Jun 2007 15:30:58 -0000 1.9
@@ -296,8 +296,16 @@
glDeleteTextures(1, &tex->texture);
if (tex->texture2) glDeleteTextures(1, &tex->texture2);
if (tex->texture3) glDeleteTextures(1, &tex->texture3);
+/*
+ if (tex->fshad)
+ {
+ glDeleteObjectARB(tex->fshad);
+ }
if (tex->prog)
- glDeleteObjectARB(tex->prog);
+ {
+ glDeleteObjectARB(tex->prog);
+ }
+ */
free(tex);
}
@@ -418,7 +426,6 @@
Evas_GL_Texture *tex;
int im_w, im_h, tw, th, y;
GLenum texfmt;
- GLhandleARB fshad;
// on an nv 6600gt this is fast - but on a 5500fx its DEAD SLOW!!!!!
// if (!gc->ext.arb_texture_non_power_of_two) return NULL;
@@ -436,40 +443,13 @@
tex->references = 0;
tex->smooth = 0;
tex->changed = 1;
-
- tex->prog = glCreateProgramObjectARB();
- fshad = glCreateShaderObjectARB(GL_FRAGMENT_SHADER_ARB);
- {
- const char *code =
- "uniform sampler2D ytex, utex, vtex;\n"
- "void main(void) {\n"
- " float r, g, b, y, u, v;\n"
- " y = texture2D(ytex, gl_TexCoord[0].st).r;\n"
- " u = texture2D(utex, gl_TexCoord[0].st).r;\n"
- " v = texture2D(vtex, gl_TexCoord[0].st).r;\n"
- " y = (y - 0.0625) * 1.164;\n"
- " u = u - 0.5;\n"
- " v = v - 0.5;\n"
- " r = y + (1.402 * v);\n"
- " g = y - (0.34414 * u) - (0.71414 * v);\n"
- " b = y + (1.772 * u);\n"
- " gl_FragColor = vec4(r * gl_Color.r * gl_Color.a, g * gl_Color.g *
gl_Color.a, b * gl_Color.b * gl_Color.a, gl_Color.a);\n"
- "}\n";
- glShaderSourceARB(fshad, 1, &code, NULL);
- }
-
- glCompileShaderARB(fshad);
- glAttachObjectARB(tex->prog, fshad);
- glLinkProgramARB(tex->prog);
+ tex->prog = gc->yuv422p.prog;
glEnable(GL_TEXTURE_2D);
texfmt = GL_LUMINANCE;
glUseProgramObjectARB(tex->prog);
- glUniform1iARB(glGetUniformLocationARB(tex->prog, "ytex"), 0);
- glUniform1iARB(glGetUniformLocationARB(tex->prog, "utex"), 1);
- glUniform1iARB(glGetUniformLocationARB(tex->prog, "vtex"), 2);
glGenTextures(1, &(tex->texture));
glBindTexture(GL_TEXTURE_2D, tex->texture);
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs