Beispiel #1
0
        public override StepResult Run(Blackboard blackboard)
        {
            var logger = blackboard.Get <ILogger>("Logger");

            var shaderLibrary = blackboard.Get <ShaderLibrary>(LibraryKey);

            if (shaderLibrary == null)
            {
                logger.Log($"Missing ShaderLibrary key {LibraryKey}", ILogger.Verbosity.Error);
                return(StepResult.Failed);
            }

            var translator = blackboard.Get <FrontEndTranslator>(TranslatorKey);
            var spvPath    = blackboard.Get <string>(SpvPathKey);

            var writer             = new BinaryWriter(new FileStream(spvPath, FileMode.Create));
            var spirvWriter        = new SpirVStreamWriter(writer);
            var spirVBinaryBackend = new ShaderToSpirVBinary();

            spirVBinaryBackend.Write(spirvWriter, shaderLibrary, translator);
            writer.Close();

            var artifactsList = blackboard.Get <ArtifactsList>();

            artifactsList.Add(spvPath);

            return(StepResult.Success);
        }
        public override StepResult Run(Blackboard blackboard)
        {
            var logger    = blackboard.Get <ILogger>("Logger");
            var generator = blackboard.Get <SimpleShaderGenerator>(GeneratorKey);
            var spvPath   = blackboard.Get <string>(SpvPathKey);

            var writer             = new BinaryWriter(new FileStream(spvPath, FileMode.Create));
            var spirvWriter        = new SpirVStreamWriter(writer);
            var spirVBinaryBackend = new ShaderToSpirVBinary();

            spirVBinaryBackend.Write(spirvWriter, generator.FragmentLibrary, generator.FrontEnd);
            writer.Close();

            var artifactList = blackboard.Get <ArtifactsList>();

            artifactList.Add(spvPath);

            return(StepResult.Success);
        }