UDocumentation
UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
D3D12RHIDefinitions.h
Go to the documentation of this file.
1
// Copyright Epic Games, Inc. All Rights Reserved.
2
3
#pragma once
4
5
#include "
RHIDefinitions.h
"
6
7
#include COMPILED_PLATFORM_HEADER(D3D12RHIDefinitions.h)
8
9
// DX12 doesn't support higher MSAA count
10
#define DX_MAX_MSAA_COUNT 8
11
12
// How many residency packets can be in flight before the rendering thread
13
// blocks for them to drain. Should be ~ NumBufferedFrames * AvgNumSubmissionsPerFrame i.e.
14
// enough to ensure that the GPU is rarely blocked by residency work
15
#define RESIDENCY_PIPELINE_DEPTH 6
16
17
#define DEBUG_RESOURCE_STATES 0
18
#define DX12_RESOURCE_NAME_TO_LOG ""
19
20
// Useful for debugging. Only flushes the default context though.
21
#define D3D12RHI_IDLE_AFTER_EVERY_GPU_EVENT 0
22
23
#define D3D12_RHI_RAYTRACING (RHI_RAYTRACING)
24
25
#if D3D12_MAX_COMMANDLIST_INTERFACE >= 10
26
#define D3D12_RHI_WORKGRAPHS 1
27
#define D3D12_RHI_WORKGRAPHS_GRAPHICS 0
28
#else
29
#define D3D12_RHI_WORKGRAPHS 0
30
#define D3D12_RHI_WORKGRAPHS_GRAPHICS 0
31
#endif
32
33
#ifndef D3D12RHI_ALLOW_ENHANCED_BARRIERS
34
#error "Please define D3D12RHI_ALLOW_ENHANCED_BARRIERS in <Platform>D3D12RHIDefinitions.h!"
35
#endif
36
37
#ifndef D3D12RHI_ALLOW_LEGACY_BARRIERS
38
#error "Please define D3D12RHI_ALLOW_LEGACY_BARRIERS in <Platform>D3D12RHIDefinitions.h!"
39
#endif
40
41
#if D3D12_MAX_DEVICE_INTERFACE >= 11
42
#define D3D12RHI_SUPPORTS_ENHANCED_BARRIERS (D3D12RHI_ALLOW_ENHANCED_BARRIERS)
43
#else
44
#define D3D12RHI_SUPPORTS_ENHANCED_BARRIERS 0
45
#endif
46
47
#define D3D12RHI_SUPPORTS_LEGACY_BARRIERS (D3D12RHI_ALLOW_LEGACY_BARRIERS)
48
49
#if D3D12_MAX_DEVICE_INTERFACE >= 12
50
#define D3D12RHI_SUPPORTS_UNCOMPRESSED_UAV 1
51
#else
52
#define D3D12RHI_SUPPORTS_UNCOMPRESSED_UAV 0
53
#endif
54
55
// This value controls how many root constant buffers can be used per shader stage in a root signature.
56
// Note: Using root descriptors significantly increases the size of root signatures (each root descriptor is 2 DWORDs).
57
#define MAX_ROOT_CBVS MAX_CBS
58
59
#define EXECUTE_DEBUG_COMMAND_LISTS 0
60
#define NAME_OBJECTS RHI_USE_RESOURCE_DEBUG_NAME
61
#define LOG_PSO_CREATES (0 && STATS)
// Logs Create Pipeline State timings (also requires STATS)
62
#define TRACK_RESOURCE_ALLOCATIONS (PLATFORM_WINDOWS && !UE_BUILD_SHIPPING && !UE_BUILD_TEST)
63
64
#define READBACK_BUFFER_POOL_MAX_ALLOC_SIZE (64 * 1024)
65
#define READBACK_BUFFER_POOL_DEFAULT_POOL_SIZE (4 * 1024 * 1024)
66
67
#define TEXTURE_POOL_SIZE (8 * 1024 * 1024)
68
69
#if DEBUG_RESOURCE_STATES
70
#define LOG_EXECUTE_COMMAND_LISTS 1
71
#define LOG_PRESENT 1
72
#else
73
#define LOG_EXECUTE_COMMAND_LISTS 0
74
#define LOG_PRESENT 0
75
#endif
76
77
#define DEBUG_FRAME_TIMING 0
78
79
#if DEBUG_FRAME_TIMING
80
#define LOG_VIEWPORT_EVENTS 1
81
#define LOG_PRESENT 1
82
#define LOG_EXECUTE_COMMAND_LISTS 1
83
#else
84
#define LOG_VIEWPORT_EVENTS 0
85
#endif
86
87
#if EXECUTE_DEBUG_COMMAND_LISTS
88
#define DEBUG_EXECUTE_COMMAND_LIST(scope) if ((scope)->ActiveQueries == 0) { (scope)->FlushCommands(ED3D12FlushFlags::WaitForCompletion); }
89
#define DEBUG_EXECUTE_COMMAND_CONTEXT(context) if ((context).ActiveQueries == 0) { (context).FlushCommands(ED3D12FlushFlags::WaitForCompletion); }
90
#define DEBUG_RHI_EXECUTE_COMMAND_LIST(scope) if ((scope)->GetRHIDevice(0)->GetDefaultCommandContext().ActiveQueries == 0) { (scope)->GetRHIDevice(0)->GetDefaultCommandContext().FlushCommands(ED3D12FlushFlags::WaitForCompletion); }
91
#else
92
#define DEBUG_EXECUTE_COMMAND_LIST(scope)
93
#define DEBUG_EXECUTE_COMMAND_CONTEXT(context)
94
#define DEBUG_RHI_EXECUTE_COMMAND_LIST(scope)
95
#endif
96
97
#ifndef D3D12_VIEWPORT_EXPOSES_SWAP_CHAIN
98
#define D3D12_VIEWPORT_EXPOSES_SWAP_CHAIN 1
99
#endif
100
101
#if D3D12_VIEWPORT_EXPOSES_SWAP_CHAIN
102
#ifndef DXGI_PRESENT_ALLOW_TEARING
103
#define DXGI_PRESENT_ALLOW_TEARING 0x00000200UL
104
#define DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING 2048
105
#endif
106
#endif
107
108
#if D3D12_SUPPORTS_INFO_QUEUE
109
#define EMBED_DXGI_ERROR_LIST(PerEntry, Terminator) \
110
PerEntry(DXGI_ERROR_UNSUPPORTED) Terminator \
111
PerEntry(DXGI_ERROR_NOT_CURRENT) Terminator \
112
PerEntry(DXGI_ERROR_MORE_DATA) Terminator \
113
PerEntry(DXGI_ERROR_MODE_CHANGE_IN_PROGRESS) Terminator \
114
PerEntry(DXGI_ERROR_ALREADY_EXISTS) Terminator \
115
PerEntry(DXGI_ERROR_SESSION_DISCONNECTED) Terminator \
116
PerEntry(DXGI_ERROR_ACCESS_DENIED) Terminator \
117
PerEntry(DXGI_ERROR_NON_COMPOSITED_UI) Terminator \
118
PerEntry(DXGI_ERROR_CACHE_FULL) Terminator \
119
PerEntry(DXGI_ERROR_NOT_CURRENTLY_AVAILABLE) Terminator \
120
PerEntry(DXGI_ERROR_CACHE_CORRUPT) Terminator \
121
PerEntry(DXGI_ERROR_WAIT_TIMEOUT) Terminator \
122
PerEntry(DXGI_ERROR_FRAME_STATISTICS_DISJOINT) Terminator \
123
PerEntry(DXGI_ERROR_DYNAMIC_CODE_POLICY_VIOLATION) Terminator \
124
PerEntry(DXGI_ERROR_REMOTE_OUTOFMEMORY) Terminator \
125
PerEntry(DXGI_ERROR_ACCESS_LOST) Terminator
126
#endif
127
128
// Note: the following defines depend on D3D12RHIBasePrivate.h
129
130
//@TODO: Improve allocator efficiency so we can increase these thresholds and improve performance
131
// We measured 149MB of wastage in 340MB of allocations with DEFAULT_BUFFER_POOL_MAX_ALLOC_SIZE set to 512KB
132
#if !defined(DEFAULT_BUFFER_POOL_MAX_ALLOC_SIZE)
133
#if D3D12_RHI_RAYTRACING
134
// #dxr_todo: Reevaluate these values. Currently optimized to reduce number of CreateCommitedResource() calls, at the expense of memory use.
135
#define DEFAULT_BUFFER_POOL_MAX_ALLOC_SIZE (64 * 1024 * 1024)
136
#define DEFAULT_BUFFER_POOL_DEFAULT_POOL_SIZE (16 * 1024 * 1024)
137
#else
138
// On PC, buffers are 64KB aligned, so anything smaller should be sub-allocated
139
#define DEFAULT_BUFFER_POOL_MAX_ALLOC_SIZE (64 * 1024)
140
#define DEFAULT_BUFFER_POOL_DEFAULT_POOL_SIZE (8 * 1024 * 1024)
141
#endif
//D3D12_RHI_RAYTRACING
142
#endif
RHIDefinitions.h
Engine
Source
Runtime
D3D12RHI
Private
D3D12RHIDefinitions.h
Generated by
1.9.8