Ejemplo n.º 1
0
        public void OnExecute()
        {
            VesselShaderUtil.debugMode = Debug;

            // TODO: Compile shaders or something idfk
            if (!Directory.Exists(OutputPath))
            {
                Directory.CreateDirectory(OutputPath);
            }

            // Get the shader descriptions using smart ass reflection
            VesselShaderDescription[] descs = VesselShaderUtil.GetShaderList(SearchPaths);

            HashSet <string> generatedPaths = new HashSet <string>();

            VesselShaderCompiler compiler = new VesselShaderCompiler(descs, OutputPath);

            foreach (VesselShaderDescription desc in descs)
            {
                string[] newPaths = compiler.Compile(desc);
                foreach (string s in newPaths)
                {
                    generatedPaths.Add(s);
                }
            }
        }
Ejemplo n.º 2
0
        private byte[] CompileToSpirv(
            VesselShaderDescription shader,
            string fileName,
            ShaderStages stage)
        {
            GlslCompileOptions     glslOptions = VesselShaderUtil.GetOptions(shader);
            string                 glsl        = VesselShaderUtil.LoadGlsl(fileName);
            SpirvCompilationResult result      = SpirvCompilation.CompileGlslToSpirv(
                glsl,
                fileName,
                stage,
                glslOptions);

            return(result.SpirvBytes);
        }