MCPcopy Create free account
hub / github.com/TheRealMJP/DeferredTexturing / Reset

Method Reset

SampleFramework12/v1.00/Graphics/SwapChain.cpp:158–203  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

156}
157
158void SwapChain::Reset()
159{
160 Assert_(swapChain);
161
162 // Release all references
163 for(uint64 i = 0; i < NumBackBuffers; ++i)
164 {
165 DX12::Release(backBuffers[i].Texture.Resource);
166 DX12::RTVDescriptorHeap.Free(backBuffers[i].RTV);
167 }
168
169 if(format == DXGI_FORMAT_R8G8B8A8_UNORM_SRGB)
170 noSRGBFormat = DXGI_FORMAT_R8G8B8A8_UNORM;
171 else if(format == DXGI_FORMAT_B8G8R8A8_UNORM_SRGB)
172 noSRGBFormat = DXGI_FORMAT_B8G8R8A8_UNORM;
173 else
174 noSRGBFormat = format;
175
176 if(fullScreen)
177 PrepareFullScreenSettings();
178 else
179 {
180 refreshRate.Numerator = 60;
181 refreshRate.Denominator = 1;
182 }
183
184 DXCall(swapChain->SetFullscreenState(fullScreen, NULL));
185
186 DXCall(swapChain->ResizeBuffers(NumBackBuffers, width, height,
187 noSRGBFormat, DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH));
188
189 if(fullScreen)
190 {
191 DXGI_MODE_DESC mode;
192 mode.Format = noSRGBFormat;
193 mode.Width = width;
194 mode.Height = height;
195 mode.RefreshRate.Numerator = 0;
196 mode.RefreshRate.Denominator = 0;
197 mode.Scaling = DXGI_MODE_SCALING_UNSPECIFIED;
198 mode.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED;
199 DXCall(swapChain->ResizeTarget(&mode));
200 }
201
202 AfterReset();
203}
204
205void SwapChain::BeginFrame()
206{

Callers 8

InitializeMethod · 0.45
InitializeSceneMethod · 0.45
LoadShadersMethod · 0.45
OnWindowResizedMethod · 0.45
ToggleFullScreenMethod · 0.45
InitializeFunction · 0.45
EndFrameFunction · 0.45
EndFrame_HelpersFunction · 0.45

Calls 3

ReleaseFunction · 0.85
DXCallFunction · 0.85
FreeMethod · 0.80

Tested by

no test coverage detected