private unsafe void UpdateUniform <T>(int uniformIndex, ShaderParam <T> p) where T : unmanaged { fixed(T *data = p.Data) { platformProgram.SetUniform(uniformIndex, new IntPtr(data), p.Count); } }
private unsafe void SyncIntVector2(int location, ShaderParam <IntVector2> param) { fixed(IntVector2 *dataPtr = param.Data) { GL.Uniform2(location, param.Count, (int *)dataPtr); PlatformRenderer.CheckErrors(); } }
private unsafe void SyncInt(int location, ShaderParam <int> param) { fixed(int *dataPtr = param.Data) { GL.Uniform1(location, param.Count, dataPtr); PlatformRenderer.CheckErrors(); } }
private unsafe void SyncFloatMatrix4x4(int location, ShaderParam <Matrix44> param) { fixed(Matrix44 *dataPtr = param.Data) { GL.UniformMatrix4(location, param.Count, false, (float *)dataPtr); PlatformRenderer.CheckErrors(); } }
private unsafe void SyncFloatVector4(int location, ShaderParam <Vector4> param) { fixed(Vector4 *dataPtr = param.Data) { GL.Uniform4(location, param.Count, (float *)dataPtr); PlatformRenderer.CheckErrors(); } }
private ShaderParam<T> GetParameter<T>(ShaderParamKey<T> key, int capacity) { var p = Items[key.Index] as ShaderParam<T>; if (p == null || p.Data.Length < capacity) { p = new ShaderParam<T>(capacity) { Name = key.Name }; Items[key.Index] = p; } return p; }