[cairo] [patch] gl: cache uniform location

Eric Anholt eric at anholt.net
Wed Aug 22 15:27:57 PDT 2012

"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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.cairographics.org/archives/cairo/attachments/20120822/beefb3a9/attachment.pgp>

More information about the cairo mailing list