MCPcopy Create free account
hub / github.com/Apress/Ray-Tracing-Gems-II / SetNativeResolution

Function SetNativeResolution

Chapter_27/Core/GraphicsCore.cpp:132–176  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

130 ColorBuffer g_PreDisplayBuffer;
131
132 void SetNativeResolution(void)
133 {
134 uint32_t NativeWidth, NativeHeight;
135
136 switch (eResolution((int)TargetResolution))
137 {
138 default:
139 case k720p:
140 NativeWidth = 1280;
141 NativeHeight = 720;
142 break;
143 case k900p:
144 NativeWidth = 1600;
145 NativeHeight = 900;
146 break;
147 case k1080p:
148 NativeWidth = 1920;
149 NativeHeight = 1080;
150 break;
151 case k1440p:
152 NativeWidth = 2560;
153 NativeHeight = 1440;
154 break;
155 case k1800p:
156 NativeWidth = 3200;
157 NativeHeight = 1800;
158 break;
159 case k2160p:
160 NativeWidth = 3840;
161 NativeHeight = 2160;
162 break;
163 }
164
165 if (g_NativeWidth == NativeWidth && g_NativeHeight == NativeHeight)
166 return;
167
168 DEBUGPRINT("Changing native resolution to %ux%u", NativeWidth, NativeHeight);
169
170 g_NativeWidth = NativeWidth;
171 g_NativeHeight = NativeHeight;
172
173 g_CommandManager.IdleGPU();
174
175 InitializeRenderingBuffers(NativeWidth, NativeHeight);
176 }
177
178 ID3D12Device* g_Device = nullptr;
179

Callers 2

InitializeMethod · 0.85
PresentMethod · 0.85

Calls 2

eResolutionEnum · 0.85
IdleGPUMethod · 0.80

Tested by

no test coverage detected