UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FD3D11Viewport Class Reference

#include <D3D11Viewport.h>

+ Inheritance diagram for FD3D11Viewport:

Public Types

enum  ED3DViewportValidFlags : uint32 { VIEWPORT_INVALID = 0x1 , VIEWPORT_FULLSCREEN_LOST = 0x2 }
 

Public Member Functions

 FD3D11Viewport (class FD3D11DynamicRHI *InD3DRHI)
 
D3D11RHI_API FD3D11Viewport (class FD3D11DynamicRHI *InD3DRHI, HWND InWindowHandle, uint32 InSizeX, uint32 InSizeY, bool bInIsFullscreen, EPixelFormat InPreferredPixelFormat)
 
D3D11RHI_API ~FD3D11Viewport ()
 
virtual D3D11RHI_API void Resize (uint32 InSizeX, uint32 InSizeY, bool bInIsFullscreen, EPixelFormat PreferredPixelFormat)
 
D3D11RHI_API void ConditionalResetSwapChain (bool bIgnoreFocus)
 
D3D11RHI_API void CheckHDRMonitorStatus ()
 
D3D11RHI_API bool Present (IRHICommandContext &RHICmdContext, bool bLockToVsync)
 
FIntPoint GetSizeXY () const
 
FD3D11TextureGetBackBuffer () const
 
virtual void WaitForFrameEventCompletion () override
 
virtual void IssueFrameEvent () override
 
IDXGISwapChainGetSwapChain () const
 
virtual voidGetNativeSwapChain () const override
 
virtual voidGetNativeBackBufferTexture () const override
 
virtual voidGetNativeBackBufferRT () const override
 
virtual void SetCustomPresent (FRHICustomPresent *InCustomPresent) override
 
virtual FRHICustomPresentGetCustomPresent () const
 
virtual voidGetNativeWindow (void **AddParam=nullptr) const override
 
- Public Member Functions inherited from FRHIViewport
 FRHIViewport ()
 
virtual FRHITextureGetOptionalSDRBackBuffer (FRHITexture *BackBuffer) const
 
virtual void Tick (float DeltaTime)
 
- Public Member Functions inherited from FRHIResource
RHI_API FRHIResource (ERHIResourceType InResourceType)
 
uint32 AddRef () const
 
uint32 Release () const
 
uint32 GetRefCount () const
 
bool IsValid () const
 
void DisableLifetimeExtension ()
 
ERHIResourceType GetType () const
 
FName GetOwnerName () const
 
void SetOwnerName (FName InOwnerName)
 

Static Public Member Functions

static D3D11RHI_API FD3D11TextureGetSwapChainSurface (FD3D11DynamicRHI *D3DRHI, EPixelFormat PixelFormat, uint32 SizeX, uint32 SizeY, IDXGISwapChain *SwapChain)
 
static DXGI_FORMAT GetRenderTargetFormat (EPixelFormat PixelFormat)
 

Protected Member Functions

D3D11RHI_API void ResetSwapChainInternal (bool bIgnoreFocus)
 
D3D11RHI_API uint32 GetSwapChainFlags ()
 
D3D11RHI_API void PresentWithVsyncDWM (IRHICommandContext &RHICmdContext)
 
D3D11RHI_API bool PresentChecked (IRHICommandContext &RHICmdContext, int32 SyncInterval)
 
void EnableHDR ()
 
void ShutdownHDR ()
 
D3D11RHI_API DXGI_MODE_DESC SetupDXGI_MODE_DESC () const
 
- Protected Member Functions inherited from FRHIResource
virtual RHI_API ~FRHIResource ()
 

Protected Attributes

FD3D11DynamicRHID3DRHI
 
uint64 LastFlipTime
 
uint64 LastFrameComplete
 
uint64 LastCompleteTime
 
int32 SyncCounter
 
bool bSyncedLastFrame
 
HWND WindowHandle
 
uint32 MaximumFrameLatency
 
uint32 SizeX
 
uint32 SizeY
 
uint32 BackBufferCount
 
uint32 PresentFailCount
 
TAtomic< uint32ValidState
 
EPixelFormat PixelFormat
 
EDisplayColorGamut DisplayColorGamut
 
EDisplayOutputFormat DisplayOutputFormat
 
bool bIsFullscreen
 
bool bAllowTearing
 
TRefCountPtr< IDXGISwapChainSwapChain
 
TRefCountPtr< FD3D11TextureBackBuffer
 
TRefCountPtr< IDXGIOutputForcedFullscreenOutput
 
bool bForcedFullscreenDisplay
 
bool bNeedSwapChain
 
FD3D11EventQuery FrameSyncEvent
 
FCustomPresentRHIRef CustomPresent
 

Static Protected Attributes

