Gorgon
Show / Hide Table of Contents

Class GorgonDepthStencilState

Describes how rasterized primitive data is clipped against a depth/stencil buffer.

Inheritance
object
GorgonDepthStencilState
Implements
IEquatable<GorgonDepthStencilState>
Inherited Members
object.ToString()
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetType()
object.MemberwiseClone()
Namespace: Gorgon.Graphics.Core
Assembly: Gorgon.Graphics.Core.dll
Syntax
public class GorgonDepthStencilState : IEquatable<GorgonDepthStencilState>
Remarks

This will define how rasterized primitive data is clipped against a depth/stencil buffer. Depth reading, writing, and stencil operations are affected by this state.

The depth/stencil state contains 6 common depth/stencil states used by applications: Default (disabled depth/stencil), DepthStencilEnabled (both depth and stencil enabled, full write enabled), DepthStencilEnabledNoWrite (both depth and stencil enabled, no writing allowed), DepthEnabledNoWrite (depth enabled, no writing allowed), DepthEnabled (depth enabled, stencil disabled), and StencilEnabled (stencil enabled, depth disabled).

A depth/stencil state is an immutable object, and as such can only be created by using a GorgonDepthStencilStateBuilder.

Fields

| Edit this page View Source

Default

The default depth/stencil state.

Declaration
public static readonly GorgonDepthStencilState Default
Field Value
Type Description
GorgonDepthStencilState
See Also
GorgonGraphics
GorgonPipelineState
GorgonDepthStencilStateBuilder
| Edit this page View Source

DepthEnabled

Depth only enabled.

Declaration
public static readonly GorgonDepthStencilState DepthEnabled
Field Value
Type Description
GorgonDepthStencilState
See Also
GorgonGraphics
GorgonPipelineState
GorgonDepthStencilStateBuilder
| Edit this page View Source

DepthEnabledNoWrite

Depth only enabled, depth write disabled.

Declaration
public static readonly GorgonDepthStencilState DepthEnabledNoWrite
Field Value
Type Description
GorgonDepthStencilState
See Also
GorgonGraphics
GorgonPipelineState
GorgonDepthStencilStateBuilder
| Edit this page View Source

DepthLessEqualEnabled

Depth only enabled. With a comparison of less than or equal for the depth buffer.

Declaration
public static readonly GorgonDepthStencilState DepthLessEqualEnabled
Field Value
Type Description
GorgonDepthStencilState
Remarks

This value is suitable for 2D operations because sprites don't have any depth, and not having an equals operator will cause overlapping sprites to overwrite instead of merge together.

See Also
GorgonGraphics
GorgonPipelineState
GorgonDepthStencilStateBuilder
| Edit this page View Source

DepthLessEqualEnabledNoWrite

Depth only enabled, depth write disabled. With a comparison of less than or equal for the depth buffer.

Declaration
public static readonly GorgonDepthStencilState DepthLessEqualEnabledNoWrite
Field Value
Type Description
GorgonDepthStencilState
Remarks

This value is suitable for 2D operations because sprites don't have any depth, and not having an equals operator will cause overlapping sprites to overwrite instead of merge together.

See Also
GorgonGraphics
GorgonPipelineState
GorgonDepthStencilStateBuilder
| Edit this page View Source

DepthLessEqualStencilEnabled

Depth/stencil enabled. With a comparison of less than or equal for the depth buffer.

Declaration
public static readonly GorgonDepthStencilState DepthLessEqualStencilEnabled
Field Value
Type Description
GorgonDepthStencilState
Remarks

This value is suitable for 2D operations because sprites don't have any depth, and not having an equals operator will cause overlapping sprites to overwrite instead of merge together.

See Also
GorgonGraphics
GorgonPipelineState
GorgonDepthStencilStateBuilder
| Edit this page View Source

DepthLessEqualStencilEnabledNoWrite

Depth/stencil enabled, depth write disbled. With a comparison of less than or equal for the depth buffer.

Declaration
public static readonly GorgonDepthStencilState DepthLessEqualStencilEnabledNoWrite
Field Value
Type Description
GorgonDepthStencilState
Remarks

This value is suitable for 2D operations because sprites don't have any depth, and not having an equals operator will cause overlapping sprites to overwrite instead of merge together.

See Also
GorgonGraphics
GorgonPipelineState
GorgonDepthStencilStateBuilder
| Edit this page View Source

DepthStencilEnabled

Depth/stencil enabled.

Declaration
public static readonly GorgonDepthStencilState DepthStencilEnabled
Field Value
Type Description
GorgonDepthStencilState
See Also
GorgonGraphics
GorgonPipelineState
GorgonDepthStencilStateBuilder
| Edit this page View Source

DepthStencilEnabledGreaterEqual

Depth/stencil enabled, with a greater than or equal comparer.

Declaration
public static readonly GorgonDepthStencilState DepthStencilEnabledGreaterEqual
Field Value
Type Description
GorgonDepthStencilState
Remarks

This value is useful for reversing a depth distribution across the depth buffer to provide better accuracy. See https://developer.nvidia.com/content/depth-precision-visualized for more information.

