Removed uneeded std::optional uses

This commit is contained in:
Pasha Bibko
2025-11-16 17:51:24 +00:00
parent e887b2b393
commit 46d5e41e29
3 changed files with 105 additions and 87 deletions

View File

@@ -6,12 +6,16 @@ namespace PB::Renderer
{
struct QueueFamilyIndices
{
std::optional<uint32_t> graphicsFamily = std::nullopt;
std::optional<uint32_t> presentFamily = std::nullopt;
static constexpr uint32_t UNDEFINED_UINT32_VALUE = 0xFFFFFFFF;
uint32_t graphicsFamily = UNDEFINED_UINT32_VALUE;
uint32_t presentFamily = UNDEFINED_UINT32_VALUE;
[[nodiscard]] bool Complete() const
{
return graphicsFamily && presentFamily;
return
graphicsFamily != UNDEFINED_UINT32_VALUE &&
presentFamily != UNDEFINED_UINT32_VALUE;
}
};
@@ -25,14 +29,15 @@ namespace PB::Renderer
class VulkanManager
{
public:
/* Static class so (de)constructors have been deleted to stop accidental creation */
VulkanManager() = delete;
~VulkanManager() = delete;
static bool InitAll(GLFWwindow* window);
static std::optional<VkInstance> Init();
static bool Init(GLFWwindow* window);
static bool Cleanup();
static std::optional<VkSurfaceKHR> CreateSurface(GLFWwindow* window);
static bool CreateInstance();
static bool CreateSurface(GLFWwindow* window);
static bool PickPhysicalDevice();
static bool CreateLogicalDevice();
static bool CreateSwapChain(GLFWwindow* window);
@@ -41,7 +46,7 @@ namespace PB::Renderer
static bool CreateFramebuffer();
static bool CreateGraphicsPipeline();
static bool CreateCommandBuffers();
static void CreateSemaphores();
static bool CreateSemaphores();
static bool RenderPass();
@@ -57,8 +62,8 @@ namespace PB::Renderer
static VkShaderModule CreateShaderModule(const std::string& filename);
static std::optional<VkInstance> s_Instance;
static std::optional<VkSurfaceKHR> s_Surface;
static VkInstance s_Instance;
static VkSurfaceKHR s_Surface;
static VkPhysicalDevice s_PhysicalDevice;
static QueueFamilyIndices s_QueueIndices;