Feature/VkExtensions+VkLayers (#2)
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
// resource allocation is initializion my beloved
|
||||
#include <vulkan/vulkan_raii.hpp>
|
||||
|
||||
#include "Window.hpp"
|
||||
|
||||
class Engine {
|
||||
@@ -10,6 +13,7 @@ public:
|
||||
Engine(Window* window);
|
||||
~Engine() = default;
|
||||
|
||||
// initializes and sets up the vulkan instance. outside of constructor to allow control of order the order of initialization
|
||||
void init();
|
||||
|
||||
// draw is called every render iteration in that while loop
|
||||
@@ -17,8 +21,30 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
// might get rid of this
|
||||
// returns a list of the required extensions needed by our engine
|
||||
std::vector<const char*> getRequiredInstanceExtensions();
|
||||
|
||||
// helper for organizing the creation of the vulkan instance. returns success or failure
|
||||
bool createInstance();
|
||||
|
||||
// helper for attaching callbacks to the instance
|
||||
bool initDebugMessenger();
|
||||
|
||||
// callback function for the vulkan debug extension: routes debug messages from validation layers to our app
|
||||
static VKAPI_ATTR vk::Bool32 VKAPI_CALL debugCallback(vk::DebugUtilsMessageSeverityFlagBitsEXT severity,
|
||||
vk::DebugUtilsMessageTypeFlagsEXT type,
|
||||
const vk::DebugUtilsMessengerCallbackDataEXT* pCallbackData,
|
||||
void* pUserData);
|
||||
|
||||
Window* window_;
|
||||
|
||||
// Vulkan specific instance members
|
||||
vk::raii::Context context_;
|
||||
vk::raii::Instance instance_ = nullptr;
|
||||
vk::raii::DebugUtilsMessengerEXT debugMessenger_ = nullptr;
|
||||
|
||||
// members for control over validation layers
|
||||
static constexpr bool enableValidationLayers = true; // TODO: only true in debug mode
|
||||
const std::vector<const char*> validationLayers = { "VK_LAYER_KHRONOS_validation" };
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user