From: Wonsik, Jung Date: Mon, 10 Jul 2017 11:31:52 +0000 (+0900) Subject: [EvasGL] Optimize precompiling shader list X-Git-Tag: accepted/tizen/unified/20170721.201732~10 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b3201167a6853df3519b3e9a5e2ddc640ccad392;p=platform%2Fupstream%2Fefl.git [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 --- 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));