PixelBullet  0.0.1
A C++ game engine
Loading...
Searching...
No Matches
instance.h
1#pragma once
2
3#include <volk.h>
4
5#include <vector>
6
7#ifndef VK_API_VERSION_1_1
8#define VK_API_VERSION_1_1 VK_MAKE_VERSION(1, 1, 0)
9#endif
10
11namespace pixelbullet
12{
13struct ApplicationSpecification;
14class Window;
15
17{
18 friend class Graphics;
19
20public:
21 friend VKAPI_ATTR VkBool32 VKAPI_CALL CallbackDebug(VkDebugUtilsMessageSeverityFlagBitsEXT message_severity,
22 VkDebugUtilsMessageTypeFlagsEXT message_types,
23 const VkDebugUtilsMessengerCallbackDataEXT* p_callback_data, void* p_user_data);
24
25 Instance(const ApplicationSpecification& specification, const Window& window);
26 ~Instance();
27
28 static VkResult FvkCreateDebugUtilsMessengerEXT(VkInstance instance, const VkDebugUtilsMessengerCreateInfoEXT* p_create_info,
29 const VkAllocationCallbacks* p_allocator, VkDebugUtilsMessengerEXT* p_debug_messenger);
30 static void FvkDestroyDebugUtilsMessengerEXT(VkInstance instance, VkDebugUtilsMessengerEXT messenger,
31 const VkAllocationCallbacks* p_allocator);
32
33 static uint32_t FindMemoryTypeIndex(const VkPhysicalDeviceMemoryProperties* device_memory_properties,
34 const VkMemoryRequirements* memory_requirements, VkMemoryPropertyFlags required_properties);
35
36 operator const VkInstance&() const
37 {
38 return instance_;
39 }
40
41 bool GetEnableValidationLayers() const
42 {
43 return enable_validation_layers_;
44 }
45 const VkInstance& GetInstance() const
46 {
47 return instance_;
48 }
49
50public:
51 static const std::vector<const char*> validation_layers;
52
53private:
54 bool CheckValidationLayerSupport() const;
55 std::vector<const char*> GetExtensions() const;
56 void CreateInstance();
57 void CreateDebugMessenger();
58
59private:
60 static void LogVulkanLayers(const std::vector<VkLayerProperties>& layer_properties);
61
62private:
63 const ApplicationSpecification& specification_;
64 const Window& window_;
65 bool enable_validation_layers_ = false;
66
67 VkInstance instance_ = VK_NULL_HANDLE;
68 VkDebugUtilsMessengerEXT debug_messenger_ = VK_NULL_HANDLE;
69};
70} // namespace pixelbullet
Module that manages the Vulkan instance_, Surface, Window and the renderpass structure.
Definition graphics.h:36
Definition instance.h:17
Definition window.h:23
Contains configuration options for both the game and the engine.
Definition specification.h:145