[cairo] [patch] gl: cache uniform location
Henry (Yu) Song - SISA
hsong at sisa.samsung.com
Wed Aug 22 17:42:10 PDT 2012
Thanks Eric, you are right on the performance.
From: Eric Anholt [eric at anholt.net]
Sent: Wednesday, August 22, 2012 3:27 PM
To: Henry (Yu) Song - SISA; cairo at cairographics.org
Subject: Re: [cairo] [patch] gl: cache uniform location
"Henry (Yu) Song - SISA" <hsong at sisa.samsung.com> writes:
> GetUniformLocation is expensive call, especially on embedded device, we can cache them once obtained.
> From c856118e637412a8c5cd7b68cc569f7e1bf4f44c Mon Sep 17 00:00:00 2001
> From: Henry Song <henry.song at samsung.com>
> Date: Fri, 6 Jan 2012 16:46:25 -0800
> Subject: [PATCH] gl/msaa: Cache shader uniform locations
> Instead of continuously fetching the uniform locations from compiled
> shaders, cache them.
This should be basically as expensive as glGetUniformLocation, since
that's a hash lookup too. I suspect you can't measure a performance
difference from this particular change.
Also, it looks broken, since the newly introduced static function doing
the work isn't referenced.
If you're interested in pursuing and benchmarking this, I would
recommend doing getuniformlocation once at program link time, then
saving the integer locations in the cairo_gl_shader_t instead of asking
for them by name in the future.
More information about the cairo