static D3D11RHI_API uint32 GSwapChainFlags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH
 

Member Enumeration Documentation

◆ ED3DViewportValidFlags

Enumerator
VIEWPORT_INVALID 
VIEWPORT_FULLSCREEN_LOST 

Constructor & Destructor Documentation

◆ FD3D11Viewport() [1/2]

FD3D11Viewport::FD3D11Viewport ( class FD3D11DynamicRHI InD3DRHI)
inline

◆ FD3D11Viewport() [2/2]

FD3D11Viewport::FD3D11Viewport ( class FD3D11DynamicRHI InD3DRHI,
HWND  InWindowHandle,
uint32  InSizeX,
uint32  InSizeY,
bool  bInIsFullscreen,
EPixelFormat  InPreferredPixelFormat 
)

◆ ~FD3D11Viewport()

FD3D11Viewport::~FD3D11Viewport ( )

Member Function Documentation

◆ CheckHDRMonitorStatus()

void FD3D11Viewport::CheckHDRMonitorStatus ( )

Called whenever the Viewport is moved to see if it has moved between HDR or LDR monitors

◆ ConditionalResetSwapChain()

void FD3D11Viewport::ConditionalResetSwapChain ( bool  bIgnoreFocus)

If the swap chain has been invalidated by DXGI, resets the swap chain to the expected state; otherwise, does nothing. Called once/frame by the game thread on all viewports.

Parameters
bIgnoreFocus- Whether the reset should happen regardless of whether the window is focused.

◆ EnableHDR()

void FD3D11Viewport::EnableHDR ( )
protected

Enable HDR meta data transmission and set the necessary color space.

◆ GetBackBuffer()

FD3D11Texture * FD3D11Viewport::GetBackBuffer ( ) const
inline

◆ GetCustomPresent()

virtual FRHICustomPresent * FD3D11Viewport::GetCustomPresent ( ) const
inlinevirtual

Returns currently set custom present handler.

Reimplemented from FRHIViewport.

◆ GetNativeBackBufferRT()

void * FD3D11Viewport::GetNativeBackBufferRT ( ) const
overridevirtual

Returns access to the platform-specific native resource pointer to a backbuffer rendertarget. This is designed to be used to provide plugins with access to the underlying resource and should be used very carefully or not at all.

Returns
The pointer to the native resource or NULL if it not initialized or not supported for this resource type for some reason

Reimplemented from FRHIViewport.

◆ GetNativeBackBufferTexture()

void * FD3D11Viewport::GetNativeBackBufferTexture ( ) const
overridevirtual

Returns access to the platform-specific native resource pointer to a backbuffer texture. This is designed to be used to provide plugins with access to the underlying resource and should be used very carefully or not at all.

Returns
The pointer to the native resource or NULL if it not initialized or not supported for this resource type for some reason

Reimplemented from FRHIViewport.

◆ GetNativeSwapChain()

void * FD3D11Viewport::GetNativeSwapChain ( ) const
overridevirtual

Returns access to the platform-specific native resource pointer. This is designed to be used to provide plugins with access to the underlying resource and should be used very carefully or not at all.

Returns
The pointer to the native resource or NULL if it not initialized or not supported for this resource type for some reason

Reimplemented from FRHIViewport.

◆ GetNativeWindow()

virtual void * FD3D11Viewport::GetNativeWindow ( void **  AddParam = nullptr) const
inlineoverridevirtual

Returns access to the platform-specific native window. This is designed to be used to provide plugins with access to the underlying resource and should be used very carefully or not at all.

Returns
The pointer to the native resource or NULL if it not initialized or not supported for this resource type for some reason. AddParam could represent any additional platform-specific data (could be null).

Reimplemented from FRHIViewport.

◆ GetRenderTargetFormat()

static DXGI_FORMAT FD3D11Viewport::GetRenderTargetFormat ( EPixelFormat  PixelFormat)
inlinestatic

◆ GetSizeXY()

FIntPoint FD3D11Viewport::GetSizeXY ( ) const
inline

◆ GetSwapChain()

IDXGISwapChain * FD3D11Viewport::GetSwapChain ( ) const
inline

◆ GetSwapChainFlags()

uint32 FD3D11Viewport::GetSwapChainFlags ( )
protected

Gets the swap chain flags

Returns the current swap chain flags but with the same tearing policy used during construction.

◆ GetSwapChainSurface()

FD3D11Texture * FD3D11Viewport::GetSwapChainSurface ( FD3D11DynamicRHI D3DRHI,
EPixelFormat  PixelFormat,
uint32  SizeX,
uint32  SizeY,
IDXGISwapChain SwapChain 
)
static

Creates a FD3D11Surface to represent a swap chain's back buffer.

