MCPcopy Create free account
hub / github.com/SakuraEngine/SakuraEngine / initialize

Function initialize

samples/cgpu/cgpu-basic/texture/tiled_texture.c:345–375  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

343}
344
345void 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
377typedef struct PushConstants {
378 float ColorMultiplier;

Callers 1

ProgramMainFunction · 0.70

Calls 9

app_create_windowFunction · 0.85
app_create_gfx_objectsFunction · 0.85
cgpu_create_semaphoreFunction · 0.85
cgpu_create_command_poolFunction · 0.85
cgpu_create_fenceFunction · 0.85
cgpu_create_texture_viewFunction · 0.85
create_sampled_textureFunction · 0.70
create_render_pipelineFunction · 0.70

Tested by

no test coverage detected