05d2c2940b
- Fix vulkan linking by setting correct VK_LAYER_PATH and correct vulkan library path - Add priority to GPU selection. Prioritizing dedicated GPUs over integrated GPUs
69 lines
1.8 KiB
C++
69 lines
1.8 KiB
C++
#include "copium/core/Vulkan.h"
|
|
|
|
#include "copium/asset/AssetManager.h"
|
|
#include "copium/sampler/Texture2D.h"
|
|
#include "copium/sampler/ColorAttachment.h"
|
|
#include "copium/sampler/Font.h"
|
|
#include "copium/pipeline/Pipeline.h"
|
|
#include "copium/buffer/Framebuffer.h"
|
|
|
|
namespace Copium
|
|
{
|
|
std::unique_ptr<Instance> Vulkan::instance;
|
|
std::unique_ptr<Window> Vulkan::window;
|
|
std::unique_ptr<Device> Vulkan::device;
|
|
std::unique_ptr<SwapChain> Vulkan::swapChain;
|
|
|
|
void Vulkan::Initialize()
|
|
{
|
|
instance = std::make_unique<Instance>("Copium Engine");
|
|
window = std::make_unique<Window>("Copium Engine", 1440, 810, WindowMode::Windowed);
|
|
device = std::make_unique<Device>();
|
|
swapChain = std::make_unique<SwapChain>();
|
|
|
|
AssetManager::RegisterAssetType<Texture2D>("Texture2D");
|
|
AssetManager::RegisterAssetType<ColorAttachment>("RenderTexture");
|
|
AssetManager::RegisterAssetType<Pipeline>("Pipeline");
|
|
AssetManager::RegisterAssetType<Framebuffer>("Framebuffer");
|
|
AssetManager::RegisterAssetType<Font>("Font");
|
|
|
|
// TODO: Make the working directory always be relative to the assets folder
|
|
// By looking at where the executable is, since that should always be in the bin folder (it currently isn't though)
|
|
AssetManager::RegisterAssetDir("assets/");
|
|
}
|
|
|
|
void Vulkan::Destroy()
|
|
{
|
|
AssetManager::UnregisterAssetDir("assets/");
|
|
AssetManager::Cleanup();
|
|
swapChain.reset();
|
|
device.reset();
|
|
window.reset();
|
|
instance.reset();
|
|
}
|
|
|
|
Instance& Vulkan::GetInstance()
|
|
{
|
|
return *instance;
|
|
}
|
|
|
|
Window& Vulkan::GetWindow()
|
|
{
|
|
return *window;
|
|
}
|
|
|
|
Device& Vulkan::GetDevice()
|
|
{
|
|
return *device;
|
|
}
|
|
|
|
SwapChain& Vulkan::GetSwapChain()
|
|
{
|
|
return *swapChain;
|
|
}
|
|
|
|
bool Vulkan::Valid()
|
|
{
|
|
return instance && window && device && swapChain;
|
|
}
|
|
} |