logo
#[non_exhaustive]
pub struct PipelineState { pub clear_color: Option<[f32; 4]>, pub clear_depth: Option<f32>, pub clear_stencil: Option<i32>, pub viewport: Viewport, pub srgb_enabled: bool, pub clear_scissor: Option<ScissorRegion>, }
Expand description

Various customization options for pipelines.

Fields (Non-exhaustive)

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
clear_color: Option<[f32; 4]>

Color to use when clearing color buffers.

Set this to Some(color) to use that color to clear the Framebuffer when running a PipelineGate. Set it to None not to clear the framebuffer when running the PipelineGate.

An example of not setting the clear color is if you want to accumulate renders in a Framebuffer (for instance for a paint-like application).

clear_depth: Option<f32>

Depth value to use when clearing the depth buffer.

Set this to Some(depth) to use that depth to clear the Framebuffer depth buffer.

clear_stencil: Option<i32>

Stencil value to use when clearing the stencil buffer.

Set this to Some(stencil) to use that stencil to clear the Framebuffer stencil buffer.

viewport: Viewport

Viewport to use when rendering.

srgb_enabled: bool

Whether sRGB support should be enabled.

When this is set to true, shader outputs that go in Framebuffer for each of the color slots have sRGB pixel formats are assumed to be in the linear RGB color space. The pipeline will then convert that linear color outputs to sRGB to be stored in the Framebuffer.

Typical examples are when you are rendering into an image that is to be displayed to on screen: the Framebuffer can use sRGB color pixel formats and the shader doesn’t have to worry about converting from linear color space into sRGB color space, as the pipeline will do that for you.

clear_scissor: Option<ScissorRegion>

Whether to use scissor test when clearing buffers.

Implementations

Create a default PipelineState.

See the documentation of the Default for further details.

Get the clear color, if any.

Set the clear color.

Get the clear depth, if any.

Set the clear depth.

Get the clear stencil, if any.

Set the clear stencil.

Get the viewport.

Set the viewport.

Check whether sRGB linearization is enabled.

Enable sRGB linearization.

Get the scissor configuration, if any.

Set the scissor configuration.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Default PipelineState:

  • Clear color is Some([0., 0., 0., 1.]).
  • Depth value is Some(1.).
  • Stencil value is Some(0).
  • The viewport uses the whole framebuffer’s.
  • sRGB encoding is disabled.
  • No scissor test is performed.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.