2003-09-07 04:24:48 -07:00
|
|
|
#include "evas_gl_private.h"
|
2009-11-21 02:51:51 -08:00
|
|
|
|
2010-08-08 20:27:59 -07:00
|
|
|
#define GLPIPES 1
|
|
|
|
|
2009-11-21 02:51:51 -08:00
|
|
|
static int sym_done = 0;
|
2010-10-07 16:46:42 -07:00
|
|
|
int _evas_engine_GL_common_log_dom = -1;
|
2009-11-21 02:51:51 -08:00
|
|
|
|
2010-09-18 18:33:51 -07:00
|
|
|
typedef void (*glsym_func_void) ();
|
|
|
|
|
2009-11-21 02:51:51 -08:00
|
|
|
void (*glsym_glGenFramebuffers) (GLsizei a, GLuint *b) = NULL;
|
|
|
|
void (*glsym_glBindFramebuffer) (GLenum a, GLuint b) = NULL;
|
|
|
|
void (*glsym_glFramebufferTexture2D) (GLenum a, GLenum b, GLenum c, GLuint d, GLint e) = NULL;
|
|
|
|
void (*glsym_glDeleteFramebuffers) (GLsizei a, const GLuint *b) = NULL;
|
From: Jiyoun Park <jy0703.park@samsung.com>
Subject: [E-devel] [Patch] Evas gl shader use binary shader
I make patch related with evas gl binary shader.
The concept of binary shader is compile shader only once.
Some people want to use binary shader because of performance issue.
In current evas gl engine, every application have to compile shader each
time.
But I modify code , so only first running application need compile shader.
Other application use already compiled shader(binary shader)
The binary shader is made under HOME/.evas/gl_common_shaders directory.
Binary shader is created according to GL vendor,GL renderer, GL version and
Module_arch.
The basic flow is
1. First running application which use gl engine check binary shader
directory, but it can't find binary shader.
2. After compiling shader, It saves compiled shaders..
3. Other application checks shader directory, it can use binary
shaders.
In mobile target, using binary shader, I can save 150ms. (that time, there
is 11 shaders).
If there is more shaders and more applications, this flow maybe save more
total time.
(the above is now in, changelog coming, with change to using ~/.cache,
some formatting fixes, make ity do the desktop gl one right with the
retrievable hint parameter ont he program etc. - doesn't break desktop
gl at least. yay. a,so fixes to mke it compile at all).
SVN revision: 59167
2011-05-03 23:15:00 -07:00
|
|
|
void (*glsym_glGetProgramBinary) (GLuint a, GLsizei b, GLsizei *c, GLenum *d, void *e) = NULL;
|
|
|
|
void (*glsym_glProgramBinary) (GLuint a, GLenum b, const void *c, GLint d) = NULL;
|
|
|
|
void (*glsym_glProgramParameteri) (GLuint a, GLuint b, GLint d) = NULL;
|
2009-11-21 02:51:51 -08:00
|
|
|
|
2010-08-11 23:02:15 -07:00
|
|
|
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
|
|
|
|
// just used for finding symbols :)
|
|
|
|
typedef void (*_eng_fn) (void);
|
2010-09-18 18:33:51 -07:00
|
|
|
|
|
|
|
typedef _eng_fn (*secsym_func_eng_fn) ();
|
|
|
|
typedef unsigned int (*secsym_func_uint) ();
|
|
|
|
typedef void *(*secsym_func_void_ptr) ();
|
|
|
|
|
2010-08-11 23:02:15 -07:00
|
|
|
static _eng_fn (*secsym_eglGetProcAddress) (const char *a) = NULL;
|
|
|
|
|
2010-08-13 03:34:51 -07:00
|
|
|
void *(*secsym_eglCreateImage) (void *a, void *b, GLenum c, void *d, const int *e) = NULL;
|
|
|
|
unsigned int (*secsym_eglDestroyImage) (void *a, void *b) = NULL;
|
|
|
|
void (*secsym_glEGLImageTargetTexture2DOES) (int a, void *b) = NULL;
|
|
|
|
void *(*secsym_eglMapImageSEC) (void *a, void *b) = NULL;
|
|
|
|
unsigned int (*secsym_eglUnmapImageSEC) (void *a, void *b) = NULL;
|
|
|
|
unsigned int (*secsym_eglGetImageAttribSEC) (void *a, void *b, int c, int *d) = NULL;
|
2010-08-11 23:02:15 -07:00
|
|
|
#endif
|
|
|
|
|
2010-09-30 16:20:26 -07:00
|
|
|
static int dbgflushnum = -1;
|
|
|
|
|
2009-11-21 02:51:51 -08:00
|
|
|
static void
|
|
|
|
sym_missing(void)
|
|
|
|
{
|
2010-10-07 16:46:42 -07:00
|
|
|
ERR("GL symbols missing!");
|
2009-11-21 02:51:51 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gl_symbols(void)
|
|
|
|
{
|
|
|
|
if (sym_done) return;
|
|
|
|
sym_done = 1;
|
|
|
|
|
2010-01-30 00:11:51 -08:00
|
|
|
#ifdef _EVAS_ENGINE_SDL_H
|
2010-09-18 18:33:51 -07:00
|
|
|
# define FINDSYM(dst, sym, typ) if (!dst) dst = (typ)SDL_GL_GetProcAddress(sym)
|
2010-01-30 00:11:51 -08:00
|
|
|
#else
|
2010-09-18 18:33:51 -07:00
|
|
|
# define FINDSYM(dst, sym, typ) if (!dst) dst = (typ)dlsym(RTLD_DEFAULT, sym)
|
2010-01-30 00:11:51 -08:00
|
|
|
#endif
|
2010-09-18 18:33:51 -07:00
|
|
|
#define FALLBAK(dst, typ) if (!dst) dst = (typ)sym_missing;
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-09-18 18:33:51 -07:00
|
|
|
FINDSYM(glsym_glGenFramebuffers, "glGenFramebuffers", glsym_func_void);
|
|
|
|
FINDSYM(glsym_glGenFramebuffers, "glGenFramebuffersEXT", glsym_func_void);
|
|
|
|
FINDSYM(glsym_glGenFramebuffers, "glGenFramebuffersARB", glsym_func_void);
|
|
|
|
FALLBAK(glsym_glGenFramebuffers, glsym_func_void);
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-09-18 18:33:51 -07:00
|
|
|
FINDSYM(glsym_glBindFramebuffer, "glBindFramebuffer", glsym_func_void);
|
|
|
|
FINDSYM(glsym_glBindFramebuffer, "glBindFramebufferEXT", glsym_func_void);
|
|
|
|
FINDSYM(glsym_glBindFramebuffer, "glBindFramebufferARB", glsym_func_void);
|
|
|
|
FALLBAK(glsym_glBindFramebuffer, glsym_func_void);
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-09-18 18:33:51 -07:00
|
|
|
FINDSYM(glsym_glFramebufferTexture2D, "glFramebufferTexture2D", glsym_func_void);
|
|
|
|
FINDSYM(glsym_glFramebufferTexture2D, "glFramebufferTexture2DEXT", glsym_func_void);
|
|
|
|
FINDSYM(glsym_glFramebufferTexture2D, "glFramebufferTexture2DARB", glsym_func_void);
|
|
|
|
FALLBAK(glsym_glFramebufferTexture2D, glsym_func_void);
|
2009-11-21 02:51:51 -08:00
|
|
|
|
2010-09-18 18:33:51 -07:00
|
|
|
FINDSYM(glsym_glDeleteFramebuffers, "glDeleteFramebuffers", glsym_func_void);
|
|
|
|
FINDSYM(glsym_glDeleteFramebuffers, "glDeleteFramebuffersEXT", glsym_func_void);
|
|
|
|
FINDSYM(glsym_glDeleteFramebuffers, "glDeleteFramebuffersARB", glsym_func_void);
|
|
|
|
FALLBAK(glsym_glDeleteFramebuffers, glsym_func_void);
|
2010-08-11 23:02:15 -07:00
|
|
|
|
From: Jiyoun Park <jy0703.park@samsung.com>
Subject: [E-devel] [Patch] Evas gl shader use binary shader
I make patch related with evas gl binary shader.
The concept of binary shader is compile shader only once.
Some people want to use binary shader because of performance issue.
In current evas gl engine, every application have to compile shader each
time.
But I modify code , so only first running application need compile shader.
Other application use already compiled shader(binary shader)
The binary shader is made under HOME/.evas/gl_common_shaders directory.
Binary shader is created according to GL vendor,GL renderer, GL version and
Module_arch.
The basic flow is
1. First running application which use gl engine check binary shader
directory, but it can't find binary shader.
2. After compiling shader, It saves compiled shaders..
3. Other application checks shader directory, it can use binary
shaders.
In mobile target, using binary shader, I can save 150ms. (that time, there
is 11 shaders).
If there is more shaders and more applications, this flow maybe save more
total time.
(the above is now in, changelog coming, with change to using ~/.cache,
some formatting fixes, make ity do the desktop gl one right with the
retrievable hint parameter ont he program etc. - doesn't break desktop
gl at least. yay. a,so fixes to mke it compile at all).
SVN revision: 59167
2011-05-03 23:15:00 -07:00
|
|
|
FINDSYM(glsym_glGetProgramBinary, "glGetProgramBinary", glsym_func_void);
|
|
|
|
FINDSYM(glsym_glGetProgramBinary, "glGetProgramBinaryEXT", glsym_func_void);
|
|
|
|
FINDSYM(glsym_glGetProgramBinary, "glGetProgramBinaryARB", glsym_func_void);
|
|
|
|
FINDSYM(glsym_glGetProgramBinary, "glGetProgramBinaryOES", glsym_func_void);
|
|
|
|
|
|
|
|
FINDSYM(glsym_glProgramBinary, "glProgramBinary", glsym_func_void);
|
|
|
|
FINDSYM(glsym_glProgramBinary, "glProgramBinaryEXT", glsym_func_void);
|
|
|
|
FINDSYM(glsym_glProgramBinary, "glProgramBinaryARB", glsym_func_void);
|
2011-06-17 00:47:28 -07:00
|
|
|
|
From: Jiyoun Park <jy0703.park@samsung.com>
Subject: [E-devel] [Patch] Evas gl shader use binary shader
I make patch related with evas gl binary shader.
The concept of binary shader is compile shader only once.
Some people want to use binary shader because of performance issue.
In current evas gl engine, every application have to compile shader each
time.
But I modify code , so only first running application need compile shader.
Other application use already compiled shader(binary shader)
The binary shader is made under HOME/.evas/gl_common_shaders directory.
Binary shader is created according to GL vendor,GL renderer, GL version and
Module_arch.
The basic flow is
1. First running application which use gl engine check binary shader
directory, but it can't find binary shader.
2. After compiling shader, It saves compiled shaders..
3. Other application checks shader directory, it can use binary
shaders.
In mobile target, using binary shader, I can save 150ms. (that time, there
is 11 shaders).
If there is more shaders and more applications, this flow maybe save more
total time.
(the above is now in, changelog coming, with change to using ~/.cache,
some formatting fixes, make ity do the desktop gl one right with the
retrievable hint parameter ont he program etc. - doesn't break desktop
gl at least. yay. a,so fixes to mke it compile at all).
SVN revision: 59167
2011-05-03 23:15:00 -07:00
|
|
|
FINDSYM(glsym_glProgramParameteri, "glProgramParameteri", glsym_func_void);
|
|
|
|
FINDSYM(glsym_glProgramParameteri, "glProgramParameteriEXT", glsym_func_void);
|
|
|
|
FINDSYM(glsym_glProgramParameteri, "glProgramParameteriARB", glsym_func_void);
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-08-11 23:02:15 -07:00
|
|
|
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
|
|
|
|
#undef FINDSYM
|
2010-09-18 18:33:51 -07:00
|
|
|
#define FINDSYM(dst, sym, typ) \
|
|
|
|
if ((!dst) && (secsym_eglGetProcAddress)) dst = (typ)secsym_eglGetProcAddress(sym); \
|
|
|
|
if (!dst) dst = (typ)dlsym(RTLD_DEFAULT, sym)
|
2010-08-11 23:02:15 -07:00
|
|
|
// yes - gl core looking for egl stuff. i know it's odd. a reverse-layer thing
|
|
|
|
// but it will work as the egl/glx layer calls gl core common stuff and thus
|
|
|
|
// these symbols will work. making the glx/egl + x11 layer do this kind-of is
|
|
|
|
// wrong as this is not x11 (output) layer specific like the native surface
|
|
|
|
// stuff. this is generic zero-copy textures for gl
|
|
|
|
|
2010-09-18 18:33:51 -07:00
|
|
|
FINDSYM(secsym_eglGetProcAddress, "eglGetProcAddress", secsym_func_eng_fn);
|
|
|
|
FINDSYM(secsym_eglGetProcAddress, "eglGetProcAddressEXT", secsym_func_eng_fn);
|
|
|
|
FINDSYM(secsym_eglGetProcAddress, "eglGetProcAddressARB", secsym_func_eng_fn);
|
|
|
|
FINDSYM(secsym_eglGetProcAddress, "eglGetProcAddressKHR", secsym_func_eng_fn);
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-09-18 18:33:51 -07:00
|
|
|
FINDSYM(secsym_eglCreateImage, "eglCreateImage", secsym_func_void_ptr);
|
|
|
|
FINDSYM(secsym_eglCreateImage, "eglCreateImageEXT", secsym_func_void_ptr);
|
|
|
|
FINDSYM(secsym_eglCreateImage, "eglCreateImageARB", secsym_func_void_ptr);
|
|
|
|
FINDSYM(secsym_eglCreateImage, "eglCreateImageKHR", secsym_func_void_ptr);
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-09-18 18:33:51 -07:00
|
|
|
FINDSYM(secsym_eglDestroyImage, "eglDestroyImage", secsym_func_uint);
|
|
|
|
FINDSYM(secsym_eglDestroyImage, "eglDestroyImageEXT", secsym_func_uint);
|
|
|
|
FINDSYM(secsym_eglDestroyImage, "eglDestroyImageARB", secsym_func_uint);
|
|
|
|
FINDSYM(secsym_eglDestroyImage, "eglDestroyImageKHR", secsym_func_uint);
|
2011-06-17 00:47:28 -07:00
|
|
|
|
From: Jiyoun Park <jy0703.park@samsung.com>
Subject: [E-devel] [Patch] Evas gl shader use binary shader
I make patch related with evas gl binary shader.
The concept of binary shader is compile shader only once.
Some people want to use binary shader because of performance issue.
In current evas gl engine, every application have to compile shader each
time.
But I modify code , so only first running application need compile shader.
Other application use already compiled shader(binary shader)
The binary shader is made under HOME/.evas/gl_common_shaders directory.
Binary shader is created according to GL vendor,GL renderer, GL version and
Module_arch.
The basic flow is
1. First running application which use gl engine check binary shader
directory, but it can't find binary shader.
2. After compiling shader, It saves compiled shaders..
3. Other application checks shader directory, it can use binary
shaders.
In mobile target, using binary shader, I can save 150ms. (that time, there
is 11 shaders).
If there is more shaders and more applications, this flow maybe save more
total time.
(the above is now in, changelog coming, with change to using ~/.cache,
some formatting fixes, make ity do the desktop gl one right with the
retrievable hint parameter ont he program etc. - doesn't break desktop
gl at least. yay. a,so fixes to mke it compile at all).
SVN revision: 59167
2011-05-03 23:15:00 -07:00
|
|
|
FINDSYM(glsym_glGetProgramBinary, "glGetProgramBinary", glsym_func_void);
|
|
|
|
FINDSYM(glsym_glGetProgramBinary, "glGetProgramBinaryEXT", glsym_func_void);
|
|
|
|
FINDSYM(glsym_glGetProgramBinary, "glGetProgramBinaryARB", glsym_func_void);
|
|
|
|
FINDSYM(glsym_glGetProgramBinary, "glGetProgramBinaryOES", glsym_func_void);
|
|
|
|
FINDSYM(glsym_glGetProgramBinary, "glGetProgramBinaryKHR", glsym_func_void);
|
|
|
|
|
|
|
|
FINDSYM(glsym_glProgramBinary, "glProgramBinary", glsym_func_void);
|
|
|
|
FINDSYM(glsym_glProgramBinary, "glProgramBinaryEXT", glsym_func_void);
|
|
|
|
FINDSYM(glsym_glProgramBinary, "glProgramBinaryARB", glsym_func_void);
|
|
|
|
FINDSYM(glsym_glProgramBinary, "glProgramBinaryOES", glsym_func_void);
|
|
|
|
FINDSYM(glsym_glProgramBinary, "glProgramBinaryKHR", glsym_func_void);
|
2011-06-17 00:47:28 -07:00
|
|
|
|
From: Jiyoun Park <jy0703.park@samsung.com>
Subject: [E-devel] [Patch] Evas gl shader use binary shader
I make patch related with evas gl binary shader.
The concept of binary shader is compile shader only once.
Some people want to use binary shader because of performance issue.
In current evas gl engine, every application have to compile shader each
time.
But I modify code , so only first running application need compile shader.
Other application use already compiled shader(binary shader)
The binary shader is made under HOME/.evas/gl_common_shaders directory.
Binary shader is created according to GL vendor,GL renderer, GL version and
Module_arch.
The basic flow is
1. First running application which use gl engine check binary shader
directory, but it can't find binary shader.
2. After compiling shader, It saves compiled shaders..
3. Other application checks shader directory, it can use binary
shaders.
In mobile target, using binary shader, I can save 150ms. (that time, there
is 11 shaders).
If there is more shaders and more applications, this flow maybe save more
total time.
(the above is now in, changelog coming, with change to using ~/.cache,
some formatting fixes, make ity do the desktop gl one right with the
retrievable hint parameter ont he program etc. - doesn't break desktop
gl at least. yay. a,so fixes to mke it compile at all).
SVN revision: 59167
2011-05-03 23:15:00 -07:00
|
|
|
FINDSYM(glsym_glProgramParameteri, "glProgramParameteri", glsym_func_void);
|
|
|
|
FINDSYM(glsym_glProgramParameteri, "glProgramParameteriEXT", glsym_func_void);
|
|
|
|
FINDSYM(glsym_glProgramParameteri, "glProgramParameteriARB", glsym_func_void);
|
|
|
|
FINDSYM(glsym_glProgramParameteri, "glProgramParameteriOES", glsym_func_void);
|
|
|
|
FINDSYM(glsym_glProgramParameteri, "glProgramParameteriKHR", glsym_func_void);
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-09-18 18:33:51 -07:00
|
|
|
FINDSYM(secsym_glEGLImageTargetTexture2DOES, "glEGLImageTargetTexture2DOES", glsym_func_void);
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-09-18 18:33:51 -07:00
|
|
|
FINDSYM(secsym_eglMapImageSEC, "eglMapImageSEC", secsym_func_void_ptr);
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-09-18 18:33:51 -07:00
|
|
|
FINDSYM(secsym_eglUnmapImageSEC, "eglUnmapImageSEC", secsym_func_uint);
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-09-18 18:33:51 -07:00
|
|
|
FINDSYM(secsym_eglGetImageAttribSEC, "eglGetImageAttribSEC", secsym_func_uint);
|
2011-06-17 00:47:28 -07:00
|
|
|
#endif
|
2009-11-21 02:51:51 -08:00
|
|
|
}
|
|
|
|
|
2011-03-16 10:32:49 -07:00
|
|
|
static void shader_array_flush(Evas_Engine_GL_Context *gc);
|
2003-09-07 04:24:48 -07:00
|
|
|
|
2011-03-16 10:32:49 -07:00
|
|
|
static Evas_Engine_GL_Context *_evas_gl_common_context = NULL;
|
2009-10-13 02:40:39 -07:00
|
|
|
static Evas_GL_Shared *shared = NULL;
|
2003-09-07 04:24:48 -07:00
|
|
|
|
2009-10-09 05:10:27 -07:00
|
|
|
void
|
2010-02-16 20:30:58 -08:00
|
|
|
glerr(int err, const char *file, const char *func, int line, const char *op)
|
2009-10-09 05:10:27 -07:00
|
|
|
{
|
2010-10-07 16:46:42 -07:00
|
|
|
const char *errmsg;
|
|
|
|
char buf[32];
|
|
|
|
|
2010-02-16 20:30:58 -08:00
|
|
|
switch (err)
|
2009-10-09 05:10:27 -07:00
|
|
|
{
|
2010-02-16 20:30:58 -08:00
|
|
|
case GL_INVALID_ENUM:
|
2010-10-07 16:46:42 -07:00
|
|
|
errmsg = "GL_INVALID_ENUM";
|
2010-02-16 20:30:58 -08:00
|
|
|
break;
|
|
|
|
case GL_INVALID_VALUE:
|
2010-10-07 16:46:42 -07:00
|
|
|
errmsg = "GL_INVALID_VALUE";
|
2010-02-16 20:30:58 -08:00
|
|
|
break;
|
|
|
|
case GL_INVALID_OPERATION:
|
2010-10-07 16:46:42 -07:00
|
|
|
errmsg = "GL_INVALID_OPERATION";
|
2010-02-16 20:30:58 -08:00
|
|
|
break;
|
|
|
|
case GL_OUT_OF_MEMORY:
|
2010-10-07 16:46:42 -07:00
|
|
|
errmsg = "GL_OUT_OF_MEMORY";
|
2010-02-16 20:30:58 -08:00
|
|
|
break;
|
|
|
|
default:
|
2010-10-07 16:46:42 -07:00
|
|
|
snprintf(buf, sizeof(buf), "%#x", err);
|
|
|
|
errmsg = buf;
|
2009-10-09 05:10:27 -07:00
|
|
|
}
|
2010-10-07 16:46:42 -07:00
|
|
|
|
|
|
|
eina_log_print(_evas_engine_GL_common_log_dom, EINA_LOG_LEVEL_ERR,
|
|
|
|
file, func, line, "%s: %s", op, errmsg);
|
2009-10-09 05:10:27 -07:00
|
|
|
}
|
|
|
|
|
2009-10-13 02:40:39 -07:00
|
|
|
static void
|
2010-09-21 23:52:28 -07:00
|
|
|
matrix_ortho(GLfloat *m,
|
|
|
|
GLfloat l, GLfloat r,
|
|
|
|
GLfloat t, GLfloat b,
|
2010-05-08 22:15:20 -07:00
|
|
|
GLfloat near, GLfloat far,
|
2010-09-21 23:52:28 -07:00
|
|
|
int rot, int vw, int vh,
|
|
|
|
int foc, GLfloat orth)
|
2009-10-13 02:40:39 -07:00
|
|
|
{
|
2010-05-08 22:15:20 -07:00
|
|
|
GLfloat rotf;
|
|
|
|
GLfloat cosv, sinv;
|
|
|
|
GLfloat tx, ty;
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-09-21 23:52:28 -07:00
|
|
|
rotf = (((rot / 90) & 0x3) * M_PI) / 2.0;
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-09-21 23:52:28 -07:00
|
|
|
tx = -0.5 * (1.0 - orth);
|
|
|
|
ty = -0.5 * (1.0 - orth);
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-05-08 22:15:20 -07:00
|
|
|
if (rot == 90)
|
|
|
|
{
|
2010-09-21 23:52:28 -07:00
|
|
|
tx += -(vw * 1.0);
|
|
|
|
ty += -(vh * 0.0);
|
2010-05-08 22:15:20 -07:00
|
|
|
}
|
|
|
|
if (rot == 180)
|
|
|
|
{
|
2010-09-21 23:52:28 -07:00
|
|
|
tx += -(vw * 1.0);
|
|
|
|
ty += -(vh * 1.0);
|
2010-05-08 22:15:20 -07:00
|
|
|
}
|
|
|
|
if (rot == 270)
|
|
|
|
{
|
2010-09-21 23:52:28 -07:00
|
|
|
tx += -(vw * 0.0);
|
|
|
|
ty += -(vh * 1.0);
|
2010-05-08 22:15:20 -07:00
|
|
|
}
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-05-08 22:15:20 -07:00
|
|
|
cosv = cos(rotf);
|
|
|
|
sinv = sin(rotf);
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-05-08 22:15:20 -07:00
|
|
|
m[0] = (2.0 / (r - l)) * ( cosv);
|
|
|
|
m[1] = (2.0 / (r - l)) * ( sinv);
|
2010-09-21 23:52:28 -07:00
|
|
|
m[2] = 0.0;
|
|
|
|
m[3] = 0.0;
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-05-08 22:15:20 -07:00
|
|
|
m[4] = (2.0 / (t - b)) * (-sinv);
|
|
|
|
m[5] = (2.0 / (t - b)) * ( cosv);
|
2010-09-21 23:52:28 -07:00
|
|
|
m[6] = 0.0;
|
|
|
|
m[7] = 0.0;
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-09-21 23:52:28 -07:00
|
|
|
m[8] = 0.0;
|
|
|
|
m[9] = 0.0;
|
|
|
|
m[10] = -(2.0 / (far - near));
|
|
|
|
m[11] = 1.0 / (GLfloat)foc;
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-09-21 23:52:28 -07:00
|
|
|
m[12] = (m[0] * tx) + (m[4] * ty) - ((r + l) / (r - l));
|
|
|
|
m[13] = (m[1] * tx) + (m[5] * ty) - ((t + b) / (t - b));
|
|
|
|
m[14] = (m[2] * tx) + (m[6] * ty) - ((near + far) / (far - near));
|
|
|
|
m[15] = (m[3] * tx) + (m[7] * ty) + orth;
|
2009-10-13 02:40:39 -07:00
|
|
|
}
|
|
|
|
|
2010-02-19 06:33:49 -08:00
|
|
|
static int
|
|
|
|
_evas_gl_common_version_check()
|
|
|
|
{
|
|
|
|
char *version;
|
|
|
|
char *tmp;
|
|
|
|
char *tmp2;
|
|
|
|
int major;
|
|
|
|
int minor;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* glGetString returns a string describing the current GL connection.
|
|
|
|
* GL_VERSION is used to get the version of the connection
|
|
|
|
*/
|
|
|
|
|
2010-05-08 22:15:20 -07:00
|
|
|
version = (char *)glGetString(GL_VERSION);
|
2010-02-19 06:33:49 -08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* OpengL ES
|
|
|
|
*
|
|
|
|
* 1.* : The form is:
|
|
|
|
*
|
|
|
|
* OpenGL ES-<profile> <major>.<minor>
|
|
|
|
*
|
|
|
|
* where <profile> is either "CM" or "CL". The minor can be followed by the vendor
|
|
|
|
* specific information
|
|
|
|
*
|
|
|
|
* 2.0 : The form is:
|
|
|
|
*
|
|
|
|
* OpenGL<space>ES<space><version number><space><vendor-specific information>
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* OpenGL ES 1.* ? */
|
|
|
|
|
|
|
|
if ((tmp = strstr(version, "OpenGL ES-CM ")) || (tmp = strstr(version, "OpenGL ES-CL ")))
|
|
|
|
{
|
|
|
|
/* Not supported */
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* OpenGL ES 2.* ? */
|
|
|
|
|
|
|
|
if ((tmp = strstr(version, "OpenGL ES ")))
|
|
|
|
{
|
|
|
|
/* Supported */
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* OpenGL
|
|
|
|
*
|
|
|
|
* The GL_VERSION and GL_SHADING_LANGUAGE_VERSION strings begin with a
|
|
|
|
* version number. The version number uses one of these forms:
|
|
|
|
*
|
|
|
|
* major_number.minor_number
|
|
|
|
* major_number.minor_number.release_number
|
|
|
|
*
|
|
|
|
* Vendor-specific information may follow the version number. Its format
|
|
|
|
* depends on the implementation, but a space always separates the
|
|
|
|
* version number and the vendor-specific information.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* glGetString() returns a static string, and we are going to */
|
|
|
|
/* modify it, so we get a copy first */
|
|
|
|
version = strdup(version);
|
|
|
|
if (!version)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
tmp = strchr(version, '.');
|
|
|
|
/* the first '.' always exists */
|
|
|
|
*tmp = '\0';
|
|
|
|
major = atoi(version);
|
|
|
|
/* FIXME: maybe we can assume that minor in only a cipher */
|
|
|
|
tmp2 = ++tmp;
|
|
|
|
while ((*tmp != '.') && (*tmp != ' ') && (*tmp != '\0'))
|
|
|
|
tmp++;
|
|
|
|
/* *tmp is '\0' : version is major_number.minor_number */
|
|
|
|
/* *tmp is '.' : version is major_number.minor_number.release_number */
|
|
|
|
/* *tmp is ' ' : version is major_number.minor_number followed by vendor */
|
|
|
|
*tmp = '\0';
|
|
|
|
minor = atoi(tmp2);
|
|
|
|
free(version);
|
|
|
|
|
|
|
|
if (((major == 1) && (minor >= 4)) || (major >= 2))
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2009-10-13 02:40:39 -07:00
|
|
|
static void
|
2011-03-16 10:32:49 -07:00
|
|
|
_evas_gl_common_viewport_set(Evas_Engine_GL_Context *gc)
|
2009-10-13 02:40:39 -07:00
|
|
|
{
|
|
|
|
GLfloat proj[16];
|
2011-08-24 09:20:15 -07:00
|
|
|
unsigned int i;
|
2010-09-21 23:52:28 -07:00
|
|
|
int w = 1, h = 1, m = 1, rot = 1, foc = 0;
|
2009-10-13 02:40:39 -07:00
|
|
|
|
2011-03-07 17:00:21 -08:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN(gc);
|
2010-09-21 23:52:28 -07:00
|
|
|
foc = gc->foc;
|
2010-08-08 20:27:59 -07:00
|
|
|
// surface in pipe 0 will be the same as all pipes
|
|
|
|
if ((gc->pipe[0].shader.surface == gc->def_surface) ||
|
|
|
|
(!gc->pipe[0].shader.surface))
|
2009-11-12 23:22:31 -08:00
|
|
|
{
|
|
|
|
w = gc->w;
|
|
|
|
h = gc->h;
|
2010-05-08 22:15:20 -07:00
|
|
|
rot = gc->rot;
|
2009-11-12 23:22:31 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-08-08 20:27:59 -07:00
|
|
|
w = gc->pipe[0].shader.surface->w;
|
|
|
|
h = gc->pipe[0].shader.surface->h;
|
2010-05-08 22:15:20 -07:00
|
|
|
rot = 0;
|
2009-11-12 23:22:31 -08:00
|
|
|
m = -1;
|
|
|
|
}
|
2011-06-17 00:47:28 -07:00
|
|
|
|
|
|
|
if ((!gc->change.size) ||
|
2010-08-08 20:27:59 -07:00
|
|
|
((gc->shared->w == w) && (gc->shared->h == h) &&
|
2010-09-30 23:22:31 -07:00
|
|
|
(gc->shared->rot == rot) && (gc->shared->foc == gc->foc) &&
|
|
|
|
(gc->shared->mflip == m)))
|
2010-08-08 20:27:59 -07:00
|
|
|
return;
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2009-11-12 23:22:31 -08:00
|
|
|
gc->shared->w = w;
|
|
|
|
gc->shared->h = h;
|
2010-05-08 22:15:20 -07:00
|
|
|
gc->shared->rot = rot;
|
2010-09-30 23:22:31 -07:00
|
|
|
gc->shared->mflip = m;
|
2010-09-21 23:52:28 -07:00
|
|
|
gc->shared->foc = foc;
|
|
|
|
gc->shared->z0 = gc->z0;
|
|
|
|
gc->shared->px = gc->px;
|
|
|
|
gc->shared->py = gc->py;
|
2009-10-13 02:40:39 -07:00
|
|
|
gc->change.size = 0;
|
2010-05-08 22:15:20 -07:00
|
|
|
|
2010-09-21 23:52:28 -07:00
|
|
|
if (foc == 0)
|
|
|
|
{
|
|
|
|
if ((rot == 0) || (rot == 180))
|
|
|
|
glViewport(0, 0, w, h);
|
|
|
|
else
|
|
|
|
glViewport(0, 0, h, w);
|
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
|
|
|
// std matrix
|
|
|
|
if (m == 1)
|
2011-06-17 00:47:28 -07:00
|
|
|
matrix_ortho(proj,
|
|
|
|
0, w, 0, h,
|
2010-09-21 23:52:28 -07:00
|
|
|
-1000000.0, 1000000.0,
|
|
|
|
rot, w, h,
|
|
|
|
1, 1.0);
|
|
|
|
// v flipped matrix for render-to-texture
|
|
|
|
else
|
2011-06-17 00:47:28 -07:00
|
|
|
matrix_ortho(proj,
|
|
|
|
0, w, h, 0,
|
2010-09-21 23:52:28 -07:00
|
|
|
-1000000.0, 1000000.0,
|
|
|
|
rot, w, h,
|
|
|
|
1, 1.0);
|
|
|
|
}
|
2010-05-08 22:15:20 -07:00
|
|
|
else
|
2010-09-21 23:52:28 -07:00
|
|
|
{
|
|
|
|
int px, py, vx, vy, vw = 0, vh = 0, ax = 0, ay = 0, ppx = 0, ppy = 0;
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-09-21 23:52:28 -07:00
|
|
|
px = gc->shared->px;
|
|
|
|
py = gc->shared->py;
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-09-21 23:52:28 -07:00
|
|
|
if ((rot == 0 ) || (rot == 90 )) ppx = px;
|
|
|
|
else if ((rot == 180) || (rot == 270)) ppx = w - px;
|
|
|
|
if ((rot == 0 ) || (rot == 270)) ppy = py;
|
|
|
|
else if ((rot == 90 ) || (rot == 180)) ppy = h - py;
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-09-21 23:52:28 -07:00
|
|
|
vx = ((w / 2) - ppx);
|
|
|
|
if (vx >= 0)
|
|
|
|
{
|
|
|
|
vw = w + (2 * vx);
|
|
|
|
if ((rot == 0 ) || (rot == 90 )) ax = 2 * vx;
|
|
|
|
else if ((rot == 180) || (rot == 270)) ax = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
vw = w - (2 * vx);
|
|
|
|
if ((rot == 0 ) || (rot == 90 )) ax = 0;
|
|
|
|
else if ((rot == 180) || (rot == 270)) ax = ppx - px;
|
|
|
|
vx = 0;
|
|
|
|
}
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-09-21 23:52:28 -07:00
|
|
|
vy = ((h / 2) - ppy);
|
|
|
|
if (vy < 0)
|
|
|
|
{
|
|
|
|
vh = h - (2 * vy);
|
|
|
|
if ((rot == 0 )) ay = 0;
|
|
|
|
else if ((rot == 90 ) || (rot == 180) || (rot == 270)) ay = ppy - py;
|
|
|
|
vy = -vy;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
vh = h + (2 * vy);
|
|
|
|
if ((rot == 0 ) || (rot == 270)) ay = 2 * vy;
|
|
|
|
else if ((rot == 90 ) || (rot == 180)) ay = 0;
|
|
|
|
vy = 0;
|
|
|
|
}
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-09-30 20:40:12 -07:00
|
|
|
if (m == -1) ay = vy * 2;
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-09-21 23:52:28 -07:00
|
|
|
if ((rot == 0) || (rot == 180))
|
|
|
|
glViewport(-2 * vx, -2 * vy, vw, vh);
|
|
|
|
else
|
|
|
|
glViewport(-2 * vy, -2 * vx, vh, vw);
|
|
|
|
if (m == 1)
|
|
|
|
matrix_ortho(proj, 0, vw, 0, vh,
|
|
|
|
-1000000.0, 1000000.0,
|
|
|
|
rot, vw, vh,
|
|
|
|
foc, 0.0);
|
|
|
|
else
|
|
|
|
matrix_ortho(proj, 0, vw, vh, 0,
|
|
|
|
-1000000.0, 1000000.0,
|
|
|
|
rot, vw, vh,
|
|
|
|
foc, 0.0);
|
|
|
|
gc->shared->ax = ax;
|
|
|
|
gc->shared->ay = ay;
|
|
|
|
}
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2011-08-24 09:20:15 -07:00
|
|
|
for (i = 0; i < SHADER_LAST; ++i)
|
|
|
|
{
|
|
|
|
glUseProgram(gc->shared->shader[i].prog);
|
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
|
|
|
glUniformMatrix4fv(glGetUniformLocation(gc->shared->shader[i].prog, "mvp"), 1, GL_FALSE, proj);
|
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
|
|
|
}
|
2010-02-17 23:10:28 -08:00
|
|
|
|
2010-08-08 20:27:59 -07:00
|
|
|
glUseProgram(gc->pipe[0].shader.cur_prog);
|
2010-02-16 20:21:59 -08:00
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
2009-10-13 02:40:39 -07:00
|
|
|
}
|
|
|
|
|
2011-03-16 10:32:49 -07:00
|
|
|
Evas_Engine_GL_Context *
|
2003-09-07 04:24:48 -07:00
|
|
|
evas_gl_common_context_new(void)
|
|
|
|
{
|
2011-03-16 10:32:49 -07:00
|
|
|
Evas_Engine_GL_Context *gc;
|
2010-08-11 23:02:15 -07:00
|
|
|
const char *s;
|
2010-08-08 20:27:59 -07:00
|
|
|
int i;
|
2004-02-24 18:50:48 -08:00
|
|
|
|
2009-10-13 02:40:39 -07:00
|
|
|
#if 1
|
2003-09-07 04:24:48 -07:00
|
|
|
if (_evas_gl_common_context)
|
|
|
|
{
|
2011-03-16 10:32:49 -07:00
|
|
|
_evas_gl_common_context->references++;
|
|
|
|
return _evas_gl_common_context;
|
2003-09-07 04:24:48 -07:00
|
|
|
}
|
2010-02-19 06:33:49 -08:00
|
|
|
#endif
|
|
|
|
if (!_evas_gl_common_version_check())
|
|
|
|
return NULL;
|
2011-03-16 10:32:49 -07:00
|
|
|
gc = calloc(1, sizeof(Evas_Engine_GL_Context));
|
2003-09-07 04:24:48 -07:00
|
|
|
if (!gc) return NULL;
|
2005-05-21 19:49:50 -07:00
|
|
|
|
2010-02-14 20:12:50 -08:00
|
|
|
gl_symbols();
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2009-10-09 05:10:27 -07:00
|
|
|
gc->references = 1;
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2009-10-09 05:10:27 -07:00
|
|
|
_evas_gl_common_context = gc;
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-08-08 20:27:59 -07:00
|
|
|
for (i = 0; i < MAX_PIPES; i++)
|
|
|
|
gc->pipe[i].shader.render_op = EVAS_RENDER_BLEND;
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2009-10-13 02:40:39 -07:00
|
|
|
if (!shared)
|
2009-10-09 05:10:27 -07:00
|
|
|
{
|
|
|
|
const GLubyte *ext;
|
2009-10-13 02:40:39 -07:00
|
|
|
|
|
|
|
shared = calloc(1, sizeof(Evas_GL_Shared));
|
2009-10-09 05:10:27 -07:00
|
|
|
ext = glGetString(GL_EXTENSIONS);
|
|
|
|
if (ext)
|
|
|
|
{
|
2010-08-25 18:41:48 -07:00
|
|
|
if (getenv("EVAS_GL_INFO"))
|
|
|
|
fprintf(stderr, "EXT:\n%s\n", ext);
|
2010-08-11 23:02:15 -07:00
|
|
|
if ((strstr((char *)ext, "GL_ARB_texture_non_power_of_two")) ||
|
|
|
|
(strstr((char *)ext, "OES_texture_npot")) ||
|
|
|
|
(strstr((char *)ext, "GL_IMG_texture_npot")))
|
2009-10-13 02:40:39 -07:00
|
|
|
shared->info.tex_npo2 = 1;
|
2010-08-11 23:02:15 -07:00
|
|
|
if ((strstr((char *)ext, "GL_NV_texture_rectangle")) ||
|
|
|
|
(strstr((char *)ext, "GL_EXT_texture_rectangle")) ||
|
|
|
|
(strstr((char *)ext, "GL_ARB_texture_rectangle")))
|
2009-10-13 02:40:39 -07:00
|
|
|
shared->info.tex_rect = 1;
|
From: Jiyoun Park <jy0703.park@samsung.com>
Subject: [E-devel] [Patch] Evas gl shader use binary shader
I make patch related with evas gl binary shader.
The concept of binary shader is compile shader only once.
Some people want to use binary shader because of performance issue.
In current evas gl engine, every application have to compile shader each
time.
But I modify code , so only first running application need compile shader.
Other application use already compiled shader(binary shader)
The binary shader is made under HOME/.evas/gl_common_shaders directory.
Binary shader is created according to GL vendor,GL renderer, GL version and
Module_arch.
The basic flow is
1. First running application which use gl engine check binary shader
directory, but it can't find binary shader.
2. After compiling shader, It saves compiled shaders..
3. Other application checks shader directory, it can use binary
shaders.
In mobile target, using binary shader, I can save 150ms. (that time, there
is 11 shaders).
If there is more shaders and more applications, this flow maybe save more
total time.
(the above is now in, changelog coming, with change to using ~/.cache,
some formatting fixes, make ity do the desktop gl one right with the
retrievable hint parameter ont he program etc. - doesn't break desktop
gl at least. yay. a,so fixes to mke it compile at all).
SVN revision: 59167
2011-05-03 23:15:00 -07:00
|
|
|
if ((strstr((char *)ext, "GL_ARB_get_program_binary")) ||
|
|
|
|
(strstr((char *)ext, "GL_OES_get_program_binary")))
|
|
|
|
shared->info.bin_program = 1;
|
2010-02-16 23:26:44 -08:00
|
|
|
#ifdef GL_TEXTURE_MAX_ANISOTROPY_EXT
|
2010-08-11 23:02:15 -07:00
|
|
|
if ((strstr((char *)ext, "GL_EXT_texture_filter_anisotropic")))
|
2011-06-17 00:47:28 -07:00
|
|
|
glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT,
|
2010-02-17 23:10:28 -08:00
|
|
|
&(shared->info.anisotropic));
|
|
|
|
#endif
|
|
|
|
#ifdef GL_BGRA
|
2010-08-11 23:02:15 -07:00
|
|
|
if ((strstr((char *)ext, "GL_EXT_bgra")) ||
|
|
|
|
(strstr((char *)ext, "GL_EXT_texture_format_BGRA8888")))
|
2010-02-27 02:34:19 -08:00
|
|
|
shared->info.bgra = 1;
|
2010-08-01 23:46:38 -07:00
|
|
|
#endif
|
2010-08-11 23:02:15 -07:00
|
|
|
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
|
|
|
|
// FIXME: there should be an extension name/string to check for
|
|
|
|
// not just symbols in the lib
|
|
|
|
i = 0;
|
2010-09-06 06:36:32 -07:00
|
|
|
s = getenv("EVAS_GL_NO_MAP_IMAGE_SEC");
|
|
|
|
if (s) i = atoi(s);
|
2010-08-11 23:02:15 -07:00
|
|
|
if (!i)
|
|
|
|
{
|
|
|
|
// test for all needed symbols - be "conservative" and
|
|
|
|
// need all of it
|
|
|
|
if ((secsym_eglCreateImage) &&
|
|
|
|
(secsym_eglDestroyImage) &&
|
|
|
|
(secsym_glEGLImageTargetTexture2DOES) &&
|
|
|
|
(secsym_eglMapImageSEC) &&
|
|
|
|
(secsym_eglUnmapImageSEC) &&
|
|
|
|
(secsym_eglGetImageAttribSEC))
|
|
|
|
shared->info.sec_image_map = 1;
|
|
|
|
}
|
2011-06-17 00:47:28 -07:00
|
|
|
#endif
|
2009-10-09 05:10:27 -07:00
|
|
|
}
|
|
|
|
glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS,
|
2009-10-13 02:40:39 -07:00
|
|
|
&(shared->info.max_texture_units));
|
2009-10-09 05:10:27 -07:00
|
|
|
glGetIntegerv(GL_MAX_TEXTURE_SIZE,
|
2009-10-13 02:40:39 -07:00
|
|
|
&(shared->info.max_texture_size));
|
2011-04-11 17:06:57 -07:00
|
|
|
shared->info.max_vertex_elements = 6 * 100000;
|
2010-09-06 06:36:32 -07:00
|
|
|
#ifdef GL_MAX_ELEMENTS_VERTICES
|
2011-04-11 17:06:57 -07:00
|
|
|
/* only applies to glDrawRangeElements. don't really need to get it.
|
2010-09-06 06:36:32 -07:00
|
|
|
glGetIntegerv(GL_MAX_ELEMENTS_VERTICES,
|
|
|
|
&(shared->info.max_vertex_elements));
|
2011-04-11 17:06:57 -07:00
|
|
|
*/
|
2010-09-06 06:36:32 -07:00
|
|
|
#endif
|
|
|
|
s = getenv("EVAS_GL_VERTEX_MAX");
|
|
|
|
if (s) shared->info.max_vertex_elements = atoi(s);
|
|
|
|
if (shared->info.max_vertex_elements < 6)
|
|
|
|
shared->info.max_vertex_elements = 6;
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-08-09 01:38:28 -07:00
|
|
|
// magic numbers that are a result of imperical testing and getting
|
|
|
|
// "best case" performance across a range of systems
|
2010-08-25 18:41:48 -07:00
|
|
|
shared->info.tune.cutout.max = DEF_CUTOUT;
|
|
|
|
shared->info.tune.pipes.max = DEF_PIPES;
|
|
|
|
shared->info.tune.atlas.max_alloc_size = DEF_ATLAS_ALLOC;
|
|
|
|
shared->info.tune.atlas.max_alloc_alpha_size = DEF_ATLAS_ALLOC_ALPHA;
|
|
|
|
shared->info.tune.atlas.max_w = DEF_ATLAS_W;
|
|
|
|
shared->info.tune.atlas.max_h = DEF_ATLAS_H;
|
|
|
|
shared->info.tune.atlas.slot_size = DEF_ATLAS_SLOT;
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-08-11 23:02:15 -07:00
|
|
|
// per gpu hacks. based on impirical measurement of some known gpu's
|
2010-08-13 03:34:51 -07:00
|
|
|
s = (const char *)glGetString(GL_RENDERER);
|
2010-08-11 23:02:15 -07:00
|
|
|
if (s)
|
|
|
|
{
|
|
|
|
if (strstr(s, "PowerVR SGX 540"))
|
2010-08-25 18:41:48 -07:00
|
|
|
shared->info.tune.pipes.max = DEF_PIPES_SGX_540;
|
2010-08-11 23:02:15 -07:00
|
|
|
else if (strstr(s, "NVIDIA Tegra"))
|
2010-08-25 18:41:48 -07:00
|
|
|
shared->info.tune.pipes.max = DEF_PIPES_TEGRA_2;
|
2010-08-11 23:02:15 -07:00
|
|
|
}
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-08-25 18:41:48 -07:00
|
|
|
#define GETENVOPT(name, tune_param, min, max) \
|
|
|
|
do { \
|
|
|
|
const char *__v = getenv(name); \
|
|
|
|
if (__v) { \
|
2010-08-25 21:37:43 -07:00
|
|
|
shared->info.tune.tune_param = atoi(__v); \
|
|
|
|
if (shared->info.tune.tune_param > max) \
|
|
|
|
shared->info.tune.tune_param = max; \
|
|
|
|
else if (shared->info.tune.tune_param < min) \
|
|
|
|
shared->info.tune.tune_param = min; \
|
|
|
|
} \
|
2010-08-25 18:41:48 -07:00
|
|
|
} while (0)
|
|
|
|
|
|
|
|
GETENVOPT("EVAS_GL_CUTOUT_MAX", cutout.max, -1, 0x7fffffff);
|
|
|
|
GETENVOPT("EVAS_GL_PIPES_MAX", pipes.max, 1, MAX_PIPES);
|
|
|
|
GETENVOPT("EVAS_GL_ATLAS_ALLOC_SIZE", atlas.max_alloc_size, MIN_ATLAS_ALLOC, MAX_ATLAS_ALLOC);
|
|
|
|
GETENVOPT("EVAS_GL_ATLAS_ALLOC_ALPHA_SIZE", atlas.max_alloc_alpha_size, MIN_ATLAS_ALLOC_ALPHA, MAX_ATLAS_ALLOC_ALPHA);
|
|
|
|
GETENVOPT("EVAS_GL_ATLAS_MAX_W", atlas.max_w, 0, MAX_ATLAS_W);
|
|
|
|
GETENVOPT("EVAS_GL_ATLAS_MAX_H", atlas.max_h, 0, MAX_ATLAS_H);
|
|
|
|
GETENVOPT("EVAS_GL_ATLAS_SLOT_SIZE", atlas.slot_size, MIN_ATLAS_SLOT, MAX_ATLAS_SLOT);
|
2011-05-04 01:05:46 -07:00
|
|
|
s = (const char *)getenv("EVAS_GL_GET_PROGRAM_BINARY");
|
|
|
|
if (s)
|
|
|
|
{
|
|
|
|
if (atoi(s) == 0) shared->info.bin_program = 0;
|
|
|
|
}
|
2010-08-25 18:41:48 -07:00
|
|
|
|
|
|
|
if (getenv("EVAS_GL_INFO"))
|
|
|
|
fprintf(stderr,
|
|
|
|
"max tex size %ix%i\n"
|
|
|
|
"max units %i\n"
|
|
|
|
"non-power-2 tex %i\n"
|
|
|
|
"rect tex %i\n"
|
|
|
|
"bgra : %i\n"
|
|
|
|
"max ansiotropic filtering: %3.3f\n"
|
|
|
|
"egl sec map image: %i\n"
|
2010-09-06 06:36:32 -07:00
|
|
|
"max vertex count: %i\n"
|
|
|
|
"\n"
|
|
|
|
"(can set EVAS_GL_VERTEX_MAX EVAS_GL_NO_MAP_IMAGE_SEC EVAS_GL_INFO EVAS_GL_MEMINFO )\n"
|
2010-08-25 18:41:48 -07:00
|
|
|
"\n"
|
2011-05-04 01:05:46 -07:00
|
|
|
"EVAS_GL_GET_PROGRAM_BINARY: %i\n"
|
2010-08-25 18:41:48 -07:00
|
|
|
"EVAS_GL_CUTOUT_MAX: %i\n"
|
|
|
|
"EVAS_GL_PIPES_MAX: %i\n"
|
|
|
|
"EVAS_GL_ATLAS_ALLOC_SIZE: %i\n"
|
|
|
|
"EVAS_GL_ATLAS_ALLOC_ALPHA_SIZE: %i\n"
|
|
|
|
"EVAS_GL_ATLAS_MAX_W x EVAS_GL_ATLAS_MAX_H: %i x %i\n"
|
|
|
|
"EVAS_GL_ATLAS_SLOT_SIZE: %i\n"
|
2011-06-17 00:47:28 -07:00
|
|
|
,
|
2010-08-25 18:41:48 -07:00
|
|
|
(int)shared->info.max_texture_size, (int)shared->info.max_texture_size,
|
|
|
|
(int)shared->info.max_texture_units,
|
|
|
|
(int)shared->info.tex_npo2,
|
|
|
|
(int)shared->info.tex_rect,
|
|
|
|
(int)shared->info.bgra,
|
|
|
|
(double)shared->info.anisotropic,
|
|
|
|
(int)shared->info.sec_image_map,
|
2010-09-06 06:36:32 -07:00
|
|
|
(int)shared->info.max_vertex_elements,
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2011-05-04 01:05:46 -07:00
|
|
|
(int)shared->info.bin_program,
|
2010-08-25 18:41:48 -07:00
|
|
|
(int)shared->info.tune.cutout.max,
|
|
|
|
(int)shared->info.tune.pipes.max,
|
|
|
|
(int)shared->info.tune.atlas.max_alloc_size,
|
|
|
|
(int)shared->info.tune.atlas.max_alloc_alpha_size,
|
|
|
|
(int)shared->info.tune.atlas.max_w, (int)shared->info.tune.atlas.max_h,
|
|
|
|
(int)shared->info.tune.atlas.slot_size
|
|
|
|
);
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2009-10-09 05:10:27 -07:00
|
|
|
glDisable(GL_DEPTH_TEST);
|
2010-02-16 20:21:59 -08:00
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
2009-10-09 05:10:27 -07:00
|
|
|
glEnable(GL_DITHER);
|
2010-02-16 20:21:59 -08:00
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
2009-10-09 05:10:27 -07:00
|
|
|
glDisable(GL_BLEND);
|
2010-02-16 20:21:59 -08:00
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
2009-10-09 05:10:27 -07:00
|
|
|
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
2010-02-16 20:21:59 -08:00
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
2009-11-12 23:22:31 -08:00
|
|
|
// no dest alpha
|
|
|
|
// glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // dest alpha
|
|
|
|
// glBlendFunc(GL_SRC_ALPHA, GL_ONE); // ???
|
2009-10-09 05:10:27 -07:00
|
|
|
glDepthMask(GL_FALSE);
|
2010-02-16 20:21:59 -08:00
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2009-10-09 05:10:27 -07:00
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
2010-02-16 20:21:59 -08:00
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
2009-10-09 05:10:27 -07:00
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
2010-02-16 20:21:59 -08:00
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
2009-10-09 05:10:27 -07:00
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
2010-02-16 20:21:59 -08:00
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
2009-10-09 05:10:27 -07:00
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
2010-02-16 20:21:59 -08:00
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
2010-02-16 23:26:44 -08:00
|
|
|
#ifdef GL_TEXTURE_MAX_ANISOTROPY_EXT
|
|
|
|
if (shared->info.anisotropic > 0.0)
|
|
|
|
{
|
|
|
|
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.0);
|
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
|
|
|
}
|
2009-10-09 05:10:27 -07:00
|
|
|
#endif
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2009-10-10 06:24:15 -07:00
|
|
|
glEnableVertexAttribArray(SHAD_VERTEX);
|
2010-02-16 20:21:59 -08:00
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
2009-10-10 06:24:15 -07:00
|
|
|
glEnableVertexAttribArray(SHAD_COLOR);
|
2010-02-16 20:21:59 -08:00
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
2010-03-23 02:55:02 -07:00
|
|
|
|
From: Jiyoun Park <jy0703.park@samsung.com>
Subject: [E-devel] [Patch] Evas gl shader use binary shader
I make patch related with evas gl binary shader.
The concept of binary shader is compile shader only once.
Some people want to use binary shader because of performance issue.
In current evas gl engine, every application have to compile shader each
time.
But I modify code , so only first running application need compile shader.
Other application use already compiled shader(binary shader)
The binary shader is made under HOME/.evas/gl_common_shaders directory.
Binary shader is created according to GL vendor,GL renderer, GL version and
Module_arch.
The basic flow is
1. First running application which use gl engine check binary shader
directory, but it can't find binary shader.
2. After compiling shader, It saves compiled shaders..
3. Other application checks shader directory, it can use binary
shaders.
In mobile target, using binary shader, I can save 150ms. (that time, there
is 11 shaders).
If there is more shaders and more applications, this flow maybe save more
total time.
(the above is now in, changelog coming, with change to using ~/.cache,
some formatting fixes, make ity do the desktop gl one right with the
retrievable hint parameter ont he program etc. - doesn't break desktop
gl at least. yay. a,so fixes to mke it compile at all).
SVN revision: 59167
2011-05-03 23:15:00 -07:00
|
|
|
if (!evas_gl_common_shader_program_init(shared)) goto error;
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2011-08-24 09:20:15 -07:00
|
|
|
#define SHADER_TEXTURE_ADD(Shared, Shader, Name) \
|
|
|
|
glUseProgram(Shared->shader[SHADER_##Shader].prog); \
|
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); \
|
|
|
|
glUniform1i(glGetUniformLocation(Shared->shader[SHADER_##Shader].prog, #Name), Shared->shader[SHADER_##Shader].tex_count++); \
|
2011-08-23 08:13:40 -07:00
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
|
|
|
|
2011-08-24 09:20:15 -07:00
|
|
|
SHADER_TEXTURE_ADD(shared, YUV, tex);
|
|
|
|
SHADER_TEXTURE_ADD(shared, YUV, texu);
|
|
|
|
SHADER_TEXTURE_ADD(shared, YUV, texv);
|
2011-04-05 22:38:38 -07:00
|
|
|
|
2011-08-24 09:20:15 -07:00
|
|
|
SHADER_TEXTURE_ADD(shared, YUY2, tex);
|
|
|
|
SHADER_TEXTURE_ADD(shared, YUY2, texuv);
|
2011-08-23 08:13:40 -07:00
|
|
|
|
2011-08-29 13:56:48 -07:00
|
|
|
SHADER_TEXTURE_ADD(shared, NV12, tex);
|
|
|
|
SHADER_TEXTURE_ADD(shared, NV12, texuv);
|
|
|
|
|
2011-08-24 09:20:15 -07:00
|
|
|
SHADER_TEXTURE_ADD(shared, YUV_NOMUL, tex);
|
|
|
|
SHADER_TEXTURE_ADD(shared, YUV_NOMUL, texu);
|
|
|
|
SHADER_TEXTURE_ADD(shared, YUV_NOMUL, texv);
|
2011-04-05 22:38:38 -07:00
|
|
|
|
2011-08-24 09:20:15 -07:00
|
|
|
SHADER_TEXTURE_ADD(shared, YUY2_NOMUL, tex);
|
|
|
|
SHADER_TEXTURE_ADD(shared, YUY2_NOMUL, texuv);
|
2011-04-05 22:38:38 -07:00
|
|
|
|
2011-08-29 13:56:48 -07:00
|
|
|
SHADER_TEXTURE_ADD(shared, NV12_NOMUL, tex);
|
|
|
|
SHADER_TEXTURE_ADD(shared, NV12_NOMUL, texuv);
|
|
|
|
|
2011-08-24 09:20:15 -07:00
|
|
|
SHADER_TEXTURE_ADD(shared, IMG_MASK, tex);
|
|
|
|
SHADER_TEXTURE_ADD(shared, IMG_MASK, texm);
|
2011-04-05 22:38:38 -07:00
|
|
|
|
2010-08-08 20:27:59 -07:00
|
|
|
glUseProgram(gc->pipe[0].shader.cur_prog);
|
2010-02-16 20:21:59 -08:00
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2011-03-29 02:10:57 -07:00
|
|
|
evas_gl_common_shader_program_init_done();
|
2009-10-12 06:19:55 -07:00
|
|
|
// in shader:
|
|
|
|
// uniform sampler2D tex[8];
|
2011-06-17 00:47:28 -07:00
|
|
|
//
|
2009-10-12 06:19:55 -07:00
|
|
|
// in code:
|
|
|
|
// GLuint texes[8];
|
|
|
|
// GLint loc = glGetUniformLocation(prog, "tex");
|
|
|
|
// glUniform1iv(loc, 8, texes);
|
2010-08-02 23:09:53 -07:00
|
|
|
|
2011-04-04 03:23:12 -07:00
|
|
|
shared->native_pm_hash = eina_hash_int32_new(NULL);
|
|
|
|
shared->native_tex_hash = eina_hash_int32_new(NULL);
|
2009-10-09 05:10:27 -07:00
|
|
|
}
|
2009-10-13 02:40:39 -07:00
|
|
|
gc->shared = shared;
|
|
|
|
gc->shared->references++;
|
|
|
|
_evas_gl_common_viewport_set(gc);
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2009-11-12 23:22:31 -08:00
|
|
|
gc->def_surface = evas_gl_common_image_surface_new(gc, 1, 1, 1);
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2003-09-07 04:24:48 -07:00
|
|
|
return gc;
|
2010-05-17 20:49:59 -07:00
|
|
|
error:
|
|
|
|
evas_gl_common_context_free(gc);
|
|
|
|
return NULL;
|
2003-09-07 04:24:48 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2011-03-16 10:32:49 -07:00
|
|
|
evas_gl_common_context_free(Evas_Engine_GL_Context *gc)
|
2003-09-07 04:24:48 -07:00
|
|
|
{
|
2009-10-10 07:48:34 -07:00
|
|
|
int i, j;
|
2011-01-13 02:41:08 -08:00
|
|
|
Eina_List *l;
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2003-09-07 04:24:48 -07:00
|
|
|
gc->references--;
|
|
|
|
if (gc->references > 0) return;
|
2010-05-17 20:49:59 -07:00
|
|
|
if (gc->shared) gc->shared->references--;
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-05-17 20:49:59 -07:00
|
|
|
if (gc->def_surface) evas_gl_common_image_free(gc->def_surface);
|
2010-08-25 06:41:03 -07:00
|
|
|
|
|
|
|
if (gc->shared)
|
2010-08-20 22:59:27 -07:00
|
|
|
{
|
2010-08-25 18:41:48 -07:00
|
|
|
for (i = 0; i < gc->shared->info.tune.pipes.max; i++)
|
2010-08-25 06:41:03 -07:00
|
|
|
{
|
|
|
|
if (gc->pipe[i].array.vertex) free(gc->pipe[i].array.vertex);
|
|
|
|
if (gc->pipe[i].array.color) free(gc->pipe[i].array.color);
|
|
|
|
if (gc->pipe[i].array.texuv) free(gc->pipe[i].array.texuv);
|
2011-04-05 22:38:38 -07:00
|
|
|
if (gc->pipe[i].array.texm) free(gc->pipe[i].array.texm);
|
2010-08-25 06:41:03 -07:00
|
|
|
if (gc->pipe[i].array.texuv2) free(gc->pipe[i].array.texuv2);
|
|
|
|
if (gc->pipe[i].array.texuv3) free(gc->pipe[i].array.texuv3);
|
|
|
|
}
|
2010-08-20 22:59:27 -07:00
|
|
|
}
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-05-17 20:49:59 -07:00
|
|
|
if ((gc->shared) && (gc->shared->references == 0))
|
2009-10-12 18:44:46 -07:00
|
|
|
{
|
2011-01-13 02:41:08 -08:00
|
|
|
Evas_GL_Texture_Pool *pt;
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2011-08-24 09:20:15 -07:00
|
|
|
for (i = 0; i < SHADER_LAST; ++i)
|
|
|
|
evas_gl_common_shader_program_shutdown(&(gc->shared->shader[i]));
|
2011-04-18 22:47:56 -07:00
|
|
|
|
2009-10-13 02:40:39 -07:00
|
|
|
while (gc->shared->images)
|
2009-10-10 07:48:34 -07:00
|
|
|
{
|
2009-10-13 02:40:39 -07:00
|
|
|
evas_gl_common_image_free(gc->shared->images->data);
|
2009-10-10 07:48:34 -07:00
|
|
|
}
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2011-01-13 02:41:08 -08:00
|
|
|
EINA_LIST_FOREACH(gc->shared->tex.whole, l, pt)
|
|
|
|
evas_gl_texture_pool_empty(pt);
|
2009-10-13 02:40:39 -07:00
|
|
|
for (i = 0; i < 33; i++)
|
|
|
|
{
|
|
|
|
for (j = 0; j < 3; j++)
|
|
|
|
{
|
2011-01-13 02:41:08 -08:00
|
|
|
EINA_LIST_FOREACH(gc->shared->tex.atlas[i][j], l, pt)
|
|
|
|
evas_gl_texture_pool_empty(pt);
|
2009-10-13 02:40:39 -07:00
|
|
|
}
|
|
|
|
}
|
2011-04-04 03:23:12 -07:00
|
|
|
eina_hash_free(gc->shared->native_pm_hash);
|
|
|
|
eina_hash_free(gc->shared->native_tex_hash);
|
2009-10-13 02:40:39 -07:00
|
|
|
free(gc->shared);
|
|
|
|
shared = NULL;
|
2009-10-10 07:48:34 -07:00
|
|
|
}
|
2003-09-07 04:24:48 -07:00
|
|
|
if (gc == _evas_gl_common_context) _evas_gl_common_context = NULL;
|
|
|
|
free(gc);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2011-03-16 10:32:49 -07:00
|
|
|
evas_gl_common_context_use(Evas_Engine_GL_Context *gc)
|
2003-09-07 04:24:48 -07:00
|
|
|
{
|
2010-05-20 08:24:28 -07:00
|
|
|
if (_evas_gl_common_context == gc) return;
|
2009-10-13 02:40:39 -07:00
|
|
|
_evas_gl_common_context = gc;
|
2011-04-06 03:11:01 -07:00
|
|
|
if (gc) _evas_gl_common_viewport_set(gc);
|
2003-09-07 04:24:48 -07:00
|
|
|
}
|
|
|
|
|
2010-05-20 08:24:28 -07:00
|
|
|
void
|
2011-03-16 10:32:49 -07:00
|
|
|
evas_gl_common_context_newframe(Evas_Engine_GL_Context *gc)
|
2010-05-20 08:24:28 -07:00
|
|
|
{
|
2010-08-08 20:27:59 -07:00
|
|
|
int i;
|
|
|
|
|
2010-08-08 21:54:05 -07:00
|
|
|
if (dbgflushnum < 0)
|
|
|
|
{
|
|
|
|
dbgflushnum = 0;
|
2010-09-30 16:20:26 -07:00
|
|
|
if (getenv("EVAS_GL_DBG")) dbgflushnum = 1;
|
2010-08-08 21:54:05 -07:00
|
|
|
}
|
2010-09-30 16:20:26 -07:00
|
|
|
if (dbgflushnum) printf("----prev-flushnum: %i -----------------------------------\n", gc->flushnum);
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-08-08 20:27:59 -07:00
|
|
|
gc->flushnum = 0;
|
|
|
|
gc->state.current.cur_prog = 0;
|
|
|
|
gc->state.current.cur_tex = 0;
|
|
|
|
gc->state.current.cur_texu = 0;
|
|
|
|
gc->state.current.cur_texv = 0;
|
2011-04-05 22:38:38 -07:00
|
|
|
gc->state.current.cur_texm = 0;
|
|
|
|
gc->state.current.cur_texmu = 0;
|
|
|
|
gc->state.current.cur_texmv = 0;
|
2010-08-08 20:27:59 -07:00
|
|
|
gc->state.current.render_op = 0;
|
|
|
|
gc->state.current.smooth = 0;
|
|
|
|
gc->state.current.blend = 0;
|
|
|
|
gc->state.current.clip = 0;
|
2010-08-08 21:42:15 -07:00
|
|
|
gc->state.current.cx = 0;
|
|
|
|
gc->state.current.cy = 0;
|
|
|
|
gc->state.current.cw = 0;
|
|
|
|
gc->state.current.ch = 0;
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-08-25 18:41:48 -07:00
|
|
|
for (i = 0; i < gc->shared->info.tune.pipes.max; i++)
|
2010-08-08 20:27:59 -07:00
|
|
|
{
|
|
|
|
gc->pipe[i].region.x = 0;
|
|
|
|
gc->pipe[i].region.y = 0;
|
|
|
|
gc->pipe[i].region.w = 0;
|
|
|
|
gc->pipe[i].region.h = 0;
|
|
|
|
gc->pipe[i].region.type = 0;
|
2010-08-08 21:42:15 -07:00
|
|
|
gc->pipe[i].clip.active = 0;
|
2010-08-08 20:27:59 -07:00
|
|
|
gc->pipe[i].clip.x = 0;
|
|
|
|
gc->pipe[i].clip.y = 0;
|
|
|
|
gc->pipe[i].clip.w = 0;
|
|
|
|
gc->pipe[i].clip.h = 0;
|
|
|
|
gc->pipe[i].shader.surface = NULL;
|
|
|
|
gc->pipe[i].shader.cur_prog = 0;
|
|
|
|
gc->pipe[i].shader.cur_tex = 0;
|
|
|
|
gc->pipe[i].shader.cur_texu = 0;
|
|
|
|
gc->pipe[i].shader.cur_texv = 0;
|
2011-04-05 22:38:38 -07:00
|
|
|
gc->pipe[i].shader.cur_texm = 0;
|
2010-08-08 20:27:59 -07:00
|
|
|
gc->pipe[i].shader.render_op = EVAS_RENDER_BLEND;
|
|
|
|
gc->pipe[i].shader.smooth = 0;
|
|
|
|
gc->pipe[i].shader.blend = 0;
|
|
|
|
gc->pipe[i].shader.clip = 0;
|
2010-08-08 21:42:15 -07:00
|
|
|
gc->pipe[i].shader.cx = 0;
|
|
|
|
gc->pipe[i].shader.cy = 0;
|
|
|
|
gc->pipe[i].shader.cw = 0;
|
|
|
|
gc->pipe[i].shader.ch = 0;
|
2010-08-08 20:27:59 -07:00
|
|
|
}
|
2010-05-20 08:24:28 -07:00
|
|
|
gc->change.size = 1;
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-05-20 08:24:28 -07:00
|
|
|
glDisable(GL_SCISSOR_TEST);
|
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
|
|
|
glScissor(0, 0, 0, 0);
|
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-05-20 08:24:28 -07:00
|
|
|
glDisable(GL_DEPTH_TEST);
|
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
|
|
|
glEnable(GL_DITHER);
|
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
|
|
|
glDisable(GL_BLEND);
|
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
|
|
|
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
|
|
|
// no dest alpha
|
|
|
|
// glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // dest alpha
|
|
|
|
// glBlendFunc(GL_SRC_ALPHA, GL_ONE); // ???
|
|
|
|
glDepthMask(GL_FALSE);
|
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-05-20 08:24:28 -07:00
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
|
|
|
#ifdef GL_TEXTURE_MAX_ANISOTROPY_EXT
|
|
|
|
if (shared->info.anisotropic > 0.0)
|
|
|
|
{
|
|
|
|
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.0);
|
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
|
|
|
}
|
|
|
|
#endif
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-05-20 08:24:28 -07:00
|
|
|
glEnableVertexAttribArray(SHAD_VERTEX);
|
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
|
|
|
glEnableVertexAttribArray(SHAD_COLOR);
|
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
2010-08-08 20:27:59 -07:00
|
|
|
glUseProgram(gc->pipe[0].shader.cur_prog);
|
2010-05-20 08:24:28 -07:00
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-05-20 08:24:28 -07:00
|
|
|
glActiveTexture(GL_TEXTURE0);
|
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
2010-08-08 20:27:59 -07:00
|
|
|
glBindTexture(GL_TEXTURE_2D, gc->pipe[0].shader.cur_tex);
|
2010-05-20 08:24:28 -07:00
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
|
|
|
|
|
|
|
_evas_gl_common_viewport_set(gc);
|
|
|
|
}
|
|
|
|
|
2003-09-07 04:24:48 -07:00
|
|
|
void
|
2011-03-16 10:32:49 -07:00
|
|
|
evas_gl_common_context_resize(Evas_Engine_GL_Context *gc, int w, int h, int rot)
|
2003-09-07 04:24:48 -07:00
|
|
|
{
|
2010-05-08 22:15:20 -07:00
|
|
|
if ((gc->w == w) && (gc->h == h) && (gc->rot == rot)) return;
|
2010-09-30 16:20:26 -07:00
|
|
|
evas_gl_common_context_flush(gc);
|
2003-09-07 04:24:48 -07:00
|
|
|
gc->change.size = 1;
|
2010-05-08 22:15:20 -07:00
|
|
|
gc->rot = rot;
|
2003-09-07 04:24:48 -07:00
|
|
|
gc->w = w;
|
|
|
|
gc->h = h;
|
|
|
|
if (_evas_gl_common_context == gc) _evas_gl_common_viewport_set(gc);
|
|
|
|
}
|
|
|
|
|
2009-11-12 23:22:31 -08:00
|
|
|
void
|
2011-03-16 10:32:49 -07:00
|
|
|
evas_gl_common_context_target_surface_set(Evas_Engine_GL_Context *gc,
|
2009-11-12 23:22:31 -08:00
|
|
|
Evas_GL_Image *surface)
|
|
|
|
{
|
2010-08-08 20:27:59 -07:00
|
|
|
if (surface == gc->pipe[0].shader.surface) return;
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2009-11-12 23:22:31 -08:00
|
|
|
evas_gl_common_context_flush(gc);
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-09-30 16:20:26 -07:00
|
|
|
gc->state.current.cur_prog = -1;
|
|
|
|
gc->state.current.cur_tex = -1;
|
|
|
|
gc->state.current.cur_texu = -1;
|
|
|
|
gc->state.current.cur_texv = -1;
|
|
|
|
gc->state.current.render_op = -1;
|
|
|
|
gc->state.current.smooth = -1;
|
|
|
|
gc->state.current.blend = -1;
|
|
|
|
gc->state.current.clip = -1;
|
|
|
|
gc->state.current.cx = -1;
|
|
|
|
gc->state.current.cy = -1;
|
|
|
|
gc->state.current.cw = -1;
|
|
|
|
gc->state.current.ch = -1;
|
2009-11-12 23:22:31 -08:00
|
|
|
|
2010-08-08 20:27:59 -07:00
|
|
|
gc->pipe[0].shader.surface = surface;
|
2009-11-12 23:22:31 -08:00
|
|
|
gc->change.size = 1;
|
2009-11-13 00:43:50 -08:00
|
|
|
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
|
2009-11-13 03:30:28 -08:00
|
|
|
# ifndef GL_FRAMEBUFFER
|
|
|
|
# define GL_FRAMEBUFFER GL_FRAMEBUFFER_OES
|
2011-06-17 00:47:28 -07:00
|
|
|
# endif
|
2009-11-13 00:43:50 -08:00
|
|
|
#else
|
2009-11-13 03:30:28 -08:00
|
|
|
# ifndef GL_FRAMEBUFFER
|
|
|
|
# define GL_FRAMEBUFFER GL_FRAMEBUFFER_EXT
|
2011-06-17 00:47:28 -07:00
|
|
|
# endif
|
|
|
|
#endif
|
2010-08-08 20:27:59 -07:00
|
|
|
if (gc->pipe[0].shader.surface == gc->def_surface)
|
2010-02-16 20:21:59 -08:00
|
|
|
{
|
|
|
|
glsym_glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
|
|
|
}
|
2009-11-12 23:22:31 -08:00
|
|
|
else
|
2010-02-16 20:21:59 -08:00
|
|
|
{
|
|
|
|
glsym_glBindFramebuffer(GL_FRAMEBUFFER, surface->tex->pt->fb);
|
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
|
|
|
}
|
2009-11-12 23:22:31 -08:00
|
|
|
_evas_gl_common_viewport_set(gc);
|
|
|
|
}
|
|
|
|
|
2010-08-08 20:27:59 -07:00
|
|
|
#define PUSH_VERTEX(n, x, y, z) \
|
|
|
|
gc->pipe[n].array.vertex[nv++] = x; \
|
|
|
|
gc->pipe[n].array.vertex[nv++] = y; \
|
|
|
|
gc->pipe[n].array.vertex[nv++] = z
|
|
|
|
#define PUSH_COLOR(n, r, g, b, a) \
|
|
|
|
gc->pipe[n].array.color[nc++] = r; \
|
|
|
|
gc->pipe[n].array.color[nc++] = g; \
|
|
|
|
gc->pipe[n].array.color[nc++] = b; \
|
|
|
|
gc->pipe[n].array.color[nc++] = a
|
|
|
|
#define PUSH_TEXUV(n, u, v) \
|
|
|
|
gc->pipe[n].array.texuv[nu++] = u; \
|
|
|
|
gc->pipe[n].array.texuv[nu++] = v
|
|
|
|
#define PUSH_TEXUV2(n, u, v) \
|
|
|
|
gc->pipe[n].array.texuv2[nu2++] = u; \
|
|
|
|
gc->pipe[n].array.texuv2[nu2++] = v
|
|
|
|
#define PUSH_TEXUV3(n, u, v) \
|
|
|
|
gc->pipe[n].array.texuv3[nu3++] = u; \
|
|
|
|
gc->pipe[n].array.texuv3[nu3++] = v
|
2011-04-05 22:38:38 -07:00
|
|
|
#define PUSH_TEXM(n, u, v) \
|
|
|
|
gc->pipe[n].array.texm[nm++] = u; \
|
|
|
|
gc->pipe[n].array.texm[nm++] = v
|
|
|
|
|
2009-10-09 05:10:27 -07:00
|
|
|
|
2009-10-10 06:24:15 -07:00
|
|
|
static inline void
|
2011-03-16 10:32:49 -07:00
|
|
|
array_alloc(Evas_Engine_GL_Context *gc, int n)
|
2010-08-08 20:27:59 -07:00
|
|
|
{
|
2011-01-07 02:22:22 -08:00
|
|
|
gc->havestuff = EINA_TRUE;
|
2010-08-08 20:27:59 -07:00
|
|
|
if (gc->pipe[n].array.num <= gc->pipe[n].array.alloc) return;
|
|
|
|
gc->pipe[n].array.alloc += 6 * 1024;
|
|
|
|
if (gc->pipe[n].array.use_vertex)
|
|
|
|
gc->pipe[n].array.vertex = realloc(gc->pipe[n].array.vertex,
|
|
|
|
gc->pipe[n].array.alloc * sizeof(GLshort) * 3);
|
|
|
|
if (gc->pipe[n].array.use_color)
|
|
|
|
gc->pipe[n].array.color = realloc(gc->pipe[n].array.color,
|
|
|
|
gc->pipe[n].array.alloc * sizeof(GLubyte) * 4);
|
|
|
|
if (gc->pipe[n].array.use_texuv)
|
|
|
|
gc->pipe[n].array.texuv = realloc(gc->pipe[n].array.texuv,
|
|
|
|
gc->pipe[n].array.alloc * sizeof(GLfloat) * 2);
|
2011-04-05 22:38:38 -07:00
|
|
|
if (gc->pipe[n].array.use_texm)
|
|
|
|
gc->pipe[n].array.texm = realloc(gc->pipe[n].array.texm,
|
|
|
|
gc->pipe[n].array.alloc * sizeof(GLfloat) * 2);
|
2010-08-08 20:27:59 -07:00
|
|
|
if (gc->pipe[n].array.use_texuv2)
|
|
|
|
gc->pipe[n].array.texuv2 = realloc(gc->pipe[n].array.texuv2,
|
|
|
|
gc->pipe[n].array.alloc * sizeof(GLfloat) * 2);
|
|
|
|
if (gc->pipe[n].array.use_texuv3)
|
|
|
|
gc->pipe[n].array.texuv3 = realloc(gc->pipe[n].array.texuv3,
|
|
|
|
gc->pipe[n].array.alloc * sizeof(GLfloat) * 2);
|
|
|
|
}
|
|
|
|
|
2011-08-25 01:28:34 -07:00
|
|
|
#ifdef GLPIPES
|
2010-08-08 20:27:59 -07:00
|
|
|
static int
|
2011-03-16 10:32:49 -07:00
|
|
|
pipe_region_intersects(Evas_Engine_GL_Context *gc, int n,
|
2010-08-08 20:27:59 -07:00
|
|
|
int x, int y, int w, int h)
|
2003-09-07 04:24:48 -07:00
|
|
|
{
|
2010-08-08 20:27:59 -07:00
|
|
|
int i, rx, ry, rw, rh, ii;
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-08-08 20:27:59 -07:00
|
|
|
rx = gc->pipe[n].region.x;
|
|
|
|
ry = gc->pipe[n].region.y;
|
|
|
|
rw = gc->pipe[n].region.w;
|
|
|
|
rh = gc->pipe[n].region.h;
|
|
|
|
if (!RECTS_INTERSECT(x, y, w, h, rx, ry, rw, rh))
|
|
|
|
return 0;
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-08-08 21:42:15 -07:00
|
|
|
// a hack for now. map pipes use their whole bounding box for intersects
|
|
|
|
// which at worst case reduces to old pipeline flushes, but cheaper than
|
|
|
|
// full quad region or triangle intersects right now
|
|
|
|
if (gc->pipe[n].region.type == RTYPE_MAP) return 1;
|
2011-06-17 00:47:28 -07:00
|
|
|
|
|
|
|
for (i = 0,
|
|
|
|
ii = 0;
|
|
|
|
|
|
|
|
i < gc->pipe[n].array.num;
|
|
|
|
|
|
|
|
i += (3 * 2),
|
2010-08-08 20:27:59 -07:00
|
|
|
ii += (3 * 3 * 2))
|
|
|
|
{ // tri 1...
|
|
|
|
// 0, 1, 2 < top left
|
|
|
|
// 3, 4, 5 < top right
|
|
|
|
// 6. 7, 8 < bottom left
|
|
|
|
rx = gc->pipe[n].array.vertex[ii + 0];
|
|
|
|
ry = gc->pipe[n].array.vertex[ii + 1];
|
|
|
|
rw = gc->pipe[n].array.vertex[ii + 3] - rx;
|
|
|
|
rh = gc->pipe[n].array.vertex[ii + 7] - ry;
|
|
|
|
if (RECTS_INTERSECT(x, y, w, h, rx, ry, rw, rh))
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
2011-08-25 01:28:34 -07:00
|
|
|
#endif
|
2010-08-08 20:27:59 -07:00
|
|
|
|
|
|
|
static void
|
2011-03-16 10:32:49 -07:00
|
|
|
pipe_region_expand(Evas_Engine_GL_Context *gc, int n,
|
2010-08-08 20:27:59 -07:00
|
|
|
int x, int y, int w, int h)
|
|
|
|
{
|
|
|
|
int x1, y1, x2, y2;
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-08-08 20:27:59 -07:00
|
|
|
if (gc->pipe[n].region.w <= 0)
|
|
|
|
{
|
|
|
|
gc->pipe[n].region.x = x;
|
|
|
|
gc->pipe[n].region.y = y;
|
|
|
|
gc->pipe[n].region.w = w;
|
|
|
|
gc->pipe[n].region.h = h;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
x1 = gc->pipe[n].region.x;
|
|
|
|
y1 = gc->pipe[n].region.y;
|
|
|
|
x2 = gc->pipe[n].region.x + gc->pipe[n].region.w;
|
|
|
|
y2 = gc->pipe[n].region.y + gc->pipe[n].region.h;
|
|
|
|
if (x < x1) x1 = x;
|
|
|
|
if (y < y1) y1 = y;
|
|
|
|
if ((x + w) > x2) x2 = x + w;
|
|
|
|
if ((y + h) > y2) y2 = y + h;
|
|
|
|
gc->pipe[n].region.x = x1;
|
|
|
|
gc->pipe[n].region.y = y1;
|
|
|
|
gc->pipe[n].region.w = x2 - x1;
|
|
|
|
gc->pipe[n].region.h = y2 - y1;
|
2003-09-07 04:24:48 -07:00
|
|
|
}
|
|
|
|
|
2010-09-06 06:36:32 -07:00
|
|
|
static Eina_Bool
|
2011-03-16 10:32:49 -07:00
|
|
|
vertex_array_size_check(Evas_Engine_GL_Context *gc, int pn, int n)
|
2010-09-06 06:36:32 -07:00
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
// this fixup breaks for expedite test 32. why?
|
|
|
|
if ((gc->pipe[pn].array.num + n) > gc->shared->info.max_vertex_elements)
|
|
|
|
{
|
|
|
|
shader_array_flush(gc);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2011-08-29 13:56:48 -07:00
|
|
|
static inline Evas_GL_Shader
|
|
|
|
evas_gl_common_shader_choice(int npoints,
|
|
|
|
RGBA_Map_Point *p,
|
|
|
|
int r, int g, int b, int a,
|
|
|
|
Evas_GL_Shader nomul,
|
|
|
|
Evas_GL_Shader mul)
|
|
|
|
{
|
|
|
|
if ((a == 255) && (r == 255) && (g == 255) && (b == 255))
|
|
|
|
{
|
|
|
|
if (!p) return nomul;
|
|
|
|
|
|
|
|
if ((p[0].col == 0xffffffff) && (p[1].col == 0xffffffff) &&
|
|
|
|
(p[2].col == 0xffffffff) && (p[3].col == 0xffffffff))
|
|
|
|
return nomul;
|
|
|
|
}
|
|
|
|
return mul;
|
|
|
|
}
|
|
|
|
|
2011-08-25 01:28:34 -07:00
|
|
|
static int
|
|
|
|
_evas_gl_common_context_push(int rtype,
|
|
|
|
Evas_Engine_GL_Context *gc,
|
|
|
|
Evas_GL_Texture *tex,
|
|
|
|
Evas_GL_Texture *texm,
|
|
|
|
GLuint prog,
|
|
|
|
int x, int y, int w, int h,
|
|
|
|
Eina_Bool blend,
|
|
|
|
Eina_Bool smooth,
|
|
|
|
Eina_Bool clip,
|
|
|
|
int cx, int cy, int cw, int ch)
|
|
|
|
{
|
|
|
|
int pn = 0;
|
|
|
|
|
|
|
|
#ifdef GLPIPES
|
|
|
|
again:
|
|
|
|
#endif
|
|
|
|
vertex_array_size_check(gc, gc->state.top_pipe, 6);
|
|
|
|
pn = gc->state.top_pipe;
|
|
|
|
#ifdef GLPIPES
|
|
|
|
if (!((pn == 0) && (gc->pipe[pn].array.num == 0)))
|
|
|
|
{
|
|
|
|
int found = 0;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = pn; i >= 0; i--)
|
|
|
|
{
|
|
|
|
if ((gc->pipe[i].region.type == rtype)
|
|
|
|
&& (!tex || gc->pipe[i].shader.cur_tex == tex->pt->texture)
|
|
|
|
&& (!texm || gc->pipe[i].shader.cur_texm == texm->pt->texture)
|
|
|
|
&& (gc->pipe[i].shader.cur_prog == prog)
|
|
|
|
&& (gc->pipe[i].shader.smooth == smooth)
|
|
|
|
&& (gc->pipe[i].shader.blend == blend)
|
|
|
|
&& (gc->pipe[i].shader.render_op == gc->dc->render_op)
|
|
|
|
&& (gc->pipe[i].shader.clip == clip)
|
|
|
|
&& (!clip || ((gc->pipe[i].shader.cx == cx)
|
|
|
|
&& (gc->pipe[i].shader.cy == cy)
|
|
|
|
&& (gc->pipe[i].shader.cw == cw)
|
|
|
|
&& (gc->pipe[i].shader.ch == ch))))
|
|
|
|
{
|
|
|
|
found = 1;
|
|
|
|
pn = i;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (pipe_region_intersects(gc, i, x, y, w, h)) break;
|
|
|
|
}
|
|
|
|
if (!found)
|
|
|
|
{
|
|
|
|
pn = gc->state.top_pipe + 1;
|
|
|
|
if (pn >= gc->shared->info.tune.pipes.max)
|
|
|
|
{
|
|
|
|
shader_array_flush(gc);
|
|
|
|
goto again;
|
|
|
|
}
|
|
|
|
gc->state.top_pipe = pn;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ((tex) && (((tex->im) && (tex->im->native.data)) || tex->pt->dyn.img))
|
|
|
|
{
|
|
|
|
if (gc->pipe[pn].array.im != tex->im)
|
|
|
|
{
|
|
|
|
shader_array_flush(gc);
|
|
|
|
pn = gc->state.top_pipe;
|
|
|
|
gc->pipe[pn].array.im = tex->im;
|
|
|
|
goto again;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
if (!((gc->pipe[pn].region.type == rtype)
|
|
|
|
&& (!tex || gc->pipe[pn].shader.cur_tex == tex->pt->texture)
|
|
|
|
&& (!texm || gc->pipe[pn].shader.cur_texm == texm->pt->texture)
|
|
|
|
&& (gc->pipe[pn].shader.cur_prog == prog)
|
|
|
|
&& (gc->pipe[pn].shader.smooth == smooth)
|
|
|
|
&& (gc->pipe[pn].shader.blend == blend)
|
|
|
|
&& (gc->pipe[pn].shader.render_op == gc->dc->render_op)
|
|
|
|
&& (gc->pipe[pn].shader.clip == clip)
|
|
|
|
&& (!clip || ((gc->pipe[pn].shader.cx == cx)
|
|
|
|
&& (gc->pipe[pn].shader.cy == cy)
|
|
|
|
&& (gc->pipe[pn].shader.cw == cw)
|
|
|
|
&& (gc->pipe[pn].shader.ch == ch)))))
|
|
|
|
{
|
|
|
|
shader_array_flush(gc);
|
|
|
|
}
|
|
|
|
if ((tex) && (((tex->im) && (tex->im->native.data)) || tex->pt->dyn.img))
|
|
|
|
{
|
|
|
|
if (gc->pipe[pn].array.im != tex->im)
|
|
|
|
{
|
|
|
|
shader_array_flush(gc);
|
|
|
|
gc->pipe[pn].array.im = tex->im;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return pn;
|
|
|
|
}
|
|
|
|
|
2009-12-30 03:35:40 -08:00
|
|
|
void
|
2011-06-17 00:47:28 -07:00
|
|
|
evas_gl_common_context_line_push(Evas_Engine_GL_Context *gc,
|
2009-12-30 03:35:40 -08:00
|
|
|
int x1, int y1, int x2, int y2,
|
|
|
|
int clip, int cx, int cy, int cw, int ch,
|
|
|
|
int r, int g, int b, int a)
|
|
|
|
{
|
|
|
|
int pnum, nv, nc, nu, nt, i;
|
|
|
|
Eina_Bool blend = 0;
|
2011-08-24 09:20:15 -07:00
|
|
|
GLuint prog = gc->shared->shader[SHADER_RECT].prog;
|
2010-08-08 20:27:59 -07:00
|
|
|
int pn = 0;
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2009-12-30 03:35:40 -08:00
|
|
|
if (a < 255) blend = 1;
|
|
|
|
if (gc->dc->render_op == EVAS_RENDER_COPY) blend = 0;
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-08-08 21:42:15 -07:00
|
|
|
shader_array_flush(gc);
|
2010-09-06 06:36:32 -07:00
|
|
|
vertex_array_size_check(gc, gc->state.top_pipe, 2);
|
2010-08-08 20:27:59 -07:00
|
|
|
pn = gc->state.top_pipe;
|
|
|
|
gc->pipe[pn].shader.cur_tex = 0;
|
|
|
|
gc->pipe[pn].shader.cur_prog = prog;
|
|
|
|
gc->pipe[pn].shader.blend = blend;
|
|
|
|
gc->pipe[pn].shader.render_op = gc->dc->render_op;
|
|
|
|
gc->pipe[pn].shader.clip = clip;
|
|
|
|
gc->pipe[pn].shader.cx = cx;
|
|
|
|
gc->pipe[pn].shader.cy = cy;
|
|
|
|
gc->pipe[pn].shader.cw = cw;
|
|
|
|
gc->pipe[pn].shader.ch = ch;
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-08-08 20:27:59 -07:00
|
|
|
gc->pipe[pn].array.line = 1;
|
|
|
|
gc->pipe[pn].array.use_vertex = 1;
|
|
|
|
gc->pipe[pn].array.use_color = 1;
|
|
|
|
gc->pipe[pn].array.use_texuv = 0;
|
|
|
|
gc->pipe[pn].array.use_texuv2 = 0;
|
|
|
|
gc->pipe[pn].array.use_texuv3 = 0;
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-08-08 20:27:59 -07:00
|
|
|
pnum = gc->pipe[pn].array.num;
|
2009-12-30 03:35:40 -08:00
|
|
|
nv = pnum * 3; nc = pnum * 4; nu = pnum * 2; nt = pnum * 4;
|
2010-09-06 06:36:32 -07:00
|
|
|
gc->pipe[pn].array.num += 2;
|
2010-08-08 20:27:59 -07:00
|
|
|
array_alloc(gc, pn);
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-08-08 20:27:59 -07:00
|
|
|
PUSH_VERTEX(pn, x1, y1, 0);
|
|
|
|
PUSH_VERTEX(pn, x2, y2, 0);
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2009-12-30 03:35:40 -08:00
|
|
|
for (i = 0; i < 2; i++)
|
|
|
|
{
|
2010-08-08 20:27:59 -07:00
|
|
|
PUSH_COLOR(pn, r, g, b, a);
|
2009-12-30 03:35:40 -08:00
|
|
|
}
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2009-12-30 03:35:40 -08:00
|
|
|
shader_array_flush(gc);
|
2010-08-08 20:27:59 -07:00
|
|
|
gc->pipe[pn].array.line = 0;
|
|
|
|
gc->pipe[pn].array.use_vertex = 0;
|
|
|
|
gc->pipe[pn].array.use_color = 0;
|
|
|
|
gc->pipe[pn].array.use_texuv = 0;
|
|
|
|
gc->pipe[pn].array.use_texuv2 = 0;
|
|
|
|
gc->pipe[pn].array.use_texuv3 = 0;
|
2009-12-30 03:35:40 -08:00
|
|
|
}
|
|
|
|
|
2003-09-07 04:24:48 -07:00
|
|
|
void
|
2011-06-17 00:47:28 -07:00
|
|
|
evas_gl_common_context_rectangle_push(Evas_Engine_GL_Context *gc,
|
2009-10-09 05:10:27 -07:00
|
|
|
int x, int y, int w, int h,
|
|
|
|
int r, int g, int b, int a)
|
2003-09-07 04:24:48 -07:00
|
|
|
{
|
2009-10-09 05:10:27 -07:00
|
|
|
int pnum, nv, nc, nu, nt, i;
|
2010-02-17 23:10:28 -08:00
|
|
|
Eina_Bool blend = 0;
|
2011-08-24 09:20:15 -07:00
|
|
|
GLuint prog = gc->shared->shader[SHADER_RECT].prog;
|
2010-08-08 20:27:59 -07:00
|
|
|
int pn = 0;
|
2011-04-05 22:38:38 -07:00
|
|
|
|
|
|
|
if (gc->dc->mask.mask)
|
|
|
|
{
|
|
|
|
RGBA_Draw_Context *dc;
|
|
|
|
dc = gc->dc;
|
|
|
|
Evas_GL_Image *im;
|
|
|
|
im = (void *)dc->mask.mask;
|
|
|
|
evas_gl_common_context_font_push(gc, im->tex,
|
|
|
|
x - dc->mask.x,y - dc->mask.y,
|
|
|
|
dc->mask.w,dc->mask.h,
|
|
|
|
x,y,w,h,r,g,b,a);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2010-02-17 23:10:28 -08:00
|
|
|
if (a < 255) blend = 1;
|
2009-11-12 23:22:31 -08:00
|
|
|
if (gc->dc->render_op == EVAS_RENDER_COPY) blend = 0;
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-08-08 20:27:59 -07:00
|
|
|
again:
|
2010-09-06 06:36:32 -07:00
|
|
|
vertex_array_size_check(gc, gc->state.top_pipe, 6);
|
2010-08-08 20:27:59 -07:00
|
|
|
pn = gc->state.top_pipe;
|
|
|
|
#ifdef GLPIPES
|
|
|
|
if ((pn == 0) && (gc->pipe[pn].array.num == 0))
|
|
|
|
{
|
|
|
|
gc->pipe[pn].region.type = RTYPE_RECT;
|
|
|
|
gc->pipe[pn].shader.cur_tex = 0;
|
|
|
|
gc->pipe[pn].shader.cur_prog = prog;
|
|
|
|
gc->pipe[pn].shader.blend = blend;
|
|
|
|
gc->pipe[pn].shader.render_op = gc->dc->render_op;
|
|
|
|
gc->pipe[pn].shader.clip = 0;
|
2010-08-08 21:42:15 -07:00
|
|
|
gc->pipe[pn].shader.cx = 0;
|
|
|
|
gc->pipe[pn].shader.cy = 0;
|
|
|
|
gc->pipe[pn].shader.cw = 0;
|
|
|
|
gc->pipe[pn].shader.ch = 0;
|
2010-08-08 20:27:59 -07:00
|
|
|
gc->pipe[pn].array.line = 0;
|
|
|
|
gc->pipe[pn].array.use_vertex = 1;
|
|
|
|
gc->pipe[pn].array.use_color = 1;
|
|
|
|
gc->pipe[pn].array.use_texuv = 0;
|
|
|
|
gc->pipe[pn].array.use_texuv2 = 0;
|
|
|
|
gc->pipe[pn].array.use_texuv3 = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int found = 0;
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-08-08 20:27:59 -07:00
|
|
|
for (i = pn; i >= 0; i--)
|
|
|
|
{
|
2010-08-08 21:42:15 -07:00
|
|
|
if ((gc->pipe[i].region.type == RTYPE_RECT)
|
|
|
|
&& (gc->pipe[i].shader.cur_tex == 0)
|
2010-08-08 20:27:59 -07:00
|
|
|
&& (gc->pipe[i].shader.cur_prog == prog)
|
|
|
|
&& (gc->pipe[i].shader.blend == blend)
|
|
|
|
&& (gc->pipe[i].shader.render_op == gc->dc->render_op)
|
|
|
|
&& (gc->pipe[i].shader.clip == 0)
|
|
|
|
)
|
|
|
|
{
|
|
|
|
found = 1;
|
|
|
|
pn = i;
|
|
|
|
break;
|
|
|
|
}
|
2010-08-08 21:42:15 -07:00
|
|
|
if (pipe_region_intersects(gc, i, x, y, w, h)) break;
|
2010-08-08 20:27:59 -07:00
|
|
|
}
|
|
|
|
if (!found)
|
|
|
|
{
|
|
|
|
pn = gc->state.top_pipe + 1;
|
2010-08-25 18:41:48 -07:00
|
|
|
if (pn >= gc->shared->info.tune.pipes.max)
|
2010-08-08 20:27:59 -07:00
|
|
|
{
|
|
|
|
shader_array_flush(gc);
|
|
|
|
goto again;
|
|
|
|
}
|
|
|
|
gc->state.top_pipe = pn;
|
2010-08-08 21:42:15 -07:00
|
|
|
gc->pipe[pn].region.type = RTYPE_RECT;
|
2010-08-08 20:27:59 -07:00
|
|
|
gc->pipe[pn].shader.cur_tex = 0;
|
|
|
|
gc->pipe[pn].shader.cur_prog = prog;
|
|
|
|
gc->pipe[pn].shader.blend = blend;
|
|
|
|
gc->pipe[pn].shader.render_op = gc->dc->render_op;
|
|
|
|
gc->pipe[pn].shader.clip = 0;
|
2010-08-08 21:42:15 -07:00
|
|
|
gc->pipe[pn].shader.cx = 0;
|
|
|
|
gc->pipe[pn].shader.cy = 0;
|
|
|
|
gc->pipe[pn].shader.cw = 0;
|
|
|
|
gc->pipe[pn].shader.ch = 0;
|
2010-08-08 20:27:59 -07:00
|
|
|
gc->pipe[pn].array.line = 0;
|
|
|
|
gc->pipe[pn].array.use_vertex = 1;
|
|
|
|
gc->pipe[pn].array.use_color = 1;
|
|
|
|
gc->pipe[pn].array.use_texuv = 0;
|
|
|
|
gc->pipe[pn].array.use_texuv2 = 0;
|
|
|
|
gc->pipe[pn].array.use_texuv3 = 0;
|
|
|
|
}
|
|
|
|
}
|
2011-06-17 00:47:28 -07:00
|
|
|
#else
|
2010-08-08 20:27:59 -07:00
|
|
|
if ((gc->pipe[pn].shader.cur_tex != 0)
|
|
|
|
|| (gc->pipe[pn].shader.cur_prog != prog)
|
|
|
|
|| (gc->pipe[pn].shader.blend != blend)
|
|
|
|
|| (gc->pipe[pn].shader.render_op != gc->dc->render_op)
|
|
|
|
|| (gc->pipe[pn].shader.clip != 0)
|
2009-10-09 05:10:27 -07:00
|
|
|
)
|
2006-12-06 06:58:00 -08:00
|
|
|
{
|
2009-10-09 05:10:27 -07:00
|
|
|
shader_array_flush(gc);
|
2010-08-08 20:27:59 -07:00
|
|
|
pn = gc->state.top_pipe;
|
|
|
|
gc->pipe[pn].shader.cur_tex = 0;
|
|
|
|
gc->pipe[pn].shader.cur_prog = prog;
|
|
|
|
gc->pipe[pn].shader.blend = blend;
|
|
|
|
gc->pipe[pn].shader.render_op = gc->dc->render_op;
|
|
|
|
gc->pipe[pn].shader.clip = 0;
|
2010-08-08 21:42:15 -07:00
|
|
|
gc->pipe[pn].shader.cx = 0;
|
|
|
|
gc->pipe[pn].shader.cy = 0;
|
|
|
|
gc->pipe[pn].shader.cw = 0;
|
|
|
|
gc->pipe[pn].shader.ch = 0;
|
2006-12-06 06:58:00 -08:00
|
|
|
}
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-08-08 20:27:59 -07:00
|
|
|
gc->pipe[pn].region.type = RTYPE_RECT;
|
|
|
|
gc->pipe[pn].array.line = 0;
|
|
|
|
gc->pipe[pn].array.use_vertex = 1;
|
|
|
|
gc->pipe[pn].array.use_color = 1;
|
|
|
|
gc->pipe[pn].array.use_texuv = 0;
|
|
|
|
gc->pipe[pn].array.use_texuv2 = 0;
|
|
|
|
gc->pipe[pn].array.use_texuv3 = 0;
|
|
|
|
#endif
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-08-08 20:27:59 -07:00
|
|
|
pipe_region_expand(gc, pn, x, y, w, h);
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-08-08 20:27:59 -07:00
|
|
|
pnum = gc->pipe[pn].array.num;
|
2009-10-09 05:10:27 -07:00
|
|
|
nv = pnum * 3; nc = pnum * 4; nu = pnum * 2; nt = pnum * 4;
|
2010-08-08 20:27:59 -07:00
|
|
|
gc->pipe[pn].array.num += 6;
|
|
|
|
array_alloc(gc, pn);
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-08-08 20:27:59 -07:00
|
|
|
PUSH_VERTEX(pn, x , y , 0);
|
|
|
|
PUSH_VERTEX(pn, x + w, y , 0);
|
|
|
|
PUSH_VERTEX(pn, x , y + h, 0);
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-08-08 20:27:59 -07:00
|
|
|
PUSH_VERTEX(pn, x + w, y , 0);
|
|
|
|
PUSH_VERTEX(pn, x + w, y + h, 0);
|
|
|
|
PUSH_VERTEX(pn, x , y + h, 0);
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2009-10-09 05:10:27 -07:00
|
|
|
for (i = 0; i < 6; i++)
|
2006-12-06 06:58:00 -08:00
|
|
|
{
|
2010-08-08 20:27:59 -07:00
|
|
|
PUSH_COLOR(pn, r, g, b, a);
|
2006-12-06 06:58:00 -08:00
|
|
|
}
|
2003-09-07 04:24:48 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2011-03-16 10:32:49 -07:00
|
|
|
evas_gl_common_context_image_push(Evas_Engine_GL_Context *gc,
|
2009-10-09 05:10:27 -07:00
|
|
|
Evas_GL_Texture *tex,
|
|
|
|
double sx, double sy, double sw, double sh,
|
|
|
|
int x, int y, int w, int h,
|
|
|
|
int r, int g, int b, int a,
|
2010-01-21 00:44:11 -08:00
|
|
|
Eina_Bool smooth, Eina_Bool tex_only)
|
2003-09-07 04:24:48 -07:00
|
|
|
{
|
2010-01-19 19:59:32 -08:00
|
|
|
int pnum, nv, nc, nu, nu2, nt, i;
|
2009-11-06 03:32:23 -08:00
|
|
|
GLfloat tx1, tx2, ty1, ty2;
|
2009-10-09 05:10:27 -07:00
|
|
|
Eina_Bool blend = 1;
|
2011-08-24 09:20:15 -07:00
|
|
|
GLuint prog = gc->shared->shader[SHADER_IMG].prog;
|
2010-08-08 20:27:59 -07:00
|
|
|
int pn = 0;
|
2003-09-07 04:24:48 -07:00
|
|
|
|
2010-02-17 23:10:28 -08:00
|
|
|
if (!tex->alpha) blend = 0;
|
|
|
|
if (a < 255) blend = 1;
|
2011-04-18 22:47:56 -07:00
|
|
|
|
|
|
|
if (gc->filter_prog)
|
|
|
|
{
|
|
|
|
prog = gc->filter_prog;
|
|
|
|
}
|
|
|
|
else if (tex_only)
|
2010-02-17 23:10:28 -08:00
|
|
|
{
|
2010-08-18 02:53:14 -07:00
|
|
|
if (tex->pt->dyn.img)
|
|
|
|
{
|
2011-08-29 13:56:48 -07:00
|
|
|
prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a,
|
|
|
|
SHADER_IMG_NOMUL, SHADER_IMG)].prog;
|
2010-08-18 02:53:14 -07:00
|
|
|
}
|
2010-02-17 23:10:28 -08:00
|
|
|
else
|
2010-08-18 02:53:14 -07:00
|
|
|
{
|
2011-08-29 13:56:48 -07:00
|
|
|
prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a,
|
|
|
|
SHADER_TEX_NOMUL, SHADER_TEX)].prog;
|
2010-08-18 02:53:14 -07:00
|
|
|
}
|
2010-02-17 23:10:28 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (tex->gc->shared->info.bgra)
|
|
|
|
{
|
2011-08-29 13:56:48 -07:00
|
|
|
prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a,
|
|
|
|
SHADER_IMG_BGRA_NOMUL, SHADER_IMG_BGRA)].prog;
|
2010-02-17 23:10:28 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-08-29 13:56:48 -07:00
|
|
|
prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a,
|
|
|
|
SHADER_IMG_NOMUL, SHADER_IMG)].prog;
|
2010-02-17 23:10:28 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-08-25 01:28:34 -07:00
|
|
|
pn = _evas_gl_common_context_push(RTYPE_IMAGE,
|
|
|
|
gc, tex, NULL,
|
|
|
|
prog,
|
|
|
|
x, y, w, h,
|
|
|
|
blend,
|
|
|
|
smooth,
|
|
|
|
0, 0, 0, 0, 0);
|
2010-08-08 20:27:59 -07:00
|
|
|
|
2011-08-25 01:28:34 -07:00
|
|
|
gc->pipe[pn].region.type = RTYPE_IMAGE;
|
|
|
|
gc->pipe[pn].shader.cur_tex = tex->pt->texture;
|
|
|
|
gc->pipe[pn].shader.cur_prog = prog;
|
|
|
|
gc->pipe[pn].shader.smooth = smooth;
|
|
|
|
gc->pipe[pn].shader.blend = blend;
|
|
|
|
gc->pipe[pn].shader.render_op = gc->dc->render_op;
|
|
|
|
gc->pipe[pn].shader.clip = 0;
|
|
|
|
gc->pipe[pn].shader.cx = 0;
|
|
|
|
gc->pipe[pn].shader.cy = 0;
|
|
|
|
gc->pipe[pn].shader.cw = 0;
|
|
|
|
gc->pipe[pn].shader.ch = 0;
|
2010-08-08 20:27:59 -07:00
|
|
|
gc->pipe[pn].array.line = 0;
|
|
|
|
gc->pipe[pn].array.use_vertex = 1;
|
2010-02-17 23:10:28 -08:00
|
|
|
// if nomul... dont need this
|
2010-08-08 20:27:59 -07:00
|
|
|
gc->pipe[pn].array.use_color = 1;
|
|
|
|
gc->pipe[pn].array.use_texuv = 1;
|
|
|
|
gc->pipe[pn].array.use_texuv2 = 0;
|
|
|
|
gc->pipe[pn].array.use_texuv3 = 0;
|
|
|
|
|
|
|
|
pipe_region_expand(gc, pn, x, y, w, h);
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-08-08 20:27:59 -07:00
|
|
|
pnum = gc->pipe[pn].array.num;
|
2010-01-19 19:59:32 -08:00
|
|
|
nv = pnum * 3; nc = pnum * 4; nu = pnum * 2; nu2 = pnum * 2;
|
|
|
|
nt = pnum * 4;
|
2010-08-08 20:27:59 -07:00
|
|
|
gc->pipe[pn].array.num += 6;
|
|
|
|
array_alloc(gc, pn);
|
2003-09-07 04:24:48 -07:00
|
|
|
|
2010-01-21 01:42:26 -08:00
|
|
|
if ((tex->im) && (tex->im->native.data) && (!tex->im->native.yinvert))
|
|
|
|
{
|
|
|
|
tx1 = ((double)(tex->x) + sx) / (double)tex->pt->w;
|
2011-03-10 00:23:39 -08:00
|
|
|
ty1 = 1.0 - ((double)(tex->y) + sy) / (double)tex->pt->h;
|
2010-01-21 01:42:26 -08:00
|
|
|
tx2 = ((double)(tex->x) + sx + sw) / (double)tex->pt->w;
|
2011-03-10 00:23:39 -08:00
|
|
|
ty2 = 1.0 - ((double)(tex->y) + sy + sh) / (double)tex->pt->h;
|
2010-01-21 01:42:26 -08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
tx1 = ((double)(tex->x) + sx) / (double)tex->pt->w;
|
|
|
|
ty1 = ((double)(tex->y) + sy) / (double)tex->pt->h;
|
|
|
|
tx2 = ((double)(tex->x) + sx + sw) / (double)tex->pt->w;
|
|
|
|
ty2 = ((double)(tex->y) + sy + sh) / (double)tex->pt->h;
|
|
|
|
}
|
2010-01-23 05:49:54 -08:00
|
|
|
|
2010-08-08 20:27:59 -07:00
|
|
|
PUSH_VERTEX(pn, x , y , 0);
|
|
|
|
PUSH_VERTEX(pn, x + w, y , 0);
|
|
|
|
PUSH_VERTEX(pn, x , y + h, 0);
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-08-08 20:27:59 -07:00
|
|
|
PUSH_TEXUV(pn, tx1, ty1);
|
|
|
|
PUSH_TEXUV(pn, tx2, ty1);
|
|
|
|
PUSH_TEXUV(pn, tx1, ty2);
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-08-08 20:27:59 -07:00
|
|
|
PUSH_VERTEX(pn, x + w, y , 0);
|
|
|
|
PUSH_VERTEX(pn, x + w, y + h, 0);
|
|
|
|
PUSH_VERTEX(pn, x , y + h, 0);
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-08-08 20:27:59 -07:00
|
|
|
PUSH_TEXUV(pn, tx2, ty1);
|
|
|
|
PUSH_TEXUV(pn, tx2, ty2);
|
|
|
|
PUSH_TEXUV(pn, tx1, ty2);
|
2009-10-09 05:10:27 -07:00
|
|
|
|
2010-02-17 23:10:28 -08:00
|
|
|
// if nomul... dont need this
|
2009-10-09 05:10:27 -07:00
|
|
|
for (i = 0; i < 6; i++)
|
2003-09-08 22:51:03 -07:00
|
|
|
{
|
2010-08-08 20:27:59 -07:00
|
|
|
PUSH_COLOR(pn, r, g, b, a);
|
2003-09-08 22:51:03 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-04-05 22:38:38 -07:00
|
|
|
void
|
|
|
|
evas_gl_common_context_image_mask_push(Evas_Engine_GL_Context *gc,
|
|
|
|
Evas_GL_Texture *tex,
|
|
|
|
Evas_GL_Texture *texm,
|
|
|
|
double sx, double sy, double sw, double sh,
|
|
|
|
double sxm, double sym, double swm,double shm,
|
|
|
|
int x, int y, int w, int h,
|
|
|
|
int r, int g, int b, int a,
|
|
|
|
Eina_Bool smooth)
|
|
|
|
{
|
|
|
|
int pnum, nv, nc, nu, nm, nt, i;
|
|
|
|
GLfloat tx1, tx2, ty1, ty2;
|
|
|
|
GLfloat txm1, txm2, tym1, tym2;
|
|
|
|
Eina_Bool blend = 1;
|
2011-08-24 09:20:15 -07:00
|
|
|
GLuint prog = gc->shared->shader[SHADER_IMG_MASK].prog;
|
2011-04-05 22:38:38 -07:00
|
|
|
int pn = 0;
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
if (tex->gc->shared->info.bgra)
|
|
|
|
{
|
2011-08-24 09:20:15 -07:00
|
|
|
prog = gc->shared->shader[SHADER_IMG_MASK].prog;
|
2011-04-05 22:38:38 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
#warning Nash: FIXME: Need two shaders?
|
|
|
|
printf("Not good: Need other texture\n");
|
2011-08-24 09:20:15 -07:00
|
|
|
prog = gc->shared->shader[SHADER_IMG].prog;
|
2011-04-05 22:38:38 -07:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2011-08-29 13:56:48 -07:00
|
|
|
pn = _evas_gl_common_context_push(RTYPE_IMASK,
|
|
|
|
gc, tex, texm,
|
|
|
|
prog,
|
|
|
|
x, y, w, h,
|
|
|
|
blend,
|
|
|
|
smooth,
|
|
|
|
0, 0, 0, 0, 0);
|
2011-04-05 22:38:38 -07:00
|
|
|
|
2011-08-29 13:56:48 -07:00
|
|
|
gc->pipe[pn].region.type = RTYPE_IMASK;
|
|
|
|
gc->pipe[pn].shader.cur_tex = tex->pt->texture;
|
|
|
|
gc->pipe[pn].shader.cur_texm = texm->pt->texture;
|
|
|
|
gc->pipe[pn].shader.cur_prog = prog;
|
|
|
|
gc->pipe[pn].shader.smooth = smooth;
|
|
|
|
gc->pipe[pn].shader.blend = blend;
|
|
|
|
gc->pipe[pn].shader.render_op = gc->dc->render_op;
|
|
|
|
gc->pipe[pn].shader.clip = 0;
|
|
|
|
gc->pipe[pn].shader.cx = 0;
|
|
|
|
gc->pipe[pn].shader.cy = 0;
|
|
|
|
gc->pipe[pn].shader.cw = 0;
|
|
|
|
gc->pipe[pn].shader.ch = 0;
|
2011-04-05 22:38:38 -07:00
|
|
|
gc->pipe[pn].array.line = 0;
|
|
|
|
gc->pipe[pn].array.use_vertex = 1;
|
2011-08-29 13:56:48 -07:00
|
|
|
// if nomul... dont need this
|
2011-04-05 22:38:38 -07:00
|
|
|
gc->pipe[pn].array.use_color = 1;
|
|
|
|
gc->pipe[pn].array.use_texuv = 1;
|
|
|
|
gc->pipe[pn].array.use_texuv2 = 0;
|
|
|
|
gc->pipe[pn].array.use_texuv3 = 0;
|
|
|
|
gc->pipe[pn].array.use_texm = 1;
|
|
|
|
|
|
|
|
pipe_region_expand(gc, pn, x, y, w, h);
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2011-04-05 22:38:38 -07:00
|
|
|
pnum = gc->pipe[pn].array.num;
|
|
|
|
nv = pnum * 3; nc = pnum * 4; nm = pnum * 2; nu = pnum * 2;
|
|
|
|
nt = pnum * 4;
|
|
|
|
gc->pipe[pn].array.num += 6;
|
|
|
|
array_alloc(gc, pn);
|
|
|
|
|
|
|
|
if ((tex->im) && (tex->im->native.data) && (!tex->im->native.yinvert))
|
|
|
|
{
|
|
|
|
tx1 = ((double)(tex->x) + sx) / (double)tex->pt->w;
|
|
|
|
ty1 = ((double)(tex->y) + sy + sh) / (double)tex->pt->h;
|
|
|
|
tx2 = ((double)(tex->x) + sx + sw) / (double)tex->pt->w;
|
|
|
|
ty2 = ((double)(tex->y) + sy) / (double)tex->pt->h;
|
|
|
|
|
|
|
|
txm1 = ((double)(texm->x) + sxm) / (double)texm->pt->w;
|
|
|
|
tym1 = ((double)(texm->y) + sym + shm) / (double)texm->pt->h;
|
|
|
|
txm2 = ((double)(texm->x) + sxm + swm) / (double)texm->pt->w;
|
|
|
|
tym2 = ((double)(texm->y) + sym) / (double)texm->pt->h;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
tx1 = ((double)(tex->x) + sx) / (double)tex->pt->w;
|
|
|
|
ty1 = ((double)(tex->y) + sy) / (double)tex->pt->h;
|
|
|
|
tx2 = ((double)(tex->x) + sx + sw) / (double)tex->pt->w;
|
|
|
|
ty2 = ((double)(tex->y) + sy + sh) / (double)tex->pt->h;
|
|
|
|
|
|
|
|
txm1 = (texm->x + sxm) / (double)texm->pt->w;
|
|
|
|
tym1 = (texm->y + sym) / (double)texm->pt->h;
|
|
|
|
txm2 = (texm->x + sxm + swm) / (double)texm->pt->w;
|
|
|
|
tym2 = (texm->y + sym + shm) / (double)texm->pt->h;
|
|
|
|
}
|
|
|
|
// printf(" %3.6lf %3.6lf %3.6lf %3.6lf\n",sx,sy,sw,sh);
|
|
|
|
// printf("m%3.6lf %3.6lf %3.6lf %3.6lf\n",sxm,sym,swm,shm);
|
|
|
|
// printf(" %3f %3f %3f %3f\n",tx1,ty1,tx2,ty2);
|
|
|
|
// printf("m%3f %3f %3f %3f\n",txm1,tym1,txm2,tym2);
|
|
|
|
|
|
|
|
PUSH_VERTEX(pn, x , y , 0);
|
|
|
|
PUSH_VERTEX(pn, x + w, y , 0);
|
|
|
|
PUSH_VERTEX(pn, x , y + h, 0);
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2011-04-05 22:38:38 -07:00
|
|
|
PUSH_TEXUV(pn, tx1, ty1);
|
|
|
|
PUSH_TEXUV(pn, tx2, ty1);
|
|
|
|
PUSH_TEXUV(pn, tx1, ty2);
|
|
|
|
|
|
|
|
PUSH_TEXM(pn, txm1, tym1);
|
|
|
|
PUSH_TEXM(pn, txm2, tym1);
|
|
|
|
PUSH_TEXM(pn, txm1, tym2);
|
|
|
|
|
|
|
|
PUSH_VERTEX(pn, x + w, y , 0);
|
|
|
|
PUSH_VERTEX(pn, x + w, y + h, 0);
|
|
|
|
PUSH_VERTEX(pn, x , y + h, 0);
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2011-04-05 22:38:38 -07:00
|
|
|
PUSH_TEXUV(pn, tx2, ty1);
|
|
|
|
PUSH_TEXUV(pn, tx2, ty2);
|
|
|
|
PUSH_TEXUV(pn, tx1, ty2);
|
|
|
|
|
|
|
|
PUSH_TEXM(pn, txm2, tym1);
|
|
|
|
PUSH_TEXM(pn, txm2, tym2);
|
|
|
|
PUSH_TEXM(pn, txm1, tym2);
|
|
|
|
|
|
|
|
// if nomul... dont need this
|
|
|
|
for (i = 0; i < 6; i++)
|
|
|
|
{
|
|
|
|
PUSH_COLOR(pn, r, g, b, a);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-09-07 04:24:48 -07:00
|
|
|
void
|
2011-03-16 10:32:49 -07:00
|
|
|
evas_gl_common_context_font_push(Evas_Engine_GL_Context *gc,
|
2009-10-09 05:10:27 -07:00
|
|
|
Evas_GL_Texture *tex,
|
|
|
|
double sx, double sy, double sw, double sh,
|
|
|
|
int x, int y, int w, int h,
|
|
|
|
int r, int g, int b, int a)
|
2003-09-07 04:24:48 -07:00
|
|
|
{
|
2009-10-09 05:10:27 -07:00
|
|
|
int pnum, nv, nc, nu, nt, i;
|
2009-11-06 03:32:23 -08:00
|
|
|
GLfloat tx1, tx2, ty1, ty2;
|
2011-08-24 09:20:15 -07:00
|
|
|
GLuint prog = gc->shared->shader[SHADER_FONT].prog;
|
2010-08-08 20:27:59 -07:00
|
|
|
int pn = 0;
|
2009-10-09 05:10:27 -07:00
|
|
|
|
2011-08-25 01:28:34 -07:00
|
|
|
pn = _evas_gl_common_context_push(RTYPE_FONT,
|
|
|
|
gc, tex, NULL,
|
|
|
|
prog,
|
|
|
|
x, y, w, h,
|
|
|
|
1,
|
|
|
|
0,
|
|
|
|
0, 0, 0, 0, 0);
|
|
|
|
|
|
|
|
gc->pipe[pn].region.type = RTYPE_FONT;
|
|
|
|
gc->pipe[pn].shader.cur_tex = tex->pt->texture;
|
|
|
|
gc->pipe[pn].shader.cur_prog = prog;
|
|
|
|
gc->pipe[pn].shader.smooth = 0;
|
|
|
|
gc->pipe[pn].shader.blend = 1;
|
|
|
|
gc->pipe[pn].shader.render_op = gc->dc->render_op;
|
|
|
|
gc->pipe[pn].shader.clip = 0;
|
|
|
|
gc->pipe[pn].shader.cx = 0;
|
|
|
|
gc->pipe[pn].shader.cy = 0;
|
|
|
|
gc->pipe[pn].shader.cw = 0;
|
|
|
|
gc->pipe[pn].shader.ch = 0;
|
|
|
|
gc->pipe[pn].array.line = 0;
|
|
|
|
gc->pipe[pn].array.use_vertex = 1;
|
|
|
|
gc->pipe[pn].array.use_color = 1;
|
|
|
|
gc->pipe[pn].array.use_texuv = 1;
|
|
|
|
gc->pipe[pn].array.use_texuv2 = 0;
|
|
|
|
gc->pipe[pn].array.use_texuv3 = 0;
|
|
|
|
|
|
|
|
pipe_region_expand(gc, pn, x, y, w, h);
|
|
|
|
|
|
|
|
pnum = gc->pipe[pn].array.num;
|
|
|
|
nv = pnum * 3; nc = pnum * 4; nu = pnum * 2; nt = pnum * 4;
|
|
|
|
gc->pipe[pn].array.num += 6;
|
|
|
|
array_alloc(gc, pn);
|
|
|
|
|
|
|
|
if (sw == 0.0)
|
2010-08-08 20:27:59 -07:00
|
|
|
{
|
2011-08-25 01:28:34 -07:00
|
|
|
tx1 = tex->sx1;
|
|
|
|
ty1 = tex->sy1;
|
|
|
|
tx2 = tex->sx2;
|
|
|
|
ty2 = tex->sy2;
|
2010-08-08 20:27:59 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-08-25 01:28:34 -07:00
|
|
|
tx1 = ((double)(tex->x) + sx) / (double)tex->pt->w;
|
|
|
|
ty1 = ((double)(tex->y) + sy) / (double)tex->pt->h;
|
|
|
|
tx2 = ((double)(tex->x) + sx + sw) / (double)tex->pt->w;
|
|
|
|
ty2 = ((double)(tex->y) + sy + sh) / (double)tex->pt->h;
|
|
|
|
}
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-08-08 20:27:59 -07:00
|
|
|
PUSH_VERTEX(pn, x , y , 0);
|
|
|
|
PUSH_VERTEX(pn, x + w, y , 0);
|
|
|
|
PUSH_VERTEX(pn, x , y + h, 0);
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-08-08 20:27:59 -07:00
|
|
|
PUSH_TEXUV(pn, tx1, ty1);
|
|
|
|
PUSH_TEXUV(pn, tx2, ty1);
|
|
|
|
PUSH_TEXUV(pn, tx1, ty2);
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-08-08 20:27:59 -07:00
|
|
|
PUSH_VERTEX(pn, x + w, y , 0);
|
|
|
|
PUSH_VERTEX(pn, x + w, y + h, 0);
|
|
|
|
PUSH_VERTEX(pn, x , y + h, 0);
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-08-08 20:27:59 -07:00
|
|
|
PUSH_TEXUV(pn, tx2, ty1);
|
|
|
|
PUSH_TEXUV(pn, tx2, ty2);
|
|
|
|
PUSH_TEXUV(pn, tx1, ty2);
|
2009-10-09 05:10:27 -07:00
|
|
|
|
|
|
|
for (i = 0; i < 6; i++)
|
2004-02-02 22:04:54 -08:00
|
|
|
{
|
2010-08-08 20:27:59 -07:00
|
|
|
PUSH_COLOR(pn, r, g, b, a);
|
2004-02-02 22:04:54 -08:00
|
|
|
}
|
2003-09-07 04:24:48 -07:00
|
|
|
}
|
|
|
|
|
2009-10-10 06:24:15 -07:00
|
|
|
void
|
2011-03-16 10:32:49 -07:00
|
|
|
evas_gl_common_context_yuv_push(Evas_Engine_GL_Context *gc,
|
2011-06-17 00:47:28 -07:00
|
|
|
Evas_GL_Texture *tex,
|
2009-10-10 06:24:15 -07:00
|
|
|
double sx, double sy, double sw, double sh,
|
|
|
|
int x, int y, int w, int h,
|
|
|
|
int r, int g, int b, int a,
|
|
|
|
Eina_Bool smooth)
|
|
|
|
{
|
|
|
|
int pnum, nv, nc, nu, nu2, nu3, nt, i;
|
2009-11-06 03:32:23 -08:00
|
|
|
GLfloat tx1, tx2, ty1, ty2, t2x1, t2x2, t2y1, t2y2;
|
2009-10-10 06:24:15 -07:00
|
|
|
Eina_Bool blend = 0;
|
2011-08-29 13:56:48 -07:00
|
|
|
GLuint prog;
|
2010-08-08 20:27:59 -07:00
|
|
|
int pn = 0;
|
2009-10-10 06:24:15 -07:00
|
|
|
|
|
|
|
if (a < 255) blend = 1;
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2011-08-29 13:56:48 -07:00
|
|
|
prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a,
|
|
|
|
SHADER_YUV_NOMUL, SHADER_YUV)].prog;
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2011-08-25 01:28:34 -07:00
|
|
|
pn = _evas_gl_common_context_push(RTYPE_YUV,
|
|
|
|
gc, tex, NULL,
|
|
|
|
prog,
|
|
|
|
x, y, w, h,
|
|
|
|
blend,
|
|
|
|
smooth,
|
|
|
|
0, 0, 0, 0, 0);
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-08-08 20:27:59 -07:00
|
|
|
gc->pipe[pn].region.type = RTYPE_YUV;
|
2011-08-25 01:28:34 -07:00
|
|
|
gc->pipe[pn].shader.cur_tex = tex->pt->texture;
|
|
|
|
gc->pipe[pn].shader.cur_texu = tex->ptu->texture;
|
|
|
|
gc->pipe[pn].shader.cur_texv = tex->ptv->texture;
|
|
|
|
gc->pipe[pn].shader.cur_prog = prog;
|
|
|
|
gc->pipe[pn].shader.smooth = smooth;
|
|
|
|
gc->pipe[pn].shader.blend = blend;
|
|
|
|
gc->pipe[pn].shader.render_op = gc->dc->render_op;
|
|
|
|
gc->pipe[pn].shader.clip = 0;
|
|
|
|
gc->pipe[pn].shader.cx = 0;
|
|
|
|
gc->pipe[pn].shader.cy = 0;
|
|
|
|
gc->pipe[pn].shader.cw = 0;
|
|
|
|
gc->pipe[pn].shader.ch = 0;
|
2010-08-08 20:27:59 -07:00
|
|
|
gc->pipe[pn].array.line = 0;
|
|
|
|
gc->pipe[pn].array.use_vertex = 1;
|
|
|
|
gc->pipe[pn].array.use_color = 1;
|
|
|
|
gc->pipe[pn].array.use_texuv = 1;
|
|
|
|
gc->pipe[pn].array.use_texuv2 = 1;
|
|
|
|
gc->pipe[pn].array.use_texuv3 = 1;
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-08-08 20:27:59 -07:00
|
|
|
pipe_region_expand(gc, pn, x, y, w, h);
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-08-08 20:27:59 -07:00
|
|
|
pnum = gc->pipe[pn].array.num;
|
2011-06-17 00:47:28 -07:00
|
|
|
nv = pnum * 3; nc = pnum * 4; nu = pnum * 2;
|
2009-10-10 06:24:15 -07:00
|
|
|
nu2 = pnum * 2; nu3 = pnum * 2; nt = pnum * 4;
|
2010-08-08 20:27:59 -07:00
|
|
|
gc->pipe[pn].array.num += 6;
|
|
|
|
array_alloc(gc, pn);
|
2009-10-10 06:24:15 -07:00
|
|
|
|
|
|
|
tx1 = (sx) / (double)tex->pt->w;
|
|
|
|
ty1 = (sy) / (double)tex->pt->h;
|
|
|
|
tx2 = (sx + sw) / (double)tex->pt->w;
|
|
|
|
ty2 = (sy + sh) / (double)tex->pt->h;
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2009-10-10 07:48:34 -07:00
|
|
|
t2x1 = ((sx) / 2) / (double)tex->ptu->w;
|
|
|
|
t2y1 = ((sy) / 2) / (double)tex->ptu->h;
|
|
|
|
t2x2 = ((sx + sw) / 2) / (double)tex->ptu->w;
|
|
|
|
t2y2 = ((sy + sh) / 2) / (double)tex->ptu->h;
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-08-08 20:27:59 -07:00
|
|
|
PUSH_VERTEX(pn, x , y , 0);
|
|
|
|
PUSH_VERTEX(pn, x + w, y , 0);
|
|
|
|
PUSH_VERTEX(pn, x , y + h, 0);
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-08-08 20:27:59 -07:00
|
|
|
PUSH_TEXUV(pn, tx1, ty1);
|
|
|
|
PUSH_TEXUV(pn, tx2, ty1);
|
|
|
|
PUSH_TEXUV(pn, tx1, ty2);
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-08-08 20:27:59 -07:00
|
|
|
PUSH_TEXUV2(pn, t2x1, t2y1);
|
|
|
|
PUSH_TEXUV2(pn, t2x2, t2y1);
|
|
|
|
PUSH_TEXUV2(pn, t2x1, t2y2);
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-08-08 20:27:59 -07:00
|
|
|
PUSH_TEXUV3(pn, t2x1, t2y1);
|
|
|
|
PUSH_TEXUV3(pn, t2x2, t2y1);
|
|
|
|
PUSH_TEXUV3(pn, t2x1, t2y2);
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-08-08 20:27:59 -07:00
|
|
|
PUSH_VERTEX(pn, x + w, y , 0);
|
|
|
|
PUSH_VERTEX(pn, x + w, y + h, 0);
|
|
|
|
PUSH_VERTEX(pn, x , y + h, 0);
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-08-08 20:27:59 -07:00
|
|
|
PUSH_TEXUV(pn, tx2, ty1);
|
|
|
|
PUSH_TEXUV(pn, tx2, ty2);
|
|
|
|
PUSH_TEXUV(pn, tx1, ty2);
|
2009-10-10 06:24:15 -07:00
|
|
|
|
2010-08-08 20:27:59 -07:00
|
|
|
PUSH_TEXUV2(pn, t2x2, t2y1);
|
|
|
|
PUSH_TEXUV2(pn, t2x2, t2y2);
|
|
|
|
PUSH_TEXUV2(pn, t2x1, t2y2);
|
2009-10-10 06:24:15 -07:00
|
|
|
|
2010-08-08 20:27:59 -07:00
|
|
|
PUSH_TEXUV3(pn, t2x2, t2y1);
|
|
|
|
PUSH_TEXUV3(pn, t2x2, t2y2);
|
|
|
|
PUSH_TEXUV3(pn, t2x1, t2y2);
|
2009-10-10 06:24:15 -07:00
|
|
|
|
|
|
|
for (i = 0; i < 6; i++)
|
|
|
|
{
|
2010-08-08 20:27:59 -07:00
|
|
|
PUSH_COLOR(pn, r, g, b, a);
|
2009-10-10 06:24:15 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-08-23 08:13:40 -07:00
|
|
|
void
|
|
|
|
evas_gl_common_context_yuy2_push(Evas_Engine_GL_Context *gc,
|
|
|
|
Evas_GL_Texture *tex,
|
|
|
|
double sx, double sy, double sw, double sh,
|
|
|
|
int x, int y, int w, int h,
|
|
|
|
int r, int g, int b, int a,
|
|
|
|
Eina_Bool smooth)
|
|
|
|
{
|
|
|
|
int pnum, nv, nc, nu, nu2, nu3, nt, i;
|
|
|
|
GLfloat tx1, tx2, ty1, ty2, t2x1, t2x2, t2y1, t2y2;
|
|
|
|
Eina_Bool blend = 0;
|
2011-08-29 13:56:48 -07:00
|
|
|
GLuint prog;
|
2011-08-23 08:13:40 -07:00
|
|
|
int pn = 0;
|
|
|
|
|
|
|
|
if (a < 255) blend = 1;
|
|
|
|
|
2011-08-29 13:56:48 -07:00
|
|
|
prog = gc->shared->shader[evas_gl_common_shader_choice(0, NULL, r, g, b, a,
|
|
|
|
SHADER_YUY2_NOMUL, SHADER_YUY2)].prog;
|
2011-08-23 08:13:40 -07:00
|
|
|
|
2011-08-25 01:28:34 -07:00
|
|
|
pn = _evas_gl_common_context_push(RTYPE_YUY2,
|
|
|
|
gc, tex, NULL,
|
|
|
|
prog,
|
|
|
|
x, y, w, h,
|
|
|
|
blend,
|
|
|
|
smooth,
|
|
|
|
0, 0, 0, 0, 0);
|
2011-08-23 08:13:40 -07:00
|
|
|
|
|
|
|
gc->pipe[pn].region.type = RTYPE_YUY2;
|
2011-08-25 01:28:34 -07:00
|
|
|
gc->pipe[pn].shader.cur_tex = tex->pt->texture;
|
|
|
|
gc->pipe[pn].shader.cur_texu = tex->ptuv->texture;
|
|
|
|
gc->pipe[pn].shader.cur_prog = prog;
|
|
|
|
gc->pipe[pn].shader.smooth = smooth;
|
|
|
|
gc->pipe[pn].shader.blend = blend;
|
|
|
|
gc->pipe[pn].shader.render_op = gc->dc->render_op;
|
|
|
|
gc->pipe[pn].shader.clip = 0;
|
|
|
|
gc->pipe[pn].shader.cx = 0;
|
|
|
|
gc->pipe[pn].shader.cy = 0;
|
|
|
|
gc->pipe[pn].shader.cw = 0;
|
|
|
|
gc->pipe[pn].shader.ch = 0;
|
2011-08-23 08:13:40 -07:00
|
|
|
gc->pipe[pn].array.line = 0;
|
|
|
|
gc->pipe[pn].array.use_vertex = 1;
|
|
|
|
gc->pipe[pn].array.use_color = 1;
|
|
|
|
gc->pipe[pn].array.use_texuv = 1;
|
|
|
|
gc->pipe[pn].array.use_texuv2 = 1;
|
|
|
|
gc->pipe[pn].array.use_texuv3 = 0;
|
|
|
|
|
|
|
|
pipe_region_expand(gc, pn, x, y, w, h);
|
|
|
|
|
|
|
|
pnum = gc->pipe[pn].array.num;
|
|
|
|
nv = pnum * 3; nc = pnum * 4; nu = pnum * 2;
|
|
|
|
nu2 = pnum * 2; nu3 = pnum * 2; nt = pnum * 4;
|
|
|
|
gc->pipe[pn].array.num += 6;
|
|
|
|
array_alloc(gc, pn);
|
|
|
|
|
|
|
|
tx1 = (sx) / (double)tex->pt->w;
|
|
|
|
ty1 = (sy) / (double)tex->pt->h;
|
|
|
|
tx2 = (sx + sw) / (double)tex->pt->w;
|
|
|
|
ty2 = (sy + sh) / (double)tex->pt->h;
|
|
|
|
|
|
|
|
t2x1 = sx / (double)tex->ptuv->w;
|
|
|
|
t2y1 = sy / (double)tex->ptuv->h;
|
|
|
|
t2x2 = (sx + sw) / (double)tex->ptuv->w;
|
|
|
|
t2y2 = (sy + sh) / (double)tex->ptuv->h;
|
|
|
|
|
|
|
|
PUSH_VERTEX(pn, x , y , 0);
|
|
|
|
PUSH_VERTEX(pn, x + w, y , 0);
|
|
|
|
PUSH_VERTEX(pn, x , y + h, 0);
|
|
|
|
|
|
|
|
PUSH_TEXUV(pn, tx1, ty1);
|
|
|
|
PUSH_TEXUV(pn, tx2, ty1);
|
|
|
|
PUSH_TEXUV(pn, tx1, ty2);
|
|
|
|
|
|
|
|
PUSH_TEXUV2(pn, t2x1, t2y1);
|
|
|
|
PUSH_TEXUV2(pn, t2x2, t2y1);
|
|
|
|
PUSH_TEXUV2(pn, t2x1, t2y2);
|
|
|
|
|
|
|
|
PUSH_VERTEX(pn, x + w, y , 0);
|
|
|
|
PUSH_VERTEX(pn, x + w, y + h, 0);
|
|
|
|
PUSH_VERTEX(pn, x , y + h, 0);
|
|
|
|
|
|
|
|
PUSH_TEXUV(pn, tx2, ty1);
|
|
|
|
PUSH_TEXUV(pn, tx2, ty2);
|
|
|
|
PUSH_TEXUV(pn, tx1, ty2);
|
|
|
|
|
|
|
|
PUSH_TEXUV2(pn, t2x2, t2y1);
|
|
|
|
PUSH_TEXUV2(pn, t2x2, t2y2);
|
|
|
|
PUSH_TEXUV2(pn, t2x1, t2y2);
|
|
|
|
|
|
|
|
for (i = 0; i < 6; i++)
|
|
|
|
{
|
|
|
|
PUSH_COLOR(pn, r, g, b, a);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-11-11 03:39:25 -08:00
|
|
|
void
|
2011-03-16 10:32:49 -07:00
|
|
|
evas_gl_common_context_image_map_push(Evas_Engine_GL_Context *gc,
|
2011-02-09 22:52:53 -08:00
|
|
|
Evas_GL_Texture *tex,
|
|
|
|
int npoints,
|
|
|
|
RGBA_Map_Point *p,
|
|
|
|
int clip, int cx, int cy, int cw, int ch,
|
|
|
|
int r, int g, int b, int a,
|
2011-08-29 13:56:48 -07:00
|
|
|
Eina_Bool smooth, Eina_Bool tex_only,
|
|
|
|
Evas_Colorspace cspace)
|
2009-11-11 03:39:25 -08:00
|
|
|
{
|
2010-09-04 19:58:30 -07:00
|
|
|
int pnum, nv, nc, nu, nu2, nu3, nt, i;
|
2009-11-11 03:39:25 -08:00
|
|
|
const int points[6] = { 0, 1, 2, 0, 2, 3 };
|
2010-08-18 09:08:30 -07:00
|
|
|
int x = 0, y = 0, w = 0, h = 0, px = 0, py = 0;
|
2010-09-04 19:58:30 -07:00
|
|
|
GLfloat tx[4], ty[4], t2x[4], t2y[4];
|
2009-11-11 03:39:25 -08:00
|
|
|
Eina_Bool blend = 1;
|
|
|
|
DATA32 cmul;
|
2011-08-24 09:20:15 -07:00
|
|
|
GLuint prog = gc->shared->shader[SHADER_IMG].prog;
|
2011-08-29 13:56:48 -07:00
|
|
|
Eina_Bool utexture = EINA_FALSE;
|
|
|
|
Eina_Bool uvtexture = EINA_FALSE;
|
2010-08-08 20:27:59 -07:00
|
|
|
int pn = 0;
|
2010-09-21 23:52:28 -07:00
|
|
|
int flat = 0;
|
2010-09-18 07:23:20 -07:00
|
|
|
|
2010-02-17 23:10:28 -08:00
|
|
|
if (!tex->alpha) blend = 0;
|
|
|
|
if (a < 255) blend = 1;
|
2011-02-09 22:52:53 -08:00
|
|
|
if (npoints != 4)
|
|
|
|
{
|
2011-05-30 09:45:08 -07:00
|
|
|
// FIXME: nash - you didn't fix this for n points. its still all
|
2011-05-23 23:51:47 -07:00
|
|
|
// 4 point stuff!!! grrrr.
|
2011-02-09 22:52:53 -08:00
|
|
|
abort();
|
|
|
|
}
|
2010-02-18 00:51:00 -08:00
|
|
|
if ((A_VAL(&(p[0].col)) < 0xff) || (A_VAL(&(p[1].col)) < 0xff) ||
|
|
|
|
(A_VAL(&(p[2].col)) < 0xff) || (A_VAL(&(p[3].col)) < 0xff))
|
|
|
|
blend = 1;
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-09-21 23:52:28 -07:00
|
|
|
if ((p[0].z == p[1].z) && (p[1].z == p[2].z) && (p[2].z == p[3].z))
|
|
|
|
flat = 1;
|
2010-09-30 16:20:26 -07:00
|
|
|
|
|
|
|
if (!clip) cx = cy = cw = ch = 0;
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-09-21 23:52:28 -07:00
|
|
|
if (!flat)
|
|
|
|
{
|
|
|
|
if (p[0].foc <= 0) flat = 1;
|
|
|
|
}
|
2011-08-29 13:56:48 -07:00
|
|
|
|
|
|
|
switch (cspace)
|
|
|
|
{
|
|
|
|
case EVAS_COLORSPACE_YCBCR422P601_PL:
|
|
|
|
case EVAS_COLORSPACE_YCBCR422P709_PL:
|
|
|
|
prog = gc->shared->shader[evas_gl_common_shader_choice(npoints, p, r, g, b, a,
|
|
|
|
SHADER_YUV_NOMUL, SHADER_YUV)].prog;
|
|
|
|
utexture = EINA_TRUE;
|
|
|
|
break;
|
|
|
|
case EVAS_COLORSPACE_YCBCR422601_PL:
|
|
|
|
prog = gc->shared->shader[evas_gl_common_shader_choice(npoints, p, r, g, b, a,
|
|
|
|
SHADER_YUY2_NOMUL, SHADER_YUY2)].prog;
|
|
|
|
uvtexture = EINA_TRUE;
|
|
|
|
break;
|
|
|
|
case EVAS_COLORSPACE_YCBCR420NV12601_PL:
|
|
|
|
case EVAS_COLORSPACE_YCBCR420TM12601_PL:
|
|
|
|
prog = gc->shared->shader[evas_gl_common_shader_choice(npoints, p, r, g, b, a,
|
|
|
|
SHADER_NV12_NOMUL, SHADER_NV12)].prog;
|
|
|
|
uvtexture = EINA_TRUE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
if (tex_only)
|
|
|
|
{
|
|
|
|
if (tex->pt->dyn.img)
|
|
|
|
{
|
|
|
|
prog = gc->shared->shader[evas_gl_common_shader_choice(npoints, p, r, g, b, a,
|
|
|
|
SHADER_IMG_NOMUL, SHADER_IMG)].prog;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
prog = gc->shared->shader[evas_gl_common_shader_choice(npoints, p, r, g, b, a,
|
|
|
|
SHADER_TEX_NOMUL, SHADER_TEX)].prog;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (tex->gc->shared->info.bgra)
|
|
|
|
{
|
|
|
|
prog = gc->shared->shader[evas_gl_common_shader_choice(npoints, p, r, g, b, a,
|
|
|
|
SHADER_IMG_BGRA_NOMUL,
|
|
|
|
SHADER_IMG_BGRA)].prog;
|
|
|
|
}
|
2010-02-17 23:10:28 -08:00
|
|
|
else
|
2010-09-04 19:58:30 -07:00
|
|
|
{
|
2011-08-29 13:56:48 -07:00
|
|
|
prog = gc->shared->shader[evas_gl_common_shader_choice(npoints, p, r, g, b, a,
|
|
|
|
SHADER_IMG_NOMUL,
|
|
|
|
SHADER_IMG)].prog;
|
2010-09-04 19:58:30 -07:00
|
|
|
}
|
2011-08-29 13:56:48 -07:00
|
|
|
}
|
2010-02-17 23:10:28 -08:00
|
|
|
}
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2011-05-23 23:51:47 -07:00
|
|
|
x = w = (p[points[0]].x >> FP);
|
|
|
|
y = h = (p[points[0]].y >> FP);
|
|
|
|
for (i = 0; i < 4; i++)
|
|
|
|
{
|
|
|
|
tx[i] = ((double)(tex->x) + (((double)p[i].u) / FP1)) /
|
|
|
|
(double)tex->pt->w;
|
2011-06-17 00:47:28 -07:00
|
|
|
ty[i] = ((double)(tex->y) + (((double)p[i].v) / FP1)) /
|
2011-05-23 23:51:47 -07:00
|
|
|
(double)tex->pt->h;
|
|
|
|
px = (p[points[i]].x >> FP);
|
|
|
|
if (px < x) x = px;
|
|
|
|
else if (px > w) w = px;
|
|
|
|
py = (p[points[i]].y >> FP);
|
|
|
|
if (py < y) y = py;
|
|
|
|
else if (py > h) h = py;
|
2011-08-29 13:56:48 -07:00
|
|
|
if (utexture)
|
2011-05-23 23:51:47 -07:00
|
|
|
{
|
|
|
|
t2x[i] = ((((double)p[i].u / 2) / FP1)) / (double)tex->ptu->w;
|
|
|
|
t2y[i] = ((((double)p[i].v / 2) / FP1)) / (double)tex->ptu->h;
|
|
|
|
}
|
2011-08-29 13:56:48 -07:00
|
|
|
else if (uvtexture)
|
|
|
|
{
|
|
|
|
t2x[i] = ((((double)p[i].u / 2) / FP1)) / (double)tex->ptuv->w;
|
|
|
|
t2y[i] = ((((double)p[i].v / 2) / FP1)) / (double)tex->ptuv->h;
|
|
|
|
}
|
2011-05-23 23:51:47 -07:00
|
|
|
}
|
|
|
|
w = w - x;
|
|
|
|
h = h - y;
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2011-05-23 23:51:47 -07:00
|
|
|
if (clip)
|
|
|
|
{
|
|
|
|
int nx = x, ny = y, nw = w, nh = h;
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2011-05-23 23:51:47 -07:00
|
|
|
RECTS_CLIP_TO_RECT(nx, ny, nw, nh, cx, cy, cw, ch);
|
|
|
|
if ((nx == x) && (ny == y) && (nw == w) && (nh == h))
|
|
|
|
{
|
|
|
|
clip = 0; cx = 0; cy = 0; cw = 0; ch = 0;
|
|
|
|
}
|
|
|
|
x = nx; y = nw; w = nw; h = nh;
|
|
|
|
}
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-09-21 23:52:28 -07:00
|
|
|
if (!flat)
|
|
|
|
{
|
|
|
|
shader_array_flush(gc);
|
|
|
|
gc->foc = p[0].foc >> FP;
|
|
|
|
gc->z0 = p[0].z0 >> FP;
|
|
|
|
gc->px = p[0].px >> FP;
|
|
|
|
gc->py = p[0].py >> FP;
|
|
|
|
gc->change.size = 1;
|
|
|
|
_evas_gl_common_viewport_set(gc);
|
|
|
|
}
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2011-08-25 01:28:34 -07:00
|
|
|
pn = _evas_gl_common_context_push(RTYPE_MAP,
|
|
|
|
gc, tex, NULL,
|
|
|
|
prog,
|
|
|
|
x, y, w, h,
|
|
|
|
blend,
|
|
|
|
smooth,
|
|
|
|
clip, cx, cy, cw, ch);
|
2010-08-08 21:42:15 -07:00
|
|
|
|
2010-08-08 20:27:59 -07:00
|
|
|
gc->pipe[pn].region.type = RTYPE_MAP;
|
2011-08-25 01:28:34 -07:00
|
|
|
gc->pipe[pn].shader.cur_tex = tex->pt->texture;
|
2011-08-29 13:56:48 -07:00
|
|
|
if (utexture)
|
2010-09-04 19:58:30 -07:00
|
|
|
{
|
2011-08-25 01:28:34 -07:00
|
|
|
gc->pipe[pn].shader.cur_texu = tex->ptu->texture;
|
|
|
|
gc->pipe[pn].shader.cur_texv = tex->ptv->texture;
|
2010-09-04 19:58:30 -07:00
|
|
|
}
|
2011-08-29 13:56:48 -07:00
|
|
|
else if (uvtexture)
|
2011-08-23 08:13:40 -07:00
|
|
|
{
|
2011-08-25 01:28:34 -07:00
|
|
|
gc->pipe[pn].shader.cur_texu = tex->ptuv->texture;
|
2011-08-23 08:13:40 -07:00
|
|
|
}
|
2011-08-25 01:28:34 -07:00
|
|
|
gc->pipe[pn].shader.cur_prog = prog;
|
|
|
|
gc->pipe[pn].shader.smooth = smooth;
|
|
|
|
gc->pipe[pn].shader.blend = blend;
|
|
|
|
gc->pipe[pn].shader.render_op = gc->dc->render_op;
|
|
|
|
gc->pipe[pn].shader.clip = clip;
|
|
|
|
gc->pipe[pn].shader.cx = cx;
|
|
|
|
gc->pipe[pn].shader.cy = cy;
|
|
|
|
gc->pipe[pn].shader.cw = cw;
|
|
|
|
gc->pipe[pn].shader.ch = ch;
|
|
|
|
gc->pipe[pn].array.line = 0;
|
|
|
|
gc->pipe[pn].array.use_vertex = 1;
|
|
|
|
gc->pipe[pn].array.use_color = 1;
|
|
|
|
gc->pipe[pn].array.use_texuv = 1;
|
2011-08-29 13:56:48 -07:00
|
|
|
gc->pipe[pn].array.use_texuv2 = (utexture || uvtexture) ? 1 : 0;
|
|
|
|
gc->pipe[pn].array.use_texuv3 = (utexture) ? 1 : 0;
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-08-08 21:42:15 -07:00
|
|
|
pipe_region_expand(gc, pn, x, y, w, h);
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-08-08 21:42:15 -07:00
|
|
|
pnum = gc->pipe[pn].array.num;
|
|
|
|
nv = pnum * 3; nc = pnum * 4; nu = pnum * 2; nu2 = pnum * 2;
|
2010-09-04 19:58:30 -07:00
|
|
|
nu2 = pnum * 2; nu3 = pnum * 2; nt = pnum * 4;
|
2010-08-08 21:42:15 -07:00
|
|
|
gc->pipe[pn].array.num += 6;
|
|
|
|
array_alloc(gc, pn);
|
|
|
|
|
2010-02-06 00:38:26 -08:00
|
|
|
if ((tex->im) && (tex->im->native.data) && (!tex->im->native.yinvert))
|
|
|
|
{
|
2011-05-01 19:14:00 -07:00
|
|
|
for (i = 0; i < 4; i++)
|
|
|
|
{
|
|
|
|
ty[i] = 1.0 - ty[i];
|
2011-08-29 13:56:48 -07:00
|
|
|
if (utexture || uvtexture)
|
2011-05-01 19:14:00 -07:00
|
|
|
t2y[i] = 1.0 - t2y[i];
|
|
|
|
}
|
2010-02-06 00:38:26 -08:00
|
|
|
}
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2009-11-11 03:39:25 -08:00
|
|
|
cmul = ARGB_JOIN(a, r, g, b);
|
|
|
|
for (i = 0; i < 6; i++)
|
|
|
|
{
|
|
|
|
DATA32 cl = MUL4_SYM(cmul, p[points[i]].col);
|
2010-09-21 23:52:28 -07:00
|
|
|
if (flat)
|
|
|
|
{
|
|
|
|
PUSH_VERTEX(pn,
|
2011-06-17 00:47:28 -07:00
|
|
|
(p[points[i]].x >> FP),
|
2010-09-21 23:52:28 -07:00
|
|
|
(p[points[i]].y >> FP),
|
|
|
|
0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
PUSH_VERTEX(pn,
|
2011-06-17 00:47:28 -07:00
|
|
|
(p[points[i]].fx) + gc->shared->ax,
|
2011-01-15 23:49:49 -08:00
|
|
|
(p[points[i]].fy) + gc->shared->ay,
|
2011-06-17 00:47:28 -07:00
|
|
|
(p[points[i]].fz)
|
2010-09-21 23:52:28 -07:00
|
|
|
+ (gc->shared->foc - gc->shared->z0));
|
|
|
|
}
|
2010-08-08 20:27:59 -07:00
|
|
|
PUSH_TEXUV(pn,
|
|
|
|
tx[points[i]],
|
2009-11-11 03:39:25 -08:00
|
|
|
ty[points[i]]);
|
2011-08-29 13:56:48 -07:00
|
|
|
if (utexture)
|
2010-09-04 19:58:30 -07:00
|
|
|
{
|
|
|
|
PUSH_TEXUV2(pn,
|
|
|
|
t2x[points[i]],
|
|
|
|
t2y[points[i]]);
|
|
|
|
PUSH_TEXUV3(pn,
|
|
|
|
t2x[points[i]],
|
|
|
|
t2y[points[i]]);
|
|
|
|
}
|
2011-08-29 13:56:48 -07:00
|
|
|
else if (uvtexture)
|
2011-08-23 08:13:40 -07:00
|
|
|
{
|
|
|
|
PUSH_TEXUV2(pn,
|
|
|
|
t2x[points[i]],
|
|
|
|
t2y[points[i]]);
|
|
|
|
}
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-08-08 20:27:59 -07:00
|
|
|
PUSH_COLOR(pn,
|
|
|
|
R_VAL(&cl),
|
2009-11-11 03:39:25 -08:00
|
|
|
G_VAL(&cl),
|
|
|
|
B_VAL(&cl),
|
|
|
|
A_VAL(&cl));
|
|
|
|
}
|
2010-09-21 23:52:28 -07:00
|
|
|
if (!flat)
|
|
|
|
{
|
|
|
|
shader_array_flush(gc);
|
|
|
|
gc->foc = 0;
|
|
|
|
gc->z0 = 0;
|
|
|
|
gc->px = 0;
|
|
|
|
gc->py = 0;
|
|
|
|
gc->change.size = 1;
|
|
|
|
_evas_gl_common_viewport_set(gc);
|
|
|
|
}
|
2009-11-11 03:39:25 -08:00
|
|
|
}
|
|
|
|
|
2003-09-07 04:24:48 -07:00
|
|
|
void
|
2011-03-16 10:32:49 -07:00
|
|
|
evas_gl_common_context_flush(Evas_Engine_GL_Context *gc)
|
2003-09-07 04:24:48 -07:00
|
|
|
{
|
2009-10-09 05:10:27 -07:00
|
|
|
shader_array_flush(gc);
|
2003-09-07 04:24:48 -07:00
|
|
|
}
|
|
|
|
|
2011-04-06 00:32:33 -07:00
|
|
|
static void
|
|
|
|
scissor_rot(Evas_Engine_GL_Context *gc __UNUSED__,
|
|
|
|
int rot, int gw, int gh, int cx, int cy, int cw, int ch)
|
|
|
|
{
|
|
|
|
switch (rot)
|
|
|
|
{
|
|
|
|
case 0: // UP this way: ^
|
|
|
|
glScissor(cx, cy, cw, ch);
|
|
|
|
break;
|
|
|
|
case 90: // UP this way: <
|
|
|
|
glScissor(gh - (cy + ch), cx, ch, cw);
|
|
|
|
break;
|
|
|
|
case 180: // UP this way: v
|
|
|
|
glScissor(gw - (cx + cw), gh - (cy + ch), cw, ch);
|
|
|
|
break;
|
|
|
|
case 270: // UP this way: >
|
|
|
|
glScissor(cy, gw - (cx + cw), ch, cw);
|
|
|
|
break;
|
|
|
|
default: // assume up is up
|
|
|
|
glScissor(cx, cy, cw, ch);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-09-07 04:24:48 -07:00
|
|
|
static void
|
2011-03-16 10:32:49 -07:00
|
|
|
shader_array_flush(Evas_Engine_GL_Context *gc)
|
2003-09-07 04:24:48 -07:00
|
|
|
{
|
2010-09-30 21:46:04 -07:00
|
|
|
int i, gw, gh, setclip, cy, fbo = 0, done = 0;
|
2011-01-07 02:22:22 -08:00
|
|
|
|
|
|
|
if (!gc->havestuff) return;
|
2010-09-30 16:20:26 -07:00
|
|
|
gw = gc->w;
|
|
|
|
gh = gc->h;
|
|
|
|
if (!((gc->pipe[0].shader.surface == gc->def_surface) ||
|
|
|
|
(!gc->pipe[0].shader.surface)))
|
|
|
|
{
|
|
|
|
gw = gc->pipe[0].shader.surface->w;
|
|
|
|
gh = gc->pipe[0].shader.surface->h;
|
2010-09-30 21:46:04 -07:00
|
|
|
fbo = 1;
|
2010-09-30 16:20:26 -07:00
|
|
|
}
|
2010-08-25 18:41:48 -07:00
|
|
|
for (i = 0; i < gc->shared->info.tune.pipes.max; i++)
|
2003-09-07 04:24:48 -07:00
|
|
|
{
|
2010-08-08 20:27:59 -07:00
|
|
|
if (gc->pipe[i].array.num <= 0) break;
|
2010-09-30 21:46:04 -07:00
|
|
|
setclip = 0;
|
2010-09-30 16:20:26 -07:00
|
|
|
done++;
|
2010-08-08 20:27:59 -07:00
|
|
|
gc->flushnum++;
|
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "<flush err>");
|
|
|
|
if (gc->pipe[i].shader.cur_prog != gc->state.current.cur_prog)
|
2010-04-27 22:14:02 -07:00
|
|
|
{
|
2010-08-08 20:27:59 -07:00
|
|
|
glUseProgram(gc->pipe[i].shader.cur_prog);
|
2010-04-27 22:14:02 -07:00
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
|
|
|
}
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-08-08 20:27:59 -07:00
|
|
|
if (gc->pipe[i].shader.cur_tex != gc->state.current.cur_tex)
|
2010-04-27 22:14:02 -07:00
|
|
|
{
|
2010-08-08 20:27:59 -07:00
|
|
|
#if 0
|
|
|
|
if (gc->pipe[i].shader.cur_tex)
|
|
|
|
{
|
|
|
|
glEnable(GL_TEXTURE_2D);
|
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
glDisable(GL_TEXTURE_2D);
|
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
|
|
|
}
|
2010-04-27 22:14:02 -07:00
|
|
|
#endif
|
2010-08-08 20:27:59 -07:00
|
|
|
glActiveTexture(GL_TEXTURE0);
|
2010-02-16 20:21:59 -08:00
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
2010-08-08 20:27:59 -07:00
|
|
|
glBindTexture(GL_TEXTURE_2D, gc->pipe[i].shader.cur_tex);
|
2010-02-16 20:21:59 -08:00
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
2009-11-12 23:22:31 -08:00
|
|
|
}
|
2010-08-08 20:27:59 -07:00
|
|
|
if (gc->pipe[i].array.im)
|
2010-02-16 20:21:59 -08:00
|
|
|
{
|
2010-08-13 03:34:51 -07:00
|
|
|
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
|
|
|
|
if (gc->pipe[i].array.im->tex->pt->dyn.img)
|
2010-08-08 20:27:59 -07:00
|
|
|
{
|
2010-08-13 03:34:51 -07:00
|
|
|
secsym_glEGLImageTargetTexture2DOES
|
|
|
|
(GL_TEXTURE_2D, gc->pipe[i].array.im->tex->pt->dyn.img);
|
|
|
|
}
|
|
|
|
else
|
2011-06-17 00:47:28 -07:00
|
|
|
#endif
|
2010-08-13 03:34:51 -07:00
|
|
|
{
|
|
|
|
if (!gc->pipe[i].array.im->native.loose)
|
|
|
|
{
|
|
|
|
if (gc->pipe[i].array.im->native.func.bind)
|
2011-06-17 00:47:28 -07:00
|
|
|
gc->pipe[i].array.im->native.func.bind(gc->pipe[i].array.im->native.func.data,
|
2010-08-13 03:34:51 -07:00
|
|
|
gc->pipe[i].array.im);
|
|
|
|
}
|
2010-08-08 20:27:59 -07:00
|
|
|
}
|
2010-02-16 20:21:59 -08:00
|
|
|
}
|
2010-08-08 20:27:59 -07:00
|
|
|
if (gc->pipe[i].shader.render_op != gc->state.current.render_op)
|
2010-02-16 20:21:59 -08:00
|
|
|
{
|
2010-08-08 20:27:59 -07:00
|
|
|
switch (gc->pipe[i].shader.render_op)
|
|
|
|
{
|
|
|
|
case EVAS_RENDER_BLEND: /**< default op: d = d*(1-sa) + s */
|
|
|
|
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
|
|
|
break;
|
|
|
|
case EVAS_RENDER_COPY: /**< d = s */
|
|
|
|
gc->pipe[i].shader.blend = 0;
|
|
|
|
glBlendFunc(GL_ONE, GL_ONE);
|
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
|
|
|
break;
|
|
|
|
// FIXME: fix blend funcs below!
|
|
|
|
case EVAS_RENDER_BLEND_REL: /**< d = d*(1 - sa) + s*da */
|
|
|
|
case EVAS_RENDER_COPY_REL: /**< d = s*da */
|
|
|
|
case EVAS_RENDER_ADD: /**< d = d + s */
|
|
|
|
case EVAS_RENDER_ADD_REL: /**< d = d + s*da */
|
|
|
|
case EVAS_RENDER_SUB: /**< d = d - s */
|
|
|
|
case EVAS_RENDER_SUB_REL: /**< d = d - s*da */
|
|
|
|
case EVAS_RENDER_TINT: /**< d = d*s + d*(1 - sa) + s*(1 - da) */
|
|
|
|
case EVAS_RENDER_TINT_REL: /**< d = d*(1 - sa + s) */
|
|
|
|
case EVAS_RENDER_MASK: /**< d = d*sa */
|
|
|
|
case EVAS_RENDER_MUL: /**< d = d*s */
|
|
|
|
default:
|
2010-09-04 19:58:30 -07:00
|
|
|
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
2010-08-08 20:27:59 -07:00
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
|
|
|
break;
|
|
|
|
}
|
2010-02-16 20:21:59 -08:00
|
|
|
}
|
2010-08-08 20:27:59 -07:00
|
|
|
if (gc->pipe[i].shader.blend != gc->state.current.blend)
|
2009-10-10 06:24:15 -07:00
|
|
|
{
|
2010-08-08 20:27:59 -07:00
|
|
|
if (gc->pipe[i].shader.blend)
|
2010-02-16 23:26:44 -08:00
|
|
|
{
|
2010-08-08 20:27:59 -07:00
|
|
|
glEnable(GL_BLEND);
|
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
glDisable(GL_BLEND);
|
2010-02-16 23:26:44 -08:00
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
|
|
|
}
|
2009-10-10 06:24:15 -07:00
|
|
|
}
|
2010-08-25 18:41:48 -07:00
|
|
|
if ((gc->pipe[i].shader.smooth != gc->state.current.smooth) ||
|
|
|
|
(gc->pipe[i].shader.cur_tex != gc->state.current.cur_tex))
|
2009-10-10 06:24:15 -07:00
|
|
|
{
|
2010-08-08 20:27:59 -07:00
|
|
|
if (gc->pipe[i].shader.smooth)
|
2010-02-16 23:26:44 -08:00
|
|
|
{
|
2010-08-08 20:27:59 -07:00
|
|
|
#ifdef GL_TEXTURE_MAX_ANISOTROPY_EXT
|
|
|
|
if (shared->info.anisotropic > 0.0)
|
|
|
|
{
|
|
|
|
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, shared->info.anisotropic);
|
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
2010-02-16 23:26:44 -08:00
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
|
|
|
}
|
2010-08-08 20:27:59 -07:00
|
|
|
else
|
|
|
|
{
|
|
|
|
#ifdef GL_TEXTURE_MAX_ANISOTROPY_EXT
|
|
|
|
if (shared->info.anisotropic > 0.0)
|
|
|
|
{
|
|
|
|
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1.0);
|
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
|
|
|
}
|
2009-10-09 05:10:27 -07:00
|
|
|
#endif
|
2010-08-08 20:27:59 -07:00
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
|
|
|
}
|
|
|
|
}
|
2010-09-18 07:23:20 -07:00
|
|
|
if (gc->pipe[i].shader.clip != gc->state.current.clip)
|
|
|
|
{
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-09-18 07:23:20 -07:00
|
|
|
if (gc->pipe[i].shader.clip)
|
|
|
|
{
|
2010-09-30 21:46:04 -07:00
|
|
|
cy = gh - gc->pipe[i].shader.cy - gc->pipe[i].shader.ch;
|
|
|
|
if (fbo) cy = gc->pipe[i].shader.cy;
|
2010-09-18 07:23:20 -07:00
|
|
|
glEnable(GL_SCISSOR_TEST);
|
2011-04-06 00:32:33 -07:00
|
|
|
if (!fbo)
|
2011-06-17 00:47:28 -07:00
|
|
|
scissor_rot(gc, gc->rot, gw, gh,
|
2011-04-06 00:32:33 -07:00
|
|
|
gc->pipe[i].shader.cx,
|
|
|
|
cy,
|
|
|
|
gc->pipe[i].shader.cw,
|
|
|
|
gc->pipe[i].shader.ch);
|
|
|
|
else
|
|
|
|
glScissor(gc->pipe[i].shader.cx, cy,
|
|
|
|
gc->pipe[i].shader.cw, gc->pipe[i].shader.ch);
|
2010-09-30 16:20:26 -07:00
|
|
|
setclip = 1;
|
2010-09-18 07:23:20 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
glDisable(GL_SCISSOR_TEST);
|
2010-09-30 16:20:26 -07:00
|
|
|
glScissor(0, 0, 0, 0);
|
2010-09-18 07:23:20 -07:00
|
|
|
}
|
|
|
|
}
|
2010-09-30 16:20:26 -07:00
|
|
|
if ((gc->pipe[i].shader.clip) && (!setclip))
|
2010-09-18 07:23:20 -07:00
|
|
|
{
|
|
|
|
if ((gc->pipe[i].shader.cx != gc->state.current.cx) ||
|
2010-09-30 21:46:04 -07:00
|
|
|
(gc->pipe[i].shader.cy != gc->state.current.cy) ||
|
|
|
|
(gc->pipe[i].shader.cw != gc->state.current.cw) ||
|
|
|
|
(gc->pipe[i].shader.ch != gc->state.current.ch))
|
2010-09-18 07:23:20 -07:00
|
|
|
{
|
2010-09-30 21:46:04 -07:00
|
|
|
cy = gh - gc->pipe[i].shader.cy - gc->pipe[i].shader.ch;
|
|
|
|
if (fbo) cy = gc->pipe[i].shader.cy;
|
2011-04-06 00:32:33 -07:00
|
|
|
if (!fbo)
|
2011-06-17 00:47:28 -07:00
|
|
|
scissor_rot(gc, gc->rot, gw, gh,
|
2011-04-06 00:32:33 -07:00
|
|
|
gc->pipe[i].shader.cx,
|
|
|
|
cy,
|
|
|
|
gc->pipe[i].shader.cw,
|
|
|
|
gc->pipe[i].shader.ch);
|
|
|
|
else
|
|
|
|
glScissor(gc->pipe[i].shader.cx, cy,
|
|
|
|
gc->pipe[i].shader.cw, gc->pipe[i].shader.ch);
|
2010-09-18 07:23:20 -07:00
|
|
|
}
|
|
|
|
}
|
2010-09-30 21:46:04 -07:00
|
|
|
|
2010-08-08 20:27:59 -07:00
|
|
|
glVertexAttribPointer(SHAD_VERTEX, 3, GL_SHORT, GL_FALSE, 0, gc->pipe[i].array.vertex);
|
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
|
|
|
glVertexAttribPointer(SHAD_COLOR, 4, GL_UNSIGNED_BYTE, GL_TRUE, 0, gc->pipe[i].array.color);
|
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
|
|
|
if (gc->pipe[i].array.use_texuv)
|
|
|
|
{
|
|
|
|
glEnableVertexAttribArray(SHAD_TEXUV);
|
2010-02-16 20:21:59 -08:00
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
2010-08-08 20:27:59 -07:00
|
|
|
glVertexAttribPointer(SHAD_TEXUV, 2, GL_FLOAT, GL_FALSE, 0, gc->pipe[i].array.texuv);
|
2010-02-16 20:21:59 -08:00
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
2009-10-10 06:24:15 -07:00
|
|
|
}
|
2009-12-13 06:28:07 -08:00
|
|
|
else
|
2009-12-30 03:35:40 -08:00
|
|
|
{
|
2010-08-08 20:27:59 -07:00
|
|
|
glDisableVertexAttribArray(SHAD_TEXUV);
|
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
2009-12-30 03:35:40 -08:00
|
|
|
}
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-08-08 20:27:59 -07:00
|
|
|
if (gc->pipe[i].array.line)
|
2009-12-30 03:35:40 -08:00
|
|
|
{
|
2010-08-08 20:27:59 -07:00
|
|
|
glDisableVertexAttribArray(SHAD_TEXUV);
|
2010-02-16 20:21:59 -08:00
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
2011-04-05 22:38:38 -07:00
|
|
|
glDisableVertexAttribArray(SHAD_TEXUV2);
|
2010-02-16 20:21:59 -08:00
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
2010-08-08 20:27:59 -07:00
|
|
|
glDisableVertexAttribArray(SHAD_TEXUV3);
|
2010-02-16 20:21:59 -08:00
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
2010-08-08 20:27:59 -07:00
|
|
|
glDrawArrays(GL_LINES, 0, gc->pipe[i].array.num);
|
2010-02-16 20:21:59 -08:00
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
2010-01-19 19:59:32 -08:00
|
|
|
}
|
2009-12-30 03:35:40 -08:00
|
|
|
else
|
|
|
|
{
|
2011-04-05 22:38:38 -07:00
|
|
|
if (gc->pipe[i].array.use_texm)
|
|
|
|
{
|
|
|
|
glEnableVertexAttribArray(SHAD_TEXM);
|
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
|
|
|
glVertexAttribPointer(SHAD_TEXM, 2, GL_FLOAT, GL_FALSE, 0, gc->pipe[i].array.texm);
|
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
|
|
|
glActiveTexture(GL_TEXTURE1);
|
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
|
|
|
glBindTexture(GL_TEXTURE_2D, gc->pipe[i].shader.cur_texm);
|
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
|
|
|
glActiveTexture(GL_TEXTURE0);
|
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
glDisableVertexAttribArray(SHAD_TEXM);
|
|
|
|
}
|
2010-08-08 20:27:59 -07:00
|
|
|
if ((gc->pipe[i].array.use_texuv2) && (gc->pipe[i].array.use_texuv3))
|
|
|
|
{
|
|
|
|
glEnableVertexAttribArray(SHAD_TEXUV2);
|
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
|
|
|
glEnableVertexAttribArray(SHAD_TEXUV3);
|
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
|
|
|
glVertexAttribPointer(SHAD_TEXUV2, 2, GL_FLOAT, GL_FALSE, 0, gc->pipe[i].array.texuv2);
|
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
|
|
|
glVertexAttribPointer(SHAD_TEXUV3, 2, GL_FLOAT, GL_FALSE, 0, gc->pipe[i].array.texuv3);
|
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
|
|
|
glActiveTexture(GL_TEXTURE1);
|
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
|
|
|
glBindTexture(GL_TEXTURE_2D, gc->pipe[i].shader.cur_texu);
|
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
|
|
|
glActiveTexture(GL_TEXTURE2);
|
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
|
|
|
glBindTexture(GL_TEXTURE_2D, gc->pipe[i].shader.cur_texv);
|
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
|
|
|
glActiveTexture(GL_TEXTURE0);
|
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
|
|
|
}
|
|
|
|
else if (gc->pipe[i].array.use_texuv2)
|
|
|
|
{
|
|
|
|
glEnableVertexAttribArray(SHAD_TEXUV2);
|
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
|
|
|
glVertexAttribPointer(SHAD_TEXUV2, 2, GL_FLOAT, GL_FALSE, 0, gc->pipe[i].array.texuv2);
|
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
2011-04-05 22:38:38 -07:00
|
|
|
glActiveTexture(GL_TEXTURE1);
|
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
|
|
|
glBindTexture(GL_TEXTURE_2D, gc->pipe[i].shader.cur_texu);
|
|
|
|
glActiveTexture(GL_TEXTURE0);
|
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
2010-08-08 20:27:59 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
glDisableVertexAttribArray(SHAD_TEXUV2);
|
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
|
|
|
glDisableVertexAttribArray(SHAD_TEXUV3);
|
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
|
|
|
}
|
2010-09-30 16:20:26 -07:00
|
|
|
if (dbgflushnum)
|
|
|
|
{
|
2011-06-17 00:47:28 -07:00
|
|
|
const char *types[6] =
|
2010-09-30 16:20:26 -07:00
|
|
|
{"----", "RECT", "IMAG", "FONT", "YUV-", "MAP"};
|
2010-09-30 21:46:04 -07:00
|
|
|
printf(" DRAW#%3i %4i -> %p[%4ix%4i] @ %4ix%4i -{ tex %4i type %s }-\n",
|
|
|
|
i,
|
2011-06-17 00:47:28 -07:00
|
|
|
gc->pipe[i].array.num / 6,
|
2010-09-30 16:20:26 -07:00
|
|
|
gc->pipe[0].shader.surface,
|
|
|
|
gc->pipe[0].shader.surface->w,
|
|
|
|
gc->pipe[0].shader.surface->h,
|
|
|
|
gw, gh,
|
|
|
|
gc->pipe[i].shader.cur_tex,
|
|
|
|
types[gc->pipe[i].region.type]
|
|
|
|
);
|
|
|
|
}
|
2010-08-08 20:27:59 -07:00
|
|
|
glDrawArrays(GL_TRIANGLES, 0, gc->pipe[i].array.num);
|
2010-02-16 20:21:59 -08:00
|
|
|
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
|
2009-12-30 03:35:40 -08:00
|
|
|
}
|
2010-08-08 20:27:59 -07:00
|
|
|
if (gc->pipe[i].array.im)
|
2010-01-30 18:50:01 -08:00
|
|
|
{
|
2010-08-08 20:27:59 -07:00
|
|
|
if (!gc->pipe[i].array.im->native.loose)
|
|
|
|
{
|
|
|
|
if (gc->pipe[i].array.im->native.func.unbind)
|
2011-06-17 00:47:28 -07:00
|
|
|
gc->pipe[i].array.im->native.func.unbind(gc->pipe[i].array.im->native.func.data,
|
2010-08-08 20:27:59 -07:00
|
|
|
gc->pipe[i].array.im);
|
|
|
|
}
|
|
|
|
gc->pipe[i].array.im = NULL;
|
2010-01-30 18:50:01 -08:00
|
|
|
}
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-09-30 21:46:04 -07:00
|
|
|
gc->state.current.cur_prog = gc->pipe[i].shader.cur_prog;
|
|
|
|
gc->state.current.cur_tex = gc->pipe[i].shader.cur_tex;
|
|
|
|
gc->state.current.blend = gc->pipe[i].shader.blend;
|
|
|
|
gc->state.current.smooth = gc->pipe[i].shader.smooth;
|
2010-08-08 20:27:59 -07:00
|
|
|
gc->state.current.render_op = gc->pipe[i].shader.render_op;
|
2010-09-30 21:46:04 -07:00
|
|
|
gc->state.current.clip = gc->pipe[i].shader.clip;
|
|
|
|
gc->state.current.cx = gc->pipe[i].shader.cx;
|
|
|
|
gc->state.current.cy = gc->pipe[i].shader.cy;
|
|
|
|
gc->state.current.cw = gc->pipe[i].shader.cw;
|
|
|
|
gc->state.current.ch = gc->pipe[i].shader.ch;
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-08-08 20:27:59 -07:00
|
|
|
if (gc->pipe[i].array.vertex) free(gc->pipe[i].array.vertex);
|
|
|
|
if (gc->pipe[i].array.color) free(gc->pipe[i].array.color);
|
|
|
|
if (gc->pipe[i].array.texuv) free(gc->pipe[i].array.texuv);
|
2011-04-05 22:38:38 -07:00
|
|
|
if (gc->pipe[i].array.texm) free(gc->pipe[i].array.texm);
|
2010-08-08 20:27:59 -07:00
|
|
|
if (gc->pipe[i].array.texuv2) free(gc->pipe[i].array.texuv2);
|
|
|
|
if (gc->pipe[i].array.texuv3) free(gc->pipe[i].array.texuv3);
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-08-08 20:27:59 -07:00
|
|
|
gc->pipe[i].array.vertex = NULL;
|
|
|
|
gc->pipe[i].array.color = NULL;
|
|
|
|
gc->pipe[i].array.texuv = NULL;
|
2011-04-05 22:38:38 -07:00
|
|
|
gc->pipe[i].array.texm = NULL;
|
2010-08-08 20:27:59 -07:00
|
|
|
gc->pipe[i].array.texuv2 = NULL;
|
|
|
|
gc->pipe[i].array.texuv3 = NULL;
|
|
|
|
|
|
|
|
gc->pipe[i].array.num = 0;
|
|
|
|
gc->pipe[i].array.alloc = 0;
|
2011-06-17 00:47:28 -07:00
|
|
|
|
2010-08-08 20:27:59 -07:00
|
|
|
gc->pipe[i].region.x = 0;
|
|
|
|
gc->pipe[i].region.y = 0;
|
|
|
|
gc->pipe[i].region.w = 0;
|
|
|
|
gc->pipe[i].region.h = 0;
|
|
|
|
gc->pipe[i].region.type = 0;
|
2010-01-21 00:44:11 -08:00
|
|
|
}
|
2010-09-30 16:20:26 -07:00
|
|
|
gc->state.top_pipe = 0;
|
|
|
|
if (dbgflushnum)
|
|
|
|
{
|
|
|
|
if (done > 0) printf("DONE (pipes): %i\n", done);
|
|
|
|
}
|
2011-01-07 02:22:22 -08:00
|
|
|
gc->havestuff = EINA_FALSE;
|
2003-09-07 04:24:48 -07:00
|
|
|
}
|
2010-10-07 16:46:42 -07:00
|
|
|
|
|
|
|
Eina_Bool
|
|
|
|
evas_gl_common_module_open(void)
|
|
|
|
{
|
|
|
|
if (_evas_engine_GL_common_log_dom < 0)
|
|
|
|
_evas_engine_GL_common_log_dom = eina_log_domain_register
|
|
|
|
("evas-gl_common", EVAS_DEFAULT_LOG_COLOR);
|
|
|
|
if (_evas_engine_GL_common_log_dom < 0)
|
|
|
|
{
|
|
|
|
EINA_LOG_ERR("Can not create a module log domain.");
|
|
|
|
return EINA_FALSE;
|
|
|
|
}
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
evas_gl_common_module_close(void)
|
|
|
|
{
|
|
|
|
if (_evas_engine_GL_common_log_dom < 0) return;
|
|
|
|
eina_log_domain_unregister(_evas_engine_GL_common_log_dom);
|
|
|
|
_evas_engine_GL_common_log_dom = -1;
|
|
|
|
}
|