Struct PipelineState

Source
#[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§

Source§

impl PipelineState

Source

pub fn new() -> Self

Create a default PipelineState.

See the documentation of the Default for further details.

Source

pub fn clear_color(&self) -> Option<&[f32; 4]>

Get the clear color, if any.

Source

pub fn set_clear_color(self, clear_color: impl Into<Option<[f32; 4]>>) -> Self

Set the clear color.

Source

pub fn clear_depth(&self) -> Option<f32>

Get the clear depth, if any.

Source

pub fn set_clear_depth(self, clear_depth: impl Into<Option<f32>>) -> Self

Set the clear depth.

Source

pub fn clear_stencil(&self) -> Option<i32>

Get the clear stencil, if any.

Source

pub fn set_clear_stencil(self, clear_stencil: impl Into<Option<i32>>) -> Self

Set the clear stencil.

Source

pub fn viewport(&self) -> Viewport

Get the viewport.

Source

pub fn set_viewport(self, viewport: Viewport) -> Self

Set the viewport.

Source

pub fn is_srgb_enabled(&self) -> bool

Check whether sRGB linearization is enabled.

Source

pub fn enable_srgb(self, srgb_enabled: bool) -> Self

Enable sRGB linearization.

Source

pub fn scissor(&self) -> &Option<ScissorRegion>

Get the scissor configuration, if any.

Source

pub fn set_scissor(self, scissor: impl Into<Option<ScissorRegion>>) -> Self

Set the scissor configuration.

Trait Implementations§

Source§

impl Clone for PipelineState

Source§

fn clone(&self) -> PipelineState

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PipelineState

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for PipelineState

Source§

fn default() -> Self

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§

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
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
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.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

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

Source§

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>,

Source§

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.