Table of Contents

Class PresentationParameters

Namespace
Stride.Graphics
Assembly
Stride.Graphics.dll

Describes how a GraphicsDevice will display to the screen.

public sealed class PresentationParameters : IEquatable<PresentationParameters>
Inheritance
object
PresentationParameters
Implements
Extension Methods

Constructors

PresentationParameters()

Initializes a new instance of the PresentationParameters class with default values.

public PresentationParameters()

Remarks

The returned instance will be configured with the following default values:

  • A back buffer resolution of 800x480 pixels, with a 32-bits-per-pixel integer format (R8G8B8A8_UNorm).
  • A 24-bit integer depth buffer with an additional 8-bit stencil buffer (D24_UNorm_S8_UInt).
  • No multi-sampling.
  • Assuming a linear color space (Linear) and an output color space ColorSpaceType.RgbFullG22NoneP709, which is the default RGB output for monitors with a standard gamma of 2.2.
  • A windowed presentation at 60 Hz with no V-Sync (Immediate).

PresentationParameters(int, int, WindowHandle)

Initializes a new instance of the PresentationParameters class with default values, but with the specified back buffer size, using R8G8B8A8_UNorm, and window handle.

public PresentationParameters(int backBufferWidth, int backBufferHeight, WindowHandle windowHandle)

Parameters

backBufferWidth int

The width of the back buffer, in pixels.

backBufferHeight int

The height of the back buffer, in pixels.

windowHandle WindowHandle

The window handle.

See Also

PresentationParameters(int, int, WindowHandle, PixelFormat)

Initializes a new instance of the PresentationParameters class with default values, but with the specified back buffer size, pixel format, and window handle.

public PresentationParameters(int backBufferWidth, int backBufferHeight, WindowHandle windowHandle, PixelFormat backBufferFormat)

Parameters

backBufferWidth int

The width of the back buffer, in pixels.

backBufferHeight int

The height of the back buffer, in pixels.

windowHandle WindowHandle

The window handle.

backBufferFormat PixelFormat

The back buffer format.

See Also

Fields

BackBufferFormat

A PixelFormat specifying the display format.

public PixelFormat BackBufferFormat

Field Value

PixelFormat

BackBufferHeight

The height of the back-buffer, in pixels.

public int BackBufferHeight

Field Value

int

Remarks

Both BackBufferWidth and BackBufferHeight determine both the screen resolution (if in full-screen mode) or the window size (if in windowed-mode).

BackBufferWidth

The width of the back-buffer, in pixels.

public int BackBufferWidth

Field Value

int

Remarks

Both BackBufferWidth and BackBufferHeight determine both the screen resolution (if in full-screen mode) or the window size (if in windowed-mode).

ColorSpace

The color space to use for presenting the frame to the screen.

public ColorSpace ColorSpace

Field Value

ColorSpace

Remarks

The Color Space defines how colors are represented and displayed on the screen. Common values include:

  • Gamma It usually represents sRGB, the standard RGB color space used in most monitors and applications. It offers a limited range of colors suitable for general purposes.
  • Linear A linear color space suitable for high-dynamic-range color values like HDR10, supporting a wider range of brightness and colors. This is commonly used in modern HDR displays for enhanced image quality.

Choosing the appropriate color space affects the visual quality of your application. For example, sRGB is recommended for compatibility, while HDR10 may enhance visuals in games or applications designed for HDR content.

DepthStencilFormat

A PixelFormat specifying the depth-stencil format.

public PixelFormat DepthStencilFormat

Field Value

PixelFormat

Remarks

The Depth Buffer (also known as Z-buffer) is used to determine the depth of each pixel so close geometry correctly occludes farther geometry. The format determines the precission of the depth buffer.

The Stencil Buffer is used to store additional information for each pixel, such as marking or discarding specific pixels for different effects.

This format determines both because usually the stencil buffer is a part of the depth buffer reserved for other uses.

