@@ -231,10 +231,12 @@ Application::Application(const CreateInfo& createInfo)
231
231
: presentMode(createInfo.presentMode)
232
232
{
233
233
ZoneScoped;
234
- // Initialiize GLFW
235
- if (!glfwInit ())
236
234
{
237
- throw std::runtime_error (" Failed to initialize GLFW" );
235
+ ZoneScopedN (" Initialize GLFW" );
236
+ if (!glfwInit ())
237
+ {
238
+ throw std::runtime_error (" Failed to initialize GLFW" );
239
+ }
238
240
}
239
241
240
242
destroyList_.Push ([] { glfwTerminate (); });
@@ -251,10 +253,13 @@ Application::Application(const CreateInfo& createInfo)
251
253
throw std::runtime_error (" No monitor detected" );
252
254
}
253
255
const GLFWvidmode* videoMode = glfwGetVideoMode (monitor);
254
- window = glfwCreateWindow (static_cast <int >(videoMode->width * .75 ), static_cast <int >(videoMode->height * .75 ), createInfo.name .data (), nullptr , nullptr );
255
- if (!window)
256
256
{
257
- throw std::runtime_error (" Failed to create window" );
257
+ ZoneScopedN (" Create Window" );
258
+ window = glfwCreateWindow (static_cast <int >(videoMode->width * .75 ), static_cast <int >(videoMode->height * .75 ), createInfo.name .data (), nullptr , nullptr );
259
+ if (!window)
260
+ {
261
+ throw std::runtime_error (" Failed to create window" );
262
+ }
258
263
}
259
264
260
265
int xSize{};
@@ -281,51 +286,67 @@ Application::Application(const CreateInfo& createInfo)
281
286
282
287
// Initialize Vulkan
283
288
// instance
284
- instance_ = vkb::InstanceBuilder ()
285
- .set_app_name (" Frogrenderer" )
286
- .require_api_version (1 , 3 , 0 )
287
- .set_debug_callback (vulkan_debug_callback)
288
- .enable_extension (VK_EXT_DEBUG_UTILS_EXTENSION_NAME)
289
- .build ()
290
- .value ();
291
-
292
- if (volkInitialize () != VK_SUCCESS)
293
289
{
294
- throw std::runtime_error (" rip" );
290
+ ZoneScopedN (" Create Vulkan Instance" );
291
+ instance_ = vkb::InstanceBuilder ()
292
+ .set_app_name (" Frogrenderer" )
293
+ .require_api_version (1 , 3 , 0 )
294
+ .set_debug_callback (vulkan_debug_callback)
295
+ .enable_extension (VK_EXT_DEBUG_UTILS_EXTENSION_NAME)
296
+ .build ()
297
+ .value ();
295
298
}
296
299
297
- destroyList_.Push ([] { volkFinalize (); });
300
+ {
301
+ ZoneScopedN (" Initialize Volk" );
302
+ if (volkInitialize () != VK_SUCCESS)
303
+ {
304
+ throw std::runtime_error (" rip" );
305
+ }
306
+
307
+ destroyList_.Push ([] { volkFinalize (); });
298
308
299
- volkLoadInstance (instance_);
309
+ volkLoadInstance (instance_);
310
+ }
300
311
301
312
// surface
302
313
VkSurfaceKHR surface;
303
- if (auto err = glfwCreateWindowSurface (instance_, window, nullptr , &surface); err != VK_SUCCESS)
304
314
{
305
- const char * error_msg ;
306
- if (int ret = glfwGetError (&error_msg) )
315
+ ZoneScopedN ( " Create Window Surface " ) ;
316
+ if (auto err = glfwCreateWindowSurface (instance_, window, nullptr , &surface); err != VK_SUCCESS )
307
317
{
308
- std::cout << ret << " " ;
309
- if (error_msg != nullptr )
310
- std::cout << error_msg;
311
- std::cout << " \n " ;
318
+ const char * error_msg;
319
+ if (int ret = glfwGetError (&error_msg))
320
+ {
321
+ std::cout << ret << " " ;
322
+ if (error_msg != nullptr )
323
+ std::cout << error_msg;
324
+ std::cout << " \n " ;
325
+ }
326
+ throw std::runtime_error (" rip" );
312
327
}
313
- throw std::runtime_error (" rip" );
314
328
}
329
+
315
330
destroyList_.Push ([this ] { vkDestroySurfaceKHR (instance_, surface_, nullptr ); });
316
331
317
332
// device
318
- device_.emplace (instance_, surface);
333
+ {
334
+ ZoneScopedN (" Create Device" );
335
+ device_.emplace (instance_, surface);
336
+ }
319
337
320
338
// swapchain
321
- swapchain_ = MakeVkbSwapchain (device_->device_ ,
322
- windowFramebufferWidth,
323
- windowFramebufferHeight,
324
- presentMode,
325
- device_->frameOverlap ,
326
- VK_NULL_HANDLE,
327
- swapchainSrgbFormat,
328
- swapchainUnormFormat);
339
+ {
340
+ ZoneScopedN (" Create Swapchain" );
341
+ swapchain_ = MakeVkbSwapchain (device_->device_ ,
342
+ windowFramebufferWidth,
343
+ windowFramebufferHeight,
344
+ presentMode,
345
+ device_->frameOverlap ,
346
+ VK_NULL_HANDLE,
347
+ swapchainSrgbFormat,
348
+ swapchainUnormFormat);
349
+ }
329
350
swapchainImages_ = swapchain_.get_images ().value ();
330
351
swapchainImageViewsSrgb_ = MakeSwapchainImageViews (device_->device_ , swapchainImages_, swapchainSrgbFormat);
331
352
swapchainImageViewsUnorm_ = MakeSwapchainImageViews (device_->device_ , swapchainImages_, swapchainUnormFormat);
0 commit comments