| 343 | } |
| 344 | |
| 345 | void initialize(void* usrdata) |
| 346 | { |
| 347 | App.backend = *(ECGPUBackend*)usrdata; |
| 348 | App.window_title = gCGPUBackendNames[App.backend]; |
| 349 | app_create_window(&App, BACK_BUFFER_WIDTH, BACK_BUFFER_HEIGHT); |
| 350 | app_create_gfx_objects(&App); |
| 351 | |
| 352 | present_semaphore = cgpu_create_semaphore(App.device); |
| 353 | for (uint32_t i = 0; i < FLIGHT_FRAMES; i++) |
| 354 | { |
| 355 | pools[i] = cgpu_create_command_pool(App.gfx_queue, CGPU_NULLPTR); |
| 356 | CGPUCommandBufferDescriptor cmd_desc = { .is_secondary = false }; |
| 357 | cmds[i] = cgpu_create_command_buffer(pools[i], &cmd_desc); |
| 358 | exec_fences[i] = cgpu_create_fence(App.device); |
| 359 | } |
| 360 | // Create views |
| 361 | for (uint32_t i = 0; i < App.swapchain->buffer_count; i++) |
| 362 | { |
| 363 | CGPUTextureViewDescriptor view_desc = { |
| 364 | .texture = App.swapchain->back_buffers[i], |
| 365 | .aspects = CGPU_TVA_COLOR, |
| 366 | .dims = CGPU_TEX_DIMENSION_2D, |
| 367 | .format = App.swapchain->back_buffers[i]->info->format, |
| 368 | .usages = CGPU_TVU_RTV_DSV, |
| 369 | .array_layer_count = 1 |
| 370 | }; |
| 371 | views[i] = cgpu_create_texture_view(App.device, &view_desc); |
| 372 | } |
| 373 | create_sampled_texture(); |
| 374 | create_render_pipeline(); |
| 375 | } |
| 376 | |
| 377 | typedef struct PushConstants { |
| 378 | float ColorMultiplier; |
no test coverage detected