static int _evas_gl_common_shader_program_binary_save(Evas_GL_Program *p, const char *pname, Eet_File *ef) { void* data = NULL; GLenum format; int length = 0, size = 0; if (!glsym_glGetProgramBinary) return 0; glGetProgramiv(p->prog, GL_PROGRAM_BINARY_LENGTH, &length); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); if (length <= 0) return 0; data = malloc(length); if (!data) return 0; glsym_glGetProgramBinary(p->prog, length, &size, &format, data); GLERR(__FUNCTION__, __FILE__, __LINE__, ""); if (length != size) { free(data); return 0; } if (eet_write(ef, pname, data, length, 1) < 0) { if (data) free(data); return 0; } if (data) free(data); return 1; }
static int _evas_gl_common_shader_program_binary_save(Evas_GL_Program *p, Eet_File *ef) { void* data = NULL; GLenum format; int length = 0, size = 0; char pname[32]; if (!glsym_glGetProgramBinary) return 0; glGetProgramiv(p->prog, GL_PROGRAM_BINARY_LENGTH, &length); if (length <= 0) return 0; data = malloc(length); if (!data) return 0; glsym_glGetProgramBinary(p->prog, length, &size, &format, data); if (length != size) { free(data); return 0; } sprintf(pname, SHADER_PROG_NAME_FMT, p->flags); if (eet_write(ef, pname, data, length, SHADER_BINARY_EET_COMPRESS) < 0) { free(data); return 0; } free(data); p->bin_saved = 1; return 1; }