2 Commits

Author SHA1 Message Date
0194699815 add required extensions to vulkan instance (+ use the c++ library over c library)
Some checks failed
Build and Test verification / build (push) Failing after 29s
Build and Test verification / test (push) Has been skipped
2026-05-11 23:32:28 -05:00
302b680a48 update contributing with goals 2026-05-11 22:26:59 -05:00
5 changed files with 83 additions and 22 deletions

View File

@@ -56,6 +56,9 @@ target_link_options(maiden_core PRIVATE --coverage)
target_link_options(maiden PRIVATE --coverage)
target_link_options(maiden_test PRIVATE --coverage)
# vulkan necessity
target_compile_definitions(maiden_core PRIVATE VULKAN_HPP_NO_STRUCT_CONSTRUCTORS)
target_link_libraries(maiden PRIVATE
maiden_core
SDL3::SDL3

View File

@@ -19,6 +19,20 @@ Basic outline where I pretty much copy the guide:
- ... Boring optimization stuff, like mipmaps, multithreading, multisampling
- it has a section on raytracing :3
Goals:
- loading 3d models
- applying textures
- simple diffuse lighting
- vertex animations
- 3d camera and scene
- transparency
Future ambitions:
- entity component system
- shadows
- raytracing
- rigidbody simulation
## Supporting App Infrastructure
Although not crucial to the core rendering functions of the app, features separate from the rendering engine are convenient to have for testing and usability. Components below are less urgent but should be simpler to develop and implement.

View File

@@ -70,7 +70,10 @@ $ cd build
$ gcovr -r .. --filter "../src"
```
### app troubleshooting here
## App Troubleshooting
Basically these are some tricky situations that I encountered when trying to execute this app throughout this development phase. If you are running on WSL Ubuntu 26.04 like me, then you mightr run into these too, hopefully my steps help fix.
note: I am running an x86_64 system with an Nvidia GPU so some things may be slightly different if your system doesn't match.
## Development Roadmap
### lots of todo here

View File

@@ -1,7 +1,6 @@
#include "Engine.hpp"
#include "vulkan/vulkan.h"
#include <iostream>
Engine::Engine(Window* window): window_(window) {
@@ -13,24 +12,7 @@ Engine::Engine(Window* window): window_(window) {
void Engine::init() {
VkApplicationInfo appInfo {
.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO,
.pApplicationName = "maiden",
.apiVersion = VK_API_VERSION_1_4
};
uint32_t instanceExtensionsCount = 0;
char const* const* instanceExtensions{ SDL_Vulkan_GetInstanceExtensions(&instanceExtensionsCount) };
VkInstanceCreateInfo instanceCI {
.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO,
.pApplicationInfo = &appInfo,
.enabledExtensionCount = instanceExtensionsCount,
.ppEnabledExtensionNames = instanceExtensions,
};
VkInstance instance;
if(vkCreateInstance(&instanceCI, nullptr, &instance) == VK_SUCCESS) {
if(createInstance()) {
// TODO: need some kind of logger service
std::cout << "[" << __FUNCTION__ << ": " << __LINE__ << "] Vulkan instance successfully created." << std::endl;
} else {
@@ -49,3 +31,55 @@ void Engine::init() {
void Engine::draw() {
}
bool Engine::createInstance() {
// create the appInfo filled with information about our app
constexpr vk::ApplicationInfo appInfo { // using the c++ api instead of the c api
.pApplicationName = "maiden",
.applicationVersion = VK_MAKE_VERSION(1, 0, 0),
.pEngineName = "null",
.engineVersion = VK_MAKE_VERSION(1, 0, 0),
.apiVersion = VK_API_VERSION_1_4 // this one is most important
};
// get necessary extensions that our windowing library requires
uint32_t instanceExtensionsCount = 0;
char const* const* instanceExtensions{ SDL_Vulkan_GetInstanceExtensions(&instanceExtensionsCount) };
// check if these extensions are available
auto extensionProperties = context_.enumerateInstanceExtensionProperties();
uint32_t errorCount = 0;
for(uint32_t i = 0; i < instanceExtensionsCount; i++) { // for each extension that we require
bool found = false;
for(const auto& extensionProperty : extensionProperties) { // see if it matches any extensions that are provided
if(strcmp(extensionProperty.extensionName, instanceExtensions[i]) == 0) {
std::cout << "[" << __FUNCTION__ << ": " << __LINE__ << "] Required SDL3 extension not supported: " << instanceExtensions[i] << std::endl;
} else {
found = true;
break;
}
}
if(!found) {
std::cout << "[" << __FUNCTION__ << ": " << __LINE__ << "] Required SDL3 extension not supported: " << instanceExtensions[i] << std::endl;
errorCount++;
} else {
// in case you're curious
std::cout << "[" << __FUNCTION__ << ": " << __LINE__ << "] SDL3 extension located: " << instanceExtensions[i] << std::endl;
}
} // if any weren't then we must exit
if(errorCount != 0) return false;
vk::InstanceCreateInfo instanceCreateInfo {
.pApplicationInfo = &appInfo,
.enabledExtensionCount = instanceExtensionsCount,
.ppEnabledExtensionNames = instanceExtensions,
};
instance_ = vk::raii::Instance(context_, instanceCreateInfo);
if(instance_ != nullptr) {
return true;
} else {
return false;
}
}

View File

@@ -1,6 +1,9 @@
#pragma once
// resource allocation is initializion my beloved
#include <vulkan/vulkan_raii.hpp>
#include "Window.hpp"
class Engine {
@@ -17,8 +20,12 @@ public:
private:
// might get rid of this
Window* window_;
bool createInstance();
// Vulkan specific
vk::raii::Context context_;
vk::raii::Instance instance_ = nullptr;
};