From cc8a697caa43379430bbe75a7f31b3df3dcbf5b3 Mon Sep 17 00:00:00 2001 From: Gabor Galgoczy <ggabor2002@gmail.com> Date: Tue, 20 Feb 2024 12:38:39 +0100 Subject: [PATCH] Mark helper functions static --- docs/lectures/01.md | 18 +++++++++--------- src/Renderer.cpp | 8 ++++---- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/docs/lectures/01.md b/docs/lectures/01.md index f5cbf42..57d4bcd 100644 --- a/docs/lectures/01.md +++ b/docs/lectures/01.md @@ -41,7 +41,7 @@ Mivel ez egy Vulkan handle, ezért használat után nekünk kell "felszabadítan ```cpp title="Renderer.cpp" #include "Renderer.hpp" - [[nodiscard]] auto create_instance() -> vk::UniqueInstance { + [[nodiscard]] static auto create_instance() -> vk::UniqueInstance { return {}; } @@ -89,7 +89,7 @@ Ezeknél több mindent is beállíthatnánk még az Instance létrehozásához, #endif }; - [[nodiscard]] auto create_instance() -> vk::UniqueInstance + [[nodiscard]] static auto create_instance() -> vk::UniqueInstance { constexpr static vk::ApplicationInfo application_info{}; @@ -112,7 +112,7 @@ Minden a gépen jelen levő Vulkan-képes processzort egy `vk::PhysicalDevice`-a !!! example "" ```cpp - [[nodiscard]] auto choose_physical_device(vk::Instance t_instance) -> vk::PhysicalDevice + [[nodiscard]] static auto choose_physical_device(vk::Instance t_instance) -> vk::PhysicalDevice { const auto physical_devices{ t_instance.enumeratePhysicalDevices() }; @@ -167,7 +167,7 @@ Válasszunk ki egy grafikai munkát támogató családot (ennek megkötése, hog !!! example "" ```cpp - [[nodiscard]] auto find_graphics_queue_family( + [[nodiscard]] static auto find_graphics_queue_family( vk::PhysicalDevice t_physical_device ) -> uint32_t { @@ -188,7 +188,7 @@ Adott minden, hogy a *Device*-t is létrehozzuk. !!! example "" ```cpp - [[nodiscard]] auto create_device(const vk::PhysicalDevice t_physical_device) + [[nodiscard]] static auto create_device(const vk::PhysicalDevice t_physical_device) -> vk::UniqueDevice { const vk::DeviceQueueCreateInfo queue_create_info{ @@ -244,7 +244,7 @@ Adott minden, hogy a *Device*-t is létrehozzuk. #endif }; - [[nodiscard]] auto create_instance() -> vk::UniqueInstance + [[nodiscard]] static auto create_instance() -> vk::UniqueInstance { constexpr static vk::ApplicationInfo application_info{}; @@ -257,7 +257,7 @@ Adott minden, hogy a *Device*-t is létrehozzuk. return vk::createInstanceUnique(create_info); } - [[nodiscard]] auto choose_physical_device(const vk::Instance t_instance) + [[nodiscard]] auto static choose_physical_device(const vk::Instance t_instance) -> vk::PhysicalDevice { const auto physical_devices{ t_instance.enumeratePhysicalDevices() }; @@ -291,7 +291,7 @@ Adott minden, hogy a *Device*-t is létrehozzuk. return ranked_devices.front().first; } - [[nodiscard]] auto find_graphics_queue_family( + [[nodiscard]] auto static find_graphics_queue_family( const vk::PhysicalDevice t_physical_device ) -> uint32_t { @@ -306,7 +306,7 @@ Adott minden, hogy a *Device*-t is létrehozzuk. throw std::runtime_error{ "Could not find graphics queue family" }; } - [[nodiscard]] auto create_device(const vk::PhysicalDevice t_physical_device) + [[nodiscard]] auto static create_device(const vk::PhysicalDevice t_physical_device) -> vk::UniqueDevice { const vk::DeviceQueueCreateInfo queue_create_info{ diff --git a/src/Renderer.cpp b/src/Renderer.cpp index 99326af..909e075 100644 --- a/src/Renderer.cpp +++ b/src/Renderer.cpp @@ -10,7 +10,7 @@ const std::vector<const char*> g_layers{ #endif }; -[[nodiscard]] auto create_instance() -> vk::UniqueInstance +[[nodiscard]] static auto create_instance() -> vk::UniqueInstance { constexpr static vk::ApplicationInfo application_info{ .apiVersion = VK_API_VERSION_1_1 @@ -25,7 +25,7 @@ const std::vector<const char*> g_layers{ return vk::createInstanceUnique(create_info); } -[[nodiscard]] auto choose_physical_device(const vk::Instance t_instance) +[[nodiscard]] static auto choose_physical_device(const vk::Instance t_instance) -> vk::PhysicalDevice { const auto physical_devices{ t_instance.enumeratePhysicalDevices() }; @@ -59,7 +59,7 @@ const std::vector<const char*> g_layers{ return ranked_devices.front().first; } -[[nodiscard]] auto find_graphics_queue_family( +[[nodiscard]] static auto find_graphics_queue_family( const vk::PhysicalDevice t_physical_device ) -> uint32_t { @@ -74,7 +74,7 @@ const std::vector<const char*> g_layers{ throw std::runtime_error{ "Could not find graphics queue family" }; } -[[nodiscard]] auto create_device(const vk::PhysicalDevice t_physical_device) +[[nodiscard]] static auto create_device(const vk::PhysicalDevice t_physical_device) -> vk::UniqueDevice { const vk::DeviceQueueCreateInfo queue_create_info{ -- GitLab