Enlightenment CVS committal
Author : moom
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
Log Message:
* [GL-engine] Do software YUV-conversion if GLSL is not supported. I
can't test it on a GLSL card, so I hope it didn't break anything. If
something is broken, feel free to revert! (but it would probably just be
related to the way it detects GLSL support at l.78 of evas_gl_context.c)
===================================================================
RCS file: /cvs/e/e17/libs/evas/src/modules/engines/gl_common/evas_gl_common.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -3 -r1.15 -r1.16
--- evas_gl_common.h 7 Aug 2007 09:03:22 -0000 1.15
+++ evas_gl_common.h 25 Dec 2007 11:12:39 -0000 1.16
@@ -67,6 +67,7 @@
int sgis_generate_mipmap : 1;
int nv_texture_rectangle : 1;
int arb_texture_non_power_of_two : 1;
+ int arb_program : 1;
} ext;
GLenum read_buf;
===================================================================
RCS file: /cvs/e/e17/libs/evas/src/modules/engines/gl_common/evas_gl_context.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- evas_gl_context.c 2 Jun 2007 15:30:58 -0000 1.9
+++ evas_gl_context.c 25 Dec 2007 11:12:39 -0000 1.10
@@ -40,40 +40,6 @@
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;
}
@@ -110,6 +76,9 @@
// if (strstr(ext, "GL_NV_texture_rectangle"))
gc->ext.nv_texture_rectangle = 1;
// if (strstr(ext, "GL_EXT_texture_rectangle"))
gc->ext.nv_texture_rectangle = 1;
if (strstr(ext, "GL_ARB_texture_non_power_of_two"))
gc->ext.arb_texture_non_power_of_two = 1;
+ if (strstr(ext, "GL_ARB_shader_objects") && strstr(ext,
"GL_ARB_vertex_shader")
+ && strstr(ext, "GL_ARB_fragment_shader") && strstr(ext,
"GL_ARB_shading_language"))
+ gc->ext.arb_program = 1;
// printf("GL EXT supported: GL_SGIS_generate_mipmap = %x\n",
gc->ext.sgis_generate_mipmap);
// printf("GL EXT supported: GL_NV_texture_rectangle = %x\n",
gc->ext.nv_texture_rectangle);
// printf("GL EXT supported: GL_ARB_texture_non_power_of_two = %x\n",
gc->ext.arb_texture_non_power_of_two);
@@ -123,7 +92,45 @@
{
// printf("GL EXT supported: No extensions!!!!!\n");
}
- gc->ext.checked = 1;
+
+ if (gc->ext.arb_program)
+ {
+ 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);
+ }
+
+ gc->ext.checked = 1;
}
_evas_gl_common_context = gc;
_evas_gl_common_viewport_set(gc);
===================================================================
RCS file: /cvs/e/e17/libs/evas/src/modules/engines/gl_common/evas_gl_image.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- evas_gl_image.c 16 Jul 2007 07:25:34 -0000 1.9
+++ evas_gl_image.c 25 Dec 2007 11:12:39 -0000 1.10
@@ -224,6 +224,7 @@
int r, g, b, a;
double tx1, ty1, tx2, ty2;
int ow, oh;
+ int space;
if (sw < 1) sw = 1;
if (sh < 1) sh = 1;
@@ -239,8 +240,29 @@
{
r = g = b = a = 255;
}
+
+ if (!gc->ext.arb_program && (im->cs.space == EVAS_COLORSPACE_YCBCR422P601_PL
+ || im->cs.space == EVAS_COLORSPACE_YCBCR422P709_PL))
+ {
+ if ((im->cs.data) && (*((unsigned char **)im->cs.data)))
+ {
+ if (im->dirty || !im->im->image->data)
+ {
+ free(im->im->image->data);
+ im->im->image->data = malloc(im->im->image->w *
im->im->image->h * sizeof(DATA32));
+ if (im->im->image->data)
+ evas_common_convert_yuv_420p_601_rgba(im->cs.data,
+ (void
*)im->im->image->data,
+ im->im->image->w,
im->im->image->h);
+ }
+ }
+ space = EVAS_COLORSPACE_ARGB8888;
+ }
+ else
+ space = im->cs.space;
+
/* leak in this switch */
- switch (im->cs.space)
+ switch (space)
{
case EVAS_COLORSPACE_ARGB8888:
evas_cache_image_load_data(im->im);
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs