/// Create a storage buffer and use it as a writable shader resource
Create a storage buffer and use it as a writable shader resource
Create a storage buffer and use it as a writable shader resource
pub fn create_storage_buffer(
        &mut self,
        node: RenderGraphNodeId,
        mut constraint: RenderGraphBufferConstraint,
        load_op: RafxLoadOp,
    ) -> RenderGraphBufferUsageId {
        constraint.resource_type |= RafxResourceType::BUFFER_READ_WRITE;
        match load_op {
            RafxLoadOp::DontCare => {
                let usage = self.add_buffer_create(node, constraint);
                self.node_mut(node).storage_buffer_creates.push(usage);
                usage
            }
            RafxLoadOp::Load => unimplemented!("RafxLoadOp::Load not supported in create_storage_buffer call. Use modify_storage_image instead."),
            RafxLoadOp::Clear => {
                // Add a node to clear the buffer
                let clear_node = self.add_node("create_storage_buffer_clear", self.node(node).queue);
                let cleared_buffer = self.add_buffer_create(clear_node, constraint);
                self.node_mut(clear_node).storage_buffer_creates.push(cleared_buffer);
                self.setup_buffer_clear_callback(clear_node, cleared_buffer);
                // Now set this node up to modify the buffer
                let (read_usage, write_usage) = self.add_buffer_modify(node, cleared_buffer, Default::default());
                self.node_mut(node).storage_buffer_modifies.push(read_usage);
                write_usage
            }
        }
    }
pub fn create_storage_buffer ( & mut self , node : RenderGraphNodeId , mut constraint : RenderGraphBufferConstraint , load_op : RafxLoadOp , ) -> RenderGraphBufferUsageId { constraint . resource_type |= RafxResourceType :: BUFFER_READ_WRITE ; match load_op { RafxLoadOp :: DontCare => { let usage = self . add_buffer_create ( node , constraint ) ; self . node_mut ( node ) . storage_buffer_creates . push ( usage ) ; usage } RafxLoadOp :: Load => unimplemented ! ( " " ) , RafxLoadOp :: Clear => { // Add a node to clear the buffer let clear_node = self . add_node ( " " , self . node ( node ) . queue ) ; let cleared_buffer = self . add_buffer_create ( clear_node , constraint ) ; self . node_mut ( clear_node ) . storage_buffer_creates . push ( cleared_buffer ) ; self . setup_buffer_clear_callback ( clear_node , cleared_buffer ) ; // Now set this node up to modify the buffer let ( read_usage , write_usage ) = self . add_buffer_modify ( node , cleared_buffer , Default :: default ( ) ) ; self . node_mut ( node ) . storage_buffer_modifies . push ( read_usage ) ; write_usage } } }
Create a storage buffer and use it as a writable shader resource
Create a storage buffer and use it as a writable shader resource
&mut self
node
RenderGraphNodeId
constraint
RenderGraphBufferConstraint
load_op
RafxLoadOp