Struct nannou::wgpu::RenderPipelineBuilder
source · pub struct RenderPipelineBuilder<'a> { /* private fields */ }
Expand description
A builder type to help simplify the construction of a RenderPipeline.
We’ve attempted to provide a suite of reasonable defaults in the case that none are provided.
Implementations§
source§impl<'a> RenderPipelineBuilder<'a>
impl<'a> RenderPipelineBuilder<'a>
pub const DEFAULT_SHADER_ENTRY_POINT: &'static str = "main"
pub const DEFAULT_FRONT_FACE: FrontFace = wgpu::FrontFace::Ccw
pub const DEFAULT_CULL_MODE: Option<Face> = None
pub const DEFAULT_POLYGON_MODE: PolygonMode = wgpu::PolygonMode::Fill
pub const DEFAULT_PRIMITIVE_TOPOLOGY: PrimitiveTopology = wgpu::PrimitiveTopology::TriangleList
pub const DEFAULT_PRIMITIVE: PrimitiveState = _
pub const DEFAULT_COLOR_FORMAT: TextureFormat = wgpu::TextureFormat::Rgba16Float
pub const DEFAULT_COLOR_BLEND: BlendComponent = _
pub const DEFAULT_ALPHA_BLEND: BlendComponent = _
pub const DEFAULT_COLOR_WRITE: ColorWrites = wgpu::ColorWrites::ALL
pub const DEFAULT_BLEND_STATE: BlendState = _
pub const DEFAULT_COLOR_STATE: ColorTargetState = _
pub const DEFAULT_DEPTH_FORMAT: TextureFormat = wgpu::TextureFormat::Depth32Float
pub const DEFAULT_DEPTH_WRITE_ENABLED: bool = true
pub const DEFAULT_DEPTH_COMPARE: CompareFunction = wgpu::CompareFunction::LessEqual
pub const DEFAULT_STENCIL_FRONT: StencilFaceState = wgpu::StencilFaceState::IGNORE
pub const DEFAULT_STENCIL_BACK: StencilFaceState = wgpu::StencilFaceState::IGNORE
pub const DEFAULT_STENCIL_READ_MASK: u32 = 0u32
pub const DEFAULT_STENCIL_WRITE_MASK: u32 = 0u32
pub const DEFAULT_STENCIL: StencilState = _
pub const DEFAULT_DEPTH_BIAS_CONSTANT: i32 = 0i32
pub const DEFAULT_DEPTH_BIAS_SLOPE_SCALE: f32 = 0f32
pub const DEFAULT_DEPTH_BIAS_CLAMP: f32 = 0f32
pub const DEFAULT_DEPTH_BIAS: DepthBiasState = _
pub const DEFAULT_UNCLIPPED_DEPTH: bool = false
pub const DEFAULT_DEPTH_STENCIL: DepthStencilState = _
pub const DEFAULT_SAMPLE_COUNT: u32 = 1u32
pub const DEFAULT_SAMPLE_MASK: u64 = 18_446_744_073_709_551_615u64
pub const DEFAULT_ALPHA_TO_COVERAGE_ENABLED: bool = false
pub const DEFAULT_MULTISAMPLE: MultisampleState = _
sourcepub fn from_layout(
layout: &'a PipelineLayout,
vs_mod: &'a ShaderModule
) -> RenderPipelineBuilder<'a>
pub fn from_layout( layout: &'a PipelineLayout, vs_mod: &'a ShaderModule ) -> RenderPipelineBuilder<'a>
Begin building the render pipeline for the given pipeline layout and the vertex shader module.
sourcepub fn from_layout_descriptor<T>(
layout_desc: T,
vs_mod: &'a ShaderModule
) -> RenderPipelineBuilder<'a>where
T: IntoPipelineLayoutDescriptor<'a>,
pub fn from_layout_descriptor<T>(
layout_desc: T,
vs_mod: &'a ShaderModule
) -> RenderPipelineBuilder<'a>where
T: IntoPipelineLayoutDescriptor<'a>,
Begin building the render pipeline for a pipeline with the given layout descriptor and the vertex shader module.
sourcepub fn vertex_entry_point(
self,
entry_point: &'a str
) -> RenderPipelineBuilder<'a>
pub fn vertex_entry_point( self, entry_point: &'a str ) -> RenderPipelineBuilder<'a>
The name of the entry point in the compiled shader.
There must be a function that returns void with this name in the shader.
sourcepub fn fragment_entry_point(
self,
entry_point: &'a str
) -> RenderPipelineBuilder<'a>
pub fn fragment_entry_point( self, entry_point: &'a str ) -> RenderPipelineBuilder<'a>
The name of the entry point in the compiled shader.
There must be a function that returns void with this name in the shader.
sourcepub fn fragment_shader(
self,
fs_mod: &'a ShaderModule
) -> RenderPipelineBuilder<'a>
pub fn fragment_shader( self, fs_mod: &'a ShaderModule ) -> RenderPipelineBuilder<'a>
Specify a compiled fragment shader for the render pipeline.
sourcepub fn primitive(self, p: PrimitiveState) -> RenderPipelineBuilder<'a>
pub fn primitive(self, p: PrimitiveState) -> RenderPipelineBuilder<'a>
Specify the full primitive state.
Describes the state of primitive assembly and rasterization in a render pipeline.
sourcepub fn front_face(self, front_face: FrontFace) -> RenderPipelineBuilder<'a>
pub fn front_face(self, front_face: FrontFace) -> RenderPipelineBuilder<'a>
The face to consider the front for the purpose of culling and stencil operations.
sourcepub fn cull_mode(self, cull_mode: Option<Face>) -> RenderPipelineBuilder<'a>
pub fn cull_mode(self, cull_mode: Option<Face>) -> RenderPipelineBuilder<'a>
The face culling mode.
sourcepub fn primitive_topology(
self,
topology: PrimitiveTopology
) -> RenderPipelineBuilder<'a>
pub fn primitive_topology( self, topology: PrimitiveTopology ) -> RenderPipelineBuilder<'a>
Specify the primitive topology.
This represents the way vertices will be read from the VertexBuffer.
sourcepub fn polygon_mode(self, mode: PolygonMode) -> RenderPipelineBuilder<'a>
pub fn polygon_mode(self, mode: PolygonMode) -> RenderPipelineBuilder<'a>
Controls the way each polygon is rasterized. Can be either Fill
(default), Line
or
Point
.
Setting this to something other than Fill
requires Features::NON_FILL_POLYGON_MODE
to
be enabled.
sourcepub fn color_state(self, state: ColorTargetState) -> RenderPipelineBuilder<'a>
pub fn color_state(self, state: ColorTargetState) -> RenderPipelineBuilder<'a>
Specify the full color state for drawing to the output attachment.
If you have multiple output attachments, see the color_states
method.
sourcepub fn color_format(self, format: TextureFormat) -> RenderPipelineBuilder<'a>
pub fn color_format(self, format: TextureFormat) -> RenderPipelineBuilder<'a>
The texture formrat of the image that this pipelinew ill render to.
Must match the format of the corresponding color attachment.
sourcepub fn color_blend(
self,
color_blend: BlendComponent
) -> RenderPipelineBuilder<'a>
pub fn color_blend( self, color_blend: BlendComponent ) -> RenderPipelineBuilder<'a>
The color blending used for this pipeline.
sourcepub fn alpha_blend(
self,
alpha_blend: BlendComponent
) -> RenderPipelineBuilder<'a>
pub fn alpha_blend( self, alpha_blend: BlendComponent ) -> RenderPipelineBuilder<'a>
The alpha blending used for this pipeline.
sourcepub fn write_mask(self, mask: ColorWrites) -> RenderPipelineBuilder<'a>
pub fn write_mask(self, mask: ColorWrites) -> RenderPipelineBuilder<'a>
Mask which enables/disables writes to different color/alpha channel.
sourcepub fn depth_stencil(
self,
state: DepthStencilState
) -> RenderPipelineBuilder<'a>
pub fn depth_stencil( self, state: DepthStencilState ) -> RenderPipelineBuilder<'a>
Specify the full depth stencil state.
sourcepub fn depth_format(self, format: TextureFormat) -> RenderPipelineBuilder<'a>
pub fn depth_format(self, format: TextureFormat) -> RenderPipelineBuilder<'a>
Format of the depth/stencil buffer. Must be one of the depth formats. Must match the format of the depth/stencil attachment.
pub fn depth_write_enabled(self, enabled: bool) -> RenderPipelineBuilder<'a>
sourcepub fn depth_compare(
self,
compare: CompareFunction
) -> RenderPipelineBuilder<'a>
pub fn depth_compare( self, compare: CompareFunction ) -> RenderPipelineBuilder<'a>
Comparison function used to compare depth values in the depth test.
sourcepub fn stencil(self, stencil: StencilState) -> RenderPipelineBuilder<'a>
pub fn stencil(self, stencil: StencilState) -> RenderPipelineBuilder<'a>
Specify the full set of stencil parameters.
sourcepub fn stencil_front(
self,
stencil: StencilFaceState
) -> RenderPipelineBuilder<'a>
pub fn stencil_front( self, stencil: StencilFaceState ) -> RenderPipelineBuilder<'a>
Front face mode.
sourcepub fn stencil_back(
self,
stencil: StencilFaceState
) -> RenderPipelineBuilder<'a>
pub fn stencil_back( self, stencil: StencilFaceState ) -> RenderPipelineBuilder<'a>
Back face mode.
sourcepub fn stencil_read_mask(self, mask: u32) -> RenderPipelineBuilder<'a>
pub fn stencil_read_mask(self, mask: u32) -> RenderPipelineBuilder<'a>
Stencil values are AND’d with this mask when reading and writing from the stencil buffer. Only low 8 bits are used.
sourcepub fn stencil_write_mask(self, mask: u32) -> RenderPipelineBuilder<'a>
pub fn stencil_write_mask(self, mask: u32) -> RenderPipelineBuilder<'a>
Stencil values are AND’d with this mask when writing to the stencil buffer. Only low 8 bits are used.
sourcepub fn depth_bias(self, bias: DepthBiasState) -> RenderPipelineBuilder<'a>
pub fn depth_bias(self, bias: DepthBiasState) -> RenderPipelineBuilder<'a>
Specify the full set of depth bias parameters.
Describes the biasing setting for the depth target.
sourcepub fn depth_bias_constant(self, constant: i32) -> RenderPipelineBuilder<'a>
pub fn depth_bias_constant(self, constant: i32) -> RenderPipelineBuilder<'a>
Constant depth biasing factor, in basic units of the depth format.
sourcepub fn depth_bias_slope_scale(self, scale: f32) -> RenderPipelineBuilder<'a>
pub fn depth_bias_slope_scale(self, scale: f32) -> RenderPipelineBuilder<'a>
Slope depth biasing factor.
sourcepub fn depth_bias_clamp(self, clamp: f32) -> RenderPipelineBuilder<'a>
pub fn depth_bias_clamp(self, clamp: f32) -> RenderPipelineBuilder<'a>
Depth bias clamp value (absolute).
sourcepub fn unclipped_depth(self, b: bool) -> RenderPipelineBuilder<'a>
pub fn unclipped_depth(self, b: bool) -> RenderPipelineBuilder<'a>
If enabled polygon depth is clamped to 0-1 range instead of being clipped.
Requires Features::DEPTH_CLIP_CONTROL
enabled.
sourcepub fn add_vertex_buffer_layout(
self,
d: VertexBufferLayout<'static>
) -> RenderPipelineBuilder<'a>
pub fn add_vertex_buffer_layout( self, d: VertexBufferLayout<'static> ) -> RenderPipelineBuilder<'a>
Add a new vertex buffer descriptor to the render pipeline.
sourcepub fn add_vertex_buffer<V>(
self,
attrs: &'static [VertexAttribute]
) -> RenderPipelineBuilder<'a>
pub fn add_vertex_buffer<V>( self, attrs: &'static [VertexAttribute] ) -> RenderPipelineBuilder<'a>
Short-hand for adding a descriptor to the render pipeline describing a buffer of vertices of the given vertex type.
The vertex stride is assumed to be equal to size_of::<V>()
. If this is not the case,
consider using add_vertex_buffer_layout
instead.
sourcepub fn add_instance_buffer<I>(
self,
attrs: &'static [VertexAttribute]
) -> RenderPipelineBuilder<'a>
pub fn add_instance_buffer<I>( self, attrs: &'static [VertexAttribute] ) -> RenderPipelineBuilder<'a>
Short-hand for adding a descriptor to the render pipeline describing a buffer of instances of the given vertex type.
sourcepub fn multisample(
self,
multisample: MultisampleState
) -> RenderPipelineBuilder<'a>
pub fn multisample( self, multisample: MultisampleState ) -> RenderPipelineBuilder<'a>
Specify the full multisample state.
sourcepub fn sample_count(self, sample_count: u32) -> RenderPipelineBuilder<'a>
pub fn sample_count(self, sample_count: u32) -> RenderPipelineBuilder<'a>
The number of samples calculated per pixel (for MSAA).
For non-multisampled textures, this should be 1 (the default).
sourcepub fn sample_mask(self, sample_mask: u64) -> RenderPipelineBuilder<'a>
pub fn sample_mask(self, sample_mask: u64) -> RenderPipelineBuilder<'a>
Bitmask that restricts the samples of a pixel modified by this pipeline. All samples can be enabled using the value !0 (the default).
sourcepub fn alpha_to_coverage_enabled(self, b: bool) -> RenderPipelineBuilder<'a>
pub fn alpha_to_coverage_enabled(self, b: bool) -> RenderPipelineBuilder<'a>
When enabled, produces another sample mask per pixel based on the alpha output value, that is ANDed with the sample_mask and the primitive coverage to restrict the set of samples affected by a primitive.
The implicit mask produced for alpha of zero is guaranteed to be zero, and for alpha of one is guaranteed to be all 1-s.
Disabled by default.
sourcepub fn build(self, device: &Device) -> RenderPipeline
pub fn build(self, device: &Device) -> RenderPipeline
Build the render pipeline layout, its descriptor and ultimately the pipeline itself with the specified parameters.
**Panic!**s in the following occur:
- A rasterization state field was specified but no fragment shader was given.
- A color state field was specified but no fragment shader was given.
Trait Implementations§
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for RenderPipelineBuilder<'a>
impl<'a> Send for RenderPipelineBuilder<'a>
impl<'a> Sync for RenderPipelineBuilder<'a>
impl<'a> Unpin for RenderPipelineBuilder<'a>
impl<'a> !UnwindSafe for RenderPipelineBuilder<'a>
Blanket Implementations§
source§impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
source§fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<Swp, Dwp, T>,
fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<Swp, Dwp, T>,
source§fn adapt_into(self) -> D
fn adapt_into(self) -> D
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, U> ConvertInto<U> for Twhere
U: ConvertFrom<T>,
impl<T, U> ConvertInto<U> for Twhere
U: ConvertFrom<T>,
source§fn convert_into(self) -> U
fn convert_into(self) -> U
source§fn convert_unclamped_into(self) -> U
fn convert_unclamped_into(self) -> U
source§fn try_convert_into(self) -> Result<U, OutOfBounds<U>>
fn try_convert_into(self) -> Result<U, OutOfBounds<U>>
OutOfBounds
error is returned which contains the unclamped color. Read more