more work on the gles + gl engine.

SVN revision: 43036
This commit is contained in:
Carsten Haitzler 2009-10-12 13:19:55 +00:00
parent 09ba2ed738
commit c0c9f60751
22 changed files with 101 additions and 21 deletions

View File

@ -234,7 +234,8 @@ void evas_gl_common_context_flush(Evas_GL_Context *gc);
void evas_gl_common_shader_program_init(Evas_GL_Program *p,
Evas_GL_Program_Source *vert,
Evas_GL_Program_Source *frag);
Evas_GL_Program_Source *frag,
const char *name);
void evas_gl_common_rect_draw(Evas_GL_Context *gc, int x, int y, int w, int h);

View File

@ -103,17 +103,29 @@ evas_gl_common_context_new(void)
evas_gl_common_shader_program_init(&(gc->shader.rect),
&(shader_rect_vert_src),
&(shader_rect_frag_src));
&(shader_rect_frag_src),
"rect");
evas_gl_common_shader_program_init(&(gc->shader.img),
&(shader_img_vert_src),
&(shader_img_frag_src));
&(shader_img_vert_src),
&(shader_img_frag_src),
"img");
evas_gl_common_shader_program_init(&(gc->shader.font),
&(shader_font_vert_src),
&(shader_font_frag_src));
&(shader_font_frag_src),
"font");
evas_gl_common_shader_program_init(&(gc->shader.yuv),
&(shader_yuv_vert_src),
&(shader_yuv_frag_src));
&(shader_yuv_frag_src),
"yuv");
glUseProgram(gc->shader.yuv.prog);
// in shader:
// uniform sampler2D tex[8];
//
// in code:
// GLuint texes[8];
// GLint loc = glGetUniformLocation(prog, "tex");
// glUniform1iv(loc, 8, texes);
glUniform1i(glGetUniformLocation(gc->shader.yuv.prog, "tex"), 0);
glUniform1i(glGetUniformLocation(gc->shader.yuv.prog, "texu"), 1);
glUniform1i(glGetUniformLocation(gc->shader.yuv.prog, "texv"), 2);

View File

