Evas GL: Delete shaders after linking programs

The shaders eat up some memory and we don't need them after linking
the shader program.
This commit is contained in:
Jean-Philippe Andre 2015-11-06 15:33:08 +09:00
parent b80d7fa302
commit 31b8fd1649
2 changed files with 7 additions and 9 deletions

View File

@ -97,10 +97,9 @@ typedef Eina_Bool (*evas_gl_make_current_cb)(void *engine_data, void *doit);
struct _Evas_GL_Program
{
GLuint vert, frag, prog;
unsigned int flags, hitcount;
unsigned int flags, hitcount, tex_count;
GLuint prog;
int tex_count;
Eina_Bool reset : 1;
Eina_Bool bin_saved : 1;
};

View File

@ -163,13 +163,13 @@ _evas_gl_common_shader_program_binary_load(Eet_File *ef, unsigned int flags)
p = calloc(1, sizeof(*p));
p->flags = flags;
p->prog = prg;
p->vert = vtx;
p->frag = frg;
p->reset = EINA_TRUE;
p->bin_saved = EINA_TRUE;
evas_gl_common_shader_textures_bind(p);
finish:
if (vtx) glDeleteShader(vtx);
if (frg) glDeleteShader(frg);
free(formats);
if (!direct) free(data);
return p;
@ -330,8 +330,6 @@ static void
_shaders_hash_free_cb(void *data)
{
Evas_GL_Program *p = data;
if (p->vert) glDeleteShader(p->vert);
if (p->frag) glDeleteShader(p->frag);
if (p->prog) glDeleteProgram(p->prog);
free(p);
}
@ -613,10 +611,11 @@ evas_gl_common_shader_compile(unsigned int flags, const char *vertex,
p = calloc(1, sizeof(*p));
p->flags = flags;
p->prog = prg;
p->vert = vtx;
p->frag = frg;
p->reset = EINA_TRUE;
glDeleteShader(vtx);
glDeleteShader(frg);
return p;
}