UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
D3D11Util.h File Reference

Go to the source code of this file.

Classes

struct  FD3D11ResizeViewportState
 
class  FD3D11LockedKey
 
struct  FD3D11LockedData
 
class  FD3D11BoundRenderTargets
 
struct  FD3D11RHIGenericCommandString
 
class  TD3D11RHIGenericCommand< JobType, typename >
 
struct  FScopedD3D11RHIThreadStaller
 

Macros

#define D3D11RHI_IMMEDIATE_CONTEXT   (GD3D11RHI->GetDeviceContext())
 
#define D3D11RHI_DEVICE   (GD3D11RHI->GetDevice())
 
#define VERIFYD3D11RESULT_EX(x, Device)   {HRESULT hr = x; if (FAILED(hr)) { VerifyD3D11Result(hr,#x,__FILE__,__LINE__, Device); }}
 
#define VERIFYD3D11RESULT(x)   {HRESULT hr = x; if (FAILED(hr)) { VerifyD3D11Result(hr,#x,__FILE__,__LINE__, 0); }}
 
#define VERIFYD3D11RESULT_NOEXIT(x)   {HRESULT hr = x; if (FAILED(hr)) { VerifyD3D11ResultNoExit(hr,#x,__FILE__,__LINE__, 0); }}
 
#define VERIFYD3D11SHADERRESULT(Result, Shader, Device)   {HRESULT hr = (Result); if (FAILED(hr)) { VerifyD3D11ShaderResult(Shader, hr, #Result,__FILE__,__LINE__, Device); }}
 
#define VERIFYD3D11RESULT_NOEXIT(x)   {HRESULT hr = x; if (FAILED(hr)) { VerifyD3D11ResultNoExit(hr,#x,__FILE__,__LINE__, 0); }}
 
#define VERIFYD3D11CREATETEXTURERESULT(x, UEFormat, SizeX, SizeY, SizeZ, Format, NumMips, Flags, Usage, CPUAccessFlags, MiscFlags, SampleCount, SampleQuality, SubResPtr, SubResPitch, SubResSlicePitch, Device, DebugName)   {HRESULT hr = x; if (FAILED(hr)) { VerifyD3D11CreateTextureResult(hr, UEFormat,#x,__FILE__,__LINE__,SizeX,SizeY,SizeZ,Format,NumMips,Flags,Usage,CPUAccessFlags,MiscFlags,SampleCount,SampleQuality,SubResPtr,SubResPitch,SubResSlicePitch,Device,DebugName); }}
 
#define VERIFYD3D11RESIZEVIEWPORTRESULT(x, OldState, NewState, Device)   { HRESULT hr = x; if (FAILED(hr)) { VerifyD3D11ResizeViewportResult(hr, #x, __FILE__, __LINE__, OldState, NewState, Device); }}
 
#define VERIFYD3D11CREATEVIEWRESULT(x, Device, Resource, Desc)   {HRESULT hr = x; if (FAILED(hr)) { VerifyD3D11CreateViewResult(hr, #x, __FILE__, __LINE__, Device, Resource, Desc); }}
 
#define checkComRefCount(Obj, ExpectedRefs)   VerifyComRefCount(Obj,ExpectedRefs,TEXT(#Obj),TEXT(__FILE__),__LINE__)
 

Functions

void SetD3D11ObjectName (ID3D11DeviceChild *Object, FAnsiStringView Name)
 
void SetD3D11ObjectName (ID3D11DeviceChild *Object, FStringView Name)
 
void SetD3D11ResourceName (FD3D11Texture *Texture, FStringView Name)
 
void SetD3D11ResourceName (FD3D11Buffer *Buffer, FStringView Name)
 
void SetD3D11ResourceName (FD3D11UnorderedAccessView *UAV, FStringView Name)
 
D3D11RHI_API void VerifyD3D11ResultNoExit (HRESULT Result, const ANSICHAR *Code, const ANSICHAR *Filename, uint32 Line, ID3D11Device *Device)
 
