Optimized shader hash to not allocate memory or perform multiple passes of string data
Applications like dali-demo end up hashing around 1MB of shader source on startup
due to multiple calls to ShaderFactory::Load ( 340 calls for dali-demo).
The previous code would:
- Allocate a new string to hold both vertex/ fragment source code
- Copy vertex / fragment source code in to the new string
- Pass through the string removing white spaces
- Pass through the string removing tabs
- Pass through the string removing new line characters
- Pass through the string to perform Hash calculation
So if a total of 1MB is passed to the hasher it would end
read/ writing around 5MB of data.
Hence OProfile flagged it up as being a bottleneck for some apps on startup.
New version does no memory allocation and does a single pass of the data.
Todo: Need to look at a better way of comparing shaders
Change-Id: I39c8b351c65c6e91f2c4b32e321f861d634ccca4