aboutsummaryrefslogtreecommitdiff
path: root/hello
diff options
context:
space:
mode:
author3gg <3gg@shellblade.net>2025-11-25 14:41:29 -0800
committer3gg <3gg@shellblade.net>2025-11-25 14:41:29 -0800
commit14a87b0f8b7d782b8fb4b5ac27f373205ffdb8dc (patch)
treee7e3aee9c32b6c15f8f63d94e4fc5e7df1997f54 /hello
parente39e9b5bf1fb28f321b01fa427e2a7c206195b2c (diff)
Clean up on exit
Diffstat (limited to 'hello')
-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}