示例#1
0
        private static void LoadFromPrecompiledBinary(Shader shader, string compiledBinaryPath, string compiledFormatPath)
        {
            byte[] programBinary = File.ReadAllBytes(compiledBinaryPath);

            int          formatValue  = BitConverter.ToInt32(File.ReadAllBytes(compiledFormatPath), 0);
            BinaryFormat binaryFormat = (BinaryFormat)formatValue;

            // Number of supported binary formats.
            int binaryFormatCount;

            GL.GetInteger(GetPName.NumProgramBinaryFormats, out binaryFormatCount);

            // Get all supported formats.
            int[] binaryFormats = new int[binaryFormatCount];
            GL.GetInteger(GetPName.ProgramBinaryFormats, binaryFormats);

            if (binaryFormats.Contains(formatValue))
            {
                shader.LoadProgramBinary(programBinary, binaryFormat);
            }
        }