◆ IssueFrameEvent()

virtual void FD3D11Viewport::IssueFrameEvent ( )
inlineoverridevirtual

Reimplemented from FRHIViewport.

◆ Present()

bool FD3D11Viewport::Present ( IRHICommandContext RHICmdContext,
bool  bLockToVsync 
)

Presents the swap chain. Returns true if Present was done by Engine.

◆ PresentChecked()

bool FD3D11Viewport::PresentChecked ( IRHICommandContext RHICmdContext,
int32  SyncInterval 
)
protected

Presents the swap chain checking the return result. Returns true if Present was done by Engine.

Presents the swap chain checking the return result.

◆ PresentWithVsyncDWM()

void FD3D11Viewport::PresentWithVsyncDWM ( IRHICommandContext RHICmdContext)
protected

Presents the frame synchronizing with DWM.

Blocks the CPU to synchronize with vblank by communicating with DWM.

◆ ResetSwapChainInternal()

void FD3D11Viewport::ResetSwapChainInternal ( bool  bIgnoreFocus)
protected

◆ Resize()

void FD3D11Viewport::Resize ( uint32  InSizeX,
uint32  InSizeY,
bool  bInIsFullscreen,
EPixelFormat  PreferredPixelFormat 
)
virtual

◆ SetCustomPresent()

virtual void FD3D11Viewport::SetCustomPresent ( FRHICustomPresent )
inlineoverridevirtual

Sets custom Present handler on the viewport

Reimplemented from FRHIViewport.

◆ SetupDXGI_MODE_DESC()

DXGI_MODE_DESC FD3D11Viewport::SetupDXGI_MODE_DESC ( ) const
protected

◆ ShutdownHDR()

void FD3D11Viewport::ShutdownHDR ( )
protected

Disable HDR meta data transmission and set the necessary color space.

◆ WaitForFrameEventCompletion()

virtual void FD3D11Viewport::WaitForFrameEventCompletion ( )
inlineoverridevirtual

Reimplemented from FRHIViewport.

Member Data Documentation

◆ BackBuffer

TRefCountPtr<FD3D11Texture> FD3D11Viewport::BackBuffer
protected

◆ BackBufferCount

uint32 FD3D11Viewport::BackBufferCount
protected

◆ bAllowTearing

bool FD3D11Viewport::bAllowTearing
protected

◆ bForcedFullscreenDisplay

bool FD3D11Viewport::bForcedFullscreenDisplay
protected

◆ bIsFullscreen

bool FD3D11Viewport::bIsFullscreen
protected

◆ bNeedSwapChain

bool FD3D11Viewport::bNeedSwapChain
protected

◆ bSyncedLastFrame

bool FD3D11Viewport::bSyncedLastFrame
protected

◆ CustomPresent

FCustomPresentRHIRef FD3D11Viewport::CustomPresent
protected

◆ D3DRHI

FD3D11DynamicRHI* FD3D11Viewport::D3DRHI
protected

◆ DisplayColorGamut

EDisplayColorGamut FD3D11Viewport::DisplayColorGamut
protected

◆ DisplayOutputFormat

EDisplayOutputFormat FD3D11Viewport::DisplayOutputFormat
protected

◆ ForcedFullscreenOutput

TRefCountPtr<IDXGIOutput> FD3D11Viewport::ForcedFullscreenOutput
protected

◆ FrameSyncEvent

FD3D11EventQuery FD3D11Viewport::FrameSyncEvent
protected

An event used to track the GPU's progress.

◆ GSwapChainFlags

uint32 FD3D11Viewport::GSwapChainFlags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH
staticprotected

◆ LastCompleteTime

uint64 FD3D11Viewport::LastCompleteTime
protected

◆ LastFlipTime

uint64 FD3D11Viewport::LastFlipTime
protected

◆ LastFrameComplete

uint64 FD3D11Viewport::LastFrameComplete
protected

◆ MaximumFrameLatency

uint32 FD3D11Viewport::MaximumFrameLatency
protected

◆ PixelFormat

EPixelFormat FD3D11Viewport::PixelFormat
protected

◆ PresentFailCount

uint32 FD3D11Viewport::PresentFailCount
protected

◆ SizeX

uint32 FD3D11Viewport::SizeX
protected

◆ SizeY

uint32 FD3D11Viewport::SizeY
protected

◆ SwapChain

TRefCountPtr<IDXGISwapChain> FD3D11Viewport::SwapChain
protected

◆ SyncCounter

int32 FD3D11Viewport::SyncCounter
protected

◆ ValidState

TAtomic<uint32> FD3D11Viewport::ValidState
protected

◆ WindowHandle

HWND FD3D11Viewport::WindowHandle
protected

The documentation for this class was generated from the following files: