Fix opengl-es 2.0 engine support to only use GL_UNPACK_ROW_LENGTH

if the correct gles extension exists.
This commit is contained in:
Carsten Haitzler 2013-03-15 13:05:39 +09:00
parent 5a00aa5b25
commit 3728c60311
5 changed files with 149 additions and 122 deletions

View File

@ -1,3 +1,8 @@
2013-03-15 Carsten Haitzler (The Rasterman)
* Fix opengl-es 2.0 engine support to only use GL_UNPACK_ROW_LENGTH
if the correct gles extension exists.
2013-03-14 Mike Blumenkrantz 2013-03-14 Mike Blumenkrantz
* fix use of ecore_con_*_flush functions with unconnected objects * fix use of ecore_con_*_flush functions with unconnected objects

1
NEWS
View File

@ -201,3 +201,4 @@ Fixes:
* fix bug not check data value when get deiconify message * fix bug not check data value when get deiconify message
* fix use of ecore_con_*_flush functions with unconnected objects * fix use of ecore_con_*_flush functions with unconnected objects
* fix setting of write flags on ecore-con servers during connect * fix setting of write flags on ecore-con servers during connect
* fix gles support to only use GL_UNPACK_ROW_LENGTH if extension exists

View File

@ -42,6 +42,9 @@
#ifndef GL_BGRA #ifndef GL_BGRA
# define GL_BGRA 0x80E1 # define GL_BGRA 0x80E1
#endif #endif
#ifndef GL_UNPACK_ROW_LENGTH_EXT
# define GL_UNPACK_ROW_LENGTH_EXT 0x0cf2
#endif
#ifndef EGL_NO_CONTEXT #ifndef EGL_NO_CONTEXT
# define EGL_NO_CONTEXT 0 # define EGL_NO_CONTEXT 0
@ -222,6 +225,7 @@ struct _Evas_GL_Shared
Eina_Bool tex_rect : 1; Eina_Bool tex_rect : 1;
Eina_Bool sec_image_map : 1; Eina_Bool sec_image_map : 1;
Eina_Bool bin_program : 1; Eina_Bool bin_program : 1;
Eina_Bool unpack_row_length : 1;
// tuning params - per gpu/cpu combo? // tuning params - per gpu/cpu combo?
#define MAX_CUTOUT 512 #define MAX_CUTOUT 512
#define DEF_CUTOUT 512 #define DEF_CUTOUT 512

View File

@ -578,6 +578,14 @@ evas_gl_common_context_new(void)
shared->info.bin_program = 1; shared->info.bin_program = 1;
else else
glsym_glGetProgramBinary = NULL; glsym_glGetProgramBinary = NULL;
#ifdef GL_UNPACK_ROW_LENGTH
shared->info.unpack_row_length = 1;
# ifdef GL_GLES
if (!strstr((char *)ext, "_unpack_subimage"))
shared->info.unpack_row_length = 0;
# endif
#endif
#ifdef GL_TEXTURE_MAX_ANISOTROPY_EXT #ifdef GL_TEXTURE_MAX_ANISOTROPY_EXT
if ((strstr((char *)ext, "GL_EXT_texture_filter_anisotropic"))) if ((strstr((char *)ext, "GL_EXT_texture_filter_anisotropic")))
glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT,

View File

