message: Adds a caching layer to generateSyncUniforms
diff: @@ -32,6 +32,13 @@ export default class ShaderSystem extends System
  this.shader = null;
  this.program = null;
  + /**
  + * Cache to holds the generated functions. Stored against UniformObjects unique signiture
  + * @type {Object}
  + * @private
  + */
  + this.cache = {};
  +
  this.id = UID++;
  }
  @@ -99,11 +106,47 @@ export default class ShaderSystem extends System
  createSyncGroups(group)
  {
  - group.syncUniforms[this.shader.program.id] = generateUniformsSync(group, this.shader.program.uniformData);
  + const id = this.getSignature(group, this.shader.program.uniformData);
  +
  + if (!this.cache[id])
  + {
  + this.cache[id] = generateUniformsSync(group, this.shader.program.uniformData);
  + }
  +
  + group.syncUniforms[this.shader.program.id] = this.cache[id];
  return group.syncUniforms[this.shader.program.id];
  }
  + /**
  + * Takes a uniform group and data and generates a unique signiture for them.
  + *
  + * @param {PIXI.UniformGroup} group the uniform group to get signiture of
  + * @param {Object} uniformData uniform information generated by the shader
  + * @returns {String} Unique signiture of the uniform group
  + * @private
  + */
  + getSignature(group, uniformData)
  + {
  + const uniforms = group.uniforms;
  +
  + let sig = '';
  +
  + for (const i in uniforms)
  + {
  + if (uniformData[i])
  + {
  + sig += i + uniformData[i].type;
  + }
  + else
  + {
  + sig += i;
  + }
  + }
  +
  + return sig;
  + }
  +
  /**
  * Returns the underlying GLShade rof the currently bound shader.
  * This can be handy for when you to have a little more control over the setting of your uniforms.
  