Gorgon
Show / Hide Table of Contents

Class GorgonSamplerState

Describes how texture sampling should be performed when a texture is sampled in a shader.

Inheritance
object
GorgonSamplerState
Implements
IEquatable<GorgonSamplerState>
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 GorgonSamplerState : IEquatable<GorgonSamplerState>
Remarks

This will define how a texture is sampled inside of a shader when rendering. Filtering, addressing, etc... are all defined in this state.

The sampler state contains 4 common samplers used by applications: Default (bilinear filtering), PointFiltering (point or "pixelated" filtering), AnisotropicFiltering, and Wrapping.

A sampler state is an immutable object, and as such can only be created by using a GorgonSamplerStateBuilder.

Fields

| Edit this page View Source

AnisotropicFiltering

A sampler state that provides anisotropic filtering for the complete texture.

Declaration
public static readonly GorgonSamplerState AnisotropicFiltering
Field Value
Type Description
GorgonSamplerState
See Also
GorgonGraphics
GorgonPipelineState
GorgonSamplerStateBuilder
| Edit this page View Source

Default

A default sampler state.

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

PointFiltering

A sampler state that provides point filtering for the complete texture.

Declaration
public static readonly GorgonSamplerState PointFiltering
Field Value
Type Description
GorgonSamplerState
See Also
GorgonGraphics
GorgonPipelineState
GorgonSamplerStateBuilder
| Edit this page View Source

PointFilteringWrapping

A sampler state that turns on texture wrapping when texture coordinates exceed the range of the texture size.

Declaration
public static readonly GorgonSamplerState PointFilteringWrapping
Field Value
Type Description
GorgonSamplerState
See Also
GorgonGraphics
GorgonPipelineState
GorgonSamplerStateBuilder
| Edit this page View Source

Wrapping

A sampler state that turns on texture wrapping when texture coordinates exceed the range of the texture size.

Declaration
public static readonly GorgonSamplerState Wrapping
Field Value
Type Description
GorgonSamplerState
See Also
GorgonGraphics
GorgonPipelineState
GorgonSamplerStateBuilder

Properties

| Edit this page View Source

BorderColor

Property to return the color to use when using border addressing.

Declaration
public GorgonColor BorderColor { get; }
Property Value
Type Description
GorgonColor
Remarks

This value defines the color to use when the WrapU, WrapV or WrapW is set to Border. When those address modes are defined, the renderer will draw a border in the color specified when the addressing exceeds 0.0f and 1.0f.

The default value is Transparent.

See Also
GorgonGraphics
GorgonPipelineState
GorgonSamplerStateBuilder
| Edit this page View Source

ComparisonFunction

Property to return the function to compare sampled data.

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

This sets how a comparison between current sampled data and existing sampled data is handled.

The default value is Never.

See Also
GorgonGraphics
GorgonPipelineState
GorgonSamplerStateBuilder
| Edit this page View Source

Filter

Property to return the type of filtering to apply to the texture.

Declaration
public SampleFilter Filter { get; }
Property Value
Type Description
SampleFilter
Remarks

This applies a filter when the texture is zoomed in, or out so that edges appear more smooth when magnified, and have less shimmer effect when minified. Filters can be applied to mip levels as well as the overall texture.

Click this link for a full description of each filter type.

The default value is MinMagMipLinear.

Exceptions
Type Condition
GorgonException

Thrown if the state has been assigned to a sampler slot.

See Also
GorgonGraphics
GorgonPipelineState
GorgonSamplerStateBuilder
| Edit this page View Source

ID

Property to return the state ID.

Declaration
public int ID { get; }
Property Value
Type Description
int
See Also
GorgonGraphics
GorgonPipelineState
GorgonSamplerStateBuilder
| Edit this page View Source

MaxAnisotropy

Property to return the value used to clamp an anisotropic texture filter.

Declaration
public int MaxAnisotropy { get; }
Property Value
Type Description
int
Remarks

This is used to clamp the Filter of the texture when it is set to an anisotropic value.

The default value is 1.

See Also
GorgonGraphics
GorgonPipelineState
GorgonSamplerStateBuilder
| Edit this page View Source

MaximumLevelOfDetail

Property to return the minimum mip level of detail to use.

Declaration
public float MaximumLevelOfDetail { get; }
Property Value
Type Description
float
Remarks

This defines the upper end of the mip map range to clamp access to. If this value is 0, then the largest and most detailed mip level is used, and any value higher results in less detailed mip levels.

This value should be greater than MinimumLevelOfDetail, if it is not, then Gorgon will swap these values upon state creation.

The default value is MinValue (-3.40282346638528859e+38).

See Also
GorgonGraphics
GorgonPipelineState
GorgonSamplerStateBuilder
| Edit this page View Source

MinimumLevelOfDetail

Property to return the minimum mip level of detail to use.

Declaration
public float MinimumLevelOfDetail { get; }
Property Value
Type Description
float
Remarks

This defines the lower end of the mip map range to clamp access to. If this value is 0, then the largest and most detailed mip level is used, and any value higher results in less detailed mip levels.

The default value is MinValue (-3.40282346638528859e+38).

See Also
GorgonGraphics
GorgonPipelineState
GorgonSamplerStateBuilder
| Edit this page View Source

MipLevelOfDetailBias

Property to return the offset for a calculated mip map level.

Declaration
public float MipLevelOfDetailBias { get; }
Property Value
Type Description
float
Remarks

This adds the specified value to the mip map level that was calculated by the renderer.

The default value is 0.0f.

See Also
GorgonGraphics
GorgonPipelineState
GorgonSamplerStateBuilder
| Edit this page View Source

WrapU

Property to return the horizontal-U direction wrapping mode for a texture.

Declaration
public TextureWrap WrapU { get; }
Property Value
Type Description
TextureWrap
Remarks

This tells the sampler how to resolve texture data outside of the 0..1.0f range.

The default value is Clamp.

See Also
GorgonGraphics
GorgonPipelineState
GorgonSamplerStateBuilder
| Edit this page View Source

WrapV

Property to return the verical-V direction wrapping mode for a texture.

Declaration
public TextureWrap WrapV { get; }
Property Value
Type Description
TextureWrap
Remarks

This tells the sampler how to resolve texture data outside of the 0..1.0f range.

The default value is Clamp.

See Also
GorgonGraphics
GorgonPipelineState
GorgonSamplerStateBuilder
| Edit this page View Source

WrapW

Property to return the depth-W direction wrapping mode for a texture.

Declaration
public TextureWrap WrapW { get; }
Property Value
Type Description
TextureWrap
Remarks

This tells the sampler how to resolve texture data outside of the 0..1.0f range.

The default value is Clamp.

See Also
GorgonGraphics
GorgonPipelineState
GorgonSamplerStateBuilder

Methods

| Edit this page View Source

Equals(GorgonSamplerState)

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

Declaration
public bool Equals(GorgonSamplerState other)
Parameters
Type Name Description
GorgonSamplerState other

An object to compare with this object.

Returns
Type Description
bool

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

See Also
GorgonGraphics
GorgonPipelineState
GorgonSamplerStateBuilder
| 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
GorgonSamplerStateBuilder
| 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
GorgonSamplerStateBuilder

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
GorgonSamplerStateBuilder
  • 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