whitespaces--------

SVN revision: 60426
This commit is contained in:
Vincent Torri 2011-06-17 07:47:28 +00:00
parent 19ef9ecc95
commit 18d1e68924
13 changed files with 667 additions and 670 deletions

View File

@ -6,7 +6,6 @@
#include "config.h" #include "config.h"
#include <stdio.h> #include <stdio.h>
#include <unistd.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <math.h> #include <math.h>
@ -134,9 +133,9 @@ struct _Evas_GL_Program_Source
struct _Evas_GL_Shared struct _Evas_GL_Shared
{ {
Eina_List *images; Eina_List *images;
int images_size; int images_size;
struct { struct {
GLint max_texture_units; GLint max_texture_units;
GLint max_texture_size; GLint max_texture_size;
@ -151,31 +150,31 @@ struct _Evas_GL_Shared
// tuning params - per gpu/cpu combo? // tuning params - per gpu/cpu combo?
#define MAX_CUTOUT 512 #define MAX_CUTOUT 512
#define DEF_CUTOUT 512 #define DEF_CUTOUT 512
// FIXME bug with pipes > 1 right now, should default to 32 // FIXME bug with pipes > 1 right now, should default to 32
#define MAX_PIPES 128 #define MAX_PIPES 128
#define DEF_PIPES 32 #define DEF_PIPES 32
#define DEF_PIPES_SGX_540 32 #define DEF_PIPES_SGX_540 32
#define DEF_PIPES_TEGRA_2 1 #define DEF_PIPES_TEGRA_2 1
#define MIN_ATLAS_ALLOC 16 #define MIN_ATLAS_ALLOC 16
#define MAX_ATLAS_ALLOC 1024 #define MAX_ATLAS_ALLOC 1024
#define DEF_ATLAS_ALLOC 1024 #define DEF_ATLAS_ALLOC 1024
#define MIN_ATLAS_ALLOC_ALPHA 16 #define MIN_ATLAS_ALLOC_ALPHA 16
#define MAX_ATLAS_ALLOC_ALPHA 4096 #define MAX_ATLAS_ALLOC_ALPHA 4096
#define DEF_ATLAS_ALLOC_ALPHA 4096 #define DEF_ATLAS_ALLOC_ALPHA 4096
#define MAX_ATLAS_W 512 #define MAX_ATLAS_W 512
#define DEF_ATLAS_W 512 #define DEF_ATLAS_W 512
#define MAX_ATLAS_H 512 #define MAX_ATLAS_H 512
#define DEF_ATLAS_H 512 #define DEF_ATLAS_H 512
#define MIN_ATLAS_SLOT 16 #define MIN_ATLAS_SLOT 16
#define MAX_ATLAS_SLOT 512 #define MAX_ATLAS_SLOT 512
#define DEF_ATLAS_SLOT 16 #define DEF_ATLAS_SLOT 16
struct { struct {
struct { struct {
int max; int max;
@ -192,19 +191,19 @@ struct _Evas_GL_Shared
} atlas; } atlas;
} tune; } tune;
} info; } info;
struct { struct {
Eina_List *whole; Eina_List *whole;
Eina_List *atlas[33][3]; Eina_List *atlas[33][3];
} tex; } tex;
Eina_Hash *native_pm_hash; Eina_Hash *native_pm_hash;
Eina_Hash *native_tex_hash; Eina_Hash *native_tex_hash;
struct { struct {
Evas_GL_Program rect; Evas_GL_Program rect;
Evas_GL_Program font; Evas_GL_Program font;
Evas_GL_Program img, img_nomul; Evas_GL_Program img, img_nomul;
Evas_GL_Program img_bgra, img_bgra_nomul; Evas_GL_Program img_bgra, img_bgra_nomul;
Evas_GL_Program img_mask; Evas_GL_Program img_mask;
@ -236,7 +235,7 @@ struct _Evas_GL_Shared
#define RTYPE_IMAGE 2 #define RTYPE_IMAGE 2
#define RTYPE_FONT 3 #define RTYPE_FONT 3
#define RTYPE_YUV 4 #define RTYPE_YUV 4
#define RTYPE_MAP 5 /* need to merge with image */ #define RTYPE_MAP 5 /* need to merge with image */
#define RTYPE_IMASK 6 #define RTYPE_IMASK 6
@ -248,7 +247,7 @@ struct _Evas_Engine_GL_Context
int rot; int rot;
int foc, z0, px, py; int foc, z0, px, py;
RGBA_Draw_Context *dc; RGBA_Draw_Context *dc;
Evas_GL_Shared *shared; Evas_GL_Shared *shared;
int flushnum; int flushnum;
@ -265,7 +264,7 @@ struct _Evas_Engine_GL_Context
int clip; int clip;
} current; } current;
} state; } state;
struct { struct {
struct { struct {
int x, y, w, h; int x, y, w, h;
@ -303,22 +302,22 @@ struct _Evas_Engine_GL_Context
Evas_GL_Image *im; Evas_GL_Image *im;
} array; } array;
} pipe[MAX_PIPES]; } pipe[MAX_PIPES];
struct { struct {
Eina_Bool size : 1; Eina_Bool size : 1;
} change; } change;
Eina_Bool havestuff : 1; Eina_Bool havestuff : 1;
Evas_GL_Image *def_surface; Evas_GL_Image *def_surface;
/* If this is set: Force drawing with a particular filter */ /* If this is set: Force drawing with a particular filter */
GLuint filter_prog; GLuint filter_prog;
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
// FIXME: hack. expose egl display to gl core for egl image sec extn. // FIXME: hack. expose egl display to gl core for egl image sec extn.
void *egldisp; void *egldisp;
#endif #endif
}; };
struct _Evas_GL_Texture_Pool struct _Evas_GL_Texture_Pool
@ -350,7 +349,7 @@ struct _Evas_GL_Texture
int x, y, w, h; int x, y, w, h;
double sx1, sy1, sx2, sy2; double sx1, sy1, sx2, sy2;
int references; int references;
Eina_Bool alpha : 1; Eina_Bool alpha : 1;
}; };
@ -368,7 +367,7 @@ struct _Evas_GL_Image
void *data; void *data;
unsigned char no_free : 1; unsigned char no_free : 1;
} cs; } cs;
struct { struct {
void *data; void *data;
struct { struct {
@ -385,7 +384,7 @@ struct _Evas_GL_Image
int scale_hint, content_hint; int scale_hint, content_hint;
int csize; int csize;
Eina_List *filtered; Eina_List *filtered;
unsigned char dirty : 1; unsigned char dirty : 1;
@ -458,7 +457,7 @@ extern Evas_GL_Program_Source shader_filter_blur_bgra_nomul_frag_src;
#endif #endif
void glerr(int err, const char *file, const char *func, int line, const char *op); void glerr(int err, const char *file, const char *func, int line, const char *op);
Evas_Engine_GL_Context *evas_gl_common_context_new(void); Evas_Engine_GL_Context *evas_gl_common_context_new(void);
void evas_gl_common_context_free(Evas_Engine_GL_Context *gc); void evas_gl_common_context_free(Evas_Engine_GL_Context *gc);
void evas_gl_common_context_use(Evas_Engine_GL_Context *gc); void evas_gl_common_context_use(Evas_Engine_GL_Context *gc);
@ -506,7 +505,7 @@ void evas_gl_common_context_image_map_push(Evas_Engine_GL_Context *g
RGBA_Map_Point *p, RGBA_Map_Point *p,
int clip, int cx, int cy, int cw, int ch, int clip, int cx, int cy, int cw, int ch,
int r, int g, int b, int a, int r, int g, int b, int a,
Eina_Bool smooth, Eina_Bool smooth,
Eina_Bool tex_only, Eina_Bool tex_only,
Eina_Bool yuv); Eina_Bool yuv);
void evas_gl_common_context_flush(Evas_Engine_GL_Context *gc); void evas_gl_common_context_flush(Evas_Engine_GL_Context *gc);
@ -514,7 +513,7 @@ void evas_gl_common_context_flush(Evas_Engine_GL_Context *gc);
int evas_gl_common_shader_program_init(Evas_GL_Shared *shared); int evas_gl_common_shader_program_init(Evas_GL_Shared *shared);
void evas_gl_common_shader_program_init_done(void); void evas_gl_common_shader_program_init_done(void);
void evas_gl_common_shader_program_shutdown(Evas_GL_Program *p); void evas_gl_common_shader_program_shutdown(Evas_GL_Program *p);
void evas_gl_common_rect_draw(Evas_Engine_GL_Context *gc, int x, int y, int w, int h); void evas_gl_common_rect_draw(Evas_Engine_GL_Context *gc, int x, int y, int w, int h);
void evas_gl_texture_pool_empty(Evas_GL_Texture_Pool *pt); void evas_gl_texture_pool_empty(Evas_GL_Texture_Pool *pt);

File diff suppressed because it is too large Load Diff

View File

@ -11,7 +11,7 @@ evas_gl_font_texture_new(void *context, RGBA_Font_Glyph *fg)
int fh; int fh;
if (fg->ext_dat) return fg->ext_dat; // FIXME: one engine at a time can do this :( if (fg->ext_dat) return fg->ext_dat; // FIXME: one engine at a time can do this :(
w = fg->glyph_out->bitmap.width; w = fg->glyph_out->bitmap.width;
h = fg->glyph_out->bitmap.rows; h = fg->glyph_out->bitmap.rows;
if ((w == 0) || (h == 0)) return NULL; if ((w == 0) || (h == 0)) return NULL;
@ -45,13 +45,13 @@ evas_gl_font_texture_new(void *context, RGBA_Font_Glyph *fg)
DATA8 *tmpbuf = NULL, *dp, *tp, bits; DATA8 *tmpbuf = NULL, *dp, *tp, bits;
int bi, bj, end; int bi, bj, end;
const DATA8 bitrepl[2] = {0x0, 0xff}; const DATA8 bitrepl[2] = {0x0, 0xff};
tmpbuf = alloca(w); tmpbuf = alloca(w);
if (tmpbuf) if (tmpbuf)
{ {
int x, y; int x, y;
DATA8 *p1, *p2; DATA8 *p1, *p2;
for (y = 0; y < h; y++) for (y = 0; y < h; y++)
{ {
p1 = tmpbuf; p1 = tmpbuf;
@ -109,7 +109,7 @@ evas_gl_font_texture_draw(void *context, void *surface __UNUSED__, void *draw_co
int c, cx, cy, cw, ch; int c, cx, cy, cw, ch;
int i; int i;
int sx, sy, sw, sh; int sx, sy, sw, sh;
if (dc != gc->dc) return; if (dc != gc->dc) return;
tex = fg->ext_dat; tex = fg->ext_dat;
if (!tex) return; if (!tex) return;
@ -119,14 +119,14 @@ evas_gl_font_texture_draw(void *context, void *surface __UNUSED__, void *draw_co
g = (dc->col.col >> 8 ) & 0xff; g = (dc->col.col >> 8 ) & 0xff;
b = (dc->col.col ) & 0xff; b = (dc->col.col ) & 0xff;
sx = 0; sy = 0; sw = tex->w, sh = tex->h; sx = 0; sy = 0; sw = tex->w, sh = tex->h;
if ((!gc->dc->cutout.rects) if ((!gc->dc->cutout.rects)
// || (gc->dc->cutout.active > 32) // || (gc->dc->cutout.active > 32)
) )
{ {
if (gc->dc->clip.use) if (gc->dc->clip.use)
{ {
int nx, ny, nw, nh; int nx, ny, nw, nh;
nx = x; ny = y; nw = tex->w; nh = tex->h; nx = x; ny = y; nw = tex->w; nh = tex->h;
RECTS_CLIP_TO_RECT(nx, ny, nw, nh, RECTS_CLIP_TO_RECT(nx, ny, nw, nh,
gc->dc->clip.x, gc->dc->clip.y, gc->dc->clip.x, gc->dc->clip.y,
@ -145,14 +145,14 @@ evas_gl_font_texture_draw(void *context, void *surface __UNUSED__, void *draw_co
ssy = (double)sy + ((double)(sh * (ny - y)) / (double)(tex->h)); ssy = (double)sy + ((double)(sh * (ny - y)) / (double)(tex->h));
ssw = ((double)sw * (double)(nw)) / (double)(tex->w); ssw = ((double)sw * (double)(nw)) / (double)(tex->w);
ssh = ((double)sh * (double)(nh)) / (double)(tex->h); ssh = ((double)sh * (double)(nh)) / (double)(tex->h);
evas_gl_common_context_font_push(gc, tex, evas_gl_common_context_font_push(gc, tex,
ssx, ssy, ssw, ssh, ssx, ssy, ssw, ssh,
nx, ny, nw, nh, nx, ny, nw, nh,
r, g, b, a); r, g, b, a);
} }
else else
{ {
evas_gl_common_context_font_push(gc, tex, evas_gl_common_context_font_push(gc, tex,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
// sx, sy, sw, sh, // sx, sy, sw, sh,
x, y, tex->w, tex->h, x, y, tex->w, tex->h,
@ -174,7 +174,7 @@ evas_gl_font_texture_draw(void *context, void *surface __UNUSED__, void *draw_co
for (i = 0; i < rects->active; ++i) for (i = 0; i < rects->active; ++i)
{ {
int nx, ny, nw, nh; int nx, ny, nw, nh;
rct = rects->rects + i; rct = rects->rects + i;
nx = x; ny = y; nw = tex->w; nh = tex->h; nx = x; ny = y; nw = tex->w; nh = tex->h;
RECTS_CLIP_TO_RECT(nx, ny, nw, nh, rct->x, rct->y, rct->w, rct->h); RECTS_CLIP_TO_RECT(nx, ny, nw, nh, rct->x, rct->y, rct->w, rct->h);
@ -192,7 +192,7 @@ evas_gl_font_texture_draw(void *context, void *surface __UNUSED__, void *draw_co
ssy = (double)sy + ((double)(sh * (ny - y)) / (double)(tex->h)); ssy = (double)sy + ((double)(sh * (ny - y)) / (double)(tex->h));
ssw = ((double)sw * (double)(nw)) / (double)(tex->w); ssw = ((double)sw * (double)(nw)) / (double)(tex->w);
ssh = ((double)sh * (double)(nh)) / (double)(tex->h); ssh = ((double)sh * (double)(nh)) / (double)(tex->h);
evas_gl_common_context_font_push(gc, tex, evas_gl_common_context_font_push(gc, tex,
ssx, ssy, ssw, ssh, ssx, ssy, ssw, ssh,
nx, ny, nw, nh, nx, ny, nw, nh,
r, g, b, a); r, g, b, a);

View File

@ -5,7 +5,7 @@ evas_gl_common_image_all_unload(Evas_Engine_GL_Context *gc)
{ {
Eina_List *l; Eina_List *l;
Evas_GL_Image *im; Evas_GL_Image *im;
EINA_LIST_FOREACH(gc->shared->images, l, im) EINA_LIST_FOREACH(gc->shared->images, l, im)
{ {
if (im->im) evas_cache_image_unload_data(&im->im->cache_entry); if (im->im) evas_cache_image_unload_data(&im->im->cache_entry);
@ -35,7 +35,7 @@ _evas_gl_image_cache_trim(Evas_Engine_GL_Context *gc)
if (im2->references == 0) if (im2->references == 0)
{ {
im2->cached = 0; im2->cached = 0;
im2->gc->shared->images = im2->gc->shared->images =
eina_list_remove_list(im2->gc->shared->images, l); eina_list_remove_list(im2->gc->shared->images, l);
im2->gc->shared->images_size -= (im2->csize); im2->gc->shared->images_size -= (im2->csize);
evas_gl_common_image_free(im2); evas_gl_common_image_free(im2);
@ -45,13 +45,13 @@ _evas_gl_image_cache_trim(Evas_Engine_GL_Context *gc)
} }
if ((gc->shared->images_size > size) && (l)) if ((gc->shared->images_size > size) && (l))
{ {
printf("EEK %i > %i, no 0 ref imgs\n", printf("EEK %i > %i, no 0 ref imgs\n",
gc->shared->images_size, size); gc->shared->images_size, size);
break; break;
} }
if (!gc->shared->images) if (!gc->shared->images)
{ {
printf("EEK %i > %i, no imgs\n", printf("EEK %i > %i, no imgs\n",
gc->shared->images_size, size); gc->shared->images_size, size);
break; break;
} }
@ -323,7 +323,7 @@ evas_gl_common_image_native_enable(Evas_GL_Image *im)
evas_gl_common_texture_free(im->tex); evas_gl_common_texture_free(im->tex);
im->tex = NULL; im->tex = NULL;
} }
im->cs.space = EVAS_COLORSPACE_ARGB8888; im->cs.space = EVAS_COLORSPACE_ARGB8888;
im->tex = evas_gl_common_texture_native_new(im->gc, im->w, im->h, im->alpha, im); im->tex = evas_gl_common_texture_native_new(im->gc, im->w, im->h, im->alpha, im);
im->tex_only = 1; im->tex_only = 1;
@ -343,7 +343,7 @@ evas_gl_common_image_native_disable(Evas_GL_Image *im)
im->tex = NULL; im->tex = NULL;
} }
im->tex_only = 0; im->tex_only = 0;
im->im = (RGBA_Image *)evas_cache_image_empty(evas_common_image_cache_get()); im->im = (RGBA_Image *)evas_cache_image_empty(evas_common_image_cache_get());
im->im->cache_entry.flags.alpha = im->alpha; im->im->cache_entry.flags.alpha = im->alpha;
im->cs.space = EVAS_COLORSPACE_ARGB8888; im->cs.space = EVAS_COLORSPACE_ARGB8888;
@ -413,7 +413,7 @@ evas_gl_common_image_content_hint_set(Evas_GL_Image *im, int hint)
im->tex = NULL; im->tex = NULL;
} }
im->tex_only = 0; im->tex_only = 0;
im->im = (RGBA_Image *)evas_cache_image_empty(evas_common_image_cache_get()); im->im = (RGBA_Image *)evas_cache_image_empty(evas_common_image_cache_get());
im->im->cache_entry.flags.alpha = im->alpha; im->im->cache_entry.flags.alpha = im->alpha;
im->cs.space = EVAS_COLORSPACE_ARGB8888; im->cs.space = EVAS_COLORSPACE_ARGB8888;
@ -436,14 +436,14 @@ evas_gl_common_image_free(Evas_GL_Image *im)
#if 0 // filtering disabled #if 0 // filtering disabled
Filtered_Image *fi; Filtered_Image *fi;
#endif #endif
evas_gl_common_context_flush(im->gc); evas_gl_common_context_flush(im->gc);
im->references--; im->references--;
if (im->references > 0) return; if (im->references > 0) return;
if (im->native.func.free) if (im->native.func.free)
im->native.func.free(im->native.func.data, im); im->native.func.free(im->native.func.data, im);
if (im->cs.data) if (im->cs.data)
{ {
if (!im->cs.no_free) free(im->cs.data); if (!im->cs.no_free) free(im->cs.data);
@ -504,7 +504,7 @@ void
evas_gl_common_image_update(Evas_Engine_GL_Context *gc, Evas_GL_Image *im) evas_gl_common_image_update(Evas_Engine_GL_Context *gc, Evas_GL_Image *im)
{ {
if (!im->im) return; if (!im->im) return;
/* /*
if ((im->cs.space == EVAS_COLORSPACE_YCBCR422P601_PL) || if ((im->cs.space == EVAS_COLORSPACE_YCBCR422P601_PL) ||
(im->cs.space == EVAS_COLORSPACE_YCBCR422P709_PL)) (im->cs.space == EVAS_COLORSPACE_YCBCR422P709_PL))
{ {
@ -516,7 +516,7 @@ evas_gl_common_image_update(Evas_Engine_GL_Context *gc, Evas_GL_Image *im)
free(im->im->image.data); free(im->im->image.data);
im->im->image.data = malloc(im->im->cache_entry.w * im->im->cache_entry.h * sizeof(DATA32)); im->im->image.data = malloc(im->im->cache_entry.w * im->im->cache_entry.h * sizeof(DATA32));
if (im->im->image.data) if (im->im->image.data)
evas_common_convert_yuv_420p_601_rgba(im->cs.data, evas_common_convert_yuv_420p_601_rgba(im->cs.data,
(void *)im->im->image.data, (void *)im->im->image.data,
im->im->cache_entry.w, im->im->cache_entry.h); im->im->cache_entry.w, im->im->cache_entry.h);
} }
@ -548,14 +548,14 @@ evas_gl_common_image_update(Evas_Engine_GL_Context *gc, Evas_GL_Image *im)
if ((im->tex) && (im->dirty)) if ((im->tex) && (im->dirty))
{ {
evas_gl_common_texture_yuv_update(im->tex, im->cs.data, evas_gl_common_texture_yuv_update(im->tex, im->cs.data,
im->im->cache_entry.w, im->im->cache_entry.w,
im->im->cache_entry.h); im->im->cache_entry.h);
im->dirty = 0; im->dirty = 0;
} }
if ((!im->tex) && (im->cs.data) && (*((unsigned char **)im->cs.data))) if ((!im->tex) && (im->cs.data) && (*((unsigned char **)im->cs.data)))
{ {
im->tex = evas_gl_common_texture_yuv_new(gc, im->cs.data, im->tex = evas_gl_common_texture_yuv_new(gc, im->cs.data,
im->im->cache_entry.w, im->im->cache_entry.w,
im->im->cache_entry.h); im->im->cache_entry.h);
im->dirty = 0; im->dirty = 0;
} }
@ -568,14 +568,14 @@ evas_gl_common_image_update(Evas_Engine_GL_Context *gc, Evas_GL_Image *im)
} }
void void
evas_gl_common_image_map_draw(Evas_Engine_GL_Context *gc, Evas_GL_Image *im, evas_gl_common_image_map_draw(Evas_Engine_GL_Context *gc, Evas_GL_Image *im,
int npoints, RGBA_Map_Point *p, int smooth, int level __UNUSED__) int npoints, RGBA_Map_Point *p, int smooth, int level __UNUSED__)
{ {
RGBA_Draw_Context *dc; RGBA_Draw_Context *dc;
int r, g, b, a; int r, g, b, a;
int c, cx, cy, cw, ch; int c, cx, cy, cw, ch;
Eina_Bool yuv = 0; Eina_Bool yuv = 0;
dc = gc->dc; dc = gc->dc;
if (dc->mul.use) if (dc->mul.use)
{ {
@ -588,18 +588,18 @@ evas_gl_common_image_map_draw(Evas_Engine_GL_Context *gc, Evas_GL_Image *im,
{ {
r = g = b = a = 255; r = g = b = a = 255;
} }
evas_gl_common_image_update(gc, im); evas_gl_common_image_update(gc, im);
c = gc->dc->clip.use; c = gc->dc->clip.use;
cx = gc->dc->clip.x; cy = gc->dc->clip.y; cx = gc->dc->clip.x; cy = gc->dc->clip.y;
cw = gc->dc->clip.w; ch = gc->dc->clip.h; cw = gc->dc->clip.w; ch = gc->dc->clip.h;
im->tex->im = im; im->tex->im = im;
if ((im->cs.space == EVAS_COLORSPACE_YCBCR422P601_PL) || if ((im->cs.space == EVAS_COLORSPACE_YCBCR422P601_PL) ||
(im->cs.space == EVAS_COLORSPACE_YCBCR422P709_PL)) (im->cs.space == EVAS_COLORSPACE_YCBCR422P709_PL))
yuv = 1; yuv = 1;
evas_gl_common_context_image_map_push(gc, im->tex, npoints, p, evas_gl_common_context_image_map_push(gc, im->tex, npoints, p,
c, cx, cy, cw, ch, c, cx, cy, cw, ch,
r, g, b, a, smooth, im->tex_only, r, g, b, a, smooth, im->tex_only,
yuv); yuv);
} }
@ -617,7 +617,7 @@ evas_gl_common_image_draw(Evas_Engine_GL_Context *gc, Evas_GL_Image *im, int sx,
int c, cx, cy, cw, ch; int c, cx, cy, cw, ch;
int i; int i;
int yuv = 0; int yuv = 0;
if (sw < 1) sw = 1; if (sw < 1) sw = 1;
if (sh < 1) sh = 1; if (sh < 1) sh = 1;
dc = gc->dc; dc = gc->dc;
@ -633,7 +633,7 @@ evas_gl_common_image_draw(Evas_Engine_GL_Context *gc, Evas_GL_Image *im, int sx,
{ {
r = g = b = a = 255; r = g = b = a = 255;
} }
evas_gl_common_image_update(gc, im); evas_gl_common_image_update(gc, im);
if (!im->tex) if (!im->tex)
{ {
@ -744,7 +744,7 @@ evas_gl_common_image_draw(Evas_Engine_GL_Context *gc, Evas_GL_Image *im, int sx,
} }
return; return;
} }
/* save out clip info */ /* save out clip info */
c = gc->dc->clip.use; cx = gc->dc->clip.x; cy = gc->dc->clip.y; cw = gc->dc->clip.w; ch = gc->dc->clip.h; c = gc->dc->clip.use; cx = gc->dc->clip.x; cy = gc->dc->clip.y; cw = gc->dc->clip.w; ch = gc->dc->clip.h;
evas_common_draw_context_clip_clip(gc->dc, 0, 0, gc->w, gc->h); evas_common_draw_context_clip_clip(gc->dc, 0, 0, gc->w, gc->h);

View File

@ -6,7 +6,7 @@ evas_gl_common_line_draw(Evas_Engine_GL_Context *gc, int x1, int y1, int x2, int
RGBA_Draw_Context *dc; RGBA_Draw_Context *dc;
int r, g, b, a; int r, g, b, a;
int c, cx, cy, cw, ch; int c, cx, cy, cw, ch;
dc = gc->dc; dc = gc->dc;
if (dc->mul.use) if (dc->mul.use)
{ {
@ -21,12 +21,12 @@ evas_gl_common_line_draw(Evas_Engine_GL_Context *gc, int x1, int y1, int x2, int
} }
glFlush(); glFlush();
c = gc->dc->clip.use; c = gc->dc->clip.use;
cx = gc->dc->clip.x; cy = gc->dc->clip.y; cx = gc->dc->clip.x; cy = gc->dc->clip.y;
cw = gc->dc->clip.w; ch = gc->dc->clip.h; cw = gc->dc->clip.w; ch = gc->dc->clip.h;
evas_gl_common_context_line_push(gc, x1, y1, x2, y2, evas_gl_common_context_line_push(gc, x1, y1, x2, y2,
c, cx, cy, cw, ch, c, cx, cy, cw, ch,
r, g, b, a); r, g, b, a);
} }

View File

@ -101,7 +101,7 @@ static int
polygon_point_sorter(const void *a, const void *b) polygon_point_sorter(const void *a, const void *b)
{ {
RGBA_Vertex *p, *q; RGBA_Vertex *p, *q;
p = (RGBA_Vertex *)a; p = (RGBA_Vertex *)a;
q = (RGBA_Vertex *)b; q = (RGBA_Vertex *)b;
if (p->y <= q->y) return -1; if (p->y <= q->y) return -1;
@ -112,7 +112,7 @@ static int
polygon_edge_sorter(const void *a, const void *b) polygon_edge_sorter(const void *a, const void *b)
{ {
RGBA_Edge *p, *q; RGBA_Edge *p, *q;
p = (RGBA_Edge *)a; p = (RGBA_Edge *)a;
q = (RGBA_Edge *)b; q = (RGBA_Edge *)b;
if (p->x <= q->x) return -1; if (p->x <= q->x) return -1;
@ -133,7 +133,7 @@ evas_gl_common_poly_draw(Evas_Engine_GL_Context *gc, Evas_GL_Polygon *poly, int
RGBA_Vertex *point; RGBA_Vertex *point;
Evas_GL_Polygon_Point *pt; Evas_GL_Polygon_Point *pt;
Eina_Inlist *spans; Eina_Inlist *spans;
/* save out clip info */ /* save out clip info */
c = gc->dc->clip.use; cx = gc->dc->clip.x; cy = gc->dc->clip.y; cw = gc->dc->clip.w; ch = gc->dc->clip.h; c = gc->dc->clip.use; cx = gc->dc->clip.x; cy = gc->dc->clip.y; cw = gc->dc->clip.w; ch = gc->dc->clip.h;
@ -142,7 +142,7 @@ evas_gl_common_poly_draw(Evas_Engine_GL_Context *gc, Evas_GL_Polygon *poly, int
cr = (gc->dc->col.col >> 16) & 0xff; cr = (gc->dc->col.col >> 16) & 0xff;
cg = (gc->dc->col.col >> 8 ) & 0xff; cg = (gc->dc->col.col >> 8 ) & 0xff;
cb = (gc->dc->col.col ) & 0xff; cb = (gc->dc->col.col ) & 0xff;
n = eina_list_count(poly->points); n = eina_list_count(poly->points);
if (n < 3) return; if (n < 3) return;
edges = malloc(sizeof(RGBA_Edge) * n); edges = malloc(sizeof(RGBA_Edge) * n);
@ -160,7 +160,7 @@ evas_gl_common_poly_draw(Evas_Engine_GL_Context *gc, Evas_GL_Polygon *poly, int
free(point); free(point);
return; return;
} }
k = 0; k = 0;
EINA_LIST_FOREACH(poly->points, l, pt) EINA_LIST_FOREACH(poly->points, l, pt)
{ {
@ -180,20 +180,20 @@ evas_gl_common_poly_draw(Evas_Engine_GL_Context *gc, Evas_GL_Polygon *poly, int
point[k].i = k; point[k].i = k;
k++; k++;
} }
y0 = MAX(cy, ceil(point[sorted_index[0]].y - 0.5)); y0 = MAX(cy, ceil(point[sorted_index[0]].y - 0.5));
y1 = MIN(cy + ch - 1, floor(point[sorted_index[n - 1]].y - 0.5)); y1 = MIN(cy + ch - 1, floor(point[sorted_index[n - 1]].y - 0.5));
k = 0; k = 0;
num_active_edges = 0; num_active_edges = 0;
spans = NULL; spans = NULL;
for (y = y0; y <= y1; y++) for (y = y0; y <= y1; y++)
{ {
for (; (k < n) && (point[sorted_index[k]].y <= ((double)y + 0.5)); k++) for (; (k < n) && (point[sorted_index[k]].y <= ((double)y + 0.5)); k++)
{ {
i = sorted_index[k]; i = sorted_index[k];
if (i > 0) j = i - 1; if (i > 0) j = i - 1;
else j = n - 1; else j = n - 1;
if (point[j].y <= ((double)y - 0.5)) if (point[j].y <= ((double)y - 0.5))
@ -215,13 +215,13 @@ evas_gl_common_poly_draw(Evas_Engine_GL_Context *gc, Evas_GL_Polygon *poly, int
POLY_EDGE_ADD(i, y) POLY_EDGE_ADD(i, y)
} }
} }
qsort(edges, num_active_edges, sizeof(RGBA_Edge), polygon_edge_sorter); qsort(edges, num_active_edges, sizeof(RGBA_Edge), polygon_edge_sorter);
for (j = 0; j < num_active_edges; j += 2) for (j = 0; j < num_active_edges; j += 2)
{ {
int x0, x1; int x0, x1;
x0 = ceil(edges[j].x - 0.5); x0 = ceil(edges[j].x - 0.5);
if (j < (num_active_edges - 1)) if (j < (num_active_edges - 1))
x1 = floor(edges[j + 1].x - 0.5); x1 = floor(edges[j + 1].x - 0.5);
@ -230,7 +230,7 @@ evas_gl_common_poly_draw(Evas_Engine_GL_Context *gc, Evas_GL_Polygon *poly, int
if ((x1 >= cx) && (x0 < (cx + cw)) && (x0 <= x1)) if ((x1 >= cx) && (x0 < (cx + cw)) && (x0 <= x1))
{ {
RGBA_Span *span; RGBA_Span *span;
if (x0 < cx) x0 = cx; if (x0 < cx) x0 = cx;
if (x1 >= (cx + cw)) x1 = cx + cw - 1; if (x1 >= (cx + cw)) x1 = cx + cw - 1;
span = malloc(sizeof(RGBA_Span)); span = malloc(sizeof(RGBA_Span));
@ -243,13 +243,13 @@ evas_gl_common_poly_draw(Evas_Engine_GL_Context *gc, Evas_GL_Polygon *poly, int
edges[j + 1].x += edges[j + 1].dx; edges[j + 1].x += edges[j + 1].dx;
} }
} }
free(edges); free(edges);
free(point); free(point);
free(sorted_index); free(sorted_index);
evas_common_draw_context_clip_clip(gc->dc, 0, 0, gc->w, gc->h); evas_common_draw_context_clip_clip(gc->dc, 0, 0, gc->w, gc->h);
if (spans) if (spans)
{ {
RGBA_Span *span; RGBA_Span *span;
@ -298,9 +298,9 @@ evas_gl_common_poly_draw(Evas_Engine_GL_Context *gc, Evas_GL_Polygon *poly, int
span = (RGBA_Span *)spans; span = (RGBA_Span *)spans;
spans = eina_inlist_remove(spans, spans); spans = eina_inlist_remove(spans, spans);
free(span); free(span);
} }
} }
/* restore clip info */ /* restore clip info */
gc->dc->clip.use = c; gc->dc->clip.x = cx; gc->dc->clip.y = cy; gc->dc->clip.w = cw; gc->dc->clip.h = ch; gc->dc->clip.use = c; gc->dc->clip.x = cx; gc->dc->clip.y = cy; gc->dc->clip.w = cw; gc->dc->clip.h = ch;

View File

@ -6,12 +6,12 @@ evas_gl_common_rect_draw(Evas_Engine_GL_Context *gc, int x, int y, int w, int h)
Cutout_Rects *rects; Cutout_Rects *rects;
Cutout_Rect *r; Cutout_Rect *r;
int c, cx, cy, cw, ch, cr, cg, cb, ca, i; int c, cx, cy, cw, ch, cr, cg, cb, ca, i;
if ((w <= 0) || (h <= 0)) return; if ((w <= 0) || (h <= 0)) return;
if (!(RECTS_INTERSECT(x, y, w, h, 0, 0, gc->w, gc->h))) return; if (!(RECTS_INTERSECT(x, y, w, h, 0, 0, gc->w, gc->h))) return;
/* save out clip info */ /* save out clip info */
c = gc->dc->clip.use; cx = gc->dc->clip.x; cy = gc->dc->clip.y; cw = gc->dc->clip.w; ch = gc->dc->clip.h; c = gc->dc->clip.use; cx = gc->dc->clip.x; cy = gc->dc->clip.y; cw = gc->dc->clip.w; ch = gc->dc->clip.h;
ca = (gc->dc->col.col >> 24) & 0xff; ca = (gc->dc->col.col >> 24) & 0xff;
if ((gc->dc->render_op != EVAS_RENDER_COPY) && (ca <= 0)) return; if ((gc->dc->render_op != EVAS_RENDER_COPY) && (ca <= 0)) return;
cr = (gc->dc->col.col >> 16) & 0xff; cr = (gc->dc->col.col >> 16) & 0xff;
@ -25,7 +25,7 @@ evas_gl_common_rect_draw(Evas_Engine_GL_Context *gc, int x, int y, int w, int h)
gc->dc->clip.x, gc->dc->clip.y, gc->dc->clip.x, gc->dc->clip.y,
gc->dc->clip.w, gc->dc->clip.h); gc->dc->clip.w, gc->dc->clip.h);
} }
if (!gc->dc->cutout.rects) if (!gc->dc->cutout.rects)
{ {
evas_gl_common_context_rectangle_push(gc, x, y, w, h, cr, cg, cb, ca); evas_gl_common_context_rectangle_push(gc, x, y, w, h, cr, cg, cb, ca);

View File

@ -16,9 +16,9 @@ Evas_GL_Program_Source shader_rect_frag_src =
rect_frag_glsl, rect_frag_glsl,
#if defined (GLES_VARIETY_S3C6410) #if defined (GLES_VARIETY_S3C6410)
rect_frag_bin, sizeof(rect_frag_bin) rect_frag_bin, sizeof(rect_frag_bin)
#else #else
NULL, 0 NULL, 0
#endif #endif
}; };
#if defined (GLES_VARIETY_S3C6410) #if defined (GLES_VARIETY_S3C6410)
@ -35,9 +35,9 @@ Evas_GL_Program_Source shader_rect_vert_src =
rect_vert_glsl, rect_vert_glsl,
#if defined (GLES_VARIETY_S3C6410) #if defined (GLES_VARIETY_S3C6410)
rect_vert_bin, sizeof(rect_vert_bin) rect_vert_bin, sizeof(rect_vert_bin)
#else #else
NULL, 0 NULL, 0
#endif #endif
}; };
///////////////////////////////////////////// /////////////////////////////////////////////
@ -56,9 +56,9 @@ Evas_GL_Program_Source shader_font_frag_src =
font_frag_glsl, font_frag_glsl,
#if defined (GLES_VARIETY_S3C6410) #if defined (GLES_VARIETY_S3C6410)
font_frag_bin, sizeof(font_frag_bin) font_frag_bin, sizeof(font_frag_bin)
#else #else
NULL, 0 NULL, 0
#endif #endif
}; };
#if defined (GLES_VARIETY_S3C6410) #if defined (GLES_VARIETY_S3C6410)
@ -75,9 +75,9 @@ Evas_GL_Program_Source shader_font_vert_src =
font_vert_glsl, font_vert_glsl,
#if defined (GLES_VARIETY_S3C6410) #if defined (GLES_VARIETY_S3C6410)
font_vert_bin, sizeof(font_vert_bin) font_vert_bin, sizeof(font_vert_bin)
#else #else
NULL, 0 NULL, 0
#endif #endif
}; };
///////////////////////////////////////////// /////////////////////////////////////////////
@ -96,9 +96,9 @@ Evas_GL_Program_Source shader_yuv_frag_src =
yuv_frag_glsl, yuv_frag_glsl,
#if defined (GLES_VARIETY_S3C6410) #if defined (GLES_VARIETY_S3C6410)
yuv_frag_bin, sizeof(yuv_frag_bin) yuv_frag_bin, sizeof(yuv_frag_bin)
#else #else
NULL, 0 NULL, 0
#endif #endif
}; };
#if defined (GLES_VARIETY_S3C6410) #if defined (GLES_VARIETY_S3C6410)
@ -115,9 +115,9 @@ Evas_GL_Program_Source shader_yuv_vert_src =
yuv_vert_glsl, yuv_vert_glsl,
#if defined (GLES_VARIETY_S3C6410) #if defined (GLES_VARIETY_S3C6410)
yuv_vert_bin, sizeof(yuv_vert_bin) yuv_vert_bin, sizeof(yuv_vert_bin)
#else #else
NULL, 0 NULL, 0
#endif #endif
}; };
///////////////////////////////////////////// /////////////////////////////////////////////
@ -136,9 +136,9 @@ Evas_GL_Program_Source shader_yuv_nomul_frag_src =
yuv_nomul_frag_glsl, yuv_nomul_frag_glsl,
#if defined (GLES_VARIETY_S3C6410) #if defined (GLES_VARIETY_S3C6410)
yuv_nomul_frag_bin, sizeof(yuv_nomul_frag_bin) yuv_nomul_frag_bin, sizeof(yuv_nomul_frag_bin)
#else #else
NULL, 0 NULL, 0
#endif #endif
}; };
#if defined (GLES_VARIETY_S3C6410) #if defined (GLES_VARIETY_S3C6410)
@ -155,9 +155,9 @@ Evas_GL_Program_Source shader_yuv_nomul_vert_src =
yuv_nomul_vert_glsl, yuv_nomul_vert_glsl,
#if defined (GLES_VARIETY_S3C6410) #if defined (GLES_VARIETY_S3C6410)
yuv_nomul_vert_bin, sizeof(yuv_nomul_vert_bin) yuv_nomul_vert_bin, sizeof(yuv_nomul_vert_bin)
#else #else
NULL, 0 NULL, 0
#endif #endif
}; };
///////////////////////////////////////////// /////////////////////////////////////////////
@ -176,9 +176,9 @@ Evas_GL_Program_Source shader_tex_frag_src =
tex_frag_glsl, tex_frag_glsl,
#if defined (GLES_VARIETY_S3C6410) #if defined (GLES_VARIETY_S3C6410)
tex_frag_bin, sizeof(tex_frag_bin) tex_frag_bin, sizeof(tex_frag_bin)
#else #else
NULL, 0 NULL, 0
#endif #endif
}; };
#if defined (GLES_VARIETY_S3C6410) #if defined (GLES_VARIETY_S3C6410)
@ -195,9 +195,9 @@ Evas_GL_Program_Source shader_tex_vert_src =
tex_vert_glsl, tex_vert_glsl,
#if defined (GLES_VARIETY_S3C6410) #if defined (GLES_VARIETY_S3C6410)
tex_vert_bin, sizeof(tex_vert_bin) tex_vert_bin, sizeof(tex_vert_bin)
#else #else
NULL, 0 NULL, 0
#endif #endif
}; };
///////////////////////////////////////////// /////////////////////////////////////////////
@ -216,9 +216,9 @@ Evas_GL_Program_Source shader_tex_nomul_frag_src =
tex_nomul_frag_glsl, tex_nomul_frag_glsl,
#if defined (GLES_VARIETY_S3C6410) #if defined (GLES_VARIETY_S3C6410)
tex_nomul_frag_bin, sizeof(tex_nomul_frag_bin) tex_nomul_frag_bin, sizeof(tex_nomul_frag_bin)
#else #else
NULL, 0 NULL, 0
#endif #endif
}; };
#if defined (GLES_VARIETY_S3C6410) #if defined (GLES_VARIETY_S3C6410)
@ -235,9 +235,9 @@ Evas_GL_Program_Source shader_tex_nomul_vert_src =
tex_nomul_vert_glsl, tex_nomul_vert_glsl,
#if defined (GLES_VARIETY_S3C6410) #if defined (GLES_VARIETY_S3C6410)
tex_nomul_vert_bin, sizeof(tex_nomul_vert_bin) tex_nomul_vert_bin, sizeof(tex_nomul_vert_bin)
#else #else
NULL, 0 NULL, 0
#endif #endif
}; };
///////////////////////////////////////////// /////////////////////////////////////////////
@ -256,9 +256,9 @@ Evas_GL_Program_Source shader_img_frag_src =
img_frag_glsl, img_frag_glsl,
#if defined (GLES_VARIETY_S3C6410) #if defined (GLES_VARIETY_S3C6410)
img_frag_bin, sizeof(img_frag_bin) img_frag_bin, sizeof(img_frag_bin)
#else #else
NULL, 0 NULL, 0
#endif #endif
}; };
#if defined (GLES_VARIETY_S3C6410) #if defined (GLES_VARIETY_S3C6410)
@ -275,9 +275,9 @@ Evas_GL_Program_Source shader_img_vert_src =
img_vert_glsl, img_vert_glsl,
#if defined (GLES_VARIETY_S3C6410) #if defined (GLES_VARIETY_S3C6410)
img_vert_bin, sizeof(img_vert_bin) img_vert_bin, sizeof(img_vert_bin)
#else #else
NULL, 0 NULL, 0
#endif #endif
}; };
///////////////////////////////////////////// /////////////////////////////////////////////
@ -296,9 +296,9 @@ Evas_GL_Program_Source shader_img_nomul_frag_src =
img_nomul_frag_glsl, img_nomul_frag_glsl,
#if defined (GLES_VARIETY_S3C6410) #if defined (GLES_VARIETY_S3C6410)
img_nomul_frag_bin, sizeof(img_nomul_frag_bin) img_nomul_frag_bin, sizeof(img_nomul_frag_bin)
#else #else
NULL, 0 NULL, 0
#endif #endif
}; };
#if defined (GLES_VARIETY_S3C6410) #if defined (GLES_VARIETY_S3C6410)
@ -315,9 +315,9 @@ Evas_GL_Program_Source shader_img_nomul_vert_src =
img_nomul_vert_glsl, img_nomul_vert_glsl,
#if defined (GLES_VARIETY_S3C6410) #if defined (GLES_VARIETY_S3C6410)
img_nomul_vert_bin, sizeof(img_nomul_vert_bin) img_nomul_vert_bin, sizeof(img_nomul_vert_bin)
#else #else
NULL, 0 NULL, 0
#endif #endif
}; };
///////////////////////////////////////////// /////////////////////////////////////////////
@ -336,9 +336,9 @@ Evas_GL_Program_Source shader_img_bgra_frag_src =
img_bgra_frag_glsl, img_bgra_frag_glsl,
#if defined (GLES_VARIETY_S3C6410) #if defined (GLES_VARIETY_S3C6410)
img_bgra_frag_bin, sizeof(img_bgra_frag_bin) img_bgra_frag_bin, sizeof(img_bgra_frag_bin)
#else #else
NULL, 0 NULL, 0
#endif #endif
}; };
#if defined (GLES_VARIETY_S3C6410) #if defined (GLES_VARIETY_S3C6410)
@ -355,9 +355,9 @@ Evas_GL_Program_Source shader_img_bgra_vert_src =
img_bgra_vert_glsl, img_bgra_vert_glsl,
#if defined (GLES_VARIETY_S3C6410) #if defined (GLES_VARIETY_S3C6410)
img_bgra_vert_bin, sizeof(img_bgra_vert_bin) img_bgra_vert_bin, sizeof(img_bgra_vert_bin)
#else #else
NULL, 0 NULL, 0
#endif #endif
}; };
@ -418,9 +418,9 @@ Evas_GL_Program_Source shader_img_bgra_nomul_frag_src =
img_bgra_nomul_frag_glsl, img_bgra_nomul_frag_glsl,
#if defined (GLES_VARIETY_S3C6410) #if defined (GLES_VARIETY_S3C6410)
img_bgra_nomul_frag_bin, sizeof(img_bgra_nomul_frag_bin) img_bgra_nomul_frag_bin, sizeof(img_bgra_nomul_frag_bin)
#else #else
NULL, 0 NULL, 0
#endif #endif
}; };
#if defined (GLES_VARIETY_S3C6410) #if defined (GLES_VARIETY_S3C6410)
@ -437,9 +437,9 @@ Evas_GL_Program_Source shader_img_bgra_nomul_vert_src =
img_bgra_nomul_vert_glsl, img_bgra_nomul_vert_glsl,
#if defined (GLES_VARIETY_S3C6410) #if defined (GLES_VARIETY_S3C6410)
img_bgra_nomul_vert_bin, sizeof(img_bgra_nomul_vert_bin) img_bgra_nomul_vert_bin, sizeof(img_bgra_nomul_vert_bin)
#else #else
NULL, 0 NULL, 0
#endif #endif
}; };
///////////////////////////////////////////// /////////////////////////////////////////////
@ -622,7 +622,7 @@ gl_compile_link_error(GLuint target, const char *action)
free(logtxt); free(logtxt);
} }
} }
/* Program info log */ /* Program info log */
glGetProgramiv(target, GL_INFO_LOG_LENGTH, &loglen); glGetProgramiv(target, GL_INFO_LOG_LENGTH, &loglen);
if (loglen > 0) if (loglen > 0)
@ -709,7 +709,7 @@ _evas_gl_shader_dir_check(char *bin_shader_dir, int num)
home = getenv("HOME"); home = getenv("HOME");
if ((!home) || (!home[0])) return 0; if ((!home) || (!home[0])) return 0;
snprintf(bin_shader_dir, num, "%s/%s", home, subdir); snprintf(bin_shader_dir, num, "%s/%s", home, subdir);
return _evas_gl_shader_file_exists(bin_shader_dir); return _evas_gl_shader_file_exists(bin_shader_dir);
} }
@ -774,8 +774,8 @@ _evas_gl_common_shader_program_binary_init(Evas_GL_Program *p,
p->prog = glCreateProgram(); p->prog = glCreateProgram();
#if 0 #if 0
// TODO: invalid rendering error occurs when attempting to use a // TODO: invalid rendering error occurs when attempting to use a
// glProgramBinary. in order to render correctly we should create a dummy // glProgramBinary. in order to render correctly we should create a dummy
// vertex shader. // vertex shader.
p->vert = glCreateShader(GL_VERTEX_SHADER); p->vert = glCreateShader(GL_VERTEX_SHADER);
glAttachShader(p->prog, p->vert); glAttachShader(p->prog, p->vert);
@ -840,7 +840,7 @@ _evas_gl_common_shader_program_source_init(Evas_GL_Program *p,
const char *name) const char *name)
{ {
GLint ok; GLint ok;
p->vert = glCreateShader(GL_VERTEX_SHADER); p->vert = glCreateShader(GL_VERTEX_SHADER);
p->frag = glCreateShader(GL_FRAGMENT_SHADER); p->frag = glCreateShader(GL_FRAGMENT_SHADER);
#if defined (GLES_VARIETY_S3C6410) #if defined (GLES_VARIETY_S3C6410)
@ -848,7 +848,7 @@ _evas_gl_common_shader_program_source_init(Evas_GL_Program *p,
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glShaderBinary(1, &(p->frag), 0, frag->bin, frag->bin_size); glShaderBinary(1, &(p->frag), 0, frag->bin, frag->bin_size);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
#else #else
glShaderSource(p->vert, 1, glShaderSource(p->vert, 1,
(const char **)&(vert->src), NULL); (const char **)&(vert->src), NULL);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
@ -882,14 +882,14 @@ _evas_gl_common_shader_program_source_init(Evas_GL_Program *p,
#if defined(GLES_VARIETY_S3C6410) || defined(GLES_VARIETY_SGX) #if defined(GLES_VARIETY_S3C6410) || defined(GLES_VARIETY_SGX)
#else #else
if ((glsym_glGetProgramBinary) && (glsym_glProgramParameteri)) if ((glsym_glGetProgramBinary) && (glsym_glProgramParameteri))
glsym_glProgramParameteri(p->prog, GL_PROGRAM_BINARY_RETRIEVABLE_HINT, glsym_glProgramParameteri(p->prog, GL_PROGRAM_BINARY_RETRIEVABLE_HINT,
GL_TRUE); GL_TRUE);
#endif #endif
glAttachShader(p->prog, p->vert); glAttachShader(p->prog, p->vert);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glAttachShader(p->prog, p->frag); glAttachShader(p->prog, p->frag);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glBindAttribLocation(p->prog, SHAD_VERTEX, "vertex"); glBindAttribLocation(p->prog, SHAD_VERTEX, "vertex");
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glBindAttribLocation(p->prog, SHAD_COLOR, "color"); glBindAttribLocation(p->prog, SHAD_COLOR, "color");
@ -902,7 +902,7 @@ _evas_gl_common_shader_program_source_init(Evas_GL_Program *p,
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glBindAttribLocation(p->prog, SHAD_TEXM, "tex_coordm"); glBindAttribLocation(p->prog, SHAD_TEXM, "tex_coordm");
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glLinkProgram(p->prog); glLinkProgram(p->prog);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
ok = 0; ok = 0;
@ -965,7 +965,7 @@ _evas_gl_common_shader_source_init(Evas_GL_Shared *shared)
&(shader_yuv_nomul_vert_src), &(shader_yuv_nomul_vert_src),
&(shader_yuv_nomul_frag_src), &(shader_yuv_nomul_frag_src),
"yuv_nomul")) return 0; "yuv_nomul")) return 0;
/* Most of the filters use the image fragment shader */ /* Most of the filters use the image fragment shader */
if (!_evas_gl_common_shader_program_source_init(&(shared->shader.filter_invert), if (!_evas_gl_common_shader_program_source_init(&(shared->shader.filter_invert),
&(shader_img_vert_src), &(shader_img_vert_src),
@ -983,7 +983,7 @@ _evas_gl_common_shader_source_init(Evas_GL_Shared *shared)
&(shader_img_vert_src), &(shader_img_vert_src),
&(shader_filter_invert_bgra_nomul_frag_src), &(shader_filter_invert_bgra_nomul_frag_src),
"filter_invert_bgra_nomul")) return 0; "filter_invert_bgra_nomul")) return 0;
if (!_evas_gl_common_shader_program_source_init(&(shared->shader.filter_sepia), if (!_evas_gl_common_shader_program_source_init(&(shared->shader.filter_sepia),
&(shader_img_vert_src), &(shader_img_vert_src),
&(shader_filter_sepia_frag_src), &(shader_filter_sepia_frag_src),
@ -1000,7 +1000,7 @@ _evas_gl_common_shader_source_init(Evas_GL_Shared *shared)
&(shader_img_vert_src), &(shader_img_vert_src),
&(shader_filter_sepia_bgra_nomul_frag_src), &(shader_filter_sepia_bgra_nomul_frag_src),
"filter_sepia_bgra_nomul")) return 0; "filter_sepia_bgra_nomul")) return 0;
if (!_evas_gl_common_shader_program_source_init(&(shared->shader.filter_greyscale), if (!_evas_gl_common_shader_program_source_init(&(shared->shader.filter_greyscale),
&(shader_img_vert_src), &(shader_img_vert_src),
&(shader_filter_greyscale_frag_src), &(shader_filter_greyscale_frag_src),
@ -1035,7 +1035,7 @@ _evas_gl_common_shader_source_init(Evas_GL_Shared *shared)
&(shader_filter_blur_bgra_nomul_frag_src), &(shader_filter_blur_bgra_nomul_frag_src),
"filter_blur_bgra_nomul")) return 0; "filter_blur_bgra_nomul")) return 0;
#endif #endif
return 1; return 1;
} }
@ -1049,11 +1049,11 @@ _evas_gl_common_shader_binary_init(Evas_GL_Shared *shared)
if (!_evas_gl_shader_dir_check(bin_dir_path, sizeof(bin_dir_path))) if (!_evas_gl_shader_dir_check(bin_dir_path, sizeof(bin_dir_path)))
return 0; return 0;
if (!_evas_gl_shader_file_check(bin_dir_path, bin_file_path, if (!_evas_gl_shader_file_check(bin_dir_path, bin_file_path,
sizeof(bin_dir_path))) sizeof(bin_dir_path)))
return 0; return 0;
/* use eet */ /* use eet */
if (!eet_init()) return 0; if (!eet_init()) return 0;
et = eet_open(bin_file_path, EET_FILE_MODE_READ); et = eet_open(bin_file_path, EET_FILE_MODE_READ);
@ -1117,10 +1117,10 @@ _evas_gl_common_shader_binary_save(Evas_GL_Shared *shared)
if (!_evas_gl_shader_dir_check(bin_dir_path, sizeof(bin_dir_path))) if (!_evas_gl_shader_dir_check(bin_dir_path, sizeof(bin_dir_path)))
res = _evas_gl_shader_file_mkpath(bin_dir_path); res = _evas_gl_shader_file_mkpath(bin_dir_path);
if (!res) return 0; /* we can't make directory */ if (!res) return 0; /* we can't make directory */
_evas_gl_shader_file_check(bin_dir_path, bin_file_path, _evas_gl_shader_file_check(bin_dir_path, bin_file_path,
sizeof(bin_dir_path)); sizeof(bin_dir_path));
/* use mkstemp for writing */ /* use mkstemp for writing */
snprintf(tmp_file, sizeof(tmp_file), "%s.XXXXXX", bin_file_path); snprintf(tmp_file, sizeof(tmp_file), "%s.XXXXXX", bin_file_path);
tmpfd = mkstemp(tmp_file); tmpfd = mkstemp(tmp_file);
@ -1182,7 +1182,7 @@ int
evas_gl_common_shader_program_init(Evas_GL_Shared *shared) evas_gl_common_shader_program_init(Evas_GL_Shared *shared)
{ {
// gl support binary shader and get env of binary shader path // gl support binary shader and get env of binary shader path
if (shared->info.bin_program && if (shared->info.bin_program &&
_evas_gl_common_shader_binary_init(shared)) return 1; _evas_gl_common_shader_binary_init(shared)) return 1;
/* compile all shader.*/ /* compile all shader.*/
if (!_evas_gl_common_shader_source_init(shared)) return 0; if (!_evas_gl_common_shader_source_init(shared)) return 0;
@ -1196,7 +1196,7 @@ evas_gl_common_shader_program_init_done(void)
{ {
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
glReleaseShaderCompiler(); glReleaseShaderCompiler();
#endif #endif
} }
void void

View File

@ -88,7 +88,7 @@ _tex_format_index(GLuint format)
case GL_RGBA: case GL_RGBA:
#ifdef GL_BGRA #ifdef GL_BGRA
case GL_BGRA: case GL_BGRA:
#endif #endif
return 0; return 0;
case GL_RGB: case GL_RGB:
return 1; return 1;
@ -120,7 +120,7 @@ static Evas_GL_Texture_Pool *
_pool_tex_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, GLenum format) _pool_tex_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, GLenum format)
{ {
Evas_GL_Texture_Pool *pt; Evas_GL_Texture_Pool *pt;
pt = calloc(1, sizeof(Evas_GL_Texture_Pool)); pt = calloc(1, sizeof(Evas_GL_Texture_Pool));
if (!pt) return NULL; if (!pt) return NULL;
h = _tex_round_slot(gc, h) * gc->shared->info.tune.atlas.slot_size; h = _tex_round_slot(gc, h) * gc->shared->info.tune.atlas.slot_size;
@ -132,7 +132,7 @@ _pool_tex_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, GLenum fo
pt->format = format; pt->format = format;
pt->dataformat = GL_UNSIGNED_BYTE; pt->dataformat = GL_UNSIGNED_BYTE;
pt->references = 0; pt->references = 0;
if (format == alpha_fmt) if (format == alpha_fmt)
{ {
texinfo.a.num++; texinfo.a.num++;
@ -150,7 +150,7 @@ _pool_tex_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, GLenum fo
} }
_print_tex_count(); _print_tex_count();
glGenTextures(1, &(pt->texture)); glGenTextures(1, &(pt->texture));
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glBindTexture(GL_TEXTURE_2D, pt->texture); glBindTexture(GL_TEXTURE_2D, pt->texture);
@ -215,8 +215,8 @@ _pool_tex_alloc(Evas_GL_Texture_Pool *pt, int w, int h __UNUSED__, int *u, int *
} }
static Evas_GL_Texture_Pool * static Evas_GL_Texture_Pool *
_pool_tex_find(Evas_Engine_GL_Context *gc, int w, int h, _pool_tex_find(Evas_Engine_GL_Context *gc, int w, int h,
int intformat, int format, int *u, int *v, int intformat, int format, int *u, int *v,
Eina_List **l_after, int atlas_w) Eina_List **l_after, int atlas_w)
{ {
Evas_GL_Texture_Pool *pt = NULL; Evas_GL_Texture_Pool *pt = NULL;
@ -225,7 +225,7 @@ _pool_tex_find(Evas_Engine_GL_Context *gc, int w, int h,
if (atlas_w > gc->shared->info.max_texture_size) if (atlas_w > gc->shared->info.max_texture_size)
atlas_w = gc->shared->info.max_texture_size; atlas_w = gc->shared->info.max_texture_size;
if ((w > gc->shared->info.tune.atlas.max_w) || if ((w > gc->shared->info.tune.atlas.max_w) ||
(h > gc->shared->info.tune.atlas.max_h)) (h > gc->shared->info.tune.atlas.max_h))
{ {
pt = _pool_tex_new(gc, w, h, intformat, format); pt = _pool_tex_new(gc, w, h, intformat, format);
@ -238,22 +238,22 @@ _pool_tex_find(Evas_Engine_GL_Context *gc, int w, int h,
*l_after = NULL; *l_after = NULL;
return pt; return pt;
} }
th = _tex_round_slot(gc, h); th = _tex_round_slot(gc, h);
th2 = _tex_format_index(intformat); th2 = _tex_format_index(intformat);
EINA_LIST_FOREACH(gc->shared->tex.atlas[th][th2], l, pt) EINA_LIST_FOREACH(gc->shared->tex.atlas[th][th2], l, pt)
{ {
if (_pool_tex_alloc(pt, w, h, u, v, l_after)) if (_pool_tex_alloc(pt, w, h, u, v, l_after))
{ {
gc->shared->tex.atlas[th][th2] = gc->shared->tex.atlas[th][th2] =
eina_list_remove_list(gc->shared->tex.atlas[th][th2], l); eina_list_remove_list(gc->shared->tex.atlas[th][th2], l);
gc->shared->tex.atlas[th][th2] = gc->shared->tex.atlas[th][th2] =
eina_list_prepend(gc->shared->tex.atlas[th][th2], pt); eina_list_prepend(gc->shared->tex.atlas[th][th2], pt);
return pt; return pt;
} }
} }
pt = _pool_tex_new(gc, atlas_w, h, intformat, format); pt = _pool_tex_new(gc, atlas_w, h, intformat, format);
gc->shared->tex.atlas[th][th2] = gc->shared->tex.atlas[th][th2] =
eina_list_prepend(gc->shared->tex.atlas[th][th2], pt); eina_list_prepend(gc->shared->tex.atlas[th][th2], pt);
pt->slot = th; pt->slot = th;
pt->fslot = th2; pt->fslot = th2;
@ -272,7 +272,7 @@ evas_gl_common_texture_new(Evas_Engine_GL_Context *gc, RGBA_Image *im)
tex = calloc(1, sizeof(Evas_GL_Texture)); tex = calloc(1, sizeof(Evas_GL_Texture));
if (!tex) return NULL; if (!tex) return NULL;
tex->gc = gc; tex->gc = gc;
tex->references = 1; tex->references = 1;
@ -280,12 +280,12 @@ evas_gl_common_texture_new(Evas_Engine_GL_Context *gc, RGBA_Image *im)
{ {
if (gc->shared->info.bgra) if (gc->shared->info.bgra)
tex->pt = _pool_tex_find(gc, im->cache_entry.w + 2, tex->pt = _pool_tex_find(gc, im->cache_entry.w + 2,
im->cache_entry.h + 1, bgra_ifmt, bgra_fmt, im->cache_entry.h + 1, bgra_ifmt, bgra_fmt,
&u, &v, &l_after, &u, &v, &l_after,
gc->shared->info.tune.atlas.max_alloc_size); gc->shared->info.tune.atlas.max_alloc_size);
else else
tex->pt = _pool_tex_find(gc, im->cache_entry.w + 2, tex->pt = _pool_tex_find(gc, im->cache_entry.w + 2,
im->cache_entry.h + 1, rgba_ifmt, rgba_fmt, im->cache_entry.h + 1, rgba_ifmt, rgba_fmt,
&u, &v, &l_after, &u, &v, &l_after,
gc->shared->info.tune.atlas.max_alloc_size); gc->shared->info.tune.atlas.max_alloc_size);
tex->alpha = 1; tex->alpha = 1;
@ -293,18 +293,18 @@ evas_gl_common_texture_new(Evas_Engine_GL_Context *gc, RGBA_Image *im)
else else
{ {
if (gc->shared->info.bgra) if (gc->shared->info.bgra)
tex->pt = _pool_tex_find(gc, im->cache_entry.w + 3, tex->pt = _pool_tex_find(gc, im->cache_entry.w + 3,
im->cache_entry.h + 1, bgr_ifmt, bgr_fmt, im->cache_entry.h + 1, bgr_ifmt, bgr_fmt,
&u, &v, &l_after, &u, &v, &l_after,
gc->shared->info.tune.atlas.max_alloc_size); gc->shared->info.tune.atlas.max_alloc_size);
else else
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
tex->pt = _pool_tex_find(gc, im->cache_entry.w + 3, tex->pt = _pool_tex_find(gc, im->cache_entry.w + 3,
im->cache_entry.h + 1, rgba_ifmt, rgba_fmt, im->cache_entry.h + 1, rgba_ifmt, rgba_fmt,
&u, &v, &l_after, &u, &v, &l_after,
gc->shared->info.tune.atlas.max_alloc_size); gc->shared->info.tune.atlas.max_alloc_size);
#else #else
tex->pt = _pool_tex_find(gc, im->cache_entry.w + 3, tex->pt = _pool_tex_find(gc, im->cache_entry.w + 3,
im->cache_entry.h + 1, rgb_ifmt, rgb_fmt, im->cache_entry.h + 1, rgb_ifmt, rgb_fmt,
&u, &v, &l_after, &u, &v, &l_after,
gc->shared->info.tune.atlas.max_alloc_size); gc->shared->info.tune.atlas.max_alloc_size);
@ -320,10 +320,10 @@ evas_gl_common_texture_new(Evas_Engine_GL_Context *gc, RGBA_Image *im)
tex->w = im->cache_entry.w; tex->w = im->cache_entry.w;
tex->h = im->cache_entry.h; tex->h = im->cache_entry.h;
if (l_after) if (l_after)
tex->pt->allocations = tex->pt->allocations =
eina_list_append_relative_list(tex->pt->allocations, tex, l_after); eina_list_append_relative_list(tex->pt->allocations, tex, l_after);
else else
tex->pt->allocations = tex->pt->allocations =
eina_list_prepend(tex->pt->allocations, tex); eina_list_prepend(tex->pt->allocations, tex);
tex->pt->references++; tex->pt->references++;
evas_gl_common_texture_update(tex, im); evas_gl_common_texture_update(tex, im);
@ -334,7 +334,7 @@ static Evas_GL_Texture_Pool *
_pool_tex_render_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, int format) _pool_tex_render_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, int format)
{ {
Evas_GL_Texture_Pool *pt; Evas_GL_Texture_Pool *pt;
pt = calloc(1, sizeof(Evas_GL_Texture_Pool)); pt = calloc(1, sizeof(Evas_GL_Texture_Pool));
if (!pt) return NULL; if (!pt) return NULL;
h = _tex_round_slot(gc, h) * gc->shared->info.tune.atlas.slot_size; h = _tex_round_slot(gc, h) * gc->shared->info.tune.atlas.slot_size;
@ -361,12 +361,12 @@ _pool_tex_render_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, in
# ifndef GL_COLOR_ATTACHMENT0 # ifndef GL_COLOR_ATTACHMENT0
# define GL_COLOR_ATTACHMENT0 GL_COLOR_ATTACHMENT0_EXT # define GL_COLOR_ATTACHMENT0 GL_COLOR_ATTACHMENT0_EXT
# endif # endif
#endif #endif
texinfo.r.num++; texinfo.r.num++;
texinfo.r.pix += pt->w * pt->h; texinfo.r.pix += pt->w * pt->h;
_print_tex_count(); _print_tex_count();
glGenTextures(1, &(pt->texture)); glGenTextures(1, &(pt->texture));
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glBindTexture(GL_TEXTURE_2D, pt->texture); glBindTexture(GL_TEXTURE_2D, pt->texture);
@ -380,7 +380,7 @@ _pool_tex_render_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, in
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);
glsym_glGenFramebuffers(1, &(pt->fb)); glsym_glGenFramebuffers(1, &(pt->fb));
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glBindFramebuffer(GL_FRAMEBUFFER, pt->fb); glsym_glBindFramebuffer(GL_FRAMEBUFFER, pt->fb);
@ -389,7 +389,7 @@ _pool_tex_render_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, in
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glsym_glBindFramebuffer(GL_FRAMEBUFFER, 0); glsym_glBindFramebuffer(GL_FRAMEBUFFER, 0);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glBindTexture(GL_TEXTURE_2D, gc->pipe[0].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;
@ -399,11 +399,11 @@ static Evas_GL_Texture_Pool *
_pool_tex_native_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, int format, Evas_GL_Image *im) _pool_tex_native_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, int format, Evas_GL_Image *im)
{ {
Evas_GL_Texture_Pool *pt; Evas_GL_Texture_Pool *pt;
pt = calloc(1, sizeof(Evas_GL_Texture_Pool)); pt = calloc(1, sizeof(Evas_GL_Texture_Pool));
if (!pt) return NULL; if (!pt) return NULL;
pt->gc = gc; pt->gc = gc;
#ifdef GL_TEXTURE_RECTANGLE_ARB #ifdef GL_TEXTURE_RECTANGLE_ARB
if (im->native.target == GL_TEXTURE_RECTANGLE_ARB) if (im->native.target == GL_TEXTURE_RECTANGLE_ARB)
{ {
printf("REEEEEEEEECT\n"); printf("REEEEEEEEECT\n");
@ -411,7 +411,7 @@ _pool_tex_native_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, in
pt->h = h; pt->h = h;
} }
else else
#endif #endif
{ {
// FIXME: handle po2 only textures // FIXME: handle po2 only textures
pt->w = w; pt->w = w;
@ -424,14 +424,14 @@ _pool_tex_native_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, in
pt->native = 1; pt->native = 1;
texinfo.n.num++; texinfo.n.num++;
texinfo.n.pix += pt->w * pt->h; texinfo.n.pix += pt->w * pt->h;
_print_tex_count(); _print_tex_count();
glGenTextures(1, &(pt->texture)); glGenTextures(1, &(pt->texture));
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glBindTexture(im->native.target, pt->texture); glBindTexture(im->native.target, pt->texture);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
#else #else
if (im->native.loose) if (im->native.loose)
@ -440,7 +440,7 @@ _pool_tex_native_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, in
im->native.func.bind(im->native.func.data, im); im->native.func.bind(im->native.func.data, im);
} }
#endif #endif
glTexParameteri(im->native.target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(im->native.target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glTexParameteri(im->native.target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(im->native.target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
@ -460,7 +460,7 @@ static Evas_GL_Texture_Pool *
_pool_tex_dynamic_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, int format) _pool_tex_dynamic_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, int format)
{ {
Evas_GL_Texture_Pool *pt = NULL; Evas_GL_Texture_Pool *pt = NULL;
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
int fmt; // EGL_MAP_GL_TEXTURE_RGBA_SEC or EGL_MAP_GL_TEXTURE_RGB_SEC or bust int fmt; // EGL_MAP_GL_TEXTURE_RGBA_SEC or EGL_MAP_GL_TEXTURE_RGB_SEC or bust
int pixtype; // EGL_MAP_GL_TEXTURE_UNSIGNED_BYTE_SEC or bust int pixtype; // EGL_MAP_GL_TEXTURE_UNSIGNED_BYTE_SEC or bust
@ -473,7 +473,7 @@ _pool_tex_dynamic_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, i
EGL_NONE EGL_NONE
}; };
void *egldisplay; void *egldisplay;
pt = calloc(1, sizeof(Evas_GL_Texture_Pool)); pt = calloc(1, sizeof(Evas_GL_Texture_Pool));
if (!pt) return NULL; if (!pt) return NULL;
h = _tex_round_slot(gc, h) * gc->shared->info.tune.atlas.slot_size; h = _tex_round_slot(gc, h) * gc->shared->info.tune.atlas.slot_size;
@ -488,9 +488,9 @@ _pool_tex_dynamic_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, i
pt->references = 0; pt->references = 0;
texinfo.d.num++; texinfo.d.num++;
texinfo.d.pix += pt->w * pt->h; texinfo.d.pix += pt->w * pt->h;
_print_tex_count(); _print_tex_count();
glGenTextures(1, &(pt->texture)); glGenTextures(1, &(pt->texture));
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glBindTexture(GL_TEXTURE_2D, pt->texture); glBindTexture(GL_TEXTURE_2D, pt->texture);
@ -505,14 +505,14 @@ _pool_tex_dynamic_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, i
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
egldisplay = pt->gc->egldisp; egldisplay = pt->gc->egldisp;
attr[1] = pt->w; attr[1] = pt->w;
attr[3] = pt->h; attr[3] = pt->h;
// FIXME: seems a bit slower than i'd like - maybe too many flushes? // FIXME: seems a bit slower than i'd like - maybe too many flushes?
// FIXME: YCbCr no support as yet // FIXME: YCbCr no support as yet
pt->dyn.img = secsym_eglCreateImage(egldisplay, pt->dyn.img = secsym_eglCreateImage(egldisplay,
EGL_NO_CONTEXT, EGL_NO_CONTEXT,
EGL_MAP_GL_TEXTURE_2D_SEC, EGL_MAP_GL_TEXTURE_2D_SEC,
0, attr); 0, attr);
if (!pt->dyn.img) if (!pt->dyn.img)
@ -593,7 +593,7 @@ _pool_tex_dynamic_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, i
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
return pt; return pt;
} }
glBindTexture(GL_TEXTURE_2D, gc->pipe[0].shader.cur_tex); glBindTexture(GL_TEXTURE_2D, gc->pipe[0].shader.cur_tex);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
#else #else
@ -602,7 +602,7 @@ _pool_tex_dynamic_new(Evas_Engine_GL_Context *gc, int w, int h, int intformat, i
h = 0; h = 0;
intformat = 0; intformat = 0;
format = 0; format = 0;
#endif #endif
return pt; return pt;
} }
@ -610,7 +610,7 @@ void
evas_gl_texture_pool_empty(Evas_GL_Texture_Pool *pt) evas_gl_texture_pool_empty(Evas_GL_Texture_Pool *pt)
{ {
if (!pt->gc) return; if (!pt->gc) return;
if (pt->format == alpha_fmt) if (pt->format == alpha_fmt)
{ {
texinfo.a.num--; texinfo.a.num--;
@ -641,9 +641,9 @@ evas_gl_texture_pool_empty(Evas_GL_Texture_Pool *pt)
texinfo.c.num--; texinfo.c.num--;
texinfo.c.pix -= pt->w * pt->h; texinfo.c.pix -= pt->w * pt->h;
} }
_print_tex_count(); _print_tex_count();
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
if (pt->dyn.img) if (pt->dyn.img)
{ {
@ -654,8 +654,8 @@ evas_gl_texture_pool_empty(Evas_GL_Texture_Pool *pt)
pt->dyn.h = 0; pt->dyn.h = 0;
pt->dyn.stride = 0; pt->dyn.stride = 0;
} }
#endif #endif
glDeleteTextures(1, &(pt->texture)); glDeleteTextures(1, &(pt->texture));
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
if (pt->fb) if (pt->fb)
@ -665,7 +665,7 @@ evas_gl_texture_pool_empty(Evas_GL_Texture_Pool *pt)
pt->fb = 0; pt->fb = 0;
} }
while (pt->allocations) while (pt->allocations)
pt->allocations = pt->allocations =
eina_list_remove_list(pt->allocations, pt->allocations); eina_list_remove_list(pt->allocations, pt->allocations);
pt->texture = 0; pt->texture = 0;
pt->gc = NULL; pt->gc = NULL;
@ -683,7 +683,7 @@ pt_unref(Evas_GL_Texture_Pool *pt)
if (!((pt->render) || (pt->native))) if (!((pt->render) || (pt->native)))
{ {
if (pt->whole) if (pt->whole)
pt->gc->shared->tex.whole = pt->gc->shared->tex.whole =
eina_list_remove(pt->gc->shared->tex.whole, pt); eina_list_remove(pt->gc->shared->tex.whole, pt);
else else
pt->gc->shared->tex.atlas [pt->slot][pt->fslot] = pt->gc->shared->tex.atlas [pt->slot][pt->fslot] =
@ -700,7 +700,7 @@ evas_gl_common_texture_native_new(Evas_Engine_GL_Context *gc, unsigned int w, un
tex = calloc(1, sizeof(Evas_GL_Texture)); tex = calloc(1, sizeof(Evas_GL_Texture));
if (!tex) return NULL; if (!tex) return NULL;
tex->gc = gc; tex->gc = gc;
tex->references = 1; tex->references = 1;
tex->alpha = alpha; tex->alpha = alpha;
@ -738,7 +738,7 @@ evas_gl_common_texture_render_new(Evas_Engine_GL_Context *gc, unsigned int w, un
tex = calloc(1, sizeof(Evas_GL_Texture)); tex = calloc(1, sizeof(Evas_GL_Texture));
if (!tex) return NULL; if (!tex) return NULL;
tex->gc = gc; tex->gc = gc;
tex->references = 1; tex->references = 1;
tex->alpha = alpha; tex->alpha = alpha;
@ -765,7 +765,7 @@ evas_gl_common_texture_render_new(Evas_Engine_GL_Context *gc, unsigned int w, un
tex->y = 0; tex->y = 0;
tex->w = w; tex->w = w;
tex->h = h; tex->h = h;
tex->pt->references++; tex->pt->references++;
return tex; return tex;
} }
@ -776,7 +776,7 @@ evas_gl_common_texture_dynamic_new(Evas_Engine_GL_Context *gc, Evas_GL_Image *im
tex = calloc(1, sizeof(Evas_GL_Texture)); tex = calloc(1, sizeof(Evas_GL_Texture));
if (!tex) return NULL; if (!tex) return NULL;
tex->gc = gc; tex->gc = gc;
tex->references = 1; tex->references = 1;
tex->alpha = im->alpha; tex->alpha = im->alpha;
@ -834,36 +834,36 @@ evas_gl_common_texture_update(Evas_GL_Texture *tex, RGBA_Image *im)
} }
if (!tex->pt) return; if (!tex->pt) return;
if (!im->image.data) return; if (!im->image.data) return;
fmt = tex->pt->format; fmt = tex->pt->format;
glBindTexture(GL_TEXTURE_2D, tex->pt->texture); glBindTexture(GL_TEXTURE_2D, tex->pt->texture);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
#ifdef GL_UNPACK_ROW_LENGTH #ifdef GL_UNPACK_ROW_LENGTH
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
#endif #endif
glPixelStorei(GL_UNPACK_ALIGNMENT, 4); glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
// printf("tex upload %ix%i\n", im->cache_entry.w, im->cache_entry.h); // printf("tex upload %ix%i\n", im->cache_entry.w, im->cache_entry.h);
// +-+ // +-+
// +-+ // +-+
// //
_tex_sub_2d(tex->x, tex->y, _tex_sub_2d(tex->x, tex->y,
im->cache_entry.w, im->cache_entry.h, im->cache_entry.w, im->cache_entry.h,
fmt, tex->pt->dataformat, fmt, tex->pt->dataformat,
im->image.data); im->image.data);
// |xxx // |xxx
// |xxx // |xxx
// //
_tex_sub_2d(tex->x - 1, tex->y, _tex_sub_2d(tex->x - 1, tex->y,
1, im->cache_entry.h, 1, im->cache_entry.h,
fmt, tex->pt->dataformat, fmt, tex->pt->dataformat,
im->image.data); im->image.data);
// xxx| // xxx|
// xxx| // xxx|
// //
_tex_sub_2d(tex->x + im->cache_entry.w, tex->y, _tex_sub_2d(tex->x + im->cache_entry.w, tex->y,
1, im->cache_entry.h, 1, im->cache_entry.h,
fmt, tex->pt->dataformat, fmt, tex->pt->dataformat,
im->image.data + (im->cache_entry.w - 1)); im->image.data + (im->cache_entry.w - 1));
@ -923,11 +923,11 @@ evas_gl_common_texture_alpha_new(Evas_Engine_GL_Context *gc, DATA8 *pixels,
tex = calloc(1, sizeof(Evas_GL_Texture)); tex = calloc(1, sizeof(Evas_GL_Texture));
if (!tex) return NULL; if (!tex) return NULL;
tex->gc = gc; tex->gc = gc;
tex->references = 1; tex->references = 1;
tex->pt = _pool_tex_find(gc, w + 3, fh, alpha_ifmt, alpha_fmt, &u, &v, tex->pt = _pool_tex_find(gc, w + 3, fh, alpha_ifmt, alpha_fmt, &u, &v,
&l_after, &l_after,
gc->shared->info.tune.atlas.max_alloc_alpha_size); gc->shared->info.tune.atlas.max_alloc_alpha_size);
if (!tex->pt) if (!tex->pt)
{ {
@ -939,7 +939,7 @@ evas_gl_common_texture_alpha_new(Evas_Engine_GL_Context *gc, DATA8 *pixels,
tex->w = w; tex->w = w;
tex->h = h; tex->h = h;
if (l_after) if (l_after)
tex->pt->allocations = tex->pt->allocations =
eina_list_append_relative_list(tex->pt->allocations, tex, l_after); eina_list_append_relative_list(tex->pt->allocations, tex, l_after);
else else
tex->pt->allocations = eina_list_prepend(tex->pt->allocations, tex); tex->pt->allocations = eina_list_prepend(tex->pt->allocations, tex);
@ -955,13 +955,13 @@ evas_gl_common_texture_alpha_update(Evas_GL_Texture *tex, DATA8 *pixels,
if (!tex->pt) return; if (!tex->pt) return;
glBindTexture(GL_TEXTURE_2D, tex->pt->texture); glBindTexture(GL_TEXTURE_2D, tex->pt->texture);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
#ifdef GL_UNPACK_ROW_LENGTH #ifdef GL_UNPACK_ROW_LENGTH
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
#endif #endif
glPixelStorei(GL_UNPACK_ALIGNMENT, 4); glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
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->pipe[0].shader.cur_tex) if (tex->pt->texture != tex->gc->pipe[0].shader.cur_tex)
{ {
@ -977,7 +977,7 @@ evas_gl_common_texture_yuv_new(Evas_Engine_GL_Context *gc, DATA8 **rows, unsigne
tex = calloc(1, sizeof(Evas_GL_Texture)); tex = calloc(1, sizeof(Evas_GL_Texture));
if (!tex) return NULL; if (!tex) return NULL;
tex->gc = gc; tex->gc = gc;
tex->references = 1; tex->references = 1;
tex->pt = _pool_tex_new(gc, w + 1, h + 1, lum_ifmt, lum_fmt); tex->pt = _pool_tex_new(gc, w + 1, h + 1, lum_ifmt, lum_fmt);
@ -1073,7 +1073,7 @@ evas_gl_common_texture_yuv_update(Evas_GL_Texture *tex, DATA8 **rows, unsigned i
for (y = 0; y < (h / 2); y++) for (y = 0; y < (h / 2); y++)
_tex_sub_2d(0, y, w / 2, 1, tex->ptu->format, tex->ptu->dataformat, rows[h + y]); _tex_sub_2d(0, y, w / 2, 1, tex->ptu->format, tex->ptu->dataformat, rows[h + y]);
} }
glBindTexture(GL_TEXTURE_2D, tex->ptv->texture); glBindTexture(GL_TEXTURE_2D, tex->ptv->texture);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
if ((rows[h + (h / 2) + 1] - rows[h + (h / 2)]) == (int)(w / 2)) if ((rows[h + (h / 2) + 1] - rows[h + (h / 2)]) == (int)(w / 2))
@ -1083,7 +1083,7 @@ evas_gl_common_texture_yuv_update(Evas_GL_Texture *tex, DATA8 **rows, unsigned i
for (y = 0; y < (h / 2); y++) for (y = 0; y < (h / 2); y++)
_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->pipe[0].shader.cur_tex) if (tex->pt->texture != tex->gc->pipe[0].shader.cur_tex)
{ {
glBindTexture(GL_TEXTURE_2D, tex->gc->pipe[0].shader.cur_tex); glBindTexture(GL_TEXTURE_2D, tex->gc->pipe[0].shader.cur_tex);

View File

@ -33,16 +33,14 @@ struct _Evas_Engine_Info_GL_X11
struct { struct {
void (*pre_swap) (void *data, Evas *e); void (*pre_swap) (void *data, Evas *e);
void (*post_swap) (void *data, Evas *e); void (*post_swap) (void *data, Evas *e);
void *data; // data for callback calls void *data; // data for callback calls
} callback; } callback;
/* non-blocking or blocking mode */ /* non-blocking or blocking mode */
Evas_Engine_Render_Mode render_mode; Evas_Engine_Render_Mode render_mode;
unsigned char vsync : 1; // does nothing right now unsigned char vsync : 1; // does nothing right now
unsigned char indirect : 1; // use indirect rendering unsigned char indirect : 1; // use indirect rendering
}; };
#endif #endif

File diff suppressed because it is too large Load Diff

View File

@ -92,7 +92,7 @@ struct _Evas_GL_X11_Window
EGLSurface egl_surface[1]; EGLSurface egl_surface[1];
EGLConfig egl_config; EGLConfig egl_config;
EGLDisplay egl_disp; EGLDisplay egl_disp;
#else #else
GLXContext context; GLXContext context;
GLXWindow glxwin; GLXWindow glxwin;
struct { struct {
@ -102,7 +102,7 @@ struct _Evas_GL_X11_Window
int mipmap; int mipmap;
unsigned char yinvert : 1; unsigned char yinvert : 1;
} depth_cfg[33]; // config for all 32 possible depths! } depth_cfg[33]; // config for all 32 possible depths!
struct { struct {
unsigned int loose_binding : 1; unsigned int loose_binding : 1;
} detected; } detected;

View File

@ -41,15 +41,15 @@ eng_window_new(Display *disp,
int config_attrs[40]; int config_attrs[40];
int major_version, minor_version; int major_version, minor_version;
int num_config, n = 0; int num_config, n = 0;
#endif #endif
XVisualInfo *vi_use; XVisualInfo *vi_use;
const GLubyte *vendor, *renderer, *version; const GLubyte *vendor, *renderer, *version;
if (!_evas_gl_x11_vi) return NULL; if (!_evas_gl_x11_vi) return NULL;
gw = calloc(1, sizeof(Evas_GL_X11_Window)); gw = calloc(1, sizeof(Evas_GL_X11_Window));
if (!gw) return NULL; if (!gw) return NULL;
win_count++; win_count++;
gw->disp = disp; gw->disp = disp;
gw->win = win; gw->win = win;
@ -76,11 +76,11 @@ eng_window_new(Display *disp,
{ {
vi_use = _evas_gl_x11_rgba_vi; vi_use = _evas_gl_x11_rgba_vi;
} }
#endif #endif
#endif #endif
} }
gw->visualinfo = vi_use; gw->visualinfo = vi_use;
// EGL / GLES // EGL / GLES
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
context_attrs[0] = EGL_CONTEXT_CLIENT_VERSION; context_attrs[0] = EGL_CONTEXT_CLIENT_VERSION;
@ -137,7 +137,7 @@ eng_window_new(Display *disp,
config_attrs[n++] = 1; config_attrs[n++] = 1;
config_attrs[n++] = EGL_BLUE_SIZE; config_attrs[n++] = EGL_BLUE_SIZE;
config_attrs[n++] = 1; config_attrs[n++] = 1;
// FIXME: end n900 breakage // FIXME: end n900 breakage
#endif #endif
if (gw->alpha) if (gw->alpha)
{ {
@ -155,7 +155,7 @@ eng_window_new(Display *disp,
config_attrs[n++] = 0; config_attrs[n++] = 0;
config_attrs[n++] = EGL_NONE; config_attrs[n++] = EGL_NONE;
# endif # endif
gw->egl_disp = eglGetDisplay((EGLNativeDisplayType)(gw->disp)); gw->egl_disp = eglGetDisplay((EGLNativeDisplayType)(gw->disp));
if (!gw->egl_disp) if (!gw->egl_disp)
{ {
@ -176,7 +176,7 @@ eng_window_new(Display *disp,
eng_window_free(gw); eng_window_free(gw);
return NULL; return NULL;
} }
num_config = 0; num_config = 0;
if (!eglChooseConfig(gw->egl_disp, config_attrs, &gw->egl_config, if (!eglChooseConfig(gw->egl_disp, config_attrs, &gw->egl_config,
1, &num_config) || (num_config != 1)) 1, &num_config) || (num_config != 1))
@ -196,7 +196,7 @@ eng_window_new(Display *disp,
return NULL; return NULL;
} }
if (context == EGL_NO_CONTEXT) if (context == EGL_NO_CONTEXT)
context = eglCreateContext(gw->egl_disp, gw->egl_config, NULL, context = eglCreateContext(gw->egl_disp, gw->egl_config, NULL,
context_attrs); context_attrs);
gw->egl_context[0] = context; gw->egl_context[0] = context;
if (gw->egl_context[0] == EGL_NO_CONTEXT) if (gw->egl_context[0] == EGL_NO_CONTEXT)
@ -205,8 +205,8 @@ eng_window_new(Display *disp,
eng_window_free(gw); eng_window_free(gw);
return NULL; return NULL;
} }
if (eglMakeCurrent(gw->egl_disp, if (eglMakeCurrent(gw->egl_disp,
gw->egl_surface[0], gw->egl_surface[0],
gw->egl_surface[0], gw->egl_surface[0],
gw->egl_context[0]) == EGL_FALSE) gw->egl_context[0]) == EGL_FALSE)
{ {
@ -227,18 +227,18 @@ eng_window_new(Display *disp,
fprintf(stderr, "renderer: %s\n", renderer); fprintf(stderr, "renderer: %s\n", renderer);
fprintf(stderr, "version: %s\n", version); fprintf(stderr, "version: %s\n", version);
} }
// GLX // GLX
#else #else
if (!context) if (!context)
{ {
#ifdef NEWGL #ifdef NEWGL
if (indirect) if (indirect)
context = glXCreateNewContext(gw->disp, fbconf, context = glXCreateNewContext(gw->disp, fbconf,
GLX_RGBA_TYPE, NULL, GLX_RGBA_TYPE, NULL,
GL_TRUE); GL_TRUE);
else else
context = glXCreateNewContext(gw->disp, fbconf, context = glXCreateNewContext(gw->disp, fbconf,
GLX_RGBA_TYPE, NULL, GLX_RGBA_TYPE, NULL,
GL_FALSE); GL_FALSE);
#else #else
if (indirect) if (indirect)
@ -251,12 +251,12 @@ eng_window_new(Display *disp,
if ((gw->alpha) && (!rgba_context)) if ((gw->alpha) && (!rgba_context))
{ {
if (indirect) if (indirect)
rgba_context = glXCreateNewContext(gw->disp, rgba_fbconf, rgba_context = glXCreateNewContext(gw->disp, rgba_fbconf,
GLX_RGBA_TYPE, context, GLX_RGBA_TYPE, context,
GL_TRUE); GL_TRUE);
else else
rgba_context = glXCreateNewContext(gw->disp, rgba_fbconf, rgba_context = glXCreateNewContext(gw->disp, rgba_fbconf,
GLX_RGBA_TYPE, context, GLX_RGBA_TYPE, context,
GL_FALSE); GL_FALSE);
} }
if (gw->alpha) if (gw->alpha)
@ -268,10 +268,10 @@ eng_window_new(Display *disp,
eng_window_free(gw); eng_window_free(gw);
return NULL; return NULL;
} }
if (gw->alpha) gw->context = rgba_context; if (gw->alpha) gw->context = rgba_context;
else gw->context = context; else gw->context = context;
#else #else
gw->context = context; gw->context = context;
#endif #endif
@ -288,7 +288,7 @@ eng_window_new(Display *disp,
if (gw->glxwin) if (gw->glxwin)
{ {
if (!glXMakeContextCurrent(gw->disp, gw->glxwin, gw->glxwin, if (!glXMakeContextCurrent(gw->disp, gw->glxwin, gw->glxwin,
gw->context)) gw->context))
{ {
printf("Error: glXMakeContextCurrent(%p, %p, %p, %p)\n", (void *)gw->disp, (void *)gw->win, (void *)gw->win, (void *)gw->context); printf("Error: glXMakeContextCurrent(%p, %p, %p, %p)\n", (void *)gw->disp, (void *)gw->win, (void *)gw->win, (void *)gw->context);
@ -305,7 +305,7 @@ eng_window_new(Display *disp,
return NULL; return NULL;
} }
} }
// FIXME: move this up to context creation // FIXME: move this up to context creation
vendor = glGetString(GL_VENDOR); vendor = glGetString(GL_VENDOR);
@ -363,7 +363,7 @@ eng_window_new(Display *disp,
// version: 2.0 Mesa 7.8.2 // version: 2.0 Mesa 7.8.2
// or // or
// vendor: Tungsten Graphics, Inc // vendor: Tungsten Graphics, Inc
// renderer: Mesa DRI Mobile Intel® GM45 Express Chipset GEM 20100330 DEVELOPMENT // renderer: Mesa DRI Mobile Intel® GM45 Express Chipset GEM 20100330 DEVELOPMENT
// version: 2.1 Mesa 7.9-devel // version: 2.1 Mesa 7.9-devel
// or (bad - software renderer) // or (bad - software renderer)
// vendor: Mesa Project // vendor: Mesa Project
@ -373,7 +373,7 @@ eng_window_new(Display *disp,
// vendor: VMware, Inc. // vendor: VMware, Inc.
// renderer: Gallium 0.4 on softpipe // renderer: Gallium 0.4 on softpipe
// version: 2.1 Mesa 7.9-devel // version: 2.1 Mesa 7.9-devel
if (strstr((const char *)vendor, "Mesa Project")) if (strstr((const char *)vendor, "Mesa Project"))
{ {
if (strstr((const char *)renderer, "Software Rasterizer")) if (strstr((const char *)renderer, "Software Rasterizer"))
@ -396,12 +396,12 @@ eng_window_new(Display *disp,
{ {
int v1 = 0, v2 = 0, v3 = 0; int v1 = 0, v2 = 0, v3 = 0;
if (sscanf((const char *)version, if (sscanf((const char *)version,
"%*s %*s %i.%i.%i", "%*s %*s %i.%i.%i",
&v1, &v2, &v3) != 3) &v1, &v2, &v3) != 3)
{ {
v1 = v2 = v3 = 0; v1 = v2 = v3 = 0;
if (sscanf((const char *)version, if (sscanf((const char *)version,
"%*s %*s %i.%i", "%*s %*s %i.%i",
&v1, &v2) != 2) &v1, &v2) != 2)
v1 = 0; v1 = 0;
@ -415,7 +415,7 @@ eng_window_new(Display *disp,
{ {
// noothing yet. add more cases and options over time // noothing yet. add more cases and options over time
} }
fbc = glXGetFBConfigs(gw->disp, screen, &num); fbc = glXGetFBConfigs(gw->disp, screen, &num);
if (!fbc) if (!fbc)
{ {
@ -431,22 +431,22 @@ eng_window_new(Display *disp,
int vd; int vd;
int alph, val, dbuf, stencil, tdepth; int alph, val, dbuf, stencil, tdepth;
int rgba; int rgba;
vi = glXGetVisualFromFBConfig(gw->disp, fbc[j]); vi = glXGetVisualFromFBConfig(gw->disp, fbc[j]);
if (!vi) continue; if (!vi) continue;
vd = vi->depth; vd = vi->depth;
XFree(vi); XFree(vi);
if (vd != i) continue; if (vd != i) continue;
glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_ALPHA_SIZE, &alph); glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_ALPHA_SIZE, &alph);
glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_BUFFER_SIZE, &val); glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_BUFFER_SIZE, &val);
if ((val != i) && ((val - alph) != i)) continue; if ((val != i) && ((val - alph) != i)) continue;
val = 0; val = 0;
rgba = 0; rgba = 0;
if (i == 32) if (i == 32)
{ {
glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_BIND_TO_TEXTURE_RGBA_EXT, &val); glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_BIND_TO_TEXTURE_RGBA_EXT, &val);
@ -463,32 +463,32 @@ eng_window_new(Display *disp,
if (!val) continue; if (!val) continue;
gw->depth_cfg[i].tex_format = GLX_TEXTURE_FORMAT_RGB_EXT; gw->depth_cfg[i].tex_format = GLX_TEXTURE_FORMAT_RGB_EXT;
} }
dbuf = 0x7fff; dbuf = 0x7fff;
glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_DOUBLEBUFFER, &val); glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_DOUBLEBUFFER, &val);
if (val > dbuf) continue; if (val > dbuf) continue;
dbuf = val; dbuf = val;
stencil = 0x7fff; stencil = 0x7fff;
glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_STENCIL_SIZE, &val); glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_STENCIL_SIZE, &val);
if (val > stencil) continue; if (val > stencil) continue;
stencil = val; stencil = val;
tdepth = 0x7fff; tdepth = 0x7fff;
glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_DEPTH_SIZE, &val); glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_DEPTH_SIZE, &val);
if (val > tdepth) continue; if (val > tdepth) continue;
tdepth = val; tdepth = val;
glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_BIND_TO_MIPMAP_TEXTURE_EXT, &val); glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_BIND_TO_MIPMAP_TEXTURE_EXT, &val);
if (val < 0) continue; if (val < 0) continue;
gw->depth_cfg[i].mipmap = val; gw->depth_cfg[i].mipmap = val;
glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_Y_INVERTED_EXT, &val); glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_Y_INVERTED_EXT, &val);
gw->depth_cfg[i].yinvert = val; gw->depth_cfg[i].yinvert = val;
glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_BIND_TO_TEXTURE_TARGETS_EXT, &val); glXGetFBConfigAttrib(gw->disp, fbc[j], GLX_BIND_TO_TEXTURE_TARGETS_EXT, &val);
gw->depth_cfg[i].tex_target = val; gw->depth_cfg[i].tex_target = val;
gw->depth_cfg[i].fbc = fbc[j]; gw->depth_cfg[i].fbc = fbc[j];
} }
} }
@ -499,7 +499,7 @@ eng_window_new(Display *disp,
} }
} }
#endif #endif
gw->gl_context = evas_gl_common_context_new(); gw->gl_context = evas_gl_common_context_new();
if (!gw->gl_context) if (!gw->gl_context)
{ {
@ -508,7 +508,7 @@ eng_window_new(Display *disp,
} }
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
gw->gl_context->egldisp = gw->egl_disp; gw->gl_context->egldisp = gw->egl_disp;
#endif #endif
eng_window_use(gw); eng_window_use(gw);
evas_gl_common_context_resize(gw->gl_context, w, h, rot); evas_gl_common_context_resize(gw->gl_context, w, h, rot);
gw->surf = 1; gw->surf = 1;
@ -557,15 +557,15 @@ void
eng_window_use(Evas_GL_X11_Window *gw) eng_window_use(Evas_GL_X11_Window *gw)
{ {
Eina_Bool force_use = EINA_FALSE; Eina_Bool force_use = EINA_FALSE;
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
if (_evas_gl_x11_window) if (_evas_gl_x11_window)
{ {
if ((eglGetCurrentContext() != if ((eglGetCurrentContext() !=
_evas_gl_x11_window->egl_context[0]) || _evas_gl_x11_window->egl_context[0]) ||
(eglGetCurrentSurface(EGL_READ) != (eglGetCurrentSurface(EGL_READ) !=
_evas_gl_x11_window->egl_surface[0]) || _evas_gl_x11_window->egl_surface[0]) ||
(eglGetCurrentSurface(EGL_DRAW) != (eglGetCurrentSurface(EGL_DRAW) !=
_evas_gl_x11_window->egl_surface[0])) _evas_gl_x11_window->egl_surface[0]))
force_use = EINA_TRUE; force_use = EINA_TRUE;
} }
@ -575,7 +575,7 @@ eng_window_use(Evas_GL_X11_Window *gw)
if (glXGetCurrentContext() != _evas_gl_x11_window->context) if (glXGetCurrentContext() != _evas_gl_x11_window->context)
force_use = EINA_TRUE; force_use = EINA_TRUE;
} }
#endif #endif
if ((_evas_gl_x11_window != gw) || (force_use)) if ((_evas_gl_x11_window != gw) || (force_use))
{ {
if (_evas_gl_x11_window) if (_evas_gl_x11_window)
@ -590,19 +590,19 @@ eng_window_use(Evas_GL_X11_Window *gw)
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
if (gw->egl_surface[0] != EGL_NO_SURFACE) if (gw->egl_surface[0] != EGL_NO_SURFACE)
{ {
if (eglMakeCurrent(gw->egl_disp, if (eglMakeCurrent(gw->egl_disp,
gw->egl_surface[0], gw->egl_surface[0],
gw->egl_surface[0], gw->egl_surface[0],
gw->egl_context[0]) == EGL_FALSE) gw->egl_context[0]) == EGL_FALSE)
{ {
ERR("eglMakeCurrent() failed!"); ERR("eglMakeCurrent() failed!");
} }
} }
// GLX // GLX
#else #else
if (gw->glxwin) if (gw->glxwin)
{ {
if (!glXMakeContextCurrent(gw->disp, gw->glxwin, gw->glxwin, if (!glXMakeContextCurrent(gw->disp, gw->glxwin, gw->glxwin,
gw->context)) gw->context))
{ {
ERR("glXMakeContextCurrent(%p, %p, %p, %p)", (void *)gw->disp, (void *)gw->win, (void *)gw->win, (void *)gw->context); ERR("glXMakeContextCurrent(%p, %p, %p, %p)", (void *)gw->disp, (void *)gw->win, (void *)gw->win, (void *)gw->context);
@ -667,8 +667,8 @@ eng_window_resurf(Evas_GL_X11_Window *gw)
(unsigned int)gw->win, eglGetError()); (unsigned int)gw->win, eglGetError());
return; return;
} }
if (eglMakeCurrent(gw->egl_disp, if (eglMakeCurrent(gw->egl_disp,
gw->egl_surface[0], gw->egl_surface[0],
gw->egl_surface[0], gw->egl_surface[0],
gw->egl_context[0]) == EGL_FALSE) gw->egl_context[0]) == EGL_FALSE)
{ {
@ -680,18 +680,18 @@ eng_window_resurf(Evas_GL_X11_Window *gw)
gw->glxwin = glXCreateWindow(gw->disp, rgba_fbconf, gw->win, NULL); gw->glxwin = glXCreateWindow(gw->disp, rgba_fbconf, gw->win, NULL);
else else
gw->glxwin = glXCreateWindow(gw->disp, fbconf, gw->win, NULL); gw->glxwin = glXCreateWindow(gw->disp, fbconf, gw->win, NULL);
if (!glXMakeContextCurrent(gw->disp, gw->glxwin, gw->glxwin, if (!glXMakeContextCurrent(gw->disp, gw->glxwin, gw->glxwin,
gw->context)) gw->context))
{ {
ERR("glXMakeContextCurrent(%p, %p, %p, %p)", (void *)gw->disp, (void *)gw->win, (void *)gw->win, (void *)gw->context); ERR("glXMakeContextCurrent(%p, %p, %p, %p)", (void *)gw->disp, (void *)gw->win, (void *)gw->win, (void *)gw->context);
} }
#else #else
if (!glXMakeCurrent(gw->disp, gw->win, gw->context)) if (!glXMakeCurrent(gw->disp, gw->win, gw->context))
{ {
ERR("glXMakeCurrent(%p, 0x%x, %p) failed", (void *)gw->disp, (unsigned int)gw->win, (void *)gw->context); ERR("glXMakeCurrent(%p, 0x%x, %p) failed", (void *)gw->disp, (unsigned int)gw->win, (void *)gw->context);
} }
#endif #endif
#endif #endif
gw->surf = 1; gw->surf = 1;
} }
@ -703,7 +703,7 @@ eng_best_visual_get(Evas_Engine_Info_GL_X11 *einfo)
if (!_evas_gl_x11_vi) if (!_evas_gl_x11_vi)
{ {
int alpha; int alpha;
// EGL / GLES // EGL / GLES
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
for (alpha = 0; alpha < 2; alpha++) for (alpha = 0; alpha < 2; alpha++)
@ -715,7 +715,7 @@ eng_best_visual_get(Evas_Engine_Info_GL_X11 *einfo)
XVisualInfo *xvi, vi_in; XVisualInfo *xvi, vi_in;
int nvi, i; int nvi, i;
XRenderPictFormat *fmt; XRenderPictFormat *fmt;
vi_in.screen = einfo->info.screen; vi_in.screen = einfo->info.screen;
vi_in.depth = 32; vi_in.depth = 32;
vi_in.class = TrueColor; vi_in.class = TrueColor;
@ -726,16 +726,16 @@ eng_best_visual_get(Evas_Engine_Info_GL_X11 *einfo)
if (xvi) if (xvi)
{ {
for (i = 0; i < nvi; i++) for (i = 0; i < nvi; i++)
{ {
fmt = XRenderFindVisualFormat(einfo->info.display, fmt = XRenderFindVisualFormat(einfo->info.display,
xvi[i].visual); xvi[i].visual);
if ((fmt->type == PictTypeDirect) && if ((fmt->type == PictTypeDirect) &&
(fmt->direct.alphaMask)) (fmt->direct.alphaMask))
{ {
_evas_gl_x11_rgba_vi = _evas_gl_x11_rgba_vi =
calloc(1, sizeof(XVisualInfo)); calloc(1, sizeof(XVisualInfo));
if (_evas_gl_x11_rgba_vi) if (_evas_gl_x11_rgba_vi)
memcpy(_evas_gl_x11_rgba_vi, memcpy(_evas_gl_x11_rgba_vi,
&(xvi[i]), sizeof(XVisualInfo)); &(xvi[i]), sizeof(XVisualInfo));
break; break;
} }
@ -758,7 +758,7 @@ eng_best_visual_get(Evas_Engine_Info_GL_X11 *einfo)
int config_attrs[40]; int config_attrs[40];
GLXFBConfig *configs = NULL, config = 0; GLXFBConfig *configs = NULL, config = 0;
int i, num; int i, num;
i = 0; i = 0;
config_attrs[i++] = GLX_DRAWABLE_TYPE; config_attrs[i++] = GLX_DRAWABLE_TYPE;
config_attrs[i++] = GLX_WINDOW_BIT; config_attrs[i++] = GLX_WINDOW_BIT;
@ -793,8 +793,8 @@ eng_best_visual_get(Evas_Engine_Info_GL_X11 *einfo)
config_attrs[i++] = GLX_TRANSPARENT_TYPE; config_attrs[i++] = GLX_TRANSPARENT_TYPE;
config_attrs[i++] = GLX_NONE;//GLX_NONE;//GLX_TRANSPARENT_INDEX//GLX_TRANSPARENT_RGB; config_attrs[i++] = GLX_NONE;//GLX_NONE;//GLX_TRANSPARENT_INDEX//GLX_TRANSPARENT_RGB;
config_attrs[i++] = 0; config_attrs[i++] = 0;
configs = glXChooseFBConfig(einfo->info.display, configs = glXChooseFBConfig(einfo->info.display,
einfo->info.screen, einfo->info.screen,
config_attrs, &num); config_attrs, &num);
if ((!configs) || (num < 1)) if ((!configs) || (num < 1))
@ -806,8 +806,8 @@ eng_best_visual_get(Evas_Engine_Info_GL_X11 *einfo)
{ {
XVisualInfo *visinfo; XVisualInfo *visinfo;
XRenderPictFormat *format = NULL; XRenderPictFormat *format = NULL;
visinfo = glXGetVisualFromFBConfig(einfo->info.display, visinfo = glXGetVisualFromFBConfig(einfo->info.display,
configs[i]); configs[i]);
if (!visinfo) continue; if (!visinfo) continue;
if (!alpha) if (!alpha)
@ -849,11 +849,11 @@ eng_best_visual_get(Evas_Engine_Info_GL_X11 *einfo)
// EGL / GLES // EGL / GLES
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
if (_evas_gl_x11_rgba_vi) return _evas_gl_x11_rgba_vi->visual; if (_evas_gl_x11_rgba_vi) return _evas_gl_x11_rgba_vi->visual;
#else #else
# ifdef NEWGL # ifdef NEWGL
if (_evas_gl_x11_rgba_vi) return _evas_gl_x11_rgba_vi->visual; if (_evas_gl_x11_rgba_vi) return _evas_gl_x11_rgba_vi->visual;
# endif # endif
#endif #endif
} }
return _evas_gl_x11_vi->visual; return _evas_gl_x11_vi->visual;
} }
@ -868,24 +868,24 @@ eng_best_colormap_get(Evas_Engine_Info_GL_X11 *einfo)
if (einfo->info.destination_alpha) if (einfo->info.destination_alpha)
{ {
if (!_evas_gl_x11_rgba_cmap) if (!_evas_gl_x11_rgba_cmap)
_evas_gl_x11_rgba_cmap = _evas_gl_x11_rgba_cmap =
XCreateColormap(einfo->info.display, XCreateColormap(einfo->info.display,
RootWindow(einfo->info.display, RootWindow(einfo->info.display,
einfo->info.screen), einfo->info.screen),
_evas_gl_x11_rgba_vi->visual, _evas_gl_x11_rgba_vi->visual,
0); 0);
return _evas_gl_x11_rgba_cmap; return _evas_gl_x11_rgba_cmap;
} }
if (!_evas_gl_x11_cmap) if (!_evas_gl_x11_cmap)
_evas_gl_x11_cmap = _evas_gl_x11_cmap =
XCreateColormap(einfo->info.display, XCreateColormap(einfo->info.display,
RootWindow(einfo->info.display, RootWindow(einfo->info.display,
einfo->info.screen), einfo->info.screen),
_evas_gl_x11_vi->visual, _evas_gl_x11_vi->visual,
0); 0);
return _evas_gl_x11_cmap; return _evas_gl_x11_cmap;
} }
int int
eng_best_depth_get(Evas_Engine_Info_GL_X11 *einfo) eng_best_depth_get(Evas_Engine_Info_GL_X11 *einfo)
{ {