aboutsummaryrefslogtreecommitdiff
path: root/hello/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'hello/main.c')
-rw-r--r--hello/main.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/hello/main.c b/hello/main.c
index 44f8a90..1f0b4ed 100644
--- a/hello/main.c
+++ b/hello/main.c
@@ -277,6 +277,21 @@ static void d3d_init(D3D* d3d, Window* pWindow, const D3DSettings* pSettings) {
277 } 277 }
278} 278}
279 279
280void d3d_destroy(D3D* d3d) {
281 assert(d3d);
282 SafeRelease(d3d->pCommandList);
283 SafeRelease(d3d->pCommandAllocator);
284 SafeRelease(d3d->pCommandQueue);
285 // Swap chain buffers are owned by the swap chain.
286 SafeRelease(d3d->pDepthStencilBuffer);
287 SafeRelease(d3d->pSwapChain);
288 SafeRelease(d3d->pRtvHeap);
289 SafeRelease(d3d->pDsvHeap);
290 SafeRelease(d3d->pFence);
291 SafeRelease(d3d->pDevice);
292 SafeRelease(d3d->pDxgiFactory);
293}
294
280static D3D12_CPU_DESCRIPTOR_HANDLE d3d_get_current_back_buffer_view(const D3D* d3d) { 295static D3D12_CPU_DESCRIPTOR_HANDLE d3d_get_current_back_buffer_view(const D3D* d3d) {
281 assert(d3d); 296 assert(d3d);
282 assert(d3d->pSwapChain); 297 assert(d3d->pSwapChain);
@@ -437,6 +452,7 @@ int main(int argc, const char** argv) {
437 Sleep(10); 452 Sleep(10);
438 } 453 }
439 454
455 d3d_destroy(&d3d);
440 window_global_quit(); 456 window_global_quit();
441 return 0; 457 return 0;
442} 458}