D3D11RHI_API void VerifyD3D11Result (HRESULT Result, const ANSICHAR *Code, const ANSICHAR *Filename, uint32 Line, ID3D11Device *Device)
 
D3D11RHI_API void VerifyD3D11ShaderResult (class FRHIShader *Shader, HRESULT Result, const ANSICHAR *Code, const ANSICHAR *Filename, uint32 Line, ID3D11Device *Device)
 
D3D11RHI_API void VerifyD3D11CreateTextureResult (HRESULT D3DResult, int32 UEFormat, const ANSICHAR *Code, const ANSICHAR *Filename, uint32 Line, uint32 SizeX, uint32 SizeY, uint32 SizeZ, uint8 D3DFormat, uint32 NumMips, uint32 Flags, D3D11_USAGE Usage, uint32 CPUAccessFlags, uint32 MiscFlags, uint32 SampleCount, uint32 SampleQuality, const void *SubResPtr, uint32 SubResPitch, uint32 SubResSlicePitch, ID3D11Device *Device, const TCHAR *DebugName)
 
D3D11RHI_API void VerifyD3D11ResizeViewportResult (HRESULT D3DResult, const ANSICHAR *Code, const ANSICHAR *Filename, uint32 Line, const FD3D11ResizeViewportState &OldState, const FD3D11ResizeViewportState &NewState, ID3D11Device *Device)
 
D3D11RHI_API void VerifyD3D11CreateViewResult (HRESULT D3DResult, const ANSICHAR *Code, const ANSICHAR *Filename, uint32 Line, ID3D11Device *Device, FRHITexture *Texture, const D3D11_UNORDERED_ACCESS_VIEW_DESC &Desc)
 
D3D11RHI_API void VerifyD3D11CreateViewResult (HRESULT D3DResult, const ANSICHAR *Code, const ANSICHAR *Filename, uint32 Line, ID3D11Device *Device, FRHIBuffer *Buffer, const D3D11_UNORDERED_ACCESS_VIEW_DESC &Desc)
 
D3D11RHI_API void VerifyComRefCount (IUnknown *Object, int32 ExpectedRefs, const TCHAR *Code, const TCHAR *Filename, int32 Line)
 
FString GetD3D11ErrorString (HRESULT ErrorCode, ID3D11Device *Device)
 
uint32 GetD3D11CubeFace (ECubeFace Face)
 
template<typename JobType >
void RunOnRHIThread (JobType &&InRHIJob)
 
bool ShouldNotEnqueueRHICommand ()
 

Macro Definition Documentation

◆ checkComRefCount

