Struct rafx_framework::graph::RenderGraphBuilder
source · pub struct RenderGraphBuilder { /* private fields */ }
Expand description
A collection of nodes and resources. Nodes represent an event or process that will occur at a certain time. (For now, they just represent subpasses that may be merged with each other.) Resources represent images and buffers that may be read/written by nodes.
Implementations§
source§impl RenderGraphBuilder
impl RenderGraphBuilder
sourcepub fn create_unattached_image(
&mut self,
create_node: RenderGraphNodeId,
constraint: RenderGraphImageConstraint,
view_options: RenderGraphImageViewOptions
) -> RenderGraphImageUsageId
pub fn create_unattached_image( &mut self, create_node: RenderGraphNodeId, constraint: RenderGraphImageConstraint, view_options: RenderGraphImageViewOptions ) -> RenderGraphImageUsageId
Create an image but do not use it (may be passed around and used elsewhere)
sourcepub fn create_color_attachment(
&mut self,
node: RenderGraphNodeId,
color_attachment_index: usize,
clear_color_value: Option<RafxColorClearValue>,
constraint: RenderGraphImageConstraint,
view_options: RenderGraphImageViewOptions
) -> RenderGraphImageUsageId
pub fn create_color_attachment( &mut self, node: RenderGraphNodeId, color_attachment_index: usize, clear_color_value: Option<RafxColorClearValue>, constraint: RenderGraphImageConstraint, view_options: RenderGraphImageViewOptions ) -> RenderGraphImageUsageId
Create a new image and use it as a writable color attachment in a renderpass
sourcepub fn create_depth_attachment(
&mut self,
node: RenderGraphNodeId,
clear_depth_stencil_value: Option<RafxDepthStencilClearValue>,
constraint: RenderGraphImageConstraint,
view_options: RenderGraphImageViewOptions
) -> RenderGraphImageUsageId
pub fn create_depth_attachment( &mut self, node: RenderGraphNodeId, clear_depth_stencil_value: Option<RafxDepthStencilClearValue>, constraint: RenderGraphImageConstraint, view_options: RenderGraphImageViewOptions ) -> RenderGraphImageUsageId
Create a new image and use it as a writable depth attachment in a renderpass
sourcepub fn create_depth_stencil_attachment(
&mut self,
node: RenderGraphNodeId,
clear_depth_stencil_value: Option<RafxDepthStencilClearValue>,
constraint: RenderGraphImageConstraint,
view_options: RenderGraphImageViewOptions,
has_depth: bool,
has_stencil: bool
) -> RenderGraphImageUsageId
pub fn create_depth_stencil_attachment( &mut self, node: RenderGraphNodeId, clear_depth_stencil_value: Option<RafxDepthStencilClearValue>, constraint: RenderGraphImageConstraint, view_options: RenderGraphImageViewOptions, has_depth: bool, has_stencil: bool ) -> RenderGraphImageUsageId
Create a new image and use it as a writable depth/stencil attachment in a renderpass
sourcepub fn create_resolve_attachment(
&mut self,
node: RenderGraphNodeId,
resolve_attachment_index: usize,
constraint: RenderGraphImageConstraint,
view_options: RenderGraphImageViewOptions
) -> RenderGraphImageUsageId
pub fn create_resolve_attachment( &mut self, node: RenderGraphNodeId, resolve_attachment_index: usize, constraint: RenderGraphImageConstraint, view_options: RenderGraphImageViewOptions ) -> RenderGraphImageUsageId
Create a new image and use it as a resolve attachment in a renderpass
sourcepub fn read_color_attachment(
&mut self,
node: RenderGraphNodeId,
image: RenderGraphImageUsageId,
color_attachment_index: usize,
constraint: RenderGraphImageConstraint,
view_options: RenderGraphImageViewOptions
)
pub fn read_color_attachment( &mut self, node: RenderGraphNodeId, image: RenderGraphImageUsageId, color_attachment_index: usize, constraint: RenderGraphImageConstraint, view_options: RenderGraphImageViewOptions )
Use the given image as a read-only color attachment in a renderpass
sourcepub fn read_depth_attachment(
&mut self,
node: RenderGraphNodeId,
image: RenderGraphImageUsageId,
constraint: RenderGraphImageConstraint,
view_options: RenderGraphImageViewOptions
)
pub fn read_depth_attachment( &mut self, node: RenderGraphNodeId, image: RenderGraphImageUsageId, constraint: RenderGraphImageConstraint, view_options: RenderGraphImageViewOptions )
Use the given image as a read-only depth attachment in a renderpass
sourcepub fn read_depth_stencil_attachment(
&mut self,
node: RenderGraphNodeId,
image: RenderGraphImageUsageId,
constraint: RenderGraphImageConstraint,
view_options: RenderGraphImageViewOptions,
has_depth: bool,
has_stencil: bool
)
pub fn read_depth_stencil_attachment( &mut self, node: RenderGraphNodeId, image: RenderGraphImageUsageId, constraint: RenderGraphImageConstraint, view_options: RenderGraphImageViewOptions, has_depth: bool, has_stencil: bool )
Use the given image as a read-only depth/stencil attachment in a renderpass
sourcepub fn modify_color_attachment(
&mut self,
node: RenderGraphNodeId,
image: RenderGraphImageUsageId,
color_attachment_index: usize,
clear_color_value: Option<RafxColorClearValue>,
constraint: RenderGraphImageConstraint,
view_options: RenderGraphImageViewOptions
) -> RenderGraphImageUsageId
pub fn modify_color_attachment( &mut self, node: RenderGraphNodeId, image: RenderGraphImageUsageId, color_attachment_index: usize, clear_color_value: Option<RafxColorClearValue>, constraint: RenderGraphImageConstraint, view_options: RenderGraphImageViewOptions ) -> RenderGraphImageUsageId
Use the given image as a writable color attachment in a renderpass
sourcepub fn modify_depth_attachment(
&mut self,
node: RenderGraphNodeId,
image: RenderGraphImageUsageId,
clear_depth_stencil_value: Option<RafxDepthStencilClearValue>,
constraint: RenderGraphImageConstraint,
view_options: RenderGraphImageViewOptions
) -> RenderGraphImageUsageId
pub fn modify_depth_attachment( &mut self, node: RenderGraphNodeId, image: RenderGraphImageUsageId, clear_depth_stencil_value: Option<RafxDepthStencilClearValue>, constraint: RenderGraphImageConstraint, view_options: RenderGraphImageViewOptions ) -> RenderGraphImageUsageId
Use the given image as a writable depth attachment in a renderpass
sourcepub fn modify_depth_stencil_attachment(
&mut self,
node: RenderGraphNodeId,
image: RenderGraphImageUsageId,
clear_depth_stencil_value: Option<RafxDepthStencilClearValue>,
constraint: RenderGraphImageConstraint,
view_options: RenderGraphImageViewOptions
) -> RenderGraphImageUsageId
pub fn modify_depth_stencil_attachment( &mut self, node: RenderGraphNodeId, image: RenderGraphImageUsageId, clear_depth_stencil_value: Option<RafxDepthStencilClearValue>, constraint: RenderGraphImageConstraint, view_options: RenderGraphImageViewOptions ) -> RenderGraphImageUsageId
Use the given image as a writable depth/stencil attachment in a renderpass
sourcepub fn sample_image(
&mut self,
node: RenderGraphNodeId,
image: RenderGraphImageUsageId,
constraint: RenderGraphImageConstraint,
view_options: RenderGraphImageViewOptions
) -> RenderGraphImageUsageId
pub fn sample_image( &mut self, node: RenderGraphNodeId, image: RenderGraphImageUsageId, constraint: RenderGraphImageConstraint, view_options: RenderGraphImageViewOptions ) -> RenderGraphImageUsageId
Use the given image as a shader resource (i.e. can sample from the image) in a renderpass
sourcepub fn read_vertex_buffer(
&mut self,
node: RenderGraphNodeId,
buffer: RenderGraphBufferUsageId,
constraint: RenderGraphBufferConstraint
) -> RenderGraphBufferUsageId
pub fn read_vertex_buffer( &mut self, node: RenderGraphNodeId, buffer: RenderGraphBufferUsageId, constraint: RenderGraphBufferConstraint ) -> RenderGraphBufferUsageId
Use the given buffer as a vertex buffer
sourcepub fn read_index_buffer(
&mut self,
node: RenderGraphNodeId,
buffer: RenderGraphBufferUsageId,
constraint: RenderGraphBufferConstraint
) -> RenderGraphBufferUsageId
pub fn read_index_buffer( &mut self, node: RenderGraphNodeId, buffer: RenderGraphBufferUsageId, constraint: RenderGraphBufferConstraint ) -> RenderGraphBufferUsageId
Use the given buffer as an index buffer
sourcepub fn read_indirect_buffer(
&mut self,
node: RenderGraphNodeId,
buffer: RenderGraphBufferUsageId,
constraint: RenderGraphBufferConstraint
) -> RenderGraphBufferUsageId
pub fn read_indirect_buffer( &mut self, node: RenderGraphNodeId, buffer: RenderGraphBufferUsageId, constraint: RenderGraphBufferConstraint ) -> RenderGraphBufferUsageId
Use the given buffer as an indirect buffer
sourcepub fn read_uniform_buffer(
&mut self,
node: RenderGraphNodeId,
buffer: RenderGraphBufferUsageId,
constraint: RenderGraphBufferConstraint
) -> RenderGraphBufferUsageId
pub fn read_uniform_buffer( &mut self, node: RenderGraphNodeId, buffer: RenderGraphBufferUsageId, constraint: RenderGraphBufferConstraint ) -> RenderGraphBufferUsageId
Use the given buffer as a uniform buffer
sourcepub fn read_copy_src_buffer(
&mut self,
node: RenderGraphNodeId,
buffer: RenderGraphBufferUsageId,
constraint: RenderGraphBufferConstraint
) -> RenderGraphBufferUsageId
pub fn read_copy_src_buffer( &mut self, node: RenderGraphNodeId, buffer: RenderGraphBufferUsageId, constraint: RenderGraphBufferConstraint ) -> RenderGraphBufferUsageId
Use the given buffer as a copy source
sourcepub fn write_copy_dst_buffer(
&mut self,
node: RenderGraphNodeId,
buffer: RenderGraphBufferUsageId,
constraint: RenderGraphBufferConstraint
) -> RenderGraphBufferUsageId
pub fn write_copy_dst_buffer( &mut self, node: RenderGraphNodeId, buffer: RenderGraphBufferUsageId, constraint: RenderGraphBufferConstraint ) -> RenderGraphBufferUsageId
Use the given buffer as a copy destination
sourcepub fn read_copy_src_image(
&mut self,
node: RenderGraphNodeId,
image: RenderGraphImageUsageId,
constraint: RenderGraphImageConstraint,
view_options: RenderGraphImageViewOptions
) -> RenderGraphImageUsageId
pub fn read_copy_src_image( &mut self, node: RenderGraphNodeId, image: RenderGraphImageUsageId, constraint: RenderGraphImageConstraint, view_options: RenderGraphImageViewOptions ) -> RenderGraphImageUsageId
Use the given image as a copy source
sourcepub fn write_copy_dst_image(
&mut self,
node: RenderGraphNodeId,
image: RenderGraphImageUsageId,
constraint: RenderGraphImageConstraint,
view_options: RenderGraphImageViewOptions
) -> RenderGraphImageUsageId
pub fn write_copy_dst_image( &mut self, node: RenderGraphNodeId, image: RenderGraphImageUsageId, constraint: RenderGraphImageConstraint, view_options: RenderGraphImageViewOptions ) -> RenderGraphImageUsageId
Use the given image as a copy destination
sourcepub fn create_storage_buffer(
&mut self,
node: RenderGraphNodeId,
constraint: RenderGraphBufferConstraint,
load_op: RafxLoadOp
) -> RenderGraphBufferUsageId
pub fn create_storage_buffer( &mut self, node: RenderGraphNodeId, constraint: RenderGraphBufferConstraint, load_op: RafxLoadOp ) -> RenderGraphBufferUsageId
Create a storage buffer and use it as a writable shader resource
sourcepub fn read_storage_buffer(
&mut self,
node: RenderGraphNodeId,
buffer: RenderGraphBufferUsageId,
constraint: RenderGraphBufferConstraint
) -> RenderGraphBufferUsageId
pub fn read_storage_buffer( &mut self, node: RenderGraphNodeId, buffer: RenderGraphBufferUsageId, constraint: RenderGraphBufferConstraint ) -> RenderGraphBufferUsageId
Use the given storage buffer as a read-only shader resource
sourcepub fn modify_storage_buffer(
&mut self,
node: RenderGraphNodeId,
buffer: RenderGraphBufferUsageId,
constraint: RenderGraphBufferConstraint,
load_op: RafxLoadOp
) -> RenderGraphBufferUsageId
pub fn modify_storage_buffer( &mut self, node: RenderGraphNodeId, buffer: RenderGraphBufferUsageId, constraint: RenderGraphBufferConstraint, load_op: RafxLoadOp ) -> RenderGraphBufferUsageId
Use the given storage buffer as a writable shader resource
sourcepub fn create_storage_image(
&mut self,
node: RenderGraphNodeId,
constraint: RenderGraphImageConstraint,
view_options: RenderGraphImageViewOptions
) -> RenderGraphImageUsageId
pub fn create_storage_image( &mut self, node: RenderGraphNodeId, constraint: RenderGraphImageConstraint, view_options: RenderGraphImageViewOptions ) -> RenderGraphImageUsageId
Create a storage image and use it as a writable shader resource
sourcepub fn read_storage_image(
&mut self,
node: RenderGraphNodeId,
image: RenderGraphImageUsageId,
constraint: RenderGraphImageConstraint,
view_options: RenderGraphImageViewOptions
) -> RenderGraphImageUsageId
pub fn read_storage_image( &mut self, node: RenderGraphNodeId, image: RenderGraphImageUsageId, constraint: RenderGraphImageConstraint, view_options: RenderGraphImageViewOptions ) -> RenderGraphImageUsageId
Use the given storage image as a read-only shader resource
sourcepub fn modify_storage_image(
&mut self,
node: RenderGraphNodeId,
image: RenderGraphImageUsageId,
constraint: RenderGraphImageConstraint,
view_options: RenderGraphImageViewOptions
) -> RenderGraphImageUsageId
pub fn modify_storage_image( &mut self, node: RenderGraphNodeId, image: RenderGraphImageUsageId, constraint: RenderGraphImageConstraint, view_options: RenderGraphImageViewOptions ) -> RenderGraphImageUsageId
Use the given storage image as a writable shader resource
sourcepub fn add_external_image(
&mut self,
image_resource: ResourceArc<ImageViewResource>,
view_options: RenderGraphImageViewOptions,
initial_state: RafxResourceState,
final_state: RafxResourceState
) -> RenderGraphExternalImageId
pub fn add_external_image( &mut self, image_resource: ResourceArc<ImageViewResource>, view_options: RenderGraphImageViewOptions, initial_state: RafxResourceState, final_state: RafxResourceState ) -> RenderGraphExternalImageId
Register a non-rendergraph image for use with the rendergraph. (Use read_external_image() or write_external_image() to access it)
sourcepub fn add_external_buffer(
&mut self,
buffer_resource: ResourceArc<BufferResource>,
initial_state: RafxResourceState,
final_state: RafxResourceState
) -> RenderGraphExternalBufferId
pub fn add_external_buffer( &mut self, buffer_resource: ResourceArc<BufferResource>, initial_state: RafxResourceState, final_state: RafxResourceState ) -> RenderGraphExternalBufferId
Register a non-rendergraph buffer for use with the rendergraph. (Use read_external_buffer() or write_external_buffer() to access it)
sourcepub fn read_external_image(
&mut self,
external_image_id: RenderGraphExternalImageId
) -> RenderGraphImageUsageId
pub fn read_external_image( &mut self, external_image_id: RenderGraphExternalImageId ) -> RenderGraphImageUsageId
Use an external image as an input for a render graph node
sourcepub fn read_external_buffer(
&mut self,
external_buffer_id: RenderGraphExternalBufferId
) -> RenderGraphBufferUsageId
pub fn read_external_buffer( &mut self, external_buffer_id: RenderGraphExternalBufferId ) -> RenderGraphBufferUsageId
Use an external buffer as an input for a render graph node
sourcepub fn write_external_image(
&mut self,
external_image_id: RenderGraphExternalImageId,
image_id: RenderGraphImageUsageId
)
pub fn write_external_image( &mut self, external_image_id: RenderGraphExternalImageId, image_id: RenderGraphImageUsageId )
Use an external image as an output for a render graph node
sourcepub fn write_external_buffer(
&mut self,
external_buffer_id: RenderGraphExternalBufferId,
buffer_id: RenderGraphBufferUsageId
)
pub fn write_external_buffer( &mut self, external_buffer_id: RenderGraphExternalBufferId, buffer_id: RenderGraphBufferUsageId )
Use an external buffer as an output for a render graph node
sourcepub fn copy_buffer_to_buffer(
&mut self,
name: &'static str,
queue: RenderGraphQueue,
src_buffer: RenderGraphBufferUsageId,
dst_buffer: Option<RenderGraphBufferUsageId>,
params: Option<RafxCmdCopyBufferToBufferParams>
) -> RenderGraphBufferUsageId
pub fn copy_buffer_to_buffer( &mut self, name: &'static str, queue: RenderGraphQueue, src_buffer: RenderGraphBufferUsageId, dst_buffer: Option<RenderGraphBufferUsageId>, params: Option<RafxCmdCopyBufferToBufferParams> ) -> RenderGraphBufferUsageId
Schedule a GPU copy from one buffer to another. If dst_buffer is None, create a copy of the src_buffer.
sourcepub fn clone_buffer(
&mut self,
name: &'static str,
queue: RenderGraphQueue,
src_buffer: RenderGraphBufferUsageId,
params: Option<RafxCmdCopyBufferToBufferParams>
) -> RenderGraphBufferUsageId
pub fn clone_buffer( &mut self, name: &'static str, queue: RenderGraphQueue, src_buffer: RenderGraphBufferUsageId, params: Option<RafxCmdCopyBufferToBufferParams> ) -> RenderGraphBufferUsageId
Create a buffer and schedule a GPU copy from the src_buffer into it. (Shorthand for using copy_buffer_to_buffer())
sourcepub fn copy_image_to_image(
&mut self,
name: &'static str,
queue: RenderGraphQueue,
src_image: RenderGraphImageUsageId,
dst_image: Option<RenderGraphImageUsageId>,
params: Option<RafxCmdCopyTextureToTextureParams>
) -> RenderGraphImageUsageId
pub fn copy_image_to_image( &mut self, name: &'static str, queue: RenderGraphQueue, src_image: RenderGraphImageUsageId, dst_image: Option<RenderGraphImageUsageId>, params: Option<RafxCmdCopyTextureToTextureParams> ) -> RenderGraphImageUsageId
Schedule a GPU copy from one image to another. If dst_image is None, create a copy of the src_image.
sourcepub fn clone_image(
&mut self,
name: &'static str,
queue: RenderGraphQueue,
src_image: RenderGraphImageUsageId,
params: Option<RafxCmdCopyTextureToTextureParams>
) -> RenderGraphImageUsageId
pub fn clone_image( &mut self, name: &'static str, queue: RenderGraphQueue, src_image: RenderGraphImageUsageId, params: Option<RafxCmdCopyTextureToTextureParams> ) -> RenderGraphImageUsageId
Create a image and schedule a GPU copy from the src_buffer into it. (Shorthand for using copy_image_to_image())
sourcepub fn blit_image_to_image(
&mut self,
name: &'static str,
queue: RenderGraphQueue,
src_image: RenderGraphImageUsageId,
src_min_uv: Vec2,
src_max_uv: Vec2,
dst_image: RenderGraphImageUsageId,
dst_min_uv: Vec2,
dst_max_uv: Vec2
) -> RenderGraphImageUsageId
pub fn blit_image_to_image( &mut self, name: &'static str, queue: RenderGraphQueue, src_image: RenderGraphImageUsageId, src_min_uv: Vec2, src_max_uv: Vec2, dst_image: RenderGraphImageUsageId, dst_min_uv: Vec2, dst_max_uv: Vec2 ) -> RenderGraphImageUsageId
Render the src_image into the dst_image. This is less efficient than copy_image_to_image, but is more flexible. (It is essentially drawing the src_image as a quad on the dst_image)
pub fn add_renderpass_node( &mut self, name: &'static str, queue: RenderGraphQueue ) -> RenderGraphNodeId
pub fn add_callback_node( &mut self, name: &'static str, queue: RenderGraphQueue ) -> RenderGraphNodeId
pub fn add_node( &mut self, name: &'static str, kind: RenderGraphNodeKind, queue: RenderGraphQueue ) -> RenderGraphNodeId
pub fn add_node_unnamed( &mut self, kind: RenderGraphNodeKind, queue: RenderGraphQueue ) -> RenderGraphNodeId
pub fn set_node_required(&mut self, node_id: RenderGraphNodeId)
pub fn add_explicit_dependency( &mut self, before_node_id: RenderGraphNodeId, after_node_id: RenderGraphNodeId )
pub fn set_buffer_required(&mut self, buffer_usage: RenderGraphBufferUsageId)
pub fn set_image_required(&mut self, image_usage: RenderGraphImageUsageId)
pub fn set_node_name(&mut self, node_id: RenderGraphNodeId, name: &'static str)
pub fn set_image_name( &mut self, image_id: RenderGraphImageUsageId, name: RenderGraphResourceName )
pub fn set_buffer_name( &mut self, buffer_id: RenderGraphBufferUsageId, name: RenderGraphResourceName )
sourcepub fn set_renderpass_callback<CallbackFnT>(
&mut self,
node_id: RenderGraphNodeId,
f: CallbackFnT
)
pub fn set_renderpass_callback<CallbackFnT>( &mut self, node_id: RenderGraphNodeId, f: CallbackFnT )
Adds a callback that receives the renderpass associated with the node
sourcepub fn set_callback<CallbackFnT>(
&mut self,
node_id: RenderGraphNodeId,
f: CallbackFnT
)
pub fn set_callback<CallbackFnT>( &mut self, node_id: RenderGraphNodeId, f: CallbackFnT )
Adds a callback for compute based nodes
pub fn add_render_phase_dependency<PhaseT: RenderPhase>( &mut self, node_id: RenderGraphNodeId )
pub fn build_plan( self, swapchain_surface_info: &SwapchainSurfaceInfo ) -> RenderGraphPlan
Trait Implementations§
source§impl Default for RenderGraphBuilder
impl Default for RenderGraphBuilder
source§fn default() -> RenderGraphBuilder
fn default() -> RenderGraphBuilder
Auto Trait Implementations§
impl !RefUnwindSafe for RenderGraphBuilder
impl Send for RenderGraphBuilder
impl !Sync for RenderGraphBuilder
impl Unpin for RenderGraphBuilder
impl !UnwindSafe for RenderGraphBuilder
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.