//Refer ShaderAssetExporter public bool Export(IExportContainer container, Object asset, string path) { using (Stream fileStream = FileUtils.CreateVirtualFile(path)) { Shader shader = (Shader)asset; if (settings.ShaderExportMode == ShaderExportMode.Dummy) { DummyShaderTextExporter.ExportShader(shader, container, fileStream, DefaultShaderExporterInstantiator); } else if (settings.ShaderExportMode == ShaderExportMode.GLSL || settings.ShaderExportMode == ShaderExportMode.Metal) { var exporter = new CustomShaderExporter(settings.CondenseShaderSubprograms); exporter.ExportShader(shader, container, fileStream, DefaultShaderExporterInstantiator); } else if (settings.ShaderExportMode == ShaderExportMode.Asm) { shader.ExportBinary(container, fileStream, DXShaderExporterInstantiator); } else { shader.ExportBinary(container, fileStream, DefaultShaderExporterInstantiator); } } return(true); }
public void Export(IExportContainer container, Object asset, string path, Action <IExportContainer, Object, string> callback) { using (Stream fileStream = FileUtils.CreateVirtualFile(path)) { Shader shader = (Shader)asset; DummyShaderTextExporter.ExportShader(shader, container, fileStream, ShaderExporterInstantiator); } callback?.Invoke(container, asset, path); }