@@ -184,33 +184,32 @@ int main(int argc, char **argv) {
184184 CommandBuffer * cmd = $ (renderDevice , acquireCommandBuffer );
185185
186186 SwapchainTexture swapchain = { 0 };
187- if ($ (cmd , acquireSwapchainTexture , window , & swapchain )) {
188-
189- float4x4 modelView = float4x4_rotation (angleX , float3_new (1.f , 0.f , 0.f ));
190- modelView = float4x4_mul (float4x4_rotation (angleY , float3_new (0.f , 1.f , 0.f )), modelView );
191- modelView = float4x4_mul (float4x4_translation (float3_new (0.f , 0.f , -2.5f )), modelView );
192- const float4x4 projection = float4x4_perspective (45.f , (float ) swapchain .size .w / (float ) swapchain .size .h , 0.01f , 100.f );
193- const float4x4 modelViewProjection = float4x4_mul (projection , modelView );
194-
195- SDL_GPUColorTargetInfo colorTarget = {
196- .texture = swapchain .texture ,
197- .clear_color = { 0.1f , 0.1f , 0.2f , 1.0f },
198- .load_op = SDL_GPU_LOADOP_CLEAR ,
199- .store_op = SDL_GPU_STOREOP_STORE ,
200- };
201-
202- SDL_GPUDepthStencilTargetInfo depthTarget = $ (framebuffer , depthTargetInfo , SDL_GPU_LOADOP_CLEAR , SDL_GPU_STOREOP_DONT_CARE , 1.f );
203-
204- RenderPass * renderPass = $ (cmd , beginRenderPass , & colorTarget , 1 , & depthTarget );
205- $ (renderPass , bindPipeline , pipeline );
206- $ (renderPass , bindVertexBuffers , 0 , & (SDL_GPUBufferBinding ) {
207- .buffer = vertexBuffer ,
208- .offset = 0 ,
209- }, 1 );
210- $ (cmd , pushVertexUniformData , 0 , modelViewProjection .f , sizeof (modelViewProjection ));
211- $ (renderPass , drawPrimitives , (Uint32 ) SDL_arraysize (vertex_data ), 1 , 0 , 0 );
212- release (renderPass );
213- }
187+ $ (cmd , waitAndAcquireSwapchainTexture , window , & swapchain );
188+
189+ float4x4 modelView = float4x4_rotation (angleX , float3_new (1.f , 0.f , 0.f ));
190+ modelView = float4x4_mul (float4x4_rotation (angleY , float3_new (0.f , 1.f , 0.f )), modelView );
191+ modelView = float4x4_mul (float4x4_translation (float3_new (0.f , 0.f , -2.5f )), modelView );
192+ const float4x4 projection = float4x4_perspective (45.f , (float ) swapchain .size .w / (float ) swapchain .size .h , 0.01f , 100.f );
193+ const float4x4 modelViewProjection = float4x4_mul (projection , modelView );
194+
195+ SDL_GPUColorTargetInfo colorTarget = {
196+ .texture = swapchain .texture ,
197+ .clear_color = { 0.1f , 0.1f , 0.2f , 1.0f },
198+ .load_op = SDL_GPU_LOADOP_CLEAR ,
199+ .store_op = SDL_GPU_STOREOP_STORE ,
200+ };
201+
202+ SDL_GPUDepthStencilTargetInfo depthTarget = $ (framebuffer , depthTargetInfo , SDL_GPU_LOADOP_CLEAR , SDL_GPU_STOREOP_DONT_CARE , 1.f );
203+
204+ RenderPass * renderPass = $ (cmd , beginRenderPass , & colorTarget , 1 , & depthTarget );
205+ $ (renderPass , bindPipeline , pipeline );
206+ $ (renderPass , bindVertexBuffers , 0 , & (SDL_GPUBufferBinding ) {
207+ .buffer = vertexBuffer ,
208+ .offset = 0 ,
209+ }, 1 );
210+ $ (cmd , pushVertexUniformData , 0 , modelViewProjection .f , sizeof (modelViewProjection ));
211+ $ (renderPass , drawPrimitives , (Uint32 ) SDL_arraysize (vertex_data ), 1 , 0 , 0 );
212+ release (renderPass );
214213
215214 $ (cmd , submit );
216215 release (cmd );
0 commit comments