pub fn new(
        device_context: &VkDeviceContext,
        resource_context: &ResourceContext,
        graph: RenderGraphBuilder,
        swapchain_surface_info: &SwapchainSurfaceInfo,
        callbacks: RenderGraphNodeCallbacks<T>,
    ) -> VkResult<Self> {
        //
        // Allocate the resources for the graph
        //
        let prepared_graph = PreparedRenderGraph::new(
            device_context,
            resource_context,
            resource_context.resources(),
            graph,
            swapchain_surface_info,
        )?;

        //
        // Pre-warm caches for pipelines that we may need
        //
        for (node_id, render_phase_indices) in &callbacks.render_phase_dependencies {
            // Passes may get culled if the images are not used. This means the renderpass would
            // not be created so pipelines are also not needed
            if let Some(&renderpass_index) =
                prepared_graph.graph_plan.node_to_pass_index.get(node_id)
            {
                let renderpass = &prepared_graph.renderpass_resources[renderpass_index];
                if let Some(renderpass) = renderpass {
                    for &render_phase_index in render_phase_indices {
                        resource_context
                            .graphics_pipeline_cache()
                            .register_renderpass_to_phase_index_per_frame(
                                renderpass,
                                render_phase_index,
                            )
                    }
                } else {
                    log::error!("add_renderphase_dependency was called on node {:?} ({:?}) that is not a renderpass", node_id, prepared_graph.graph_plan.passes[renderpass_index].debug_name());
                }
            }
        }
        resource_context
            .graphics_pipeline_cache()
            .precache_pipelines_for_all_phases()?;

        //
        // Return the executor which can be triggered later
        //
        Ok(RenderGraphExecutor {
            prepared_graph,
            callbacks,
        })
    }
/// Create the executor. This allows the prepared graph, resources required to execute it, and
/// callbacks that will be triggered while executing it to be passed around and executed later.
Create the executor. This allows the prepared graph, resources required to execute it, and
callbacks that will be triggered while executing it to be passed around and executed later.
Create the executor . This allows the prepared graph resources required to execute it and callbacks that will be triggered while executing it to be passed around and executed later .
pub fn new(
        device_context: &VkDeviceContext,
        resource_context: &ResourceContext,
        graph: RenderGraphBuilder,
        swapchain_surface_info: &SwapchainSurfaceInfo,
        callbacks: RenderGraphNodeCallbacks<T>,
    ) -> VkResult<Self> {
        //
        // Allocate the resources for the graph
        //
        let prepared_graph = PreparedRenderGraph::new(
            device_context,
            resource_context,
            resource_context.resources(),
            graph,
            swapchain_surface_info,
        )?;
        //
        // Pre-warm caches for pipelines that we may need
        //
        for (node_id, render_phase_indices) in &callbacks.render_phase_dependencies {
            // Passes may get culled if the images are not used. This means the renderpass would
            // not be created so pipelines are also not needed
            if let Some(&renderpass_index) =
                prepared_graph.graph_plan.node_to_pass_index.get(node_id)
            {
                let renderpass = &prepared_graph.renderpass_resources[renderpass_index];
                if let Some(renderpass) = renderpass {
                    for &render_phase_index in render_phase_indices {
                        resource_context
                            .graphics_pipeline_cache()
                            .register_renderpass_to_phase_index_per_frame(
                                renderpass,
                                render_phase_index,
                            )
                    }
                } else {
                    log::error!("add_renderphase_dependency was called on node {:?} ({:?}) that is not a renderpass", node_id, prepared_graph.graph_plan.passes[renderpass_index].debug_name());
                }
            }
        }
        resource_context
            .graphics_pipeline_cache()
            .precache_pipelines_for_all_phases()?;
        //
        // Return the executor which can be triggered later
        //
        Ok(RenderGraphExecutor {
            prepared_graph,
            callbacks,
        })
    }
pub fn new ( device_context : & VkDeviceContext , resource_context : & ResourceContext , graph : RenderGraphBuilder , swapchain_surface_info : & SwapchainSurfaceInfo , callbacks : RenderGraphNodeCallbacks < T > , ) -> VkResult < Self > { // // Allocate the resources for the graph // let prepared_graph = PreparedRenderGraph :: new ( device_context , resource_context , resource_context . resources ( ) , graph , swapchain_surface_info , ) ? ; // // Pre-warm caches for pipelines that we may need // for ( node_id , render_phase_indices ) in & callbacks . render_phase_dependencies { // Passes may get culled if the images are not used. This means the renderpass would // not be created so pipelines are also not needed if let Some ( & renderpass_index ) = prepared_graph . graph_plan . node_to_pass_index . get ( node_id ) { let renderpass = & prepared_graph . renderpass_resources [ renderpass_index ] ; if let Some ( renderpass ) = renderpass { for & render_phase_index in render_phase_indices { resource_context . graphics_pipeline_cache ( ) . register_renderpass_to_phase_index_per_frame ( renderpass , render_phase_index , ) } } else { log :: error ! ( " " node_id prepared_graph graph_plan passes [ renderpass_index ] debug_name ( ) ) ; } } } resource_context . graphics_pipeline_cache ( ) . precache_pipelines_for_all_phases ( ) ? ; // // Return the executor which can be triggered later // Ok ( RenderGraphExecutor { prepared_graph , callbacks , } ) }
Create the executor.
Create the executor .
device_context
&VkDeviceContext
resource_context
&ResourceContext
graph
RenderGraphBuilder
swapchain_surface_info
&SwapchainSurfaceInfo
callbacks
RenderGraphNodeCallbacks<T>
device_context
&VkDeviceContext
resource_context
&ResourceContext
graph
RenderGraphBuilder
swapchain_surface_info
&SwapchainSurfaceInfo
callbacks
RenderGraphNodeCallbacks<T>