@ -186,10 +186,11 @@ gl_compile_link_error(GLuint target, const char *action)
void
evas_gl_common_shader_program_init(Evas_GL_Program *p,
Evas_GL_Program_Source *vert,
Evas_GL_Program_Source *frag)
Evas_GL_Program_Source *frag,
const char *name)
{
GLint ok;
p->vert = glCreateShader(GL_VERTEX_SHADER);
p->frag = glCreateShader(GL_FRAGMENT_SHADER);
#if defined (GLES_VARIETY_S3C6410)
@ -200,12 +201,22 @@ evas_gl_common_shader_program_init(Evas_GL_Program *p,
(const char **)&(vert->src), NULL);
glCompileShader(p->vert);
glGetShaderiv(p->vert, GL_COMPILE_STATUS, &ok);
if (!ok) gl_compile_link_error(p->vert, "compile vertex shader");
if (!ok)
{
gl_compile_link_error(p->vert, "compile vertex shader");
printf("Abort compile of shader vert (%s):\n%s\n", name, vert->src);
return;
}
glShaderSource(p->frag, 1,
(const char **)&(frag->src), NULL);
glCompileShader(p->frag);
glGetShaderiv(p->frag, GL_COMPILE_STATUS, &ok);
if (!ok) gl_compile_link_error(p->frag, "compile fragment shader");
if (!ok)
{
gl_compile_link_error(p->frag, "compile fragment shader");
printf("Abort compile of shader frag (%s):\n%s\n", name, frag->src);
return;
}
#endif
p->prog = glCreateProgram();
glAttachShader(p->prog, p->vert);
@ -219,5 +230,11 @@ evas_gl_common_shader_program_init(Evas_GL_Program *p,
glLinkProgram(p->prog);
glGetProgramiv(p->prog, GL_LINK_STATUS, &ok);
if (!ok) gl_compile_link_error(p->prog, "link fragment and vertex shaders");
if (!ok)
{
gl_compile_link_error(p->prog, "link fragment and vertex shaders");
printf("Abort compile of shader frag (%s):\n%s\n", name, frag->src);
printf("Abort compile of shader vert (%s):\n%s\n", name, vert->src);
return;
}
}

View File

@ -175,14 +175,14 @@ evas_gl_common_texture_new(Evas_GL_Context *gc, RGBA_Image *im)
tex->gc = gc;
tex->references = 1;
if (im->cache_entry.flags.alpha)
tex->pt = _pool_tex_find(gc, im->cache_entry.w + 3,
im->cache_entry.h + 1, GL_RGBA,
&u, &v, &l_after, 1024);
else
tex->pt = _pool_tex_find(gc, im->cache_entry.w + 3,
im->cache_entry.h + 1, GL_RGB,
&u, &v, &l_after, 1024);
// if (im->cache_entry.flags.alpha)
tex->pt = _pool_tex_find(gc, im->cache_entry.w + 3,
im->cache_entry.h + 1, GL_RGBA,
&u, &v, &l_after, 1024);
// else
// tex->pt = _pool_tex_find(gc, im->cache_entry.w + 3,
// im->cache_entry.h + 1, GL_RGB,
// &u, &v, &l_after, 1024);
if (!tex->pt)
{
free(tex);

View File

@ -1,6 +1,6 @@
#!/bin/sh
ORIONEXE=/home/raster/Data/orion/orion.exe
OPTS="-O --nolodcalc -hp"
OPTS="-O --nolodcalc -lp"
function compile()
{

View File

@ -1,3 +1,6 @@
"#ifdef GL_ES\n"
"precision mediump float;\n"
"#endif\n"
"uniform sampler2D tex;\n"
"varying vec4 col;\n"
"varying vec2 tex_c;\n"

View File

@ -1,3 +1,6 @@
#ifdef GL_ES
precision mediump float;
#endif
uniform sampler2D tex;
varying vec4 col;
varying vec2 tex_c;

View File

@ -1,3 +1,6 @@
"#ifdef GL_ES\n"
"precision mediump float;\n"
"#endif\n"
"attribute vec4 vertex;\n"
"attribute vec4 color;\n"
"attribute vec2 tex_coord;\n"

View File

@ -1,3 +1,6 @@
#ifdef GL_ES
precision mediump float;
#endif
attribute vec4 vertex;
attribute vec4 color;
attribute vec2 tex_coord;

View File

@ -1,3 +1,6 @@
"#ifdef GL_ES\n"
"precision mediump float;\n"
"#endif\n"
"uniform sampler2D tex;\n"
"varying vec4 col;\n"
"varying vec2 tex_c;\n"

View File

@ -1,3 +1,6 @@
#ifdef GL_ES
precision mediump float;
#endif
uniform sampler2D tex;
varying vec4 col;
varying vec2 tex_c;

View File

@ -1,3 +1,6 @@
"#ifdef GL_ES\n"
"precision mediump float;\n"
"#endif\n"
"attribute vec4 vertex;\n"
"attribute vec4 color;\n"
"attribute vec2 tex_coord;\n"

View File

@ -1,3 +1,6 @@
#ifdef GL_ES
precision mediump float;
#endif
attribute vec4 vertex;
attribute vec4 color;
attribute vec2 tex_coord;

View File

@ -1,3 +1,6 @@
"#ifdef GL_ES\n"
"precision mediump float;\n"
"#endif\n"
"uniform sampler2D tex;\n"
"varying vec4 col;\n"
"void main()\n"

View File

@ -1,3 +1,6 @@
#ifdef GL_ES
precision mediump float;
#endif
uniform sampler2D tex;
varying vec4 col;
void main()

View File

@ -1,3 +1,6 @@
"#ifdef GL_ES\n"
"precision mediump float;\n"
"#endif\n"
"attribute vec4 vertex;\n"
"attribute vec4 color;\n"
"attribute vec2 tex_coord;\n"

View File

@ -1,3 +1,6 @@
#ifdef GL_ES
precision mediump float;
#endif
attribute vec4 vertex;
attribute vec4 color;
attribute vec2 tex_coord;

View File

@ -1,3 +1,6 @@
"#ifdef GL_ES\n"
"precision mediump float;\n"
"#endif\n"
"uniform sampler2D tex, texu, texv;\n"
"varying vec4 col;\n"
"varying vec2 tex_c;\n"

View File

@ -1,3 +1,6 @@
#ifdef GL_ES
precision mediump float;
#endif
uniform sampler2D tex, texu, texv;
varying vec4 col;
varying vec2 tex_c;

View File

@ -1,3 +1,6 @@
"#ifdef GL_ES\n"
"precision mediump float;\n"
"#endif\n"
"attribute vec4 vertex;\n"
"attribute vec4 color;\n"
"attribute vec2 tex_coord;\n"

View File

@ -1,3 +1,6 @@
#ifdef GL_ES
precision mediump float;
#endif
attribute vec4 vertex;
attribute vec4 color;
attribute vec2 tex_coord;

View File

@ -59,7 +59,9 @@ eng_window_new(Display *disp,
config_attrs[7] = 6;
config_attrs[8] = EGL_BLUE_SIZE;
config_attrs[9] = 5;
config_attrs[10] = EGL_NONE;
config_attrs[10] = EGL_DEPTH_SIZE;
config_attrs[11] = 16;
config_attrs[12] = EGL_NONE;
}
else // 24/32bit. no one does 8bpp anymore. and 15bpp... dead
{