Пример #1
0
        public static void Main(string[] args)
        {
            var infoSink = new InfoSink {
                debug = new InfoSinkBase(), info = new InfoSinkBase()
            };
            var    intermediate = new GLSLIntermediate();
            var    preprocessor = new Standalone(infoSink, intermediate);
            string result       = null;

            //const string fileName = "Sample.vert";
            const string fileName = "notex.vert";
            string       original = null;

            using (var fs = File.OpenRead(fileName))
                using (var sr = new StreamReader(fs))
                {
                    original = sr.ReadToEnd();
                }

            Console.WriteLine(original);
            Console.WriteLine(original.Length);

            if (preprocessor.Run(fileName, out result))
            {
                Console.WriteLine(result);
                Console.WriteLine(result.Length);
            }
        }
Пример #2
0
        public static void Main(string[] args)
        {
            var infoSink = new InfoSink {debug = new InfoSinkBase(), info = new InfoSinkBase()};
            var intermediate = new GLSLIntermediate ();
            var preprocessor = new Standalone (infoSink, intermediate);
            string result = null;

            //const string fileName = "Sample.vert";
            const string fileName = "notex.vert";
            string original = null;
            using (var fs = File.OpenRead (fileName))
            using (var sr = new StreamReader(fs))
            {
                original = sr.ReadToEnd ();
            }

            Console.WriteLine (original);
            Console.WriteLine (original.Length);

            if (preprocessor.Run (fileName, out result))
            {
                Console.WriteLine (result);
                Console.WriteLine (result.Length);
            }
        }
Пример #3
0
        private static string TransformTemplate(
            string filePath,
            NumDefine[] defines,
            PasteToken[] attributeTypes
            )
        {
            var debug        = new InfoSinkBase(SinkType.String);
            var info         = new InfoSinkBase(SinkType.String);
            var infoSink     = new InfoSink(info, debug);
            var intermediate = new GLSLIntermediate();
            var symbols      = new SymbolLookup();

            symbols.SetPreambleManually(Profile.CoreProfile);

            foreach (var x in defines)
            {
                symbols.DefineAs(x.Name, x.Value);
            }

            foreach (var t in attributeTypes)
            {
                symbols.AddPasteToken(t.Name, t.Value);
            }

            var preprocessor = new Standalone(infoSink, intermediate, symbols);

            preprocessor.Run(filePath, out string result);
            return(result);
        }
Пример #4
0
        public void TestCase()
        {
            var debug        = new InfoSinkBase(SinkType.String);
            var info         = new InfoSinkBase(SinkType.String);
            var infoSink     = new InfoSink(info, debug);
            var intermediate = new GLSLIntermediate();
            var symbols      = new SymbolLookup();

            symbols.SetPreambleManually(Profile.CoreProfile);
            symbols.DefineAs("GL_ARB_shader_storage_buffer_object", 1);
            var    preprocessor = new Standalone(infoSink, intermediate, symbols);
            string result;

            Assert.IsTrue(preprocessor.Run("Sample.vert", out result));
            Assert.IsNotNull(result);
        }