pub fn copy_buffer_to_buffer(
        &mut self,
        name: RenderGraphNodeName,
        queue: RenderGraphQueue,
        src_buffer: RenderGraphBufferUsageId,
        dst_buffer: Option<RenderGraphBufferUsageId>,
        params: Option<RafxCmdCopyBufferToBufferParams>,
    ) -> RenderGraphBufferUsageId {
        let node = self.add_node(name, queue);
        let src_buffer = self.read_copy_src_buffer(node, src_buffer, Default::default());
        let dst_buffer = if let Some(dst_buffer) = dst_buffer {
            self.write_copy_dst_buffer(node, dst_buffer, Default::default())
        } else {
            // This is a combination of create_storage_buffer() and write_copy_dst_buffer()
            let dst_buffer = self.add_buffer_create(node, Default::default());
            self.node_mut(node).copy_dst_buffer_writes.push(dst_buffer);
            dst_buffer
        };

        self.nodes[node.0]
            .buffer_copies
            .push(RenderGraphBufferCopy {
                input: src_buffer,
                output: dst_buffer,
                constraint: Default::default(),
            });

        self.set_callback(node, move |args| {
            let src = args.graph_context.buffer(src_buffer).unwrap();
            let dst = args.graph_context.buffer(dst_buffer).unwrap();

            let params = params.clone().unwrap_or_else(|| {
                let src_size = src.get_raw().buffer.buffer_def().size;
                let dst_size = dst.get_raw().buffer.buffer_def().size;
                assert_eq!(src_size, dst_size);

                RafxCmdCopyBufferToBufferParams {
                    src_byte_offset: 0,
                    dst_byte_offset: 0,
                    size: src_size,
                }
            });

            args.command_buffer.cmd_copy_buffer_to_buffer(
                &src.get_raw().buffer,
                &dst.get_raw().buffer,
                &params,
            )
        });

        dst_buffer
    }
/// Schedule a GPU copy from one buffer to another. If dst_buffer is None, create a copy of the
/// src_buffer.
Schedule a GPU copy from one buffer to another. If dst_buffer is None, create a copy of the
src_buffer.
Schedule a GPU copy from one buffer to another . If dst_buffer is None create a copy of the src_buffer .
pub fn copy_buffer_to_buffer(
        &mut self,
        name: RenderGraphNodeName,
        queue: RenderGraphQueue,
        src_buffer: RenderGraphBufferUsageId,
        dst_buffer: Option<RenderGraphBufferUsageId>,
        params: Option<RafxCmdCopyBufferToBufferParams>,
    ) -> RenderGraphBufferUsageId {
        let node = self.add_node(name, queue);
        let src_buffer = self.read_copy_src_buffer(node, src_buffer, Default::default());
        let dst_buffer = if let Some(dst_buffer) = dst_buffer {
            self.write_copy_dst_buffer(node, dst_buffer, Default::default())
        } else {
            // This is a combination of create_storage_buffer() and write_copy_dst_buffer()
            let dst_buffer = self.add_buffer_create(node, Default::default());
            self.node_mut(node).copy_dst_buffer_writes.push(dst_buffer);
            dst_buffer
        };
        self.nodes[node.0]
            .buffer_copies
            .push(RenderGraphBufferCopy {
                input: src_buffer,
                output: dst_buffer,
                constraint: Default::default(),
            });
        self.set_callback(node, move |args| {
            let src = args.graph_context.buffer(src_buffer).unwrap();
            let dst = args.graph_context.buffer(dst_buffer).unwrap();
            let params = params.clone().unwrap_or_else(|| {
                let src_size = src.get_raw().buffer.buffer_def().size;
                let dst_size = dst.get_raw().buffer.buffer_def().size;
                assert_eq!(src_size, dst_size);
                RafxCmdCopyBufferToBufferParams {
                    src_byte_offset: 0,
                    dst_byte_offset: 0,
                    size: src_size,
                }
            });
            args.command_buffer.cmd_copy_buffer_to_buffer(
                &src.get_raw().buffer,
                &dst.get_raw().buffer,
                &params,
            )
        });
        dst_buffer
    }
pub fn copy_buffer_to_buffer ( & mut self , name : RenderGraphNodeName , queue : RenderGraphQueue , src_buffer : RenderGraphBufferUsageId , dst_buffer : Option < RenderGraphBufferUsageId > , params : Option < RafxCmdCopyBufferToBufferParams > , ) -> RenderGraphBufferUsageId { let node = self . add_node ( name , queue ) ; let src_buffer = self . read_copy_src_buffer ( node , src_buffer , Default :: default ( ) ) ; let dst_buffer = if let Some ( dst_buffer ) = dst_buffer { self . write_copy_dst_buffer ( node , dst_buffer , Default :: default ( ) ) } else { // This is a combination of create_storage_buffer() and write_copy_dst_buffer() let dst_buffer = self . add_buffer_create ( node , Default :: default ( ) ) ; self . node_mut ( node ) . copy_dst_buffer_writes . push ( dst_buffer ) ; dst_buffer } ; self . nodes [ node . 0 ] . buffer_copies . push ( RenderGraphBufferCopy { input : src_buffer , output : dst_buffer , constraint : Default :: default ( ) , } ) ; self . set_callback ( node , move | args | { let src = args . graph_context . buffer ( src_buffer ) . unwrap ( ) ; let dst = args . graph_context . buffer ( dst_buffer ) . unwrap ( ) ; let params = params . clone ( ) . unwrap_or_else ( | | { let src_size = src . get_raw ( ) . buffer . buffer_def ( ) . size ; let dst_size = dst . get_raw ( ) . buffer . buffer_def ( ) . size ; assert_eq ! ( src_size dst_size ) ; RafxCmdCopyBufferToBufferParams { src_byte_offset : 0 , dst_byte_offset : 0 , size : src_size , } } ) ; args . command_buffer . cmd_copy_buffer_to_buffer ( & src . get_raw ( ) . buffer , & dst . get_raw ( ) . buffer , & params , ) } ) ; dst_buffer }
Schedule a GPU copy from one buffer to another.
Schedule a GPU copy from one buffer to another .
&mut self
name
RenderGraphNodeName
queue
RenderGraphQueue
src_buffer
RenderGraphBufferUsageId
dst_buffer
Option<RenderGraphBufferUsageId>
params
Option<RafxCmdCopyBufferToBufferParams>
&mut self
name
RenderGraphNodeName
queue
RenderGraphQueue
src_buffer
RenderGraphBufferUsageId
dst_buffer
Option<RenderGraphBufferUsageId>
params
Option<RafxCmdCopyBufferToBufferParams>