pub struct RasterizationState {
    pub depth_clamp_enable: bool,
    pub rasterizer_discard_enable: bool,
    pub polygon_mode: PolygonMode,
    pub cull_mode: CullMode,
    pub front_face: FrontFace,
    pub depth_bias: Option<DepthBiasState>,
    pub line_width: f32,
    pub line_rasterization_mode: LineRasterizationMode,
    pub line_stipple: Option<LineStipple>,
    pub _ne: NonExhaustive,
}
Expand description

The state in a graphics pipeline describing how the rasterization stage should behave.

Fields§

§depth_clamp_enable: bool

If true, then the depth value of the vertices will be clamped to the range [0.0, 1.0]. If false, fragments whose depth is outside of this range will be discarded.

If enabled, the depth_clamp feature must be enabled on the device.

The default value is false.

§rasterizer_discard_enable: bool

If true, all the fragments will be discarded, and the fragment shader will not be run. This is usually used when your vertex shader has some side effects and you don’t need to run the fragment shader.

The default value is false.

§polygon_mode: PolygonMode

This setting can ask the rasterizer to downgrade triangles into lines or points, or lines into points.

If set to a value other than Fill, the fill_mode_non_solid feature must be enabled on the device.

The default value is PolygonMode::Fill.

§cull_mode: CullMode

Specifies whether front faces or back faces should be discarded, or none, or both.

The default value is CullMode::None.

§front_face: FrontFace

Specifies which triangle orientation is considered to be the front of the triangle.

The default value is FrontFace::CounterClockwise.

§depth_bias: Option<DepthBiasState>

Sets how to modify depth values in the rasterization stage.

If set to None, depth biasing is disabled, the depth values will pass to the fragment shader unmodified.

The default value is None.

§line_width: f32

Width, in pixels, of lines when drawing lines.

Setting this to a value other than 1.0 requires the wide_lines feature to be enabled on the device.

The default value is 1.0.

§line_rasterization_mode: LineRasterizationMode

The rasterization mode for lines.

If this is not set to Default, the ext_line_rasterization extension and an additional feature must be enabled on the device.

The default value is LineRasterizationMode::Default.

§line_stipple: Option<LineStipple>

Enables and sets the parameters for line stippling.

If this is set to Some, the ext_line_rasterization extension and an additional feature must be enabled on the device.

The default value is None.

§_ne: NonExhaustive

Implementations§

source§

impl RasterizationState

source

pub fn new() -> Self

👎Deprecated since 0.34.0: use RasterizationState::default instead

Creates a RasterizationState with depth clamping, discard, depth biasing and line stippling disabled, filled polygons, no culling, counterclockwise front face, and the default line width and line rasterization mode.

source

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

👎Deprecated since 0.34.0

Sets the polygon mode.

source

pub fn cull_mode(self, cull_mode: CullMode) -> Self

👎Deprecated since 0.34.0

Sets the cull mode.

source

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

👎Deprecated since 0.34.0

Sets the front face.

Trait Implementations§

source§

impl Clone for RasterizationState

source§

fn clone(&self) -> RasterizationState

Returns a copy 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 RasterizationState

source§

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

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

impl Default for RasterizationState

source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. 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 Twhere 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 Twhere T: Clone,

§

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 Twhere 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 Twhere 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.