See Also
GorgonGraphics
GorgonPipelineState
GorgonDepthStencilStateBuilder
| Edit this page View Source

DepthStencilEnabledNoWrite

Depth/stencil enabled, depth write disbled.

Declaration
public static readonly GorgonDepthStencilState DepthStencilEnabledNoWrite
Field Value
Type Description
GorgonDepthStencilState
See Also
GorgonGraphics
GorgonPipelineState
GorgonDepthStencilStateBuilder
| Edit this page View Source

StencilEnabled

Stencil only enabled.

Declaration
public static readonly GorgonDepthStencilState StencilEnabled
Field Value
Type Description
GorgonDepthStencilState
See Also
GorgonGraphics
GorgonPipelineState
GorgonDepthStencilStateBuilder

Properties

| Edit this page View Source

BackFaceStencilOp

Property to return the setup information for stencil operations on back facing polygons.

Declaration
public GorgonStencilOperation BackFaceStencilOp { get; }
Property Value
Type Description
GorgonStencilOperation
See Also
GorgonGraphics
GorgonPipelineState
GorgonDepthStencilStateBuilder
| Edit this page View Source

DepthComparison

Property to set or return the depth comparison function.

Declaration
public Comparison DepthComparison { get; }
Property Value
Type Description
Comparison
Remarks

Use this property to determine whether a depth value will be written into the buffer if the function specified evaluates to true using the data being written and existing data.

The default value is Less.

See Also
GorgonGraphics
GorgonPipelineState
GorgonDepthStencilStateBuilder
| Edit this page View Source

FrontFaceStencilOp

Property to return the setup information for stencil operations on front facing polygons.

Declaration
public GorgonStencilOperation FrontFaceStencilOp { get; }
Property Value
Type Description
GorgonStencilOperation
See Also
GorgonGraphics
GorgonPipelineState
GorgonDepthStencilStateBuilder
| Edit this page View Source

IsDepthEnabled

Property to set or return whether the depth buffer is enabled or not.

Declaration
public bool IsDepthEnabled { get; }
Property Value
Type Description
bool
Remarks

The default value is false.

See Also
GorgonGraphics
GorgonPipelineState
GorgonDepthStencilStateBuilder
| Edit this page View Source

IsDepthWriteEnabled

Property to set or return whether to enable writing to the depth buffer or not.

Declaration
public bool IsDepthWriteEnabled { get; }
Property Value
Type Description
bool
Remarks

The default value is true.

See Also
GorgonGraphics
GorgonPipelineState
GorgonDepthStencilStateBuilder
| Edit this page View Source

IsStencilEnabled

Property to set or return whether the stencil buffer is enabled or not.

Declaration
public bool IsStencilEnabled { get; }
Property Value
Type Description
bool
Remarks

The default value is false.

See Also
GorgonGraphics
GorgonPipelineState
GorgonDepthStencilStateBuilder
| Edit this page View Source

StencilReadMask

Property to set or return the read mask for stencil operations.

Declaration
public byte StencilReadMask { get; }
Property Value
Type Description
byte
Remarks

Use this to filter out specific values from the stencil buffer during a read operation.

The default value is 0xff.

See Also
GorgonGraphics
GorgonPipelineState
GorgonDepthStencilStateBuilder
| Edit this page View Source

StencilWriteMask

Property to set or return the write mask for stencil operations.

Declaration
public byte StencilWriteMask { get; }
Property Value
Type Description
byte
Remarks

Use this to filter out specific values from the stencil buffer during a write operation.

The default value is 0xff.

See Also
GorgonGraphics
GorgonPipelineState
GorgonDepthStencilStateBuilder

Methods

| Edit this page View Source

Equals(GorgonDepthStencilState)

Indicates whether the current object is equal to another object of the same type.

Declaration
public bool Equals(GorgonDepthStencilState info)
Parameters
Type Name Description
GorgonDepthStencilState info

An object to compare with this object.

Returns
Type Description
bool

true if the current object is equal to the info parameter; otherwise, false.

See Also
GorgonGraphics
GorgonPipelineState
GorgonDepthStencilStateBuilder
| Edit this page View Source

Equals(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 obj parameter; otherwise, false.

Overrides
object.Equals(object)
See Also
GorgonGraphics
GorgonPipelineState
GorgonDepthStencilStateBuilder
| Edit this page View Source

GetHashCode()

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.

Overrides
object.GetHashCode()
See Also
GorgonGraphics
GorgonPipelineState
GorgonDepthStencilStateBuilder

Implements

IEquatable<T>

Extension Methods

GorgonDebugExtensions.ValidateObject<T>(T, string)
GorgonNullExtensions.AsNullable<T>(object)
GorgonNullExtensions.IfNull<T>(object, T)
GorgonNullExtensions.IsNull(object)

See Also

GorgonGraphics
GorgonPipelineState
GorgonDepthStencilStateBuilder
  • Edit this page
  • View Source
In this article
Back to top Copyright 2023 - Licensed under the MIT license by Michael Winsor (Tape_Worm).
Send comments on this topic to the author