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

Function main

samples/cgpu/cgpu-basic/hot-triangle/triangle.c:296–330  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

294}
295
296int main(int argc, char* argv[])
297{
298 if (SDL_Init(SDL_INIT_EVERYTHING) != 0) return -1;
299 // When we support more add them here
300 ECGPUBackend backends[] = {
301 CGPU_BACKEND_VULKAN
302#ifdef CGPU_USE_D3D12
303 ,
304 CGPU_BACKEND_D3D12
305#endif
306 };
307 void* watcher = watch_source();
308#if defined(__APPLE__) || defined(__EMSCRIPTEN__) || defined(__wasi__)
309 ProgramMain(backends);
310#else
311 const uint32_t TEST_BACKEND_COUNT = sizeof(backends) / sizeof(ECGPUBackend);
312 SKR_DECLARE_ZERO_VLA(SThreadHandle, hdls, TEST_BACKEND_COUNT)
313 SKR_DECLARE_ZERO_VLA(SThreadDesc, thread_descs, TEST_BACKEND_COUNT)
314 for (uint32_t i = 0; i < TEST_BACKEND_COUNT; i++)
315 {
316 thread_descs[i].pFunc = &ProgramMain;
317 thread_descs[i].pData = &backends[i];
318 skr_init_thread(&thread_descs[i], &hdls[i]);
319 }
320 for (uint32_t i = 0; i < TEST_BACKEND_COUNT; i++)
321 {
322 skr_join_thread(hdls[i]);
323 skr_destroy_thread(hdls[i]);
324 }
325#endif
326 unwatch_source(watcher);
327 SDL_Quit();
328
329 return 0;
330}

Callers

nothing calls this directly

Calls 6

watch_sourceFunction · 0.85
unwatch_sourceFunction · 0.85
ProgramMainFunction · 0.70
skr_init_threadFunction · 0.50
skr_join_threadFunction · 0.50
skr_destroy_threadFunction · 0.50

Tested by

no test coverage detected