From b3201167a6853df3519b3e9a5e2ddc640ccad392 Mon Sep 17 00:00:00 2001 From: "Wonsik, Jung" Date: Mon, 10 Jul 2017 20:31:52 +0900 Subject: [PATCH] [EvasGL] Optimize precompiling shader list 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 --- .../evas/engines/gl_common/evas_gl_shader.c | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/modules/evas/engines/gl_common/evas_gl_shader.c b/src/modules/evas/engines/gl_common/evas_gl_shader.c index 1b102ab..e77b9b2 100644 --- a/src/modules/evas/engines/gl_common/evas_gl_shader.c +++ b/src/modules/evas/engines/gl_common/evas_gl_shader.c @@ -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)); -- 2.7.4