public ShaderProgram(byte[] vpFileImage, byte[] fpFileImage, ShaderProgramOption option) { string[] constKeys = ShaderProgram.GetConstKeys(option); int[] constVals = ShaderProgram.GetConstVals(option); int errorCode = PsmShaderProgram.FromImage(vpFileImage, fpFileImage, constKeys, constVals, out this.handle); if (errorCode != 0) { Error.ThrowNativeException(errorCode); } this.state = new ShaderProgramState(this.handle); }
internal static int[] GetConstVals(ShaderProgramOption option) { int[] result; if (option == null || option.ConstantValues.Count == 0) { result = null; } else { int[] array = new int[option.ConstantValues.Count]; option.ConstantValues.Values.CopyTo(array, 0); result = array; } return(result); }
internal static string[] GetConstKeys(ShaderProgramOption option) { string[] result; if (option == null || option.ConstantValues.Count == 0) { result = null; } else { string[] array = new string[option.ConstantValues.Count]; option.ConstantValues.Keys.CopyTo(array, 0); result = array; } return(result); }
/// <summary>Creates a shader program (from a file image, with options)</summary> /// <param name="fileImage">Shader file image</param> /// <remarks>Creates a shader program from a specified file image. The usable file format is CGX.</remarks> public ShaderProgram(byte[] fileImage, ShaderProgramOption option) : this(fileImage, null, option) { }
/// <summary>Creates a shader program (from a file, with options)</summary> /// <param name="fileName">Shader filename</param> /// <param name="option">Shader program creation option</param> /// <remarks>Creates a shader program from a specified file. The usable file format is CGX.</remarks> public ShaderProgram(string fileName, ShaderProgramOption option) : this(fileName, null, option) { }