if shader compile fails - peroclate error back up to engine info_set so we

know gl engine is useless.



SVN revision: 48956
This commit is contained in:
Carsten Haitzler 2010-05-18 03:49:59 +00:00
parent 3cd8279021
commit 4fefcad954
5 changed files with 71 additions and 55 deletions

View File

@ -322,7 +322,7 @@ void evas_gl_common_context_image_map4_push(Evas_GL_Context *gc,
Eina_Bool tex_only); Eina_Bool tex_only);
void evas_gl_common_context_flush(Evas_GL_Context *gc); void evas_gl_common_context_flush(Evas_GL_Context *gc);
void evas_gl_common_shader_program_init(Evas_GL_Program *p, int evas_gl_common_shader_program_init(Evas_GL_Program *p,
Evas_GL_Program_Source *vert, Evas_GL_Program_Source *vert,
Evas_GL_Program_Source *frag, Evas_GL_Program_Source *frag,
const char *name); const char *name);

View File

@ -454,46 +454,46 @@ evas_gl_common_context_new(void)
glEnableVertexAttribArray(SHAD_COLOR); glEnableVertexAttribArray(SHAD_COLOR);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
evas_gl_common_shader_program_init(&(shared->shader.rect), if (!evas_gl_common_shader_program_init(&(shared->shader.rect),
&(shader_rect_vert_src), &(shader_rect_vert_src),
&(shader_rect_frag_src), &(shader_rect_frag_src),
"rect"); "rect")) goto error;
evas_gl_common_shader_program_init(&(shared->shader.font), if (!evas_gl_common_shader_program_init(&(shared->shader.font),
&(shader_font_vert_src), &(shader_font_vert_src),
&(shader_font_frag_src), &(shader_font_frag_src),
"font"); "font")) goto error;
evas_gl_common_shader_program_init(&(shared->shader.img), if (!evas_gl_common_shader_program_init(&(shared->shader.img),
&(shader_img_vert_src), &(shader_img_vert_src),
&(shader_img_frag_src), &(shader_img_frag_src),
"img"); "img")) goto error;
evas_gl_common_shader_program_init(&(shared->shader.img_nomul), if (!evas_gl_common_shader_program_init(&(shared->shader.img_nomul),
&(shader_img_nomul_vert_src), &(shader_img_nomul_vert_src),
&(shader_img_nomul_frag_src), &(shader_img_nomul_frag_src),
"img_nomul"); "img_nomul")) goto error;
evas_gl_common_shader_program_init(&(shared->shader.img_bgra), if (!evas_gl_common_shader_program_init(&(shared->shader.img_bgra),
&(shader_img_bgra_vert_src), &(shader_img_bgra_vert_src),
&(shader_img_bgra_frag_src), &(shader_img_bgra_frag_src),
"img_bgra"); "img_bgra")) goto error;
evas_gl_common_shader_program_init(&(shared->shader.img_bgra_nomul), if (!evas_gl_common_shader_program_init(&(shared->shader.img_bgra_nomul),
&(shader_img_bgra_nomul_vert_src), &(shader_img_bgra_nomul_vert_src),
&(shader_img_bgra_nomul_frag_src), &(shader_img_bgra_nomul_frag_src),
"img_bgra_nomul"); "img_bgra_nomul")) goto error;
evas_gl_common_shader_program_init(&(shared->shader.tex), if (!evas_gl_common_shader_program_init(&(shared->shader.tex),
&(shader_tex_vert_src), &(shader_tex_vert_src),
&(shader_tex_frag_src), &(shader_tex_frag_src),
"tex"); "tex")) goto error;
evas_gl_common_shader_program_init(&(shared->shader.tex_nomul), if (!evas_gl_common_shader_program_init(&(shared->shader.tex_nomul),
&(shader_tex_nomul_vert_src), &(shader_tex_nomul_vert_src),
&(shader_tex_nomul_frag_src), &(shader_tex_nomul_frag_src),
"tex_nomul"); "tex_nomul")) goto error;
evas_gl_common_shader_program_init(&(shared->shader.yuv), if (!evas_gl_common_shader_program_init(&(shared->shader.yuv),
&(shader_yuv_vert_src), &(shader_yuv_vert_src),
&(shader_yuv_frag_src), &(shader_yuv_frag_src),
"yuv"); "yuv")) goto error;
evas_gl_common_shader_program_init(&(shared->shader.yuv_nomul), if (!evas_gl_common_shader_program_init(&(shared->shader.yuv_nomul),
&(shader_yuv_nomul_vert_src), &(shader_yuv_nomul_vert_src),
&(shader_yuv_nomul_frag_src), &(shader_yuv_nomul_frag_src),
"yuv_nomul"); "yuv_nomul")) goto error;
glUseProgram(shared->shader.yuv.prog); glUseProgram(shared->shader.yuv.prog);
GLERR(__FUNCTION__, __FILE__, __LINE__, ""); GLERR(__FUNCTION__, __FILE__, __LINE__, "");
@ -530,6 +530,9 @@ evas_gl_common_context_new(void)
gc->def_surface = evas_gl_common_image_surface_new(gc, 1, 1, 1); gc->def_surface = evas_gl_common_image_surface_new(gc, 1, 1, 1);
return gc; return gc;
error:
evas_gl_common_context_free(gc);
return NULL;
} }
void void
@ -539,11 +542,11 @@ evas_gl_common_context_free(Evas_GL_Context *gc)
gc->references--; gc->references--;
if (gc->references > 0) return; if (gc->references > 0) return;
gc->shared->references--; if (gc->shared) gc->shared->references--;
evas_gl_common_image_free(gc->def_surface); if (gc->def_surface) evas_gl_common_image_free(gc->def_surface);
if (gc->shared->references == 0) if ((gc->shared) && (gc->shared->references == 0))
{ {
evas_gl_common_shader_program_shutdown(&(gc->shared->shader.rect)); evas_gl_common_shader_program_shutdown(&(gc->shared->shader.rect));
evas_gl_common_shader_program_shutdown(&(gc->shared->shader.font)); evas_gl_common_shader_program_shutdown(&(gc->shared->shader.font));

View File

@ -420,7 +420,7 @@ gl_compile_link_error(GLuint target, const char *action)
} }
} }
void int
evas_gl_common_shader_program_init(Evas_GL_Program *p, evas_gl_common_shader_program_init(Evas_GL_Program *p,
Evas_GL_Program_Source *vert, Evas_GL_Program_Source *vert,
Evas_GL_Program_Source *frag, Evas_GL_Program_Source *frag,
@ -447,7 +447,7 @@ evas_gl_common_shader_program_init(Evas_GL_Program *p,
{ {
gl_compile_link_error(p->vert, "compile vertex shader"); gl_compile_link_error(p->vert, "compile vertex shader");
printf("Abort compile of shader vert (%s):\n%s\n", name, vert->src); printf("Abort compile of shader vert (%s):\n%s\n", name, vert->src);
return; return 0;
} }
glShaderSource(p->frag, 1, glShaderSource(p->frag, 1,
(const char **)&(frag->src), NULL); (const char **)&(frag->src), NULL);
@ -460,7 +460,7 @@ evas_gl_common_shader_program_init(Evas_GL_Program *p,
{ {
gl_compile_link_error(p->frag, "compile fragment shader"); gl_compile_link_error(p->frag, "compile fragment shader");
printf("Abort compile of shader frag (%s):\n%s\n", name, frag->src); printf("Abort compile of shader frag (%s):\n%s\n", name, frag->src);
return; return 0;
} }
#endif #endif
p->prog = glCreateProgram(); p->prog = glCreateProgram();
@ -489,8 +489,9 @@ evas_gl_common_shader_program_init(Evas_GL_Program *p,
gl_compile_link_error(p->prog, "link fragment and vertex shaders"); 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 frag (%s):\n%s\n", name, frag->src);
printf("Abort compile of shader vert (%s):\n%s\n", name, vert->src); printf("Abort compile of shader vert (%s):\n%s\n", name, vert->src);
return; return 0;
} }
return 1;
} }
void void

View File

@ -339,7 +339,17 @@ eng_setup(Evas *e, void *in)
} }
} }
if (!e->engine.data.output) return 0; if (!re->win)
{
free(re);
return 0;
}
if (!e->engine.data.output)
{
if (re->win) eng_window_free(re->win);
free(re);
return 0;
}
if (!e->engine.data.context) if (!e->engine.data.context)
e->engine.data.context = e->engine.data.context =
e->engine.func->context_new(e->engine.data.output); e->engine.func->context_new(e->engine.data.output);
@ -363,12 +373,14 @@ eng_output_free(void *data)
re = (Render_Engine *)data; re = (Render_Engine *)data;
if (re)
{
// NOTE: XrmGetDatabase() result is shared per connection, do not free it. // NOTE: XrmGetDatabase() result is shared per connection, do not free it.
// if (re->xrdb) XrmDestroyDatabase(re->xrdb); // if (re->xrdb) XrmDestroyDatabase(re->xrdb);
eng_window_free(re->win); if (re->win) eng_window_free(re->win);
free(re); free(re);
}
evas_common_font_shutdown(); evas_common_font_shutdown();
evas_common_image_shutdown(); evas_common_image_shutdown();
} }

View File

@ -382,7 +382,7 @@ eng_window_new(Display *disp,
gw->gl_context = evas_gl_common_context_new(); gw->gl_context = evas_gl_common_context_new();
if (!gw->gl_context) if (!gw->gl_context)
{ {
free(gw); eng_window_free(gw);
return NULL; return NULL;
} }
evas_gl_common_context_use(gw->gl_context); evas_gl_common_context_use(gw->gl_context);
@ -396,7 +396,7 @@ eng_window_free(Evas_GL_X11_Window *gw)
{ {
win_count--; win_count--;
if (gw == _evas_gl_x11_window) _evas_gl_x11_window = NULL; if (gw == _evas_gl_x11_window) _evas_gl_x11_window = NULL;
evas_gl_common_context_free(gw->gl_context); if (gw->gl_context) evas_gl_common_context_free(gw->gl_context);
#if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX) #if defined (GLES_VARIETY_S3C6410) || defined (GLES_VARIETY_SGX)
if (gw->egl_surface[0] != EGL_NO_SURFACE) if (gw->egl_surface[0] != EGL_NO_SURFACE)
eglDestroySurface(gw->egl_disp, gw->egl_surface[0]); eglDestroySurface(gw->egl_disp, gw->egl_surface[0]);