Exemplo n.º 1
0
        public void TestSimple()
        {
            var simple = sourceManager.LoadShaderSource("Simple");

            // Make sure that SourceManager will fail if type is not found
            Assert.Catch <FileNotFoundException>(() => sourceManager.LoadShaderSource("BiduleNotFound"));

            // Reload it and check that it is not loaded twice
            var simple2 = sourceManager.LoadShaderSource("Simple");

            //TODO: cannot compare structure references
            //Assert.That(ReferenceEquals(simple, simple2), Is.True);
            Assert.AreEqual(simple, simple2);
        }
Exemplo n.º 2
0
        //get shader source from data base, is there a more direct way?
        public static string GetShaderSourceCode(string effectName, IVirtualFileProvider fileProvider, ShaderSourceManager shaderSourceManager)
        {
            var path = GetPathOfSdslShader(effectName, fileProvider);

            if (!string.IsNullOrWhiteSpace(path))
            {
                try
                {
                    return(File.ReadAllText(path));
                }
                catch (Exception)
                {
                    //fall through
                }
            }

            return(shaderSourceManager?.LoadShaderSource(effectName).Source);
        }