aboutsummaryrefslogtreecommitdiff
path: root/hello/main.c
diff options
context:
space:
mode:
authorMarc Sunet <marc.sunet@amd.com>2025-11-21 10:58:06 -0800
committerMarc Sunet <marc.sunet@amd.com>2025-11-21 10:58:06 -0800
commite39e9b5bf1fb28f321b01fa427e2a7c206195b2c (patch)
tree51d0f561e0373806466f965e41250386d3fb0828 /hello/main.c
parent0b5491e0a2f1a9a4023e2c4eb171287bede41388 (diff)
Tidy
Diffstat (limited to 'hello/main.c')
-rw-r--r--hello/main.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/hello/main.c b/hello/main.c
index 738f5c0..44f8a90 100644
--- a/hello/main.c
+++ b/hello/main.c
@@ -47,6 +47,7 @@ static void d3d_create_swap_chain(D3D* d3d) {
47 assert(d3d); 47 assert(d3d);
48 assert(d3d->pDxgiFactory); 48 assert(d3d->pDxgiFactory);
49 assert(d3d->pCommandQueue); 49 assert(d3d->pCommandQueue);
50 assert(d3d->pWindow);
50 51
51 SafeRelease(d3d->pSwapChain); 52 SafeRelease(d3d->pSwapChain);
52 53
@@ -80,7 +81,9 @@ static void d3d_create_swap_chain_buffer_render_target_views(D3D* d3d) {
80 assert(d3d); 81 assert(d3d);
81 assert(d3d->pDevice); 82 assert(d3d->pDevice);
82 assert(d3d->pSwapChain); 83 assert(d3d->pSwapChain);
84 assert(d3d->pSwapChainBuffer);
83 assert(d3d->pRtvHeap); 85 assert(d3d->pRtvHeap);
86 assert(d3d->rtv_descriptor_size > 0);
84 87
85 // Create the new buffer views. 88 // Create the new buffer views.
86 D3D12_CPU_DESCRIPTOR_HANDLE rtv_heap_handle; 89 D3D12_CPU_DESCRIPTOR_HANDLE rtv_heap_handle;
@@ -276,6 +279,7 @@ static void d3d_init(D3D* d3d, Window* pWindow, const D3DSettings* pSettings) {
276 279
277static D3D12_CPU_DESCRIPTOR_HANDLE d3d_get_current_back_buffer_view(const D3D* d3d) { 280static D3D12_CPU_DESCRIPTOR_HANDLE d3d_get_current_back_buffer_view(const D3D* d3d) {
278 assert(d3d); 281 assert(d3d);
282 assert(d3d->pSwapChain);
279 assert(d3d->pRtvHeap); 283 assert(d3d->pRtvHeap);
280 assert(d3d->rtv_descriptor_size > 0); 284 assert(d3d->rtv_descriptor_size > 0);
281 D3D12_CPU_DESCRIPTOR_HANDLE rtv_handle; 285 D3D12_CPU_DESCRIPTOR_HANDLE rtv_handle;
@@ -288,11 +292,15 @@ static D3D12_CPU_DESCRIPTOR_HANDLE d3d_get_current_back_buffer_view(const D3D* d
288 292
289static ID3D12Resource* d3d_get_current_back_buffer(const D3D* d3d) { 293static ID3D12Resource* d3d_get_current_back_buffer(const D3D* d3d) {
290 assert(d3d); 294 assert(d3d);
295 assert(d3d->pSwapChain);
296 assert(d3d->pSwapChainBuffer);
291 return d3d->pSwapChainBuffer[d3d->pSwapChain->lpVtbl->GetCurrentBackBufferIndex(d3d->pSwapChain)]; 297 return d3d->pSwapChainBuffer[d3d->pSwapChain->lpVtbl->GetCurrentBackBufferIndex(d3d->pSwapChain)];
292} 298}
293 299
294static void d3d_populate_command_list(D3D* d3d) { 300static void d3d_populate_command_list(D3D* d3d) {
295 assert(d3d); 301 assert(d3d);
302 assert(d3d->pCommandAllocator);
303 assert(d3d->pCommandList);
296 304
297 /// Note that we skip the following two items: 305 /// Note that we skip the following two items:
298 /// 306 ///
@@ -356,6 +364,8 @@ static void d3d_populate_command_list(D3D* d3d) {
356 364
357static void d3d_wait_for_previous_frame(D3D* d3d) { 365static void d3d_wait_for_previous_frame(D3D* d3d) {
358 assert(d3d); 366 assert(d3d);
367 assert(d3d->pFence);
368 assert(d3d->pCommandQueue);
359 369
360 // Advance the fence value to mark commands up to this fence point. 370 // Advance the fence value to mark commands up to this fence point.
361 d3d->fence_value++; 371 d3d->fence_value++;
@@ -385,6 +395,8 @@ static void d3d_wait_for_previous_frame(D3D* d3d) {
385 395
386static void d3d_render(D3D* d3d) { 396static void d3d_render(D3D* d3d) {
387 assert(d3d); 397 assert(d3d);
398 assert(d3d->pCommandQueue);
399 assert(d3d->pSwapChain);
388 400
389 d3d_populate_command_list(d3d); 401 d3d_populate_command_list(d3d);
390 402