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>

source

pub const DEFAULT_SHADER_ENTRY_POINT: &'static str = "main"

source

pub const DEFAULT_FRONT_FACE: FrontFace = wgpu::FrontFace::Ccw

source

pub const DEFAULT_CULL_MODE: Option<Face> = None

source

pub const DEFAULT_POLYGON_MODE: PolygonMode = wgpu::PolygonMode::Fill

source

pub const DEFAULT_PRIMITIVE_TOPOLOGY: PrimitiveTopology = wgpu::PrimitiveTopology::TriangleList

source

pub const DEFAULT_PRIMITIVE: PrimitiveState = _

source

pub const DEFAULT_COLOR_FORMAT: TextureFormat = wgpu::TextureFormat::Rgba16Float

source

pub const DEFAULT_COLOR_BLEND: BlendComponent = _

source

pub const DEFAULT_ALPHA_BLEND: BlendComponent = _

source

pub const DEFAULT_COLOR_WRITE: ColorWrites = wgpu::ColorWrites::ALL

source

pub const DEFAULT_BLEND_STATE: BlendState = _

source

pub const DEFAULT_COLOR_STATE: ColorTargetState = _

source

pub const DEFAULT_DEPTH_FORMAT: TextureFormat = wgpu::TextureFormat::Depth32Float

source

pub const DEFAULT_DEPTH_WRITE_ENABLED: bool = true

source

pub const DEFAULT_DEPTH_COMPARE: CompareFunction = wgpu::CompareFunction::LessEqual

source

pub const DEFAULT_STENCIL_FRONT: StencilFaceState = wgpu::StencilFaceState::IGNORE

source

pub const DEFAULT_STENCIL_BACK: StencilFaceState = wgpu::StencilFaceState::IGNORE

source

pub const DEFAULT_STENCIL_READ_MASK: u32 = 0u32

source

pub const DEFAULT_STENCIL_WRITE_MASK: u32 = 0u32

source

pub const DEFAULT_STENCIL: StencilState = _

source

pub const DEFAULT_DEPTH_BIAS_CONSTANT: i32 = 0i32

source

pub const DEFAULT_DEPTH_BIAS_SLOPE_SCALE: f32 = 0f32

source

pub const DEFAULT_DEPTH_BIAS_CLAMP: f32 = 0f32

source

pub const DEFAULT_DEPTH_BIAS: DepthBiasState = _

source

pub const DEFAULT_UNCLIPPED_DEPTH: bool = false

source

pub const DEFAULT_DEPTH_STENCIL: DepthStencilState = _

source

pub const DEFAULT_SAMPLE_COUNT: u32 = 1u32

source

pub const DEFAULT_SAMPLE_MASK: u64 = 18_446_744_073_709_551_615u64

source

pub const DEFAULT_ALPHA_TO_COVERAGE_ENABLED: bool = false

source

pub const DEFAULT_MULTISAMPLE: MultisampleState = _

source

pub fn from_layout(layout: &'a PipelineLayout, vs_mod: &'a ShaderModule) -> Self

Begin building the render pipeline for the given pipeline layout and the vertex shader module.

source

