diff --git a/legacy/evas/README b/legacy/evas/README index 53e04cf082..b577288fa4 100644 --- a/legacy/evas/README +++ b/legacy/evas/README @@ -1,5 +1,5 @@ ##################### -# Evas 1.0.0 pre-11 # +# Evas 1.0.0 pre-12 # ##################### This is a !!!!!!!!***** PRE RELEASE *****!!!!!!!!. diff --git a/legacy/evas/configure.in b/legacy/evas/configure.in index bd4ba27d5f..47bedda275 100644 --- a/legacy/evas/configure.in +++ b/legacy/evas/configure.in @@ -5,7 +5,7 @@ rm -f config.cache AC_INIT(configure.in) AC_ISC_POSIX -AM_INIT_AUTOMAKE(evas, 1.0.0_pre11) +AM_INIT_AUTOMAKE(evas, 1.0.0_pre12) AM_CONFIG_HEADER(config.h) AC_C_BIGENDIAN diff --git a/legacy/evas/src/bin/evas_test_main.c b/legacy/evas/src/bin/evas_test_main.c index 9884411029..3b7391c0ee 100644 --- a/legacy/evas/src/bin/evas_test_main.c +++ b/legacy/evas/src/bin/evas_test_main.c @@ -2,7 +2,7 @@ #include "evas_test_main.h" // test writing to image objects for video playback -//define VID_TEST +//#define VID_TEST // actualyl fill the video buffer (not fair a test as cpu spends time filling) //#define VID_WRITE diff --git a/legacy/evas/src/lib/engines/common/evas_blend_pixel_pixel.c b/legacy/evas/src/lib/engines/common/evas_blend_pixel_pixel.c index 05bb1d596d..5feeb869c8 100644 --- a/legacy/evas/src/lib/engines/common/evas_blend_pixel_pixel.c +++ b/legacy/evas/src/lib/engines/common/evas_blend_pixel_pixel.c @@ -146,18 +146,22 @@ evas_common_copy_pixels_rgba_to_rgba_mmx(DATA32 *src, DATA32 *dst, int len) int src_align; int dst_align; - src_align = (int)src & 0x7; /* 8 byte alignment */ - dst_align = (int)dst & 0x7; /* 8 byte alignment */ - if ((!src_align) && (!dst_align)) - /* both not aligned. do fixup */ + src_align = (int)src & 0x3f; /* 64 byte alignment */ + dst_align = (int)dst & 0x3f; /* 64 byte alignment */ + if ((src_align != 0) && + (!(src_align & 0x3)) && + (src_align == dst_align)) { - *dst = *src; - dst++; - src++; - len--; + while ((src_align > 0) && (len > 0)) + { + *dst = *src; + dst++; + src++; + len--; + src_align -= sizeof(DATA32); + } } - else if ((!src_align) || (!dst_align)) - /* one isnt aligned. we can't do fixup. do it the slow way */ + else { #ifdef BUILD_C evas_common_copy_pixels_rgba_to_rgba_c(src, dst, len); @@ -184,6 +188,56 @@ evas_common_copy_pixels_rgba_to_rgba_mmx(DATA32 *src, DATA32 *dst, int len) } #endif +#ifdef BUILD_MMX +void +evas_common_copy_pixels_rgba_to_rgba_mmx2(DATA32 *src, DATA32 *dst, int len) +{ + DATA32 *src_ptr, *dst_ptr, *dst_end_ptr, *dst_end_ptr_pre; + int src_align; + int dst_align; + + src_align = (int)src & 0x3f; /* 64 byte alignment */ + dst_align = (int)dst & 0x3f; /* 64 byte alignment */ + if ((src_align != 0) && + (!(src_align & 0x3)) && + (src_align == dst_align)) + { + while ((src_align > 0) && (len > 0)) + { + *dst = *src; + dst++; + src++; + len--; + src_align -= sizeof(DATA32); + } + } + else + { +#ifdef BUILD_C + evas_common_copy_pixels_rgba_to_rgba_c(src, dst, len); +#endif + return; + } + src_ptr = src; + dst_ptr = dst; + dst_end_ptr = dst + len; + dst_end_ptr_pre = dst + ((len / 16) * 16); + + while (dst_ptr < dst_end_ptr_pre) + { + MOVE_16DWORDS_MMX2(src_ptr, dst_ptr); + src_ptr+=16; + dst_ptr+=16; + } + while (dst_ptr < dst_end_ptr) + { + *dst_ptr = *src_ptr; + src_ptr++; + dst_ptr++; + } +} +#endif + #ifdef BUILD_SSE void evas_common_copy_pixels_rgba_to_rgba_sse(DATA32 *src, DATA32 *dst, int len) @@ -192,18 +246,22 @@ evas_common_copy_pixels_rgba_to_rgba_sse(DATA32 *src, DATA32 *dst, int len) int src_align; int dst_align; - src_align = (int)src & 0x7; /* 8 byte alignment */ - dst_align = (int)dst & 0x7; /* 8 byte alignment */ - if ((!src_align) && (!dst_align)) - /* both not aligned. do fixup */ + src_align = (int)src & 0x3f; /* 64 byte alignment */ + dst_align = (int)dst & 0x3f; /* 64 byte alignment */ + if ((src_align != 0) && + (!(src_align & 0x3)) && + (src_align == dst_align)) { - *dst = *src; - dst++; - src++; - len--; + while ((src_align > 0) && (len > 0)) + { + *dst = *src; + dst++; + src++; + len--; + src_align -= sizeof(DATA32); + } } - else if ((!src_align) || (!dst_align)) - /* one isnt aligned. we can't do fixup. do it the slow way */ + else { #ifdef BUILD_C evas_common_copy_pixels_rgba_to_rgba_c(src, dst, len); diff --git a/legacy/evas/src/lib/engines/common/evas_cpu.c b/legacy/evas/src/lib/engines/common/evas_cpu.c index 9f907a112e..149d9079fe 100644 --- a/legacy/evas/src/lib/engines/common/evas_cpu.c +++ b/legacy/evas/src/lib/engines/common/evas_cpu.c @@ -22,6 +22,17 @@ evas_common_cpu_mmx_test(void) #endif } +void +evas_common_cpu_mmx2_test(void) +{ +#ifdef BUILD_MMX + char data[128]; + char data2[128]; + + MOVE_16DWORDS_MMX2(data, data2); +#endif +} + void evas_common_cpu_sse_test(void) { @@ -79,6 +90,8 @@ evas_common_cpu_init(void) #ifdef BUILD_MMX cpu_feature_mask |= CPU_FEATURE_MMX * evas_common_cpu_feature_test(evas_common_cpu_mmx_test); + cpu_feature_mask |= CPU_FEATURE_MMX2 * + evas_common_cpu_feature_test(evas_common_cpu_mmx2_test); #ifdef BUILD_SSE cpu_feature_mask |= CPU_FEATURE_SSE * evas_common_cpu_feature_test(evas_common_cpu_sse_test); @@ -133,6 +146,7 @@ evas_common_cpu_can_do(int *mmx, int *sse, int *sse2) cpu_feature_mask |= CPU_FEATURE_MMX; #endif if (cpu_feature_mask & CPU_FEATURE_MMX) do_mmx = 1; + if (cpu_feature_mask & CPU_FEATURE_MMX2) do_mmx = 2; if (cpu_feature_mask & CPU_FEATURE_SSE) do_sse = 1; } // printf("%i %i %i\n", do_mmx, do_sse, do_sse2); @@ -146,7 +160,8 @@ evas_common_cpu_can_do(int *mmx, int *sse, int *sse2) void evas_common_cpu_end_opt(void) { - if (cpu_feature_mask & CPU_FEATURE_MMX) + if (cpu_feature_mask & + (CPU_FEATURE_MMX | CPU_FEATURE_MMX2)) { emms(); } diff --git a/legacy/evas/src/lib/engines/common/evas_draw_main.c b/legacy/evas/src/lib/engines/common/evas_draw_main.c index 54a222ec2b..01c7d81d22 100644 --- a/legacy/evas/src/lib/engines/common/evas_draw_main.c +++ b/legacy/evas/src/lib/engines/common/evas_draw_main.c @@ -538,7 +538,11 @@ evas_common_draw_func_blend_get(RGBA_Image *src, RGBA_Image *dst, int pixels) #endif #ifdef BUILD_MMX # ifdef BUILD_C - if (evas_common_cpu_has_feature(CPU_FEATURE_MMX)) + if (evas_common_cpu_has_feature(CPU_FEATURE_MMX2)) +# endif + return evas_common_copy_pixels_rgba_to_rgba_mmx2; +# ifdef BUILD_C + else if (evas_common_cpu_has_feature(CPU_FEATURE_MMX)) # endif return evas_common_copy_pixels_rgba_to_rgba_mmx; # ifdef BUILD_C @@ -763,7 +767,9 @@ evas_common_draw_func_copy_get(int pixels, int reverse) # ifdef BUILD_SSE else # endif - if (evas_common_cpu_has_feature(CPU_FEATURE_MMX)) + if (evas_common_cpu_has_feature(CPU_FEATURE_MMX2)) + return evas_common_copy_pixels_rgba_to_rgba_mmx2; + else if (evas_common_cpu_has_feature(CPU_FEATURE_MMX)) return evas_common_copy_pixels_rgba_to_rgba_mmx; #endif #ifdef BUILD_C diff --git a/legacy/evas/src/lib/engines/gl_common/evas_gl_context.c b/legacy/evas/src/lib/engines/gl_common/evas_gl_context.c index b628d66b1c..661f01b0ec 100644 --- a/legacy/evas/src/lib/engines/gl_common/evas_gl_context.c +++ b/legacy/evas/src/lib/engines/gl_common/evas_gl_context.c @@ -68,7 +68,8 @@ evas_gl_common_context_use(Evas_GL_Context *gc) /* technically this should work, as its a compatible */ /* implementation of the nvidia texture_rectangle extension */ /* since the #define value is the same as is the description */ - /* if (strstr(ext, "GL_EXT_texture_rectangle")) gc->ext.nv_texture_rectangle = 1; */ + /* it was fixed in the latest (3.2.5) fglrx drivers */ + if (strstr(ext, "GL_EXT_texture_rectangle")) gc->ext.nv_texture_rectangle = 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); } diff --git a/legacy/evas/src/lib/engines/gl_common/evas_gl_font.c b/legacy/evas/src/lib/engines/gl_common/evas_gl_font.c index bb3b0e1ea7..82c60067e1 100644 --- a/legacy/evas/src/lib/engines/gl_common/evas_gl_font.c +++ b/legacy/evas/src/lib/engines/gl_common/evas_gl_font.c @@ -4,6 +4,159 @@ static Evas_GL_Font_Texture_Pool_Allocation *_evas_gl_font_texture_pool_request( static void _evas_gl_font_texture_pool_relinquish(Evas_GL_Font_Texture_Pool_Allocation *fa); static int _evas_gl_font_texture_pool_rect_find(Evas_GL_Font_Texture_Pool *fp, int w, int h, int *x, int *y); +Evas_GL_Font_Texture * +evas_gl_font_texture_new(Evas_GL_Context *gc, RGBA_Font_Glyph *fg) +{ + Evas_GL_Font_Texture *ft; + DATA8 *data; + int w, h, j; + + int nw; + DATA8 *ndata; + + ft = calloc(1, sizeof(Evas_GL_Font_Texture)); + if (!ft) return NULL; + + data = fg->glyph_out->bitmap.buffer; + w = fg->glyph_out->bitmap.width; + h = fg->glyph_out->bitmap.rows; + j = fg->glyph_out->bitmap.pitch; + if (j < w) j = w; + + ft->gc = gc; + + /* bug bug! glTexSubImage2D need a multiple of 4 pixels horizontally! :( */ + nw = ((w + 3) / 4 ) * 4; + ndata = malloc(nw *h); + if (!ndata) + { + free(ft); + return NULL; + } + { + int x, y; + DATA8 *p1, *p2; + + for (y = 0; y < h; y++) + { + p1 = data + (j * y); + p2 = ndata + (nw * y); + for (x = 0; x < w; x++) + { + *p2 = *p1; + p1++; + p2++; + } + } + } + + /* where in pool texture does this live */ + ft->w = w; + ft->h = h; + ft->aw = nw; + ft->ah = h; + + ft->alloc = _evas_gl_font_texture_pool_request(gc, ft->aw, ft->ah); + if (!ft->alloc) + { + free(ndata); + free(ft); + return NULL; + } + ft->x = ft->alloc->x; + ft->y = ft->alloc->y; + ft->pool = ft->alloc->pool; + ft->texture = ft->pool->texture; + if (ft->pool->not_power_of_two) + { + glEnable(GL_TEXTURE_RECTANGLE_NV); + glBindTexture(GL_TEXTURE_RECTANGLE_NV, ft->texture); + glTexSubImage2D(GL_TEXTURE_RECTANGLE_NV, 0, + ft->x, ft->y, nw, ft->h, + GL_ALPHA, GL_UNSIGNED_BYTE, ndata); + } + else + { + glBindTexture(GL_TEXTURE_2D, ft->texture); + glTexSubImage2D(GL_TEXTURE_2D, 0, + ft->x, ft->y, nw, ft->h, + GL_ALPHA, GL_UNSIGNED_BYTE, ndata); + } + if (ndata) free(ndata); + if (gc->texture) + { + if (gc->texture) gc->texture->references--; + gc->texture = NULL; + } + gc->font_texture = ft->texture; + gc->font_texture_not_power_of_two = ft->pool->not_power_of_two; + gc->change.texture = 1; + + return ft; +} + +void +evas_gl_font_texture_free(Evas_GL_Font_Texture *ft) +{ + if (ft->gc->font_texture == ft->texture) + { + ft->gc->font_texture = 0; + ft->gc->change.texture = 1; + } + _evas_gl_font_texture_pool_relinquish(ft->alloc); + free(ft); +} + +void +evas_gl_font_texture_draw(Evas_GL_Context *gc, void *surface, RGBA_Draw_Context *dc, RGBA_Font_Glyph *fg, int x, int y) +{ + int r, g, b, a; + Evas_GL_Font_Texture *ft; + + ft = fg->ext_dat; + if (!ft) return; + a = (dc->col.col >> 24) & 0xff; + r = (dc->col.col >> 16) & 0xff; + g = (dc->col.col >> 8 ) & 0xff; + b = (dc->col.col ) & 0xff; + evas_gl_common_context_color_set(gc, r, g, b, a); + if (dc->clip.use) + evas_gl_common_context_clip_set(gc, 1, + dc->clip.x, dc->clip.y, + dc->clip.w, dc->clip.h); + else + evas_gl_common_context_clip_set(gc, 0, + 0, 0, 0, 0); + evas_gl_common_context_font_texture_set(gc, ft); + evas_gl_common_context_blend_set(gc, 1); + evas_gl_common_context_read_buf_set(gc, GL_BACK); + evas_gl_common_context_write_buf_set(gc, GL_BACK); + { + double tx1, ty1, tx2, ty2; + + if (ft->pool->not_power_of_two) + { + tx1 = ft->x; + ty1 = ft->y; + tx2 = ft->x + ft->w; + ty2 = ft->y + ft->h; + } + else + { + tx1 = (double)(ft->x ) / (double)(ft->pool->w); + ty1 = (double)(ft->y ) / (double)(ft->pool->h); + tx2 = (double)(ft->x + ft->w) / (double)(ft->pool->w); + ty2 = (double)(ft->y + ft->h) / (double)(ft->pool->h); + } + glBegin(GL_QUADS); + glTexCoord2d(tx1, ty1); glVertex2i(x , y ); + glTexCoord2d(tx2, ty1); glVertex2i(x + ft->w, y ); + glTexCoord2d(tx2, ty2); glVertex2i(x + ft->w, y + ft->h); + glTexCoord2d(tx1, ty2); glVertex2i(x , y + ft->h); + glEnd(); + } +} + static Evas_GL_Font_Texture_Pool_Allocation * _evas_gl_font_texture_pool_request(Evas_GL_Context *gc, int w, int h) { @@ -29,6 +182,11 @@ _evas_gl_font_texture_pool_request(Evas_GL_Context *gc, int w, int h) fa->w = w; fa->h = h; fp->allocations = evas_list_prepend(fp->allocations, fa); + if (evas_list_alloc_error()) + { + free(fa); + return NULL; + } fp->references++; return fa; } @@ -48,12 +206,18 @@ _evas_gl_font_texture_pool_request(Evas_GL_Context *gc, int w, int h) fp = calloc(1, sizeof(Evas_GL_Font_Texture_Pool)); if (!fp) return NULL; + gc->tex_pool = evas_list_append(gc->tex_pool, fp); + if (evas_list_alloc_error()) + { + free(fp); + return NULL; + } fp->gc = gc; fp->w = minw; fp->h = minh; if (gc->ext.nv_texture_rectangle) fp->not_power_of_two = 1; - gc->tex_pool = evas_list_append(gc->tex_pool, fp); - + + /* we dont want this mipmapped if sgis_generate_mipmap will mipmap it */ if (gc->ext.sgis_generate_mipmap) glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS, GL_FALSE); glEnable(GL_TEXTURE_2D); @@ -61,39 +225,56 @@ _evas_gl_font_texture_pool_request(Evas_GL_Context *gc, int w, int h) { glEnable(GL_TEXTURE_RECTANGLE_NV); glGenTextures(1, &(fp->texture)); + /* FIXME check gl error */ glBindTexture(GL_TEXTURE_RECTANGLE_NV, fp->texture); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, GL_ALPHA8, fp->w, fp->h, 0, GL_ALPHA, GL_UNSIGNED_BYTE, NULL); + /* FIXME check gl error */ } else { glGenTextures(1, &(fp->texture)); + /* FIXME check gl error */ glBindTexture(GL_TEXTURE_2D, fp->texture); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA8, fp->w, fp->h, 0, GL_ALPHA, GL_UNSIGNED_BYTE, NULL); + /* FIXME check gl error */ } /* new allocation entirely */ fa = calloc(1, sizeof(Evas_GL_Font_Texture_Pool_Allocation)); - if (!fa) return NULL; + if (!fa) + { + gc->tex_pool = evas_list_remove(gc->tex_pool, fp); + glDeleteTextures(1, &(fp->texture)); + free(fp); + return NULL; + } fa->pool = fp; fa->x = 0; fa->y = 0; fa->w = w; fa->h = h; fp->allocations = evas_list_prepend(fp->allocations, fa); + if (evas_list_alloc_error()) + { + gc->tex_pool = evas_list_remove(gc->tex_pool, fp); + glDeleteTextures(1, &(fp->texture)); + free(fp); + return NULL; + } fp->references++; return fa; } @@ -220,151 +401,3 @@ _evas_gl_font_texture_pool_rect_find(Evas_GL_Font_Texture_Pool *fp, } return 0; } - -Evas_GL_Font_Texture * -evas_gl_font_texture_new(Evas_GL_Context *gc, RGBA_Font_Glyph *fg) -{ - Evas_GL_Font_Texture *ft; - DATA8 *data; - int w, h, j; - - int nw; - DATA8 *ndata; - - ft = calloc(1, sizeof(Evas_GL_Font_Texture)); - if (!ft) return NULL; - - data = fg->glyph_out->bitmap.buffer; - w = fg->glyph_out->bitmap.width; - h = fg->glyph_out->bitmap.rows; - j = fg->glyph_out->bitmap.pitch; - if (j < w) j = w; - - ft->gc = gc; - - /* bug bug! glTexSubImage2D need a multiple of 4 pixels horizontally! :( */ - nw = ((w + 3) / 4 ) * 4; - ndata = malloc(nw *h); - if (!ndata) - { - free(ft); - return NULL; - } - { - int x, y; - DATA8 *p1, *p2; - - for (y = 0; y < h; y++) - { - p1 = data + (j * y); - p2 = ndata + (nw * y); - for (x = 0; x < w; x++) - { - *p2 = *p1; - p1++; - p2++; - } - } - } - - /* where in pool texture does this live */ - ft->w = w; - ft->h = h; - ft->aw = nw; - ft->ah = h; - - ft->alloc = _evas_gl_font_texture_pool_request(gc, ft->aw, ft->ah); - ft->x = ft->alloc->x; - ft->y = ft->alloc->y; - ft->pool = ft->alloc->pool; - ft->texture = ft->pool->texture; - if (ft->pool->not_power_of_two) - { - glEnable(GL_TEXTURE_RECTANGLE_NV); - glBindTexture(GL_TEXTURE_RECTANGLE_NV, ft->texture); - glTexSubImage2D(GL_TEXTURE_RECTANGLE_NV, 0, - ft->x, ft->y, nw, ft->h, - GL_ALPHA, GL_UNSIGNED_BYTE, ndata); - } - else - { - glBindTexture(GL_TEXTURE_2D, ft->texture); - glTexSubImage2D(GL_TEXTURE_2D, 0, - ft->x, ft->y, nw, ft->h, - GL_ALPHA, GL_UNSIGNED_BYTE, ndata); - } - if (ndata) free(ndata); - if (gc->texture) - { - if (gc->texture) gc->texture->references--; - gc->texture = NULL; - } - gc->font_texture = ft->texture; - gc->font_texture_not_power_of_two = ft->pool->not_power_of_two; - gc->change.texture = 1; - - return ft; -} - -void -evas_gl_font_texture_free(Evas_GL_Font_Texture *ft) -{ - if (ft->gc->font_texture == ft->texture) - { - ft->gc->font_texture = 0; - ft->gc->change.texture = 1; - } - - _evas_gl_font_texture_pool_relinquish(ft->alloc); - free(ft); -} - -void -evas_gl_font_texture_draw(Evas_GL_Context *gc, void *surface, RGBA_Draw_Context *dc, RGBA_Font_Glyph *fg, int x, int y) -{ - int r, g, b, a; - Evas_GL_Font_Texture *ft; - - ft = fg->ext_dat; - if (!ft) return; - a = (dc->col.col >> 24) & 0xff; - r = (dc->col.col >> 16) & 0xff; - g = (dc->col.col >> 8 ) & 0xff; - b = (dc->col.col ) & 0xff; - evas_gl_common_context_color_set(gc, r, g, b, a); - if (dc->clip.use) - evas_gl_common_context_clip_set(gc, 1, - dc->clip.x, dc->clip.y, - dc->clip.w, dc->clip.h); - else - evas_gl_common_context_clip_set(gc, 0, - 0, 0, 0, 0); - evas_gl_common_context_font_texture_set(gc, ft); - evas_gl_common_context_blend_set(gc, 1); - evas_gl_common_context_read_buf_set(gc, GL_BACK); - evas_gl_common_context_write_buf_set(gc, GL_BACK); - { - double tx1, ty1, tx2, ty2; - - if (ft->pool->not_power_of_two) - { - tx1 = ft->x; - ty1 = ft->y; - tx2 = ft->x + ft->w; - ty2 = ft->y + ft->h; - } - else - { - tx1 = (double)(ft->x ) / (double)(ft->pool->w); - ty1 = (double)(ft->y ) / (double)(ft->pool->h); - tx2 = (double)(ft->x + ft->w) / (double)(ft->pool->w); - ty2 = (double)(ft->y + ft->h) / (double)(ft->pool->h); - } - glBegin(GL_QUADS); - glTexCoord2d(tx1, ty1); glVertex2i(x , y ); - glTexCoord2d(tx2, ty1); glVertex2i(x + ft->w, y ); - glTexCoord2d(tx2, ty2); glVertex2i(x + ft->w, y + ft->h); - glTexCoord2d(tx1, ty2); glVertex2i(x , y + ft->h); - glEnd(); - } -} diff --git a/legacy/evas/src/lib/engines/gl_common/evas_gl_private.h b/legacy/evas/src/lib/engines/gl_common/evas_gl_private.h index 488eba50f2..7a9db7b89e 100644 --- a/legacy/evas/src/lib/engines/gl_common/evas_gl_private.h +++ b/legacy/evas/src/lib/engines/gl_common/evas_gl_private.h @@ -3,11 +3,19 @@ #include "evas_gl_common.h" -#if 1 +#ifndef GL_TEXTURE_RECTANGLE_NV +#define GL_TEXTURE_RECTANGLE_NV 0x84f5 +#endif + +#if 0 +#ifndef GL_WRITE_PIXEL_DATA_RANGE_NV /* nvidia extensions */ +extern void *glXAllocateMemoryNV(GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority); extern void glPixelDataRangeNV(GLenum target, GLsizei length, void *pointer); -#define GL_WRITE_PIXEL_DATA_RANGE_NV 0x8878 +extern void glFlushPixelDataRangeNV(GLenum target); +# define GL_WRITE_PIXEL_DATA_RANGE_NV 0x8878 #define GL_READ_PIXEL_DATA_RANGE_NV 0x8879 +#endif /* arb extensions */ void glBindBufferARB(GLenum target, uint buffer); @@ -62,9 +70,8 @@ void glGetBufferPointervARB(GLenum target, GLenum pname, void **params); #endif -#ifndef GL_TEXTURE_RECTANGLE_NV -#define GL_TEXTURE_RECTANGLE_NV 0x84f5 -#endif + + diff --git a/legacy/evas/src/lib/engines/gl_common/evas_gl_texture.c b/legacy/evas/src/lib/engines/gl_common/evas_gl_texture.c index f6d6b5ef07..f17b2361bc 100644 --- a/legacy/evas/src/lib/engines/gl_common/evas_gl_texture.c +++ b/legacy/evas/src/lib/engines/gl_common/evas_gl_texture.c @@ -138,23 +138,29 @@ evas_gl_common_texture_update(Evas_GL_Texture *tex, RGBA_Image *im, int smooth) if (tex->not_power_of_two) { + void *tmp = NULL, *data; + glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_RECTANGLE_NV); glBindTexture(GL_TEXTURE_RECTANGLE_NV, tex->texture); -// printf("%p\n", glXAllocateMemoryNV(64 * 64 * 4, 0.0, 1.0, 1.0)); -/* - if (!tex->opt) + data = im->image->data; +#if 0 // trying the glXAllocateMemoryNV() thing but its abysmally slow + tmp = glXAllocateMemoryNV(tex->w * tex->h * sizeof(DATA32), + 0.0, 1.0, 1.0); + if (tmp) { - glPixelDataRangeNV(GL_WRITE_PIXEL_DATA_RANGE_NV, - im->image->w * im->image->h * 4, - im->image->data); - printf("ER1: %s\n", gluErrorString(glGetError())); glEnableClientState(GL_WRITE_PIXEL_DATA_RANGE_NV); - printf("ER2: %s\n", gluErrorString(glGetError())); - tex->opt = 1; + glPixelDataRangeNV(GL_WRITE_PIXEL_DATA_RANGE_NV, + tex->w * tex->h * sizeof(DATA32), + tmp); +// evas_common_copy_pixels_rgba_to_rgba_mmx2(im->image->data, tmp, +// tex->w * tex->h); + memcpy(tmp, im->image->data, + tex->w * tex->h * sizeof(DATA32)); + data = tmp; } -*/ +#endif if (tex->gc->texture) tex->gc->texture->references--; tex->gc->texture = tex; tex->gc->change.texture = 1; @@ -164,21 +170,16 @@ evas_gl_common_texture_update(Evas_GL_Texture *tex, RGBA_Image *im, int smooth) else texfmt = GL_RGB8; pixfmt = NATIVE_PIX_FORMAT; - /* the MOMENT i call this call at ALL to update texture - * i instantly hit a MASSIVE speed hit - even for 1x1 pixel - */ - -#if 1 /* go from 2.3 to 15.9 if this is disabled */ glTexSubImage2D(GL_TEXTURE_RECTANGLE_NV, 0, 0, 0, tex->w, tex->h, pixfmt, NATIVE_PIX_UNIT, - im->image->data); -#else - /* also no speed difference to the above */ - glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, - texfmt, tex->w, tex->h, 0, - pixfmt, NATIVE_PIX_UNIT, - im->image->data); + data); +#if 0 // trying the glXAllocateMemoryNV() thing but its abysmally slow + if (tmp) + { + glFlushPixelDataRangeNV(GL_WRITE_PIXEL_DATA_RANGE_NV); + glXFreeMemoryNV(tmp); + } #endif return; } diff --git a/legacy/evas/src/lib/include/evas_common.h b/legacy/evas/src/lib/include/evas_common.h index 1addd9caa2..7701a2dd3f 100644 --- a/legacy/evas/src/lib/include/evas_common.h +++ b/legacy/evas/src/lib/include/evas_common.h @@ -201,10 +201,11 @@ typedef enum _CPU_Features { CPU_FEATURE_C = 0, CPU_FEATURE_MMX = (1 << 0), - CPU_FEATURE_SSE = (1 << 1), - CPU_FEATURE_ALTIVEC = (1 << 2), - CPU_FEATURE_VIS = (1 << 3), - CPU_FEATURE_VIS2 = (1 << 4) + CPU_FEATURE_MMX2 = (1 << 1), + CPU_FEATURE_SSE = (1 << 2), + CPU_FEATURE_ALTIVEC = (1 << 3), + CPU_FEATURE_VIS = (1 << 4), + CPU_FEATURE_VIS2 = (1 << 5) } CPU_Features; /*****************************************************************************/ @@ -600,6 +601,7 @@ void evas_common_blend_pixels_rgba_to_rgba_c (DATA32 *src, DATA32 *ds void evas_common_copy_pixels_rgba_to_rgba_c (DATA32 *src, DATA32 *dst, int len); void evas_common_copy_pixels_rgba_to_rgba_mmx (DATA32 *src, DATA32 *dst, int len); +void evas_common_copy_pixels_rgba_to_rgba_mmx2 (DATA32 *src, DATA32 *dst, int len); void evas_common_copy_pixels_rgba_to_rgba_sse/*NB*/ (DATA32 *src, DATA32 *dst, int len); void evas_common_copy_pixels_rgb_to_rgba_c (DATA32 *src, DATA32 *dst, int len); diff --git a/legacy/evas/src/lib/include/evas_gl_common.h b/legacy/evas/src/lib/include/evas_gl_common.h index f01f07db0c..c29843ce65 100644 --- a/legacy/evas/src/lib/include/evas_gl_common.h +++ b/legacy/evas/src/lib/include/evas_gl_common.h @@ -1,6 +1,13 @@ #ifndef EVAS_GL_COMMON_H #define EVAS_GL_COMMON_H +/* FIXME: need to handle memory errors */ +/* FIXME: need to handle list errors */ +/* FIXME: need to handle gl errors */ +/* FIXME: need to free textures is texture ream runs out */ +/* FIXME: need to break image textures into meshes if too big */ +/* FIXME: need to page mesh textures if texture alloc fails */ + #include "evas_common.h" #include "config.h"