logo
pub struct RasterizationState {
    pub depth_clamp_enable: bool,
    pub rasterizer_discard_enable: StateMode<bool>,
    pub polygon_mode: PolygonMode,
    pub cull_mode: StateMode<CullMode>,
    pub front_face: StateMode<FrontFace>,
    pub depth_bias: Option<DepthBiasState>,
    pub line_width: StateMode<f32>,
    pub line_rasterization_mode: LineRasterizationMode,
    pub line_stipple: Option<StateMode<LineStipple>>,
}
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.

rasterizer_discard_enable: StateMode<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.

If set to Dynamic, the device API version must be at least 1.3, or the extended_dynamic_state2 feature must be enabled on the device.

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.

cull_mode: StateMode<CullMode>

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

If set to Dynamic, the device API version must be at least 1.3, or the extended_dynamic_state feature must be enabled on the device.

front_face: StateMode<FrontFace>

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

If set to Dynamic, the device API version must be at least 1.3, or the extended_dynamic_state feature must be enabled on the device.

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.

line_width: StateMode<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.

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.

line_stipple: Option<StateMode<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.

Implementations

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.

Sets the polygon mode.

Sets the cull mode.

Sets the cull mode to dynamic.

Sets the front face.

Sets the front face to dynamic.

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

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.