@ -860,10 +860,11 @@ evas_gl_common_texture_update(Evas_GL_Texture *tex, RGBA_Image *im)
fmt = tex->pt->format; fmt = tex->pt->format;
glBindTexture(GL_TEXTURE_2D, tex->pt->texture); glBindTexture(GL_TEXTURE_2D, tex->pt->texture);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
#ifdef GL_UNPACK_ROW_LENGTH if (tex->gc->shared->info.unpack_row_length)
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); {
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
#endif GLERR(__FUNCTION__, __FILE__, __LINE__, "");
}
glPixelStorei(GL_UNPACK_ALIGNMENT, 4); glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
@ -896,24 +897,26 @@ evas_gl_common_texture_update(Evas_GL_Texture *tex, RGBA_Image *im)
1, 1, 1, 1,
fmt, tex->pt->dataformat, fmt, tex->pt->dataformat,
im->image.data + ((im->cache_entry.h - 1) * im->cache_entry.w) + (im->cache_entry.w - 1)); im->image.data + ((im->cache_entry.h - 1) * im->cache_entry.w) + (im->cache_entry.w - 1));
#ifdef GL_UNPACK_ROW_LENGTH if (tex->gc->shared->info.unpack_row_length)
glPixelStorei(GL_UNPACK_ROW_LENGTH, im->cache_entry.w); {
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glPixelStorei(GL_UNPACK_ROW_LENGTH, im->cache_entry.w);
// |xxx GLERR(__FUNCTION__, __FILE__, __LINE__, "");
// |xxx // |xxx
// // |xxx
_tex_sub_2d(tex->x - 1, tex->y, //
1, im->cache_entry.h, _tex_sub_2d(tex->x - 1, tex->y,
fmt, tex->pt->dataformat, 1, im->cache_entry.h,
im->image.data); fmt, tex->pt->dataformat,
// xxx| im->image.data);
// xxx| // xxx|
// // xxx|
_tex_sub_2d(tex->x + im->cache_entry.w, tex->y, //
1, im->cache_entry.h, _tex_sub_2d(tex->x + im->cache_entry.w, tex->y,
fmt, tex->pt->dataformat, 1, im->cache_entry.h,
im->image.data + (im->cache_entry.w - 1)); fmt, tex->pt->dataformat,
#else im->image.data + (im->cache_entry.w - 1));
}
else
{ {
DATA32 *tpix, *ps, *pd; DATA32 *tpix, *ps, *pd;
int i; int i;
@ -950,7 +953,6 @@ evas_gl_common_texture_update(Evas_GL_Texture *tex, RGBA_Image *im)
fmt, tex->pt->dataformat, fmt, tex->pt->dataformat,
tpix); tpix);
} }
#endif
if (tex->pt->texture != tex->gc->pipe[0].shader.cur_tex) if (tex->pt->texture != tex->gc->pipe[0].shader.cur_tex)
{ {
glBindTexture(GL_TEXTURE_2D, tex->gc->pipe[0].shader.cur_tex); glBindTexture(GL_TEXTURE_2D, tex->gc->pipe[0].shader.cur_tex);
@ -1045,10 +1047,11 @@ evas_gl_common_texture_alpha_update(Evas_GL_Texture *tex, DATA8 *pixels,
if (!tex->pt) return; if (!tex->pt) return;
glBindTexture(GL_TEXTURE_2D, tex->pt->texture); glBindTexture(GL_TEXTURE_2D, tex->pt->texture);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
#ifdef GL_UNPACK_ROW_LENGTH if (tex->gc->shared->info.unpack_row_length)
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); {
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
#endif GLERR(__FUNCTION__, __FILE__, __LINE__, "");
}
glPixelStorei(GL_UNPACK_ALIGNMENT, 4); glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
_tex_sub_2d(tex->x, tex->y, w, h, tex->pt->format, tex->pt->dataformat, _tex_sub_2d(tex->x, tex->y, w, h, tex->pt->format, tex->pt->dataformat,
@ -1121,65 +1124,68 @@ evas_gl_common_texture_yuv_update(Evas_GL_Texture *tex, DATA8 **rows, unsigned i
{ {
if (!tex->pt) return; if (!tex->pt) return;
// FIXME: works on lowest size 4 pixel high buffers. must also be multiple of 2 // FIXME: works on lowest size 4 pixel high buffers. must also be multiple of 2
#ifdef GL_UNPACK_ROW_LENGTH if (tex->gc->shared->info.unpack_row_length)
glPixelStorei(GL_UNPACK_ROW_LENGTH, rows[1] - rows[0]); {
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glPixelStorei(GL_UNPACK_ROW_LENGTH, rows[1] - rows[0]);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glBindTexture(GL_TEXTURE_2D, tex->pt->texture); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glBindTexture(GL_TEXTURE_2D, tex->pt->texture);
_tex_2d(tex->pt->intformat, w, h, tex->pt->format, tex->pt->dataformat); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
_tex_sub_2d(0, 0, w, h, tex->pt->format, tex->pt->dataformat, rows[0]); _tex_2d(tex->pt->intformat, w, h, tex->pt->format, tex->pt->dataformat);
glBindTexture(GL_TEXTURE_2D, tex->ptu->texture); _tex_sub_2d(0, 0, w, h, tex->pt->format, tex->pt->dataformat, rows[0]);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glBindTexture(GL_TEXTURE_2D, tex->ptu->texture);
glPixelStorei(GL_UNPACK_ROW_LENGTH, rows[h + 1] - rows[h]); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glPixelStorei(GL_UNPACK_ROW_LENGTH, rows[h + 1] - rows[h]);
_tex_2d(tex->ptu->intformat, w / 2, h / 2, tex->ptu->format, tex->ptu->dataformat); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
_tex_sub_2d(0, 0, w / 2, h / 2, tex->ptu->format, tex->ptu->dataformat, rows[h]); _tex_2d(tex->ptu->intformat, w / 2, h / 2, tex->ptu->format, tex->ptu->dataformat);
glBindTexture(GL_TEXTURE_2D, tex->ptv->texture); _tex_sub_2d(0, 0, w / 2, h / 2, tex->ptu->format, tex->ptu->dataformat, rows[h]);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glBindTexture(GL_TEXTURE_2D, tex->ptv->texture);
glPixelStorei(GL_UNPACK_ROW_LENGTH, rows[h + (h / 2) + 1] - rows[h + (h / 2)]); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glPixelStorei(GL_UNPACK_ROW_LENGTH, rows[h + (h / 2) + 1] - rows[h + (h / 2)]);
_tex_2d(tex->ptv->intformat, w / 2, h / 2, tex->ptv->format, tex->ptv->dataformat); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
_tex_sub_2d(0, 0, w / 2, h / 2, tex->ptv->format, tex->ptv->dataformat, rows[h + (h / 2)]); _tex_2d(tex->ptv->intformat, w / 2, h / 2, tex->ptv->format, tex->ptv->dataformat);
#else _tex_sub_2d(0, 0, w / 2, h / 2, tex->ptv->format, tex->ptv->dataformat, rows[h + (h / 2)]);
unsigned int y; }
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glBindTexture(GL_TEXTURE_2D, tex->pt->texture);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
_tex_2d(tex->pt->intformat, w, h, tex->pt->format, tex->pt->dataformat);
if ((rows[1] - rows[0]) == (int)w)
_tex_sub_2d(0, 0, w, h, tex->pt->format, tex->pt->dataformat, rows[0]);
else else
{ {
for (y = 0; y < h; y++) unsigned int y;
_tex_sub_2d(0, y, w, 1, tex->pt->format, tex->pt->dataformat, rows[y]);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glBindTexture(GL_TEXTURE_2D, tex->pt->texture);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
_tex_2d(tex->pt->intformat, w, h, tex->pt->format, tex->pt->dataformat);
if ((rows[1] - rows[0]) == (int)w)
_tex_sub_2d(0, 0, w, h, tex->pt->format, tex->pt->dataformat, rows[0]);
else
{
for (y = 0; y < h; y++)
_tex_sub_2d(0, y, w, 1, tex->pt->format, tex->pt->dataformat, rows[y]);
}
glBindTexture(GL_TEXTURE_2D, tex->ptu->texture);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
_tex_2d(tex->ptu->intformat, w / 2, h / 2, tex->ptu->format, tex->ptu->dataformat);
if ((rows[h + 1] - rows[h]) == (int)(w / 2))
_tex_sub_2d(0, 0, w / 2, h / 2, tex->ptu->format, tex->ptu->dataformat, rows[h]);
else
{
for (y = 0; y < (h / 2); y++)
_tex_sub_2d(0, y, w / 2, 1, tex->ptu->format, tex->ptu->dataformat, rows[h + y]);
}
glBindTexture(GL_TEXTURE_2D, tex->ptv->texture);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
_tex_2d(tex->ptv->intformat, w / 2, h / 2, tex->ptv->format, tex->ptv->dataformat);
if ((rows[h + (h / 2) + 1] - rows[h + (h / 2)]) == (int)(w / 2))
_tex_sub_2d(0, 0, w / 2, h / 2, tex->ptv->format, tex->ptv->dataformat, rows[h + (h / 2)]);
else
{
for (y = 0; y < (h / 2); y++)
_tex_sub_2d(0, y, w / 2, 1, tex->ptv->format, tex->ptv->dataformat, rows[h + (h / 2) + y]);
}
} }
glBindTexture(GL_TEXTURE_2D, tex->ptu->texture);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
_tex_2d(tex->ptu->intformat, w / 2, h / 2, tex->ptu->format, tex->ptu->dataformat);
if ((rows[h + 1] - rows[h]) == (int)(w / 2))
_tex_sub_2d(0, 0, w / 2, h / 2, tex->ptu->format, tex->ptu->dataformat, rows[h]);
else
{
for (y = 0; y < (h / 2); y++)
_tex_sub_2d(0, y, w / 2, 1, tex->ptu->format, tex->ptu->dataformat, rows[h + y]);
}
glBindTexture(GL_TEXTURE_2D, tex->ptv->texture);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
_tex_2d(tex->ptv->intformat, w / 2, h / 2, tex->ptv->format, tex->ptv->dataformat);
if ((rows[h + (h / 2) + 1] - rows[h + (h / 2)]) == (int)(w / 2))
_tex_sub_2d(0, 0, w / 2, h / 2, tex->ptv->format, tex->ptv->dataformat, rows[h + (h / 2)]);
else
{
for (y = 0; y < (h / 2); y++)
_tex_sub_2d(0, y, w / 2, 1, tex->ptv->format, tex->ptv->dataformat, rows[h + (h / 2) + y]);
}
#endif
if (tex->pt->texture != tex->gc->pipe[0].shader.cur_tex) if (tex->pt->texture != tex->gc->pipe[0].shader.cur_tex)
{ {
glBindTexture(GL_TEXTURE_2D, tex->gc->pipe[0].shader.cur_tex); glBindTexture(GL_TEXTURE_2D, tex->gc->pipe[0].shader.cur_tex);
@ -1376,48 +1382,51 @@ evas_gl_common_texture_nv12_update(Evas_GL_Texture *tex, DATA8 **rows, unsigned
tex->ptuv = tex->double_buffer.ptuv[tex->double_buffer.source]; tex->ptuv = tex->double_buffer.ptuv[tex->double_buffer.source];
// FIXME: works on lowest size 4 pixel high buffers. must also be multiple of 2 // FIXME: works on lowest size 4 pixel high buffers. must also be multiple of 2
#ifdef GL_UNPACK_ROW_LENGTH if (tex->gc->shared->info.unpack_row_length)
glPixelStorei(GL_UNPACK_ROW_LENGTH, rows[1] - rows[0]); {
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glPixelStorei(GL_UNPACK_ROW_LENGTH, rows[1] - rows[0]);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glBindTexture(GL_TEXTURE_2D, tex->pt->texture); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glBindTexture(GL_TEXTURE_2D, tex->pt->texture);
_tex_2d(tex->pt->intformat, w, h, tex->pt->format, tex->pt->dataformat); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
_tex_sub_2d(0, 0, w, h, tex->pt->format, tex->pt->dataformat, rows[0]); _tex_2d(tex->pt->intformat, w, h, tex->pt->format, tex->pt->dataformat);
glBindTexture(GL_TEXTURE_2D, tex->ptuv->texture); _tex_sub_2d(0, 0, w, h, tex->pt->format, tex->pt->dataformat, rows[0]);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glBindTexture(GL_TEXTURE_2D, tex->ptuv->texture);
glPixelStorei(GL_UNPACK_ROW_LENGTH, rows[h + 1] - rows[h]); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); glPixelStorei(GL_UNPACK_ROW_LENGTH, rows[h + 1] - rows[h]);
_tex_2d(tex->ptuv->intformat, w / 2, h / 2, tex->ptuv->format, tex->ptuv->dataformat); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
_tex_sub_2d(0, 0, w / 2, h / 2, tex->ptuv->format, tex->ptuv->dataformat, rows[h]); _tex_2d(tex->ptuv->intformat, w / 2, h / 2, tex->ptuv->format, tex->ptuv->dataformat);
#else _tex_sub_2d(0, 0, w / 2, h / 2, tex->ptuv->format, tex->ptuv->dataformat, rows[h]);
unsigned int y; }
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glBindTexture(GL_TEXTURE_2D, tex->pt->texture);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
_tex_2d(tex->pt->intformat, w, h, tex->pt->format, tex->pt->dataformat);
if ((rows[1] - rows[0]) == (int)w)
_tex_sub_2d(0, 0, w, h, tex->pt->format, tex->pt->dataformat, rows[0]);
else else
{ {
for (y = 0; y < h; y++) unsigned int y;
_tex_sub_2d(0, y, w, 1, tex->pt->format, tex->pt->dataformat, rows[y]);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
glBindTexture(GL_TEXTURE_2D, tex->pt->texture);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
_tex_2d(tex->pt->intformat, w, h, tex->pt->format, tex->pt->dataformat);
if ((rows[1] - rows[0]) == (int)w)
_tex_sub_2d(0, 0, w, h, tex->pt->format, tex->pt->dataformat, rows[0]);
else
{
for (y = 0; y < h; y++)
_tex_sub_2d(0, y, w, 1, tex->pt->format, tex->pt->dataformat, rows[y]);
}
glBindTexture(GL_TEXTURE_2D, tex->ptuv->texture);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
_tex_2d(tex->ptuv->intformat, w / 2, h / 2, tex->ptuv->format, tex->ptuv->dataformat);
if ((rows[h + 1] - rows[h]) == (int)(w / 2))
_tex_sub_2d(0, 0, w / 2, h / 2, tex->ptuv->format, tex->ptuv->dataformat, rows[h]);
else
{
for (y = 0; y < (h / 2); y++)
_tex_sub_2d(0, y, w / 2, 1, tex->ptuv->format, tex->ptuv->dataformat, rows[h + y]);
}
} }
glBindTexture(GL_TEXTURE_2D, tex->ptuv->texture);
GLERR(__FUNCTION__, __FILE__, __LINE__, "");
_tex_2d(tex->ptuv->intformat, w / 2, h / 2, tex->ptuv->format, tex->ptuv->dataformat);
if ((rows[h + 1] - rows[h]) == (int)(w / 2))
_tex_sub_2d(0, 0, w / 2, h / 2, tex->ptuv->format, tex->ptuv->dataformat, rows[h]);
else
{
for (y = 0; y < (h / 2); y++)
_tex_sub_2d(0, y, w / 2, 1, tex->ptuv->format, tex->ptuv->dataformat, rows[h + y]);
}
#endif
if (tex->pt->texture != tex->gc->pipe[0].shader.cur_tex) if (tex->pt->texture != tex->gc->pipe[0].shader.cur_tex)
{ {
glBindTexture(GL_TEXTURE_2D, tex->gc->pipe[0].shader.cur_tex); glBindTexture(GL_TEXTURE_2D, tex->gc->pipe[0].shader.cur_tex);