#define checkComRefCount (   Obj,
  ExpectedRefs 
)    VerifyComRefCount(Obj,ExpectedRefs,TEXT(#Obj),TEXT(__FILE__),__LINE__)

◆ D3D11RHI_DEVICE

#define D3D11RHI_DEVICE   (GD3D11RHI->GetDevice())

◆ D3D11RHI_IMMEDIATE_CONTEXT

#define D3D11RHI_IMMEDIATE_CONTEXT   (GD3D11RHI->GetDeviceContext())

◆ VERIFYD3D11CREATETEXTURERESULT

#define VERIFYD3D11CREATETEXTURERESULT (   x,
  UEFormat,
  SizeX,
  SizeY,
  SizeZ,
  Format,
  NumMips,
  Flags,
  Usage,
  CPUAccessFlags,
  MiscFlags,
  SampleCount,
  SampleQuality,
  SubResPtr,
  SubResPitch,
  SubResSlicePitch,
  Device,
  DebugName 
)    {HRESULT hr = x; if (FAILED(hr)) { VerifyD3D11CreateTextureResult(hr, UEFormat,#x,__FILE__,__LINE__,SizeX,SizeY,SizeZ,Format,NumMips,Flags,Usage,CPUAccessFlags,MiscFlags,SampleCount,SampleQuality,SubResPtr,SubResPitch,SubResSlicePitch,Device,DebugName); }}

◆ VERIFYD3D11CREATEVIEWRESULT

#define VERIFYD3D11CREATEVIEWRESULT (   x,
  Device,
  Resource,
  Desc 
)    {HRESULT hr = x; if (FAILED(hr)) { VerifyD3D11CreateViewResult(hr, #x, __FILE__, __LINE__, Device, Resource, Desc); }}

◆ VERIFYD3D11RESIZEVIEWPORTRESULT

#define VERIFYD3D11RESIZEVIEWPORTRESULT (   x,
  OldState,
  NewState,
  Device 
)    { HRESULT hr = x; if (FAILED(hr)) { VerifyD3D11ResizeViewportResult(hr, #x, __FILE__, __LINE__, OldState, NewState, Device); }}

◆ VERIFYD3D11RESULT

#define VERIFYD3D11RESULT (   x)    {HRESULT hr = x; if (FAILED(hr)) { VerifyD3D11Result(hr,#x,__FILE__,__LINE__, 0); }}

◆ VERIFYD3D11RESULT_EX

#define VERIFYD3D11RESULT_EX (   x,
  Device 
)    {HRESULT hr = x; if (FAILED(hr)) { VerifyD3D11Result(hr,#x,__FILE__,__LINE__, Device); }}

A macro for using VERIFYD3D11RESULT that automatically passes in the code and filename/line.

◆ VERIFYD3D11RESULT_NOEXIT [1/2]

#define VERIFYD3D11RESULT_NOEXIT (   x)    {HRESULT hr = x; if (FAILED(hr)) { VerifyD3D11ResultNoExit(hr,#x,__FILE__,__LINE__, 0); }}

◆ VERIFYD3D11RESULT_NOEXIT [2/2]

#define VERIFYD3D11RESULT_NOEXIT (   x)    {HRESULT hr = x; if (FAILED(hr)) { VerifyD3D11ResultNoExit(hr,#x,__FILE__,__LINE__, 0); }}

◆ VERIFYD3D11SHADERRESULT

#define VERIFYD3D11SHADERRESULT (   Result,
  Shader,
  Device 
)    {HRESULT hr = (Result); if (FAILED(hr)) { VerifyD3D11ShaderResult(Shader, hr, #Result,__FILE__,__LINE__, Device); }}

Function Documentation

◆ GetD3D11CubeFace()

uint32 GetD3D11CubeFace ( ECubeFace  Face)
inline

Convert from ECubeFace to D3DCUBEMAP_FACES type

Parameters
Face- ECubeFace type to convert
Returns
D3D cube face enum value

◆ GetD3D11ErrorString()

FString GetD3D11ErrorString ( HRESULT  ErrorCode,
ID3D11Device Device 
)

Returns a string for the provided error code, can include device removed information if the device is provided.

◆ RunOnRHIThread()

template<typename JobType >
void RunOnRHIThread ( JobType &&  InRHIJob)
inline

◆ SetD3D11ObjectName() [1/2]

void SetD3D11ObjectName ( ID3D11DeviceChild Object,
FAnsiStringView  Name 
)

◆ SetD3D11ObjectName() [2/2]

void SetD3D11ObjectName ( ID3D11DeviceChild Object,
FStringView  Name 
)

◆ SetD3D11ResourceName() [1/3]

void SetD3D11ResourceName ( FD3D11Buffer Buffer,
FStringView  Name 
)

◆ SetD3D11ResourceName() [2/3]

void SetD3D11ResourceName ( FD3D11Texture Texture,
FStringView  Name 
)

◆ SetD3D11ResourceName() [3/3]

void SetD3D11ResourceName ( FD3D11UnorderedAccessView UAV,
FStringView  Name 
)

◆ ShouldNotEnqueueRHICommand()

bool ShouldNotEnqueueRHICommand ( )
inline

◆ VerifyComRefCount()

D3D11RHI_API void VerifyComRefCount ( IUnknown Object,
int32  ExpectedRefs,
const TCHAR Code,
const TCHAR Filename,
int32  Line 
)
extern

Checks that a COM object has the expected number of references.

◆ VerifyD3D11CreateTextureResult()

D3D11RHI_API void VerifyD3D11CreateTextureResult ( HRESULT  D3DResult,
int32  UEFormat,
const ANSICHAR Code,
const ANSICHAR Filename,
uint32  Line,
uint32  SizeX,
uint32  SizeY,
uint32  SizeZ,
uint8  D3DFormat,
uint32  NumMips,
uint32  Flags,
D3D11_USAGE  Usage,
uint32  CPUAccessFlags,
uint32  MiscFlags,
uint32  SampleCount,
uint32  SampleQuality,
const void SubResPtr,
uint32  SubResPitch,
uint32  SubResSlicePitch,
ID3D11Device Device,
const TCHAR DebugName 
)
extern

Checks that the given result isn't a failure. If it is, the application exits with an appropriate error message.

Parameters
Result- The result code to check
Code- The code which yielded the result.
Filename- The filename of the source file containing Code.
Line- The line number of Code within Filename.

◆ VerifyD3D11CreateViewResult() [1/2]

D3D11RHI_API void VerifyD3D11CreateViewResult ( HRESULT  D3DResult,
const ANSICHAR Code,
const ANSICHAR Filename,
uint32  Line,
ID3D11Device Device,
FRHIBuffer Buffer,
const D3D11_UNORDERED_ACCESS_VIEW_DESC Desc 
)
extern

◆ VerifyD3D11CreateViewResult() [2/2]

D3D11RHI_API void VerifyD3D11CreateViewResult ( HRESULT  D3DResult,
const ANSICHAR Code,
const ANSICHAR Filename,
uint32  Line,
ID3D11Device Device,
FRHITexture Texture,
const D3D11_UNORDERED_ACCESS_VIEW_DESC Desc 
)
extern

◆ VerifyD3D11ResizeViewportResult()

D3D11RHI_API void VerifyD3D11ResizeViewportResult ( HRESULT  D3DResult,
const ANSICHAR Code,
const ANSICHAR Filename,
uint32  Line,
const FD3D11ResizeViewportState OldState,
const FD3D11ResizeViewportState NewState,
ID3D11Device Device 
)
extern

◆ VerifyD3D11Result()

D3D11RHI_API void VerifyD3D11Result ( HRESULT  Result,
const ANSICHAR Code,
const ANSICHAR Filename,
uint32  Line,
ID3D11Device Device 
)
extern

Checks that the given result isn't a failure. If it is, the application exits with an appropriate error message.

Parameters
Result- The result code to check.
Code- The code which yielded the result.
Filename- The filename of the source file containing Code.
Line- The line number of Code within Filename.

◆ VerifyD3D11ResultNoExit()

D3D11RHI_API void VerifyD3D11ResultNoExit ( HRESULT  Result,
const ANSICHAR Code,
const ANSICHAR Filename,
uint32  Line,
ID3D11Device Device 
)
extern

Checks that the given result isn't a failure. If it is, the application does not exit and only logs an appropriate error message.

Parameters
Result- The result code to check.
Code- The code which yielded the result.
Filename- The filename of the source file containing Code.
Line- The line number of Code within Filename.

◆ VerifyD3D11ShaderResult()

D3D11RHI_API void VerifyD3D11ShaderResult ( class FRHIShader Shader,
HRESULT  Result,
const ANSICHAR Code,
const ANSICHAR Filename,
uint32  Line,
ID3D11Device Device 
)
extern

Checks that the given result isn't a failure. If it is, the application exits with an appropriate error message.

Parameters
Shader- The shader we are trying to create.
Result- The result code to check.
Code- The code which yielded the result.
Filename- The filename of the source file containing Code.
Line- The line number of Code within Filename.
Device- The D3D device used to create the shader.