#[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
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
impl PipelineState
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a default PipelineState
.
See the documentation of the Default
for further details.
Sourcepub fn clear_color(&self) -> Option<&[f32; 4]>
pub fn clear_color(&self) -> Option<&[f32; 4]>
Get the clear color, if any.
Sourcepub fn set_clear_color(self, clear_color: impl Into<Option<[f32; 4]>>) -> Self
pub fn set_clear_color(self, clear_color: impl Into<Option<[f32; 4]>>) -> Self
Set the clear color.
Sourcepub fn clear_depth(&self) -> Option<f32>
pub fn clear_depth(&self) -> Option<f32>
Get the clear depth, if any.
Sourcepub fn set_clear_depth(self, clear_depth: impl Into<Option<f32>>) -> Self
pub fn set_clear_depth(self, clear_depth: impl Into<Option<f32>>) -> Self
Set the clear depth.
Sourcepub fn clear_stencil(&self) -> Option<i32>
pub fn clear_stencil(&self) -> Option<i32>
Get the clear stencil, if any.
Sourcepub fn set_clear_stencil(self, clear_stencil: impl Into<Option<i32>>) -> Self
pub fn set_clear_stencil(self, clear_stencil: impl Into<Option<i32>>) -> Self
Set the clear stencil.
Sourcepub fn set_viewport(self, viewport: Viewport) -> Self
pub fn set_viewport(self, viewport: Viewport) -> Self
Set the viewport.
Sourcepub fn is_srgb_enabled(&self) -> bool
pub fn is_srgb_enabled(&self) -> bool
Check whether sRGB linearization is enabled.
Sourcepub fn enable_srgb(self, srgb_enabled: bool) -> Self
pub fn enable_srgb(self, srgb_enabled: bool) -> Self
Enable sRGB linearization.
Sourcepub fn scissor(&self) -> &Option<ScissorRegion>
pub fn scissor(&self) -> &Option<ScissorRegion>
Get the scissor configuration, if any.
Sourcepub fn set_scissor(self, scissor: impl Into<Option<ScissorRegion>>) -> Self
pub fn set_scissor(self, scissor: impl Into<Option<ScissorRegion>>) -> Self
Set the scissor configuration.
Trait Implementations§
Source§impl Clone for PipelineState
impl Clone for PipelineState
Source§fn clone(&self) -> PipelineState
fn clone(&self) -> PipelineState
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for PipelineState
impl Debug for PipelineState
Source§impl Default for PipelineState
impl Default for PipelineState
Source§fn default() -> Self
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.