public static void ShaderSetAutoDiscovery() { ToolChain toolChain = ToolChain.Get(ToolFeatures.ToCompiled); if (toolChain == null) { throw new RequiredToolFeatureMissingException("No tool chain supporting compilation was found!"); } Compilation compilation = TestUtil.GetCompilation(); LanguageBackend backend = toolChain.CreateBackend(compilation); ShaderGenerator sg = new ShaderGenerator(compilation, backend); ShaderGenerationResult generationResult = sg.GenerateShaders(); IReadOnlyList <GeneratedShaderSet> hlslSets = generationResult.GetOutput(backend); Assert.Equal(4, hlslSets.Count); GeneratedShaderSet set = hlslSets[0]; Assert.Equal("VertexAndFragment", set.Name); CompileResult result = toolChain.Compile(set.VertexShaderCode, Stage.Vertex, "VS"); Assert.False(result.HasError, result.ToString()); result = toolChain.Compile(set.FragmentShaderCode, Stage.Fragment, "FS"); Assert.False(result.HasError, result.ToString()); }
public void PartialFiles() { ToolChain toolChain = ToolChain.Get(ToolFeatures.ToCompiled); if (toolChain == null) { throw new RequiredToolFeatureMissingException("No tool chain supporting compilation was found!"); } Compilation compilation = TestUtil.GetCompilation(); LanguageBackend backend = toolChain.CreateBackend(compilation); ShaderGenerator sg = new ShaderGenerator(compilation, backend, "TestShaders.PartialVertex.VertexShaderFunc"); ShaderGenerationResult genResult = sg.GenerateShaders(); IReadOnlyList <GeneratedShaderSet> sets = genResult.GetOutput(backend); Assert.Equal(1, sets.Count); GeneratedShaderSet set = sets[0]; ShaderModel shaderModel = set.Model; string vsCode = set.VertexShaderCode; CompileResult result = toolChain.Compile(vsCode, Stage.Vertex, "VertexShaderFunc"); Assert.False(result.HasError, result.ToString()); }
public void SetResult(CompileResult cr) { this.cr = cr; resultTextBox.Text = cr.ToString(); resultTextBox.SelectionStart = resultTextBox.Text.Length; }