I've removed a comment which is creating dummy shader when using GL_OES_get_program_b...
authorJiyoun Park <jy0703.park@samsung.com>
Wed, 13 Jul 2011 06:47:28 +0000 (15:47 +0900)
committerJiyoun Park <jy0703.park@samsung.com>
Wed, 13 Jul 2011 06:47:28 +0000 (15:47 +0900)
Mr. Haegeun Park who is in charge of GPU driver fixed get_program_binary bug in the SGX driver.
There's no need to create dummy shaders any longer.
And I've added link status checking code to validate the binary object.-by gl77.lee@samsung.com

Change-Id: I2f4a2c7cb604195a08b59f792a12532b88ce9176

src/modules/engines/gl_common/evas_gl_shader.c

index 0cc6d25..1564a2f 100644 (file)
@@ -756,6 +756,7 @@ _evas_gl_common_shader_program_binary_init(Evas_GL_Program *p,
    int res = 0, num = 0, length = 0;
    int *formats = NULL;
    void *data = NULL;
+   GLint ok = 0;
 
    if (!ef) return res;
 
@@ -790,6 +791,16 @@ _evas_gl_common_shader_program_binary_init(Evas_GL_Program *p,
    glBindAttribLocation(p->prog, SHAD_TEXUV2, "tex_coord2");
    glBindAttribLocation(p->prog, SHAD_TEXUV3, "tex_coord3");
    glBindAttribLocation(p->prog, SHAD_TEXM,   "tex_coordm");
+
+   glGetProgramiv(p->prog, GL_LINK_STATUS, &ok);
+   GLERR(__FUNCTION__, __FILE__, __LINE__, "");
+   if (!ok)
+     {
+        gl_compile_link_error(p->prog, "load a program object");
+        ERR("Abort load of program (%s)", pname);
+        goto finish;
+     }
+
    res = 1;
 
 finish:
@@ -810,7 +821,7 @@ _evas_gl_common_shader_program_binary_save(Evas_GL_Program *p,
 {
    void* data = NULL;
    GLenum format;
-   int length = 0;
+   int length = 0, size = 0;
 
    if (!glsym_glGetProgramBinary) return 0;
 
@@ -821,9 +832,15 @@ _evas_gl_common_shader_program_binary_save(Evas_GL_Program *p,
    data = malloc(length);
    if (!data) return 0;
 
-   glsym_glGetProgramBinary(p->prog, length, NULL, &format, data);
+   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, 0) < 0)
      {
         if (data) free(data);