[EvasGL] Optimize precompiling shader list 58/137958/4
authorWonsik, Jung <sidein@samsung.com>
Mon, 10 Jul 2017 11:31:52 +0000 (20:31 +0900)
committerGerrit Code Review <gerrit@review.ap-northeast-2.compute.internal>
Tue, 18 Jul 2017 01:07:24 +0000 (01:07 +0000)
When Evas GL shader file is created at fist,
Many shaders is create/compiled, then program is created/attached/linked with the shaders.
In case of some devices, the glProgramLink() time is spent too much.
To opimize, base shaders are only included to the list.

Change-Id: Ibe04ffd30f2ae6d0a3b9b61d3370a9f924dc9825

src/modules/evas/engines/gl_common/evas_gl_shader.c

index 1b102ab..e77b9b2 100644 (file)
@@ -500,6 +500,30 @@ evas_gl_common_shader_precompile_list(Evas_GL_Shared *shared)
 
    if (!shared) return NULL;
 
+   // In case of some devices, glLinkProgram()'s time is spent too much.
+   // To optimize that, the precompiling's list are reduced.
+   // At first, base shaders are only included to the list.
+   if (getenv("EVAS_GL_SHADER_OPTIMIZE"))
+     {
+       /* most popular shaders */
+       const int BGRA = (shared->info.bgra ? SHADER_FLAG_BGRA : 0);
+       const int autoload[] = {
+          /* rect */ BASEFLAG,
+          /* text */ BASEFLAG | SHADER_FLAG_TEX | SHADER_FLAG_ALPHA,
+          /* img1 */ BASEFLAG | SHADER_FLAG_TEX | SHADER_FLAG_IMG | BGRA,
+          /* img2 */ BASEFLAG | SHADER_FLAG_TEX | SHADER_FLAG_IMG | SHADER_FLAG_NOMUL | BGRA,
+       };
+
+       int i;
+       // Add to base shaders
+       for (i = 0; i < 4; i++)
+         li = eina_list_append(li, P(autoload[i]));
+
+       DBG("Built list of %d shaders to precompile for tizen", eina_list_count(li));
+       return li;
+     }
+
+
    // rect
    li = eina_list_append(li, P(BASEFLAG));