Class GorgonRasterState
Describes how primitive data (i.e. triangles, lines, etc...) are rasterized by the GPU.
Implements
Inherited Members
Namespace: Gorgon.Graphics.Core
Assembly: Gorgon.Graphics.Core.dll
Syntax
public class GorgonRasterState : IEquatable<GorgonRasterState>
Remarks
This will define how a triangle, line, point, etc... is rasterized by the GPU when rendering. Clipping, vertex ordering, culling, etc... are all affected by this state.
The rasterizer state contains 4 common raster states used by applications: Default (backface culling, solid fill, etc...), WireFrameNoCulling (no culling, wireframe fill, etc...), CullFrontFace (front face culling, solid fill, etc...), and NoCulling (no culling, solid fill, etc...).
A raster state is an immutable object, and as such can only be created by using a GorgonRasterStateBuilder.
Properties
| Edit this page View SourceCullFrontFace
Front face culling.
Declaration
public static GorgonRasterState CullFrontFace { get; }
Property Value
Type | Description |
---|---|
GorgonRasterState |
See Also
| Edit this page View SourceCullMode
Property to return the current culling mode.
Declaration
public CullingMode CullMode { get; }
Property Value
Type | Description |
---|---|
CullingMode |
Remarks
This value is used to determine if a triangle is drawn or not by the direction it's facing.
The default value is Back.
See Also
| Edit this page View SourceDefault
The default raster state.
Declaration
public static GorgonRasterState Default { get; }
Property Value
Type | Description |
---|---|
GorgonRasterState |
See Also
| Edit this page View SourceDepthBias
Property to return the value to be added to the depth of a pixel.
Declaration
public int DepthBias { get; }
Property Value
Type | Description |
---|---|
int |
Remarks
This value is used to help z-fighting for co-planar polygons. This is often caused by a lack of precision for the depth in the view volume and the depth/stencil buffer. By adding a small offset via this property, it can make a polygon appear to be in front of or behind another polygon even though they actually share the same (or very nearly the same depth value).
The default value is 0.
See Also
| Edit this page View SourceDepthBiasClamp
Property to return the clamping value for the DepthBias.
Declaration
public float DepthBiasClamp { get; }
Property Value
Type | Description |
---|---|
float |
Remarks
The maximum DepthBias for a pixel.
The default value is 0.0f.
See Also
| Edit this page View SourceFillMode
Property to return the triangle fill mode.
Declaration
public FillMode FillMode { get; }
Property Value
Type | Description |
---|---|
FillMode |
Remarks
The default value is Solid.
See Also
| Edit this page View SourceForcedReadWriteViewSampleCount
Property to return the number of samples to use when unordered access view rendering or rasterizing.
Declaration
public int ForcedReadWriteViewSampleCount { get; }
Property Value
Type | Description |
---|---|
int |
Remarks
This forces the number of samples to use when rendering unordered access view data. The valid values are 0, 1, 2, 4, 8 and a value of 16 indicates that the sample count is not forced.
The default value is 0.
note
If you want to render with sample count set to 1 or greater, you must follow these guidelines:
- Don't bind depth-stencil views.
- Disable depth testing.
- Ensure the shader doesn't output depth.
- If you have any render-target views bound and this value is greater than 1, ensure that every render target has only a single sample.
- Don't operate the shader at sample frequency.
See Also
| Edit this page View SourceIsAntialiasedLineEnabled
Property to return whether anti-aliased line drawing is enabled or not.
Declaration
public bool IsAntialiasedLineEnabled { get; }
Property Value
Type | Description |
---|---|
bool |
Remarks
This only applies when drawing lines and IsMultisamplingEnabled is set to false.
The default value is false.
See Also
| Edit this page View SourceIsDepthClippingEnabled
Property to return whether depth/clipping is enabled or not.
Declaration
public bool IsDepthClippingEnabled { get; }
Property Value
Type | Description |
---|---|
bool |
Remarks
The default value is true.
See Also
| Edit this page View SourceIsFrontCounterClockwise
Property to return whether a triangle is front or back facing.
Declaration
public bool IsFrontCounterClockwise { get; }
Property Value
Type | Description |
---|---|
bool |
Remarks
This value determines if a triangle is front or back facing by using the winding order of its vertices.
The default value is false.
See Also
| Edit this page View SourceIsMultisamplingEnabled
Property to return whether multisampling anti-aliasing or alpha line anti-aliasing for a render target is enabled or not.
Declaration
public bool IsMultisamplingEnabled { get; }
Property Value
Type | Description |
---|---|
bool |
Remarks
Set this value to true to use quadrilateral anti-aliasing or false to use a alpha line algorithm. This will only apply to render targets that have a MultisampleInfo Count greater than 1.
This value overrides the value set in IsAntialiasedLineEnabled.
The default value is false.
See Also
| Edit this page View SourceNoCulling
No culling.
Declaration
public static GorgonRasterState NoCulling { get; }
Property Value
Type | Description |
---|---|
GorgonRasterState |
See Also
| Edit this page View SourceScissorRectanglesEnabled
The default raster state, with scissor rectangles enabled.
Declaration
public static GorgonRasterState ScissorRectanglesEnabled { get; }
Property Value
Type | Description |
---|---|
GorgonRasterState |
See Also
| Edit this page View SourceScissorRectsEnabled
Property to return whwther scissor rectangles are enabled or not.
Declaration
public bool ScissorRectsEnabled { get; }
Property Value
Type | Description |
---|---|
bool |
Remarks
Scissor rectangles are used to clip pixels on a region defined by a scissor rectangle region. These rectangles are set by calling SetScissorRect(Rectangle) or SetScissorRects(ReadOnlySpan<Rectangle>) on the GorgonGraphics interface.
warning
If no scissor rectangle is set on the GorgonGraphics interface, and this is set to true, nothing will be rendered.
See Also
| Edit this page View SourceSlopeScaledDepthBias
Property to return the scalar used for a slope of a pixel.
Declaration
public float SlopeScaledDepthBias { get; }
Property Value
Type | Description |
---|---|
float |
Remarks
This is used in conjunction with the DepthBias to help overcome issues (typically "acne" for shadow maps) when rendering coplanar polygons. It is used to adjust the depth value based on a slope.
The default value is 0.0f.
See Also
| Edit this page View SourceUseConservativeRasterization
Property to return whether conservative rasterization should be used or not.
Declaration
public bool UseConservativeRasterization { get; }
Property Value
Type | Description |
---|---|
bool |
See Also
| Edit this page View SourceWireFrameNoCulling
Wireframe, with no culling.
Declaration
public static GorgonRasterState WireFrameNoCulling { get; }
Property Value
Type | Description |
---|---|
GorgonRasterState |
See Also
Methods
| Edit this page View SourceEquals(GorgonRasterState)
Indicates whether the current object is equal to another object of the same type.
Declaration
public bool Equals(GorgonRasterState state)
Parameters
Type | Name | Description |
---|---|---|
GorgonRasterState | state | An object to compare with this object. |
Returns
Type | Description |
---|---|
bool | true if the current object is equal to the |
See Also
| Edit this page View SourceEquals(object)
Indicates whether the current object is equal to another object of the same type.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
object | obj | An object to compare with this object. |
Returns
Type | Description |
---|---|
bool | true if the current object is equal to the |
Overrides
See Also
| Edit this page View SourceGetHashCode()
Returns a hash code for this instance.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
int | A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. |