Some examples are D24_UNorm_S8_UInt, where the depth buffer uses 24 bits and the stencil buffer uses 8 bits, for a total of 32 bits per pixel, or D32_Float, which uses 32 bits for the depth buffer and no bits for the stencil buffer.

DeviceWindowHandle

The window object or handle where the presentation will occur.

public WindowHandle DeviceWindowHandle

Field Value

WindowHandle

Remarks

A window object is platform-dependent:

  • Windows Desktop This could be a low-level window/control handle (nint), or directly a Windows Forms' Form or Control object.
  • Windows Metro This could be a SwapChainBackgroundPanel or SwapChainPanel object.

IsFullScreen

A value indicating whether the application must render in full-screen mode (true) or inside a window (false).

public bool IsFullScreen

Field Value

bool

MultisampleCount

A MultisampleCount indicating the number of sample locations during multi-sampling.

public MultisampleCount MultisampleCount

Field Value

MultisampleCount

Remarks

The multi-sampling is applied to the back-buffer to reduce the aliasing artifacts. This is known as Multi-Sampling Anti-Aliasing (MSAA).

The higher the number of samples, the aliasing patterns will be less visible, but it will result in more memory being consumed, and costlier rasterization.

If None is selected, no multi-sampling will be applied. Common values include X2 (minimal anti-aliasing) and X8 (high-quality anti-aliasing). Higher values increase GPU workload.

OutputColorSpace

The color space type used for the Graphics Presenter output.

public ColorSpaceType OutputColorSpace

Field Value

ColorSpaceType

Remarks

The output color space can be used to render to HDR monitors. Consult the documentation of the ColorSpaceType enum for more details.

Note that this is currently only supported in Stride when using the Direct3D Graphics API. For more information about High Dynamic Range (HDR) rendering, see https://learn.microsoft.com/en-us/windows/win32/direct3darticles/high-dynamic-range.

PreferredFullScreenOutputIndex

The index of the preferred output (monitor) to use when switching to full-screen mode.

public int PreferredFullScreenOutputIndex

Field Value

int

Remarks

This parameter does not have any effect when windowed mode is used (IsFullScreen is false).

PresentationInterval

A value of PresentationInterval determining the maximum rate at which the Swap Chain's back buffers can be presented to the front buffer.

public PresentInterval PresentationInterval

Field Value

PresentInterval

RefreshRate

The refresh rate of the screen, in hertz.

public Rational RefreshRate

Field Value

Rational

Remarks

The Refresh Rate is the number of times per second the screen is refreshed, i.e. the number of frames per second the monitor can display.

The value is represented as a Rational, so it can represent both usual integer refresh rates (e.g. 60Hz) and fractional refresh rates (e.g. 59.94Hz).

Usually, the refresh rate is only respected when rendering in full-screen mode (i.e. when IsFullScreen is set to true).

Common refresh rates include 60Hz, 120Hz, and 144Hz, depending on monitor capabilities.

Methods

Clone()

Creates a new PresentationParameters object that is a copy of the current instance.

public PresentationParameters Clone()

Returns

PresentationParameters

A new PresentationParameters object that is a copy of this instance.

Equals(PresentationParameters)

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

public bool Equals(PresentationParameters other)

Parameters

other PresentationParameters

An object to compare with this object.

Returns

bool

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

Equals(object)

Determines whether the specified object is equal to the current object.

public override bool Equals(object obj)

Parameters

obj object

The object to compare with the current object.

Returns

bool

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

GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

Returns

int

A hash code for the current object.

Operators

operator ==(PresentationParameters, PresentationParameters)

public static bool operator ==(PresentationParameters left, PresentationParameters right)

Parameters

left PresentationParameters
right PresentationParameters

Returns

bool

operator !=(PresentationParameters, PresentationParameters)

public static bool operator !=(PresentationParameters left, PresentationParameters right)

Parameters

left PresentationParameters
right PresentationParameters

Returns

bool