Diligent::ISwapChain struct

Swap chain interface.

The swap chain is created by a platform-dependent function

Base classes

struct IObject
Base interface for all dynamic objects in the engine.

Derived classes

struct ISwapChainD3D11
Exposes Direct3D11-specific functionality of a swap chain.
struct ISwapChainD3D12
Exposes Direct3D12-specific functionality of a swap chain.
struct ISwapChainGL
Exposes OpenGL-specific functionality of a swap chain.
class ISwapChainMtl
Exposes Metal-specific functionality of a swap chain.
struct ISwapChainVk
Exposes Vulkan-specific functionality of a swap chain.

Public functions

auto Present(Uint32 SyncInterval = 1) -> void METHOD() virtual
Presents a rendered image to the user.
auto GetDesc() const -> const SwapChainDesc&METHOD() virtual
Returns the swap chain desctription.
auto Resize(Uint32 NewWidth, Uint32 NewHeight, SURFACE_TRANSFORM NewTransform = SURFACE_TRANSFORM_OPTIMAL) -> void METHOD() virtual
Changes the swap chain size.
auto SetFullscreenMode(const DisplayModeAttribs& DisplayMode) -> void METHOD() virtual
Sets fullscreen mode (only supported on Win32 platform)
auto SetWindowedMode() -> void METHOD() virtual
Sets windowed mode (only supported on Win32 platform)
auto SetMaximumFrameLatency(Uint32 MaxLatency) -> void METHOD() virtual
Sets the maximum number of frames that the swap chain is allowed to queue for rendering.
auto GetCurrentBackBufferRTV() -> ITextureView*METHOD() virtual
Returns render target view of the current back buffer in the swap chain.
auto GetDepthBufferDSV() -> ITextureView*METHOD() virtual
Returns depth-stencil view of the depth buffer.

Function documentation

void METHOD() Diligent::ISwapChain::Resize(Uint32 NewWidth, Uint32 NewHeight, SURFACE_TRANSFORM NewTransform = SURFACE_TRANSFORM_OPTIMAL) virtual

Changes the swap chain size.

Parameters
NewWidth in - New logical swap chain width (not accounting for pre-transform), in pixels.
NewHeight in - New logical swap chain height (not accounting for pre-transform), in pixels.
NewTransform in - New surface transform, see Diligent::SURFACE_TRANSFORM.

New width and height should not account for surface pre-transform. For example, if the window size is 1920 x 1080, but the surface is pre-rotated by 90 degrees, NewWidth should still be 1920, and NewHeight should still be 1080. It is highly recommended to always use SURFACE_TRANSFORM_OPTIMAL to let the engine select the most optimal pre-transform. However SURFACE_TRANSFORM_ROTATE_90 will also work in the scenario above. After the swap chain has been resized, its actual width will be 1080, actual height will be 1920, and PreTransform will be SURFACE_TRANSFORM_ROTATE_90.

void METHOD() Diligent::ISwapChain::SetMaximumFrameLatency(Uint32 MaxLatency) virtual

Sets the maximum number of frames that the swap chain is allowed to queue for rendering.

This value is only relevant for D3D11 and D3D12 backends and ignored for others. By default it matches the number of buffers in the swap chain. For example, for a 2-buffer swap chain, the CPU can enqueue frames 0 and 1, but Present command of frame 2 will block until frame 0 is presented. If in the example above the maximum frame latency is set to 1, then Present command of frame 1 will block until Present of frame 0 is complete.

ITextureView*METHOD() Diligent::ISwapChain::GetCurrentBackBufferRTV() virtual

Returns render target view of the current back buffer in the swap chain.

The method does NOT call AddRef() on the returned interface, so Release() must not be called.

ITextureView*METHOD() Diligent::ISwapChain::GetDepthBufferDSV() virtual

Returns depth-stencil view of the depth buffer.

The method does NOT call AddRef() on the returned interface, so Release() must not be called.