pub fn from_layout_descriptor<T>( layout_desc: T, vs_mod: &'a ShaderModule ) -> Self
where T: IntoPipelineLayoutDescriptor<'a>,

Begin building the render pipeline for a pipeline with the given layout descriptor and the vertex shader module.

source

pub fn vertex_entry_point(self, entry_point: &'a str) -> Self

The name of the entry point in the compiled shader.

There must be a function that returns void with this name in the shader.

source

pub fn fragment_entry_point(self, entry_point: &'a str) -> Self

The name of the entry point in the compiled shader.

There must be a function that returns void with this name in the shader.

source

pub fn fragment_shader(self, fs_mod: &'a ShaderModule) -> Self

Specify a compiled fragment shader for the render pipeline.

source

pub fn primitive(self, p: PrimitiveState) -> Self

Specify the full primitive state.

Describes the state of primitive assembly and rasterization in a render pipeline.

source

pub fn front_face(self, front_face: FrontFace) -> Self

The face to consider the front for the purpose of culling and stencil operations.

source

pub fn cull_mode(self, cull_mode: Option<Face>) -> Self

The face culling mode.

source

pub fn primitive_topology(self, topology: PrimitiveTopology) -> Self

Specify the primitive topology.

This represents the way vertices will be read from the VertexBuffer.

source

pub fn polygon_mode(self, mode: PolygonMode) -> Self

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.

source

pub fn color_state(self, state: ColorTargetState) -> Self

Specify the full color state for drawing to the output attachment.

If you have multiple output attachments, see the color_states method.

source

pub fn color_format(self, format: TextureFormat) -> Self

The texture formrat of the image that this pipelinew ill render to.

Must match the format of the corresponding color attachment.

source

pub fn color_blend(self, color_blend: BlendComponent) -> Self

The color blending used for this pipeline.

source

pub fn alpha_blend(self, alpha_blend: BlendComponent) -> Self

The alpha blending used for this pipeline.

source

pub fn write_mask(self, mask: ColorWrites) -> Self

Mask which enables/disables writes to different color/alpha channel.

source

pub fn depth_stencil(self, state: DepthStencilState) -> Self

Specify the full depth stencil state.

source

pub fn depth_format(self, format: TextureFormat) -> Self

Format of the depth/stencil buffer. Must be one of the depth formats. Must match the format of the depth/stencil attachment.

source

pub fn depth_write_enabled(self, enabled: bool) -> Self

source

pub fn depth_compare(self, compare: CompareFunction) -> Self

Comparison function used to compare depth values in the depth test.

source

pub fn stencil(self, stencil: StencilState) -> Self

Specify the full set of stencil parameters.

source

pub fn stencil_front(self, stencil: StencilFaceState) -> Self

Front face mode.

source

pub fn stencil_back(self, stencil: StencilFaceState) -> Self

Back face mode.

source

pub fn stencil_read_mask(self, mask: u32) -> Self

Stencil values are AND’d with this mask when reading and writing from the stencil buffer. Only low 8 bits are used.

source

pub fn stencil_write_mask(self, mask: u32) -> Self

Stencil values are AND’d with this mask when writing to the stencil buffer. Only low 8 bits are used.

source

pub fn depth_bias(self, bias: DepthBiasState) -> Self

Specify the full set of depth bias parameters.

Describes the biasing setting for the depth target.

source

pub fn depth_bias_constant(self, constant: i32) -> Self

Constant depth biasing factor, in basic units of the depth format.

source

pub fn depth_bias_slope_scale(self, scale: f32) -> Self

Slope depth biasing factor.

source

pub fn depth_bias_clamp(self, clamp: f32) -> Self

Depth bias clamp value (absolute).

source

pub fn unclipped_depth(self, b: bool) -> Self

If enabled polygon depth is clamped to 0-1 range instead of being clipped.

Requires Features::DEPTH_CLIP_CONTROL enabled.

source

pub fn add_vertex_buffer_layout(self, d: VertexBufferLayout<'static>) -> Self

Add a new vertex buffer descriptor to the render pipeline.

source

pub fn add_vertex_buffer<V>(self, attrs: &'static [VertexAttribute]) -> Self

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.

source

pub fn add_instance_buffer<I>(self, attrs: &'static [VertexAttribute]) -> Self

Short-hand for adding a descriptor to the render pipeline describing a buffer of instances of the given vertex type.

source

pub fn multisample(self, multisample: MultisampleState) -> Self

Specify the full multisample state.

source

pub fn sample_count(self, sample_count: u32) -> Self

The number of samples calculated per pixel (for MSAA).

For non-multisampled textures, this should be 1 (the default).

source

pub fn sample_mask(self, sample_mask: u64) -> Self

Bitmask that restricts the samples of a pixel modified by this pipeline. All samples can be enabled using the value !0 (the default).

source

pub fn alpha_to_coverage_enabled(self, b: bool) -> Self

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.

source

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§

source§

impl<'a> Debug for RenderPipelineBuilder<'a>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSync for T
where T: Sync,