Struct luminance::pipeline::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
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
sourceimpl 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 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
sourceimpl Clone for PipelineState
impl Clone for PipelineState
sourcefn clone(&self) -> PipelineState
fn clone(&self) -> PipelineState
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for PipelineState
impl Debug for PipelineState
sourceimpl Default for PipelineState
impl Default for PipelineState
sourcefn 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.
Auto Trait Implementations
impl RefUnwindSafe for PipelineState
impl Send for PipelineState
impl Sync for PipelineState
impl Unpin for PipelineState
impl UnwindSafe for PipelineState
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more