static void BuildEngine(CommandLineOptions commandLine, EventExchange exchange) { PerfTracker.StartupEvent("Creating engine"); var framebuffer = new MainFramebuffer(); var sceneRenderer = new SceneRenderer("MainRenderer", framebuffer); sceneRenderer // TODO: Populate from json so mods can add new render methods .AddRenderer(new SpriteRenderer(framebuffer), typeof(VeldridSpriteBatch)) .AddRenderer(new EtmRenderer(framebuffer), typeof(EtmWindow)) .AddRenderer(new SkyboxRenderer(framebuffer), typeof(Skybox)) .AddRenderer(new DebugGuiRenderer(framebuffer), typeof(DebugGuiRenderable)) ; var engine = new Engine(commandLine.Backend, commandLine.UseRenderDoc, commandLine.StartupOnly, true, sceneRenderer); #pragma warning disable CA2000 // Dispose objects before losing scopes var config = exchange.Resolve <IGeneralConfig>(); var shaderCache = new ShaderCache(config.ResolvePath("$(CACHE)/ShaderCache")); foreach (var shaderPath in exchange.Resolve <IModApplier>().ShaderPaths) { shaderCache.AddShaderPath(shaderPath); } #pragma warning restore CA2000 // Dispose objects before losing scopes exchange .Attach(shaderCache) .Attach(framebuffer) .Attach(sceneRenderer) .Attach(engine) .Attach(new ResourceLayoutSource()) ; }