Class DxgiSwapChain2
Provides presentation capabilities that are enhanced from IDXGISwapChain1. These presentation capabilities consist of specifying dirty rectangles and scroll rectangle to optimize the presentation.
Implements
Inherited Members
Namespace: JeremyAnsel.DirectX.Dxgi
Assembly: JeremyAnsel.DirectX.Dxgi.dll
Syntax
[SecurityCritical]
public class DxgiSwapChain2 : DxgiDeviceSubObject, IDisposable
Constructors
| Edit this page View SourceDxgiSwapChain2(nint)
Initializes a new instance of the DxgiSwapChain2 class.
Declaration
public DxgiSwapChain2(nint comPtr)
Parameters
| Type | Name | Description |
|---|---|---|
| nint | comPtr |
Fields
| Edit this page View SourceDxgiSwapChain2Guid
The interface GUID.
Declaration
public static readonly Guid DxgiSwapChain2Guid
Field Value
| Type | Description |
|---|---|
| Guid |
Properties
| Edit this page View SourceBackgroundColor
Gets or sets the background color of the swap chain.
Declaration
public DxgiColorRgba BackgroundColor { get; set; }
Property Value
| Type | Description |
|---|---|
| DxgiColorRgba |
Description
Gets a description of the swap chain.
Declaration
public DxgiSwapChainDesc1 Description { get; }
Property Value
| Type | Description |
|---|---|
| DxgiSwapChainDesc1 |
FrameStatistics
Gets performance statistics about the last render frame.
Declaration
public DxgiFrameStatistics FrameStatistics { get; }
Property Value
| Type | Description |
|---|---|
| DxgiFrameStatistics |
FullscreenDescription
Gets a description of a full-screen swap chain.
Declaration
public DxgiSwapChainFullscreenDesc FullscreenDescription { get; }
Property Value
| Type | Description |
|---|---|
| DxgiSwapChainFullscreenDesc |
IsTemporaryMonoSupported
Gets a value indicating whether a swap chain supports “temporary mono.”
Declaration
public bool IsTemporaryMonoSupported { get; }
Property Value
| Type | Description |
|---|---|
| bool |
LastPresentCount
Gets the number of times that IDXGISwapChain::Present or IDXGISwapChain1::Present1 has been called.
Declaration
public uint LastPresentCount { get; }
Property Value
| Type | Description |
|---|---|
| uint |
Rotation
Gets or sets the rotation of the back buffers for the swap chain.
Declaration
public DxgiModeRotation Rotation { get; set; }
Property Value
| Type | Description |
|---|---|
| DxgiModeRotation |
WindowHandle
Gets the underlying HWND for this swap-chain object.
Declaration
public nint WindowHandle { get; }
Property Value
| Type | Description |
|---|---|
| nint |
Methods
| Edit this page View SourceGetBuffer(uint, in Guid)
Accesses one of the swap-chain's back buffers.
Declaration
public nint GetBuffer(uint buffer, in Guid riid)
Parameters
| Type | Name | Description |
|---|---|---|
| uint | buffer | A zero-based buffer index. |
| Guid | riid | The type of interface used to manipulate the buffer. |
Returns
| Type | Description |
|---|---|
| nint | A pointer to a back-buffer interface. |
GetContainingOutput()
Get the output (the display monitor) that contains the majority of the client area of the target window.
Declaration
public DxgiOutput2 GetContainingOutput()
Returns
| Type | Description |
|---|---|
| DxgiOutput2 | The output interface. |
GetFullscreenState()
Get the state associated with full-screen mode.
Declaration
public bool GetFullscreenState()
Returns
| Type | Description |
|---|---|
| bool | A value indicating whether to set the display state to windowed or full screen. |
GetFullscreenState(out DxgiOutput2?)
Get the state associated with full-screen mode.
Declaration
public bool GetFullscreenState(out DxgiOutput2? target)
Parameters
| Type | Name | Description |
|---|---|---|
| DxgiOutput2 | target | The output target when the mode is full screen. |
Returns
| Type | Description |
|---|---|
| bool | A value indicating whether to set the display state to windowed or full screen. |
GetRestrictToOutput()
Gets the output (the display monitor) to which you can restrict the contents of a present operation.
Declaration
public DxgiOutput2 GetRestrictToOutput()
Returns
| Type | Description |
|---|---|
| DxgiOutput2 | The |
GetSurface(uint)
Accesses one of the swap-chain's back buffers.
Declaration
public DxgiSurface2 GetSurface(uint buffer)
Parameters
| Type | Name | Description |
|---|---|---|
| uint | buffer | A zero-based buffer index. |
Returns
| Type | Description |
|---|---|
| DxgiSurface2 | A back-buffer surface. |
Present()
Presents a rendered image to the user.
Declaration
public void Present()
Present(uint)
Presents a frame on the display screen.
Declaration
public void Present(uint syncInterval)
Parameters
| Type | Name | Description |
|---|---|---|
| uint | syncInterval | An integer that specifies how to synchronize presentation of a frame with the vertical blank. |
Present(uint, DxgiPresentOptions)
Presents a frame on the display screen.
Declaration
public void Present(uint syncInterval, DxgiPresentOptions options)
Parameters
| Type | Name | Description |
|---|---|---|
| uint | syncInterval | An integer that specifies how to synchronize presentation of a frame with the vertical blank. |
| DxgiPresentOptions | options | An integer value that contains swap-chain presentation options. |
Present(uint, DxgiPresentOptions, in DxgiPresentParameters)
Presents a frame on the display screen.
Declaration
public void Present(uint syncInterval, DxgiPresentOptions options, in DxgiPresentParameters parameters)
Parameters
| Type | Name | Description |
|---|---|---|
| uint | syncInterval | An integer that specifies how to synchronize presentation of a frame with the vertical blank. |
| DxgiPresentOptions | options | An integer value that contains swap-chain presentation options. |
| DxgiPresentParameters | parameters | A structure that describes updated rectangles and scroll information of the frame to present. |
Present(uint, DxgiPresentOptions, in DxgiRect, in DxgiRect?, in DxgiPoint?)
Presents a frame on the display screen.
Declaration
public void Present(uint syncInterval, DxgiPresentOptions options, in DxgiRect dirtyRect, in DxgiRect? scrollRect, in DxgiPoint? scrollOffset)
Parameters
| Type | Name | Description |
|---|---|---|
| uint | syncInterval | An integer that specifies how to synchronize presentation of a frame with the vertical blank. |
| DxgiPresentOptions | options | An integer value that contains swap-chain presentation options. |
| DxgiRect | dirtyRect | An updated rectangle that you update in the back buffer for the presented frame. |
| DxgiRect? | scrollRect | The rectangle of the previous frame from which the runtime bit-block transfers content. |
| DxgiPoint? | scrollOffset | The offset of the scrolled area that goes from the source rectangle (of previous frame) to the destination rectangle (of current frame). |
Present(uint, DxgiPresentOptions, DxgiRect[]?, in DxgiRect?, in DxgiPoint?)
Presents a frame on the display screen.
Declaration
public void Present(uint syncInterval, DxgiPresentOptions options, DxgiRect[]? dirtyRects, in DxgiRect? scrollRect, in DxgiPoint? scrollOffset)
Parameters
| Type | Name | Description |
|---|---|---|
| uint | syncInterval | An integer that specifies how to synchronize presentation of a frame with the vertical blank. |
| DxgiPresentOptions | options | An integer value that contains swap-chain presentation options. |
| DxgiRect[] | dirtyRects | A list of updated rectangles that you update in the back buffer for the presented frame. |
| DxgiRect? | scrollRect | The rectangle of the previous frame from which the runtime bit-block transfers content. |
| DxgiPoint? | scrollOffset | The offset of the scrolled area that goes from the source rectangle (of previous frame) to the destination rectangle (of current frame). |
Present(uint, DxgiPresentOptions, ReadOnlySpan<DxgiRect>, in DxgiRect?, in DxgiPoint?)
Presents a frame on the display screen.
Declaration
public void Present(uint syncInterval, DxgiPresentOptions options, ReadOnlySpan<DxgiRect> dirtyRects, in DxgiRect? scrollRect, in DxgiPoint? scrollOffset)
Parameters
| Type | Name | Description |
|---|---|---|
| uint | syncInterval | An integer that specifies how to synchronize presentation of a frame with the vertical blank. |
| DxgiPresentOptions | options | An integer value that contains swap-chain presentation options. |
| ReadOnlySpan<DxgiRect> | dirtyRects | A list of updated rectangles that you update in the back buffer for the presented frame. |
| DxgiRect? | scrollRect | The rectangle of the previous frame from which the runtime bit-block transfers content. |
| DxgiPoint? | scrollOffset | The offset of the scrolled area that goes from the source rectangle (of previous frame) to the destination rectangle (of current frame). |
ResizeBuffers(uint)
Changes the swap chain's back buffer size, format, and number of buffers. This should be called when the application window is resized.
Declaration
public void ResizeBuffers(uint bufferCount)
Parameters
| Type | Name | Description |
|---|---|---|
| uint | bufferCount | The number of buffers in the swap chain (including all back and front buffers). This number can be different from the number of buffers with which you created the swap chain. |
ResizeBuffers(uint, uint, uint, DxgiFormat, DxgiSwapChainOptions)
Changes the swap chain's back buffer size, format, and number of buffers. This should be called when the application window is resized.
Declaration
public void ResizeBuffers(uint bufferCount, uint width, uint height, DxgiFormat format, DxgiSwapChainOptions options)
Parameters
| Type | Name | Description |
|---|---|---|
| uint | bufferCount | The number of buffers in the swap chain (including all back and front buffers). This number can be different from the number of buffers with which you created the swap chain. |
| uint | width | New width of the back buffer. If you specify zero, DXGI will use the width of the client area of the target window. |
| uint | height | New height of the back buffer. If you specify zero, DXGI will use the height of the client area of the target window. |
| DxgiFormat | format | A |
| DxgiSwapChainOptions | options | The options for swap-chain behavior. |
ResizeTarget(in DxgiModeDesc)
Resizes the output target.
Declaration
public void ResizeTarget(in DxgiModeDesc targetParameters)
Parameters
| Type | Name | Description |
|---|---|---|
| DxgiModeDesc | targetParameters | A |
SetFullscreenState(bool)
Sets the display state to windowed or full screen.
Declaration
public void SetFullscreenState(bool fullscreen)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | fullscreen | A value indicating whether to set the display state to windowed or full screen. |
SetFullscreenState(bool, DxgiOutput2?)
Sets the display state to windowed or full screen.
Declaration
public void SetFullscreenState(bool fullscreen, DxgiOutput2? target)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | fullscreen | A value indicating whether to set the display state to windowed or full screen. |
| DxgiOutput2 | target | A pointer to an |