diff --git a/README.md b/README.md index d600899..de65fe8 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,11 @@ # Yet Another Vulkan Engine. This project has been created with the sole purpose of teaching me how Vulkan works. + +# Installing Dependancies. +To build the project on redhat based distros these dependancies or their +equivelents are required. +''' +sudo dnf install vulkan-tools vulkan-loader-devel vulkan-validation-layers-devel +glfw-devel glm-devel glslc +''' diff --git a/src/application.cpp b/src/application.cpp index f355a38..ba4b5e3 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -1,8 +1,11 @@ #include "application.hpp" +#include "yave_vulkan_instance.hpp" namespace yave { void Application::run() { + yaveVulkanInstance VI = yaveVulkanInstance(); + while (!yaveWindow.shouldClose()) { glfwPollEvents(); } diff --git a/src/yave_vulkan_instance.cpp b/src/yave_vulkan_instance.cpp new file mode 100644 index 0000000..dee8b3f --- /dev/null +++ b/src/yave_vulkan_instance.cpp @@ -0,0 +1,35 @@ +#include "yave_vulkan_instance.hpp" + +namespace yave { + +YaveVulkanInstance::YaveVulkanInstance() { createInstance(); } + +void YaveVulkanInstance::createInstance() { + VkApplicationInfo appInfo{}; + appInfo.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO; + appInfo.pApplicationName = "Hello Triangle"; + appInfo.applicationVersion = VK_MAKE_VERSION(1, 0, 0); + appInfo.pEngineName = "Yave"; + appInfo.engineVersion = VK_MAKE_VERSION(1, 0, 0); + appInfo.apiVersion = VK_API_VERSION_1_0; + + VkInstanceCreateInfo createInfo{}; + createInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO; + createInfo.pApplicationInfo = &appInfo; + + uint32_t glfwExtensionCount = 0; + const char **glfwExtensions; + + glfwExtensions = glfwGetRequiredInstanceExtensions(&glfwExtensionCount); + + createInfo.enabledExtensionCount = glfwExtensionCount; + createInfo.ppEnabledExtensionNames = glfwExtensions; + + createInfo.enabledLayerCount = 0; + + if (vkCreateInstance(&createInfo, nullptr, &instance) != VK_SUCCESS) { + throw std::runtime_error("failed to create vulkan instance!"); + } +} + +} // namespace yave diff --git a/src/yave_vulkan_instance.hpp b/src/yave_vulkan_instance.hpp new file mode 100644 index 0000000..1621394 --- /dev/null +++ b/src/yave_vulkan_instance.hpp @@ -0,0 +1,21 @@ +#pragma once + +#include +#include + +#define GLFW_INCLUDE_VULKAN +#include + +namespace yave { +class YaveVulkanInstance { + + private: + VkInstance instance; + + void createInstance(); + + public: + YaveVulkanInstance(); + +}; +} // namespace yave