Compare commits
2 Commits
main
...
0194699815
| Author | SHA1 | Date | |
|---|---|---|---|
| 0194699815 | |||
| 302b680a48 |
@@ -56,6 +56,9 @@ target_link_options(maiden_core PRIVATE --coverage)
|
|||||||
target_link_options(maiden PRIVATE --coverage)
|
target_link_options(maiden PRIVATE --coverage)
|
||||||
target_link_options(maiden_test 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
|
target_link_libraries(maiden PRIVATE
|
||||||
maiden_core
|
maiden_core
|
||||||
SDL3::SDL3
|
SDL3::SDL3
|
||||||
|
|||||||
@@ -19,6 +19,20 @@ Basic outline where I pretty much copy the guide:
|
|||||||
- ... Boring optimization stuff, like mipmaps, multithreading, multisampling
|
- ... Boring optimization stuff, like mipmaps, multithreading, multisampling
|
||||||
- it has a section on raytracing :3
|
- 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
|
## 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.
|
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.
|
||||||
|
|
||||||
|
|||||||
@@ -70,7 +70,10 @@ $ cd build
|
|||||||
$ gcovr -r .. --filter "../src"
|
$ 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
|
## Development Roadmap
|
||||||
### lots of todo here
|
### lots of todo here
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
|
|
||||||
#include "Engine.hpp"
|
#include "Engine.hpp"
|
||||||
|
|
||||||
#include "vulkan/vulkan.h"
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
Engine::Engine(Window* window): window_(window) {
|
Engine::Engine(Window* window): window_(window) {
|
||||||
@@ -13,24 +12,7 @@ Engine::Engine(Window* window): window_(window) {
|
|||||||
|
|
||||||
void Engine::init() {
|
void Engine::init() {
|
||||||
|
|
||||||
VkApplicationInfo appInfo {
|
if(createInstance()) {
|
||||||
.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) {
|
|
||||||
// TODO: need some kind of logger service
|
// TODO: need some kind of logger service
|
||||||
std::cout << "[" << __FUNCTION__ << ": " << __LINE__ << "] Vulkan instance successfully created." << std::endl;
|
std::cout << "[" << __FUNCTION__ << ": " << __LINE__ << "] Vulkan instance successfully created." << std::endl;
|
||||||
} else {
|
} else {
|
||||||
@@ -49,3 +31,55 @@ void Engine::init() {
|
|||||||
void Engine::draw() {
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
// resource allocation is initializion my beloved
|
||||||
|
#include <vulkan/vulkan_raii.hpp>
|
||||||
|
|
||||||
#include "Window.hpp"
|
#include "Window.hpp"
|
||||||
|
|
||||||
class Engine {
|
class Engine {
|
||||||
@@ -17,8 +20,12 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// might get rid of this
|
|
||||||
|
|
||||||
Window* window_;
|
Window* window_;
|
||||||
|
|
||||||
|
bool createInstance();
|
||||||
|
|
||||||
|
// Vulkan specific
|
||||||
|
vk::raii::Context context_;
|
||||||
|
vk::raii::Instance instance_ = nullptr;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user