Add Linux support
- Add linux build system using MakeGen - Fix a swapchain validation error, likelydue to my linux system using a different vulkan version - Make DescriptorPool take in amount of descriptors it needs, instead of allocating a mass amount for every pool, causing loads of RAM/VRAM usage
This commit is contained in:
@@ -9,3 +9,5 @@ bin/
|
||||
.cache
|
||||
libs
|
||||
imgui.ini
|
||||
Makefile
|
||||
compile_flags.txt
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
<makegen>
|
||||
<configuration name="Release">
|
||||
<define>MSDF_ATLAS_PUBLIC=</define>
|
||||
<define>GLM_FORCE_LEFT_HANDED</define>
|
||||
<define>GLM_FORCE_RADIANS</define>
|
||||
<define>GLM_FORCE_DEPTH_ZERO_TO_ONE</define>
|
||||
<dependency>../ext/projects/imgui/</dependency>
|
||||
<dependency>../ext/projects/msdf-atlas-gen/</dependency>
|
||||
<dependency>../ext/projects/msdfgen-core/</dependency>
|
||||
<dependency>../ext/projects/msdfgen-ext/</dependency>
|
||||
<generatehfile>false</generatehfile>
|
||||
<outputdir>bin/Release/</outputdir>
|
||||
<outputname>libcopium.so</outputname>
|
||||
<outputtype>sharedlibrary</outputtype>
|
||||
<projectname>Copium Engine</projectname>
|
||||
<srcdir>src/</srcdir>
|
||||
<includedir>src/</includedir>
|
||||
<includedir>../ext/repos/imgui/</includedir>
|
||||
<includedir>../ext/repos/imgui/backends/</includedir>
|
||||
<includedir>../ext/repos/freetype/</includedir>
|
||||
<includedir>../ext/repos/msdf-atlas-gen/msdfgen/</includedir>
|
||||
<includedir>../ext/repos/msdf-atlas-gen/</includedir>
|
||||
<includedir>../ext/repos/stb/</includedir>
|
||||
</configuration>
|
||||
<configuration name="Debug">
|
||||
<cflag>-g3</cflag>
|
||||
<cflag>-w</cflag>
|
||||
<define>_DEBUG</define>
|
||||
<define>MSDF_ATLAS_PUBLIC=</define>
|
||||
<define>GLM_FORCE_LEFT_HANDED</define>
|
||||
<define>GLM_FORCE_RADIANS</define>
|
||||
<define>GLM_FORCE_DEPTH_ZERO_TO_ONE</define>
|
||||
<dependency>../ext/projects/imgui/</dependency>
|
||||
<dependency>../ext/projects/msdf-atlas-gen/</dependency>
|
||||
<dependency>../ext/projects/msdfgen-core/</dependency>
|
||||
<dependency>../ext/projects/msdfgen-ext/</dependency>
|
||||
<generatehfile>false</generatehfile>
|
||||
<outputdir>bin/Debug/</outputdir>
|
||||
<outputname>libcopium.so</outputname>
|
||||
<outputtype>sharedlibrary</outputtype>
|
||||
<projectname>Copium Engine</projectname>
|
||||
<srcdir>src/</srcdir>
|
||||
<includedir>src/</includedir>
|
||||
<includedir>../ext/repos/imgui/</includedir>
|
||||
<includedir>../ext/repos/imgui/backends/</includedir>
|
||||
<includedir>../ext/repos/freetype/</includedir>
|
||||
<includedir>../ext/repos/msdf-atlas-gen/msdfgen/</includedir>
|
||||
<includedir>../ext/repos/msdf-atlas-gen/</includedir>
|
||||
<includedir>../ext/repos/stb/</includedir>
|
||||
</configuration>
|
||||
<target>Debug</target>
|
||||
<version>v1.3.4</version>
|
||||
</makegen>
|
||||
@@ -1,7 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "copium/asset/AssetMeta.h"
|
||||
#include "copium/util/MetaFile.h"
|
||||
#include "copium/util/Uuid.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include "copium/asset/AssetMeta.h"
|
||||
#include "copium/util/MetaFile.h"
|
||||
#include "copium/util/Uuid.h"
|
||||
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
#include "copium/asset/AssetManager.h"
|
||||
|
||||
#include "copium/buffer/Framebuffer.h"
|
||||
#include "copium/sampler/ColorAttachment.h"
|
||||
#include "copium/sampler/Texture2D.h"
|
||||
#include "copium/util/Common.h"
|
||||
#include "copium/util/MetaFile.h"
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "copium/asset/Asset.h"
|
||||
#include "copium/asset/AssetMeta.h"
|
||||
#include "copium/asset/AssetRef.h"
|
||||
#include "copium/buffer/CommandBuffer.h"
|
||||
#include "copium/sampler/ColorAttachment.h"
|
||||
|
||||
@@ -5,7 +5,9 @@
|
||||
namespace Copium
|
||||
{
|
||||
IndexBuffer::IndexBuffer(int indexCount)
|
||||
: Buffer{VK_BUFFER_USAGE_TRANSFER_DST_BIT | VK_BUFFER_USAGE_INDEX_BUFFER_BIT, VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, indexCount * sizeof(uint16_t), 1},
|
||||
: Buffer{VK_BUFFER_USAGE_TRANSFER_DST_BIT | VK_BUFFER_USAGE_INDEX_BUFFER_BIT,
|
||||
VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT,
|
||||
indexCount * sizeof(uint16_t), 1},
|
||||
indexCount{indexCount}
|
||||
{}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "Device.h"
|
||||
|
||||
#include "copium/core/QueueFamilies.h"
|
||||
#include "copium/core/Vulkan.h"
|
||||
#include "copium/core/Window.h"
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include "copium/core/QueueFamilies.h"
|
||||
#include "copium/util/Common.h"
|
||||
|
||||
#include <vulkan/vulkan.hpp>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
namespace Copium
|
||||
{
|
||||
ImGuiInstance::ImGuiInstance()
|
||||
: descriptorPool{std::make_unique<DescriptorPool>()}
|
||||
: descriptorPool{std::make_unique<DescriptorPool>(SwapChain::MAX_FRAMES_IN_FLIGHT, 1)}
|
||||
{
|
||||
InitializeImGui();
|
||||
InitializeDescriptorSetLayout();
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
#include "Instance.h"
|
||||
|
||||
#include "copium/core/QueueFamilies.h"
|
||||
#include "copium/util/Common.h"
|
||||
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
namespace Copium
|
||||
{
|
||||
Instance::Instance(const std::string& applicationName)
|
||||
|
||||
@@ -2,9 +2,6 @@
|
||||
|
||||
#include "copium/core/DebugMessenger.h"
|
||||
|
||||
#include <GLFW/glfw3.h>
|
||||
#include <set>
|
||||
|
||||
namespace Copium
|
||||
{
|
||||
class Instance final
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
#include "copium/core/Vulkan.h"
|
||||
#include "copium/sampler/Image.h"
|
||||
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
namespace Copium
|
||||
{
|
||||
const int SwapChain::MAX_FRAMES_IN_FLIGHT = 2;
|
||||
|
||||
SwapChainSupportDetails::SwapChainSupportDetails(VkSurfaceKHR surface, VkPhysicalDevice physicalDevice)
|
||||
{
|
||||
vkGetPhysicalDeviceSurfaceCapabilitiesKHR(physicalDevice, surface, &capabilities);
|
||||
@@ -35,6 +35,7 @@ namespace Copium
|
||||
}
|
||||
|
||||
SwapChain::SwapChain()
|
||||
: flightIndex{0}, resizeFramebuffer{false}
|
||||
{
|
||||
Initialize();
|
||||
InitializeImageViews();
|
||||
@@ -49,9 +50,13 @@ namespace Copium
|
||||
for (size_t i = 0; i < MAX_FRAMES_IN_FLIGHT; ++i)
|
||||
{
|
||||
vkDestroyFence(Vulkan::GetDevice(), inFlightFences[i], nullptr);
|
||||
vkDestroySemaphore(Vulkan::GetDevice(), renderFinishedSemaphores[i], nullptr);
|
||||
vkDestroySemaphore(Vulkan::GetDevice(), imageAvailableSemaphores[i], nullptr);
|
||||
}
|
||||
for (size_t i = 0; i < images.size(); ++i)
|
||||
{
|
||||
vkDestroySemaphore(Vulkan::GetDevice(), renderFinishedSemaphores[i], nullptr);
|
||||
}
|
||||
|
||||
Destroy();
|
||||
vkDestroyRenderPass(Vulkan::GetDevice(), renderPass, nullptr);
|
||||
}
|
||||
@@ -137,7 +142,7 @@ namespace Copium
|
||||
submitInfo.commandBufferCount = 1;
|
||||
submitInfo.pCommandBuffers = &cmd;
|
||||
submitInfo.signalSemaphoreCount = 1;
|
||||
submitInfo.pSignalSemaphores = &renderFinishedSemaphores[flightIndex];
|
||||
submitInfo.pSignalSemaphores = &renderFinishedSemaphores[imageIndex];
|
||||
|
||||
CP_VK_ASSERT(vkQueueSubmit(Vulkan::GetDevice().GetGraphicsQueue(), 1, &submitInfo, inFlightFences[flightIndex]), "Failed to submit command buffer");
|
||||
}
|
||||
@@ -147,7 +152,7 @@ namespace Copium
|
||||
VkPresentInfoKHR presentInfo{};
|
||||
presentInfo.sType = VK_STRUCTURE_TYPE_PRESENT_INFO_KHR;
|
||||
presentInfo.waitSemaphoreCount = 1;
|
||||
presentInfo.pWaitSemaphores = &renderFinishedSemaphores[flightIndex];
|
||||
presentInfo.pWaitSemaphores = &renderFinishedSemaphores[imageIndex];
|
||||
presentInfo.swapchainCount = 1;
|
||||
presentInfo.pSwapchains = &handle;
|
||||
presentInfo.pImageIndices = &imageIndex;
|
||||
@@ -345,14 +350,12 @@ namespace Copium
|
||||
void SwapChain::InitializeSyncObjects()
|
||||
{
|
||||
imageAvailableSemaphores.resize(MAX_FRAMES_IN_FLIGHT);
|
||||
renderFinishedSemaphores.resize(MAX_FRAMES_IN_FLIGHT);
|
||||
inFlightFences.resize(MAX_FRAMES_IN_FLIGHT);
|
||||
VkSemaphoreCreateInfo semaphoreCreateInfo{};
|
||||
semaphoreCreateInfo.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO;
|
||||
for (size_t i = 0; i < MAX_FRAMES_IN_FLIGHT; ++i)
|
||||
{
|
||||
CP_VK_ASSERT(vkCreateSemaphore(Vulkan::GetDevice(), &semaphoreCreateInfo, nullptr, &imageAvailableSemaphores[i]), "Failed to initialize available image semaphore");
|
||||
CP_VK_ASSERT(vkCreateSemaphore(Vulkan::GetDevice(), &semaphoreCreateInfo, nullptr, &renderFinishedSemaphores[i]), "Failed to initialize render finished semaphore");
|
||||
|
||||
VkFenceCreateInfo fenceCreateInfo{};
|
||||
fenceCreateInfo.sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO;
|
||||
@@ -360,6 +363,11 @@ namespace Copium
|
||||
|
||||
CP_VK_ASSERT(vkCreateFence(Vulkan::GetDevice(), &fenceCreateInfo, nullptr, &inFlightFences[i]), "Failed to initialize in flight fence");
|
||||
}
|
||||
renderFinishedSemaphores.resize(images.size());
|
||||
for(size_t i = 0; i < renderFinishedSemaphores.size(); i++)
|
||||
{
|
||||
CP_VK_ASSERT(vkCreateSemaphore(Vulkan::GetDevice(), &semaphoreCreateInfo, nullptr, &renderFinishedSemaphores[i]), "Failed to initialize render finished semaphore");
|
||||
}
|
||||
}
|
||||
|
||||
void SwapChain::Destroy()
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Copium
|
||||
{
|
||||
CP_DELETE_COPY_AND_MOVE_CTOR(SwapChain);
|
||||
public:
|
||||
static const int MAX_FRAMES_IN_FLIGHT = 2;
|
||||
static const int MAX_FRAMES_IN_FLIGHT;
|
||||
private:
|
||||
VkSwapchainKHR handle;
|
||||
VkRenderPass renderPass;
|
||||
@@ -34,7 +34,7 @@ namespace Copium
|
||||
std::vector<VkImageView> imageViews;
|
||||
std::vector<VkImage> images;
|
||||
std::vector<VkFramebuffer> framebuffers;
|
||||
uint32_t imageIndex;
|
||||
uint32_t imageIndex;
|
||||
bool resizeFramebuffer;
|
||||
|
||||
int flightIndex;
|
||||
|
||||
@@ -22,6 +22,10 @@ namespace Copium
|
||||
{
|
||||
Timer timer;
|
||||
timer.Start();
|
||||
|
||||
glfwSetErrorCallback(glfw_error_callback);
|
||||
CP_ASSERT(glfwInit() == GLFW_TRUE, "Failed to initialize the glfw context");
|
||||
|
||||
instance = std::make_unique<Instance>("Copium Engine");
|
||||
window = std::make_unique<Window>("Copium Engine", 1440, 810, WindowMode::Windowed);
|
||||
device = std::make_unique<Device>();
|
||||
@@ -97,4 +101,9 @@ namespace Copium
|
||||
{
|
||||
return instance && window && device && swapChain;
|
||||
}
|
||||
|
||||
void Vulkan::glfw_error_callback(int error, const char* description)
|
||||
{
|
||||
CP_ABORT("GLFW Error %d: %s\n", error, description);
|
||||
}
|
||||
}
|
||||
@@ -36,5 +36,8 @@ namespace Copium
|
||||
static bool Valid();
|
||||
static AssetHandle<Texture2D> GetWhiteTexture2D();
|
||||
static AssetHandle<Texture2D> GetEmptyTexture2D();
|
||||
|
||||
private:
|
||||
static void glfw_error_callback(int error, const char* description);
|
||||
};
|
||||
}
|
||||
@@ -9,8 +9,8 @@
|
||||
#include "copium/event/MousePressEvent.h"
|
||||
#include "copium/event/MouseReleaseEvent.h"
|
||||
#include "copium/event/MouseScrollEvent.h"
|
||||
#include "copium/event/WindowResizeEvent.h"
|
||||
#include "copium/event/WindowFocusEvent.h"
|
||||
#include "copium/event/WindowResizeEvent.h"
|
||||
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
@@ -32,7 +32,6 @@ namespace Copium
|
||||
bool Window::ShouldClose() const
|
||||
{
|
||||
return glfwWindowShouldClose(window);
|
||||
|
||||
}
|
||||
|
||||
int Window::GetWidth() const
|
||||
@@ -72,6 +71,8 @@ namespace Copium
|
||||
{
|
||||
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
|
||||
|
||||
CP_ASSERT(glfwVulkanSupported(), "Vulkan is not supported");
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case WindowMode::Fullscreen:
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "copium/ecs/ECSManager.h"
|
||||
#include "copium/ecs/Config.h"
|
||||
|
||||
namespace Copium
|
||||
{
|
||||
class ECSManager;
|
||||
|
||||
template <typename Component>
|
||||
class ComponentListener
|
||||
{
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#include <map>
|
||||
#include <typeindex>
|
||||
#include <unordered_set>
|
||||
#include <vector>
|
||||
|
||||
namespace Copium
|
||||
{
|
||||
@@ -36,7 +35,7 @@ namespace Copium
|
||||
template <typename SystemClass>
|
||||
void RemoveSystem()
|
||||
{
|
||||
systemPool->MoveSystemBefore(typeid(SystemClass));
|
||||
systemPool->RemoveSystem(typeid(SystemClass));
|
||||
}
|
||||
|
||||
void UpdateSystems();
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
#include "copium/ecs/SystemBase.h"
|
||||
#include "copium/ecs/Entity.h"
|
||||
|
||||
#include <set>
|
||||
|
||||
namespace Copium
|
||||
{
|
||||
template <typename... Components>
|
||||
@@ -26,7 +28,6 @@ namespace Copium
|
||||
|
||||
// TODO: Not sure if this is the way entities should be validated
|
||||
std::set<EntityId> loggedEntities;
|
||||
template <typename... Components>
|
||||
bool ValidateEntity(Entity entity)
|
||||
{
|
||||
if (entity && entity.HasComponents<Components...>())
|
||||
|
||||
@@ -13,6 +13,8 @@ namespace Copium
|
||||
ECSManager* manager;
|
||||
|
||||
public:
|
||||
virtual ~SystemBase() = default;
|
||||
|
||||
virtual void Run() = 0;
|
||||
virtual void Run(const Signal& signal) = 0;
|
||||
};
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <typeindex>
|
||||
|
||||
namespace Copium
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include "copium/ecs/SystemPool.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
namespace Copium
|
||||
{
|
||||
SystemPool::SystemPool(ECSManager* manager)
|
||||
|
||||
@@ -11,6 +11,8 @@ namespace Copium
|
||||
public:
|
||||
Event(EventType type);
|
||||
|
||||
virtual ~Event() = default;
|
||||
|
||||
EventType GetType() const;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#include "copium/event/Input.h"
|
||||
|
||||
#include "copium/util/Common.h"
|
||||
#include "copium/core/Vulkan.h"
|
||||
#include "copium/event/InputCode.h"
|
||||
#include "copium/util/Common.h"
|
||||
|
||||
#include <glm/gtc/matrix_transform.hpp>
|
||||
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "copium/event/InputCode.h"
|
||||
#include "copium/util/BoundingBox.h"
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <string>
|
||||
|
||||
namespace Copium
|
||||
{
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include "copium/util/Enum.h"
|
||||
|
||||
#define CP_MOUSE_LEFT 0
|
||||
#define CP_MOUSE_RIGHT 1
|
||||
#define CP_MOUSE_MIDDLE 2
|
||||
@@ -128,4 +126,4 @@
|
||||
#define CP_KEY_RIGHT_ALT 346
|
||||
#define CP_KEY_RIGHT_SUPER 347
|
||||
#define CP_KEY_MENU 348
|
||||
#define CP_KEY_UNBOUND 0xffffffff
|
||||
#define CP_KEY_UNBOUND 0x0fffffff
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "copium/event/Event.h"
|
||||
#include "copium/event/EventType.h"
|
||||
#include "copium/util/BoundingBox.h"
|
||||
|
||||
namespace Copium
|
||||
|
||||
@@ -4,20 +4,31 @@
|
||||
|
||||
namespace Copium
|
||||
{
|
||||
DescriptorPool::DescriptorPool()
|
||||
DescriptorPool::DescriptorPool(int uniformDescriptorSets, int imageDescriptorSets)
|
||||
{
|
||||
std::vector<VkDescriptorPoolSize> poolSizes{2};
|
||||
poolSizes[0].type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER;
|
||||
poolSizes[0].descriptorCount = DESCRIPTOR_SET_COUNT * SwapChain::MAX_FRAMES_IN_FLIGHT; // TODO: how should this actually be determined?
|
||||
std::vector<VkDescriptorPoolSize> poolSizes;
|
||||
if (uniformDescriptorSets != 0)
|
||||
{
|
||||
VkDescriptorPoolSize descriptorSetPoolSize;
|
||||
descriptorSetPoolSize.type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER;
|
||||
descriptorSetPoolSize.descriptorCount = uniformDescriptorSets;
|
||||
poolSizes.emplace_back(descriptorSetPoolSize);
|
||||
}
|
||||
|
||||
if (imageDescriptorSets != 0)
|
||||
{
|
||||
VkDescriptorPoolSize descriptorSetPoolSize;
|
||||
descriptorSetPoolSize.type = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER;
|
||||
descriptorSetPoolSize.descriptorCount = imageDescriptorSets;
|
||||
poolSizes.emplace_back(descriptorSetPoolSize);
|
||||
}
|
||||
|
||||
poolSizes[1].type = VK_DESCRIPTOR_TYPE_SAMPLER;
|
||||
poolSizes[1].descriptorCount = DESCRIPTOR_SET_COUNT * SwapChain::MAX_FRAMES_IN_FLIGHT; // TODO: how should this actually be determined?
|
||||
|
||||
VkDescriptorPoolCreateInfo createInfo{};
|
||||
createInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO;
|
||||
createInfo.poolSizeCount = poolSizes.size();
|
||||
createInfo.pPoolSizes = poolSizes.data();
|
||||
createInfo.maxSets = DESCRIPTOR_SET_COUNT * SwapChain::MAX_FRAMES_IN_FLIGHT;
|
||||
createInfo.maxSets = uniformDescriptorSets + imageDescriptorSets; // I have no actual idea if this is fine
|
||||
createInfo.flags = VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT;
|
||||
|
||||
CP_VK_ASSERT(vkCreateDescriptorPool(Vulkan::GetDevice(), &createInfo, nullptr, &descriptorPool), "Failed to initialize descriptor pool");
|
||||
|
||||
@@ -11,9 +11,8 @@ namespace Copium
|
||||
CP_DELETE_COPY_AND_MOVE_CTOR(DescriptorPool);
|
||||
private:
|
||||
VkDescriptorPool descriptorPool;
|
||||
static const int DESCRIPTOR_SET_COUNT = 1000000;
|
||||
public:
|
||||
DescriptorPool();
|
||||
DescriptorPool(int uniformDescriptorSets, int imageDescriptorSets);
|
||||
~DescriptorPool();
|
||||
|
||||
std::vector<VkDescriptorSet> AllocateDescriptorSets(VkDescriptorSetLayout descriptorSetLayout);
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
#include "copium/buffer/UniformBuffer.h"
|
||||
#include "copium/pipeline/DescriptorPool.h"
|
||||
#include "copium/pipeline/ShaderBinding.h"
|
||||
#include "copium/pipeline/ShaderReflector.h"
|
||||
#include "copium/sampler/Sampler.h"
|
||||
#include "copium/util/Common.h"
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#include "copium/pipeline/Pipeline.h"
|
||||
|
||||
#include "copium/asset/AssetManager.h"
|
||||
#include "copium/buffer/Framebuffer.h"
|
||||
#include "copium/core/Vulkan.h"
|
||||
#include "copium/pipeline/Shader.h"
|
||||
@@ -8,7 +7,6 @@
|
||||
#include "copium/mesh/VertexPassthrough.h"
|
||||
#include "copium/mesh/Vertex.h"
|
||||
#include "copium/renderer/LineVertex.h"
|
||||
#include "copium/util/FileSystem.h"
|
||||
|
||||
namespace Copium
|
||||
{
|
||||
@@ -121,6 +119,11 @@ namespace Copium
|
||||
return DescriptorSet{descriptorPool, descriptorSetLayouts[setIndex], bindings};
|
||||
}
|
||||
|
||||
int Pipeline::GetDescriptorSetCount() const
|
||||
{
|
||||
return boundDescriptorSets.size();
|
||||
}
|
||||
|
||||
void Pipeline::InitializeDescriptorSetLayout(const PipelineCreator& creator)
|
||||
{
|
||||
boundDescriptorSets.resize(creator.descriptorSetLayouts.size());
|
||||
|
||||
@@ -36,6 +36,8 @@ namespace Copium
|
||||
std::unique_ptr<DescriptorSet> CreateDescriptorSet(DescriptorPool& descriptorPool, int setIndex) const;
|
||||
DescriptorSet CreateDescriptorSetRef(DescriptorPool& descriptorPool, int setIndex) const;
|
||||
|
||||
int GetDescriptorSetCount() const;
|
||||
|
||||
private:
|
||||
void InitializeDescriptorSetLayout(const PipelineCreator& creator);
|
||||
void InitializePipeline(const PipelineCreator& creator);
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <cstdint>
|
||||
|
||||
namespace Copium
|
||||
{
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <cstdint>
|
||||
|
||||
|
||||
#define CP_BINDING_TYPE_ENUMS Sampler2D, UniformBuffer
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
#include "copium/renderer/Batch.h"
|
||||
|
||||
#include "copium/asset/AssetManager.h"
|
||||
#include "copium/core/SwapChain.h"
|
||||
#include "copium/renderer/RendererVertex.h"
|
||||
|
||||
namespace Copium
|
||||
{
|
||||
Batch::Batch(AssetRef<Pipeline>& pipeline, DescriptorPool& descriptorPool, int vertexCount, const std::vector<const Sampler*> samplers)
|
||||
Batch::Batch(AssetRef<Pipeline>& pipeline, int vertexCount, const std::vector<const Sampler*> samplers)
|
||||
: vertexBuffer{RendererVertex::GetDescriptor(), vertexCount},
|
||||
descriptorPool{pipeline.GetAsset().GetDescriptorSetCount() * SwapChain::MAX_FRAMES_IN_FLIGHT, 32 * SwapChain::MAX_FRAMES_IN_FLIGHT},
|
||||
descriptorSet{pipeline.GetAsset().CreateDescriptorSet(descriptorPool, 0)}
|
||||
{}
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include "copium/asset/AssetMeta.h"
|
||||
#include "copium/asset/AssetRef.h"
|
||||
#include "copium/buffer/RendererVertexBuffer.h"
|
||||
#include "copium/pipeline/DescriptorSet.h"
|
||||
@@ -14,9 +13,10 @@ namespace Copium
|
||||
CP_DELETE_COPY_AND_MOVE_CTOR(Batch);
|
||||
private:
|
||||
RendererVertexBuffer vertexBuffer;
|
||||
DescriptorPool descriptorPool;
|
||||
std::unique_ptr<DescriptorSet> descriptorSet;
|
||||
public:
|
||||
Batch(AssetRef<Pipeline>& pipeline, DescriptorPool& descriptorPool, int vertexCount, const std::vector<const Sampler*> samplers);
|
||||
Batch(AssetRef<Pipeline>& pipeline, int vertexCount, const std::vector<const Sampler*> samplers);
|
||||
RendererVertexBuffer& GetVertexBuffer();
|
||||
DescriptorSet& GetDescriptorSet();
|
||||
};
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#include "copium/renderer/LineRenderer.h"
|
||||
|
||||
#include "copium/asset/AssetManager.h"
|
||||
#include "copium/core/Vulkan.h"
|
||||
#include "copium/pipeline/PipelineCreator.h"
|
||||
#include "copium/renderer/LineVertex.h"
|
||||
|
||||
namespace Copium
|
||||
{
|
||||
@@ -10,7 +10,7 @@ namespace Copium
|
||||
static constexpr int MAX_NUM_VERTICES = 2 * MAX_NUM_LINES;
|
||||
|
||||
LineRenderer::LineRenderer(const AssetRef<Pipeline>& pipeline)
|
||||
: descriptorPool{},
|
||||
: descriptorPool{pipeline.GetAsset().GetDescriptorSetCount() * SwapChain::MAX_FRAMES_IN_FLIGHT, 0},
|
||||
ibo{MAX_NUM_VERTICES},
|
||||
pipeline{pipeline},
|
||||
vertexBuffer{LineVertex::GetDescriptor(), MAX_NUM_VERTICES}
|
||||
|
||||
@@ -3,12 +3,10 @@
|
||||
#include "copium/buffer/CommandBuffer.h"
|
||||
#include "copium/buffer/IndexBuffer.h"
|
||||
#include "copium/buffer/RendererVertexBuffer.h"
|
||||
#include "copium/renderer/LineVertex.h"
|
||||
#include "copium/pipeline/Pipeline.h"
|
||||
#include "copium/util/Common.h"
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <vector>
|
||||
|
||||
namespace Copium
|
||||
{
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#include "copium/renderer/Renderer.h"
|
||||
|
||||
#include "copium/asset/AssetManager.h"
|
||||
#include "copium/core/Vulkan.h"
|
||||
#include "copium/pipeline/PipelineCreator.h"
|
||||
#include "copium/renderer/RendererVertex.h"
|
||||
@@ -13,18 +12,13 @@ namespace Copium
|
||||
static constexpr int MAX_NUM_TEXTURES = 32;
|
||||
|
||||
Renderer::Renderer(const AssetRef<Pipeline>& pipeline)
|
||||
: descriptorPool{},
|
||||
ibo{MAX_NUM_INDICES},
|
||||
: ibo{MAX_NUM_INDICES},
|
||||
pipeline{pipeline},
|
||||
samplers{MAX_NUM_TEXTURES, &Vulkan::GetEmptyTexture2D().GetAsset()}
|
||||
{
|
||||
InitializeIndexBuffer();
|
||||
}
|
||||
|
||||
Renderer::~Renderer()
|
||||
{
|
||||
}
|
||||
|
||||
void Renderer::Quad(const glm::vec2& pos, const glm::vec2& size, const glm::vec3& color)
|
||||
{
|
||||
AllocateQuad();
|
||||
@@ -71,9 +65,9 @@ namespace Copium
|
||||
const Glyph& glyph = font.GetGlyph(c);
|
||||
AllocateQuad();
|
||||
int texIndex = AllocateSampler(font);
|
||||
AddVertex(offset + glm::vec2{glyph.boundingBox.l * size, glyph.boundingBox.b * size}, color, texIndex, glyph.texCoordBoundingBox.lb, RendererVertex::TYPE_TEXT);
|
||||
AddVertex(offset + glm::vec2{glyph.boundingBox.l * size, glyph.boundingBox.b * size}, color, texIndex, glyph.texCoordBoundingBox.AsLb(), RendererVertex::TYPE_TEXT);
|
||||
AddVertex(offset + glm::vec2{glyph.boundingBox.l * size, glyph.boundingBox.t * size}, color, texIndex, glm::vec2{glyph.texCoordBoundingBox.l, glyph.texCoordBoundingBox.t}, RendererVertex::TYPE_TEXT);
|
||||
AddVertex(offset + glm::vec2{glyph.boundingBox.r * size, glyph.boundingBox.t * size}, color, texIndex, glyph.texCoordBoundingBox.rt, RendererVertex::TYPE_TEXT);
|
||||
AddVertex(offset + glm::vec2{glyph.boundingBox.r * size, glyph.boundingBox.t * size}, color, texIndex, glyph.texCoordBoundingBox.AsRt(), RendererVertex::TYPE_TEXT);
|
||||
AddVertex(offset + glm::vec2{glyph.boundingBox.r * size, glyph.boundingBox.b * size}, color, texIndex, glm::vec2{glyph.texCoordBoundingBox.r, glyph.texCoordBoundingBox.b}, RendererVertex::TYPE_TEXT);
|
||||
offset.x += glyph.advance * size;
|
||||
}
|
||||
@@ -180,7 +174,7 @@ namespace Copium
|
||||
std::fill(samplers.begin(), samplers.end(), &Vulkan::GetEmptyTexture2D().GetAsset());
|
||||
if (batchIndex >= batches.size())
|
||||
{
|
||||
batches.emplace_back(std::make_unique<Batch>(pipeline, descriptorPool, MAX_NUM_VERTICES, samplers));
|
||||
batches.emplace_back(std::make_unique<Batch>(pipeline, MAX_NUM_VERTICES, samplers));
|
||||
}
|
||||
batches[batchIndex]->GetDescriptorSet().SetSamplersDynamic(samplers, 0);
|
||||
mappedVertexBuffer = (char*)batches[batchIndex]->GetVertexBuffer().Map() + batches[batchIndex]->GetVertexBuffer().GetPosition(Vulkan::GetSwapChain().GetFlightIndex());
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include "copium/asset/AssetMeta.h"
|
||||
#include "copium/asset/AssetRef.h"
|
||||
#include "copium/buffer/CommandBuffer.h"
|
||||
#include "copium/buffer/IndexBuffer.h"
|
||||
#include "copium/buffer/RendererVertexBuffer.h"
|
||||
#include "copium/pipeline/Pipeline.h"
|
||||
#include "copium/renderer/Batch.h"
|
||||
#include "copium/sampler/Texture2D.h"
|
||||
#include "copium/sampler/Font.h"
|
||||
#include "copium/util/Common.h"
|
||||
|
||||
@@ -16,11 +13,10 @@
|
||||
|
||||
namespace Copium
|
||||
{
|
||||
class Renderer
|
||||
class Renderer final
|
||||
{
|
||||
CP_DELETE_COPY_AND_MOVE_CTOR(Renderer);
|
||||
private:
|
||||
DescriptorPool descriptorPool;
|
||||
IndexBuffer ibo;
|
||||
AssetRef<Pipeline> pipeline;
|
||||
std::vector<std::unique_ptr<Batch>> batches;
|
||||
@@ -34,7 +30,6 @@ namespace Copium
|
||||
void* mappedVertexBuffer;
|
||||
public:
|
||||
Renderer(const AssetRef<Pipeline>& pipeline);
|
||||
~Renderer();
|
||||
|
||||
void Quad(const glm::vec2& from, const glm::vec2& to, const glm::vec3& color = glm::vec3{1, 1, 1});
|
||||
void Quad(const glm::vec2& from, const glm::vec2& to, const Sampler& sampler, const glm::vec2& texCoord1 = glm::vec2{0, 0}, const glm::vec2& texCoord2 = glm::vec2{1, 1});
|
||||
|
||||
@@ -25,6 +25,5 @@ namespace Copium
|
||||
|
||||
private:
|
||||
void InitializeDepthAttachment(int width, int height);
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
@@ -143,7 +143,10 @@ namespace Copium
|
||||
boundingBox.b = std::min(boundingBox.b, offset.y + glyph.boundingBox.b);
|
||||
}
|
||||
boundingBox.r = std::max(boundingBox.r, offset.x);
|
||||
boundingBox.lbrt *= size;
|
||||
boundingBox.l *= size;
|
||||
boundingBox.b *= size;
|
||||
boundingBox.r *= size;
|
||||
boundingBox.t *= size;
|
||||
return boundingBox;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "copium/util/MetaFile.h"
|
||||
|
||||
#include <vulkan/vulkan.hpp>
|
||||
|
||||
namespace Copium
|
||||
|
||||
@@ -6,8 +6,6 @@
|
||||
#define STB_IMAGE_IMPLEMENTATION
|
||||
#include <stb_image.h>
|
||||
|
||||
#include <fstream>
|
||||
|
||||
namespace Copium
|
||||
{
|
||||
Texture2D::Texture2D(const MetaFile& metaFile)
|
||||
|
||||
@@ -15,12 +15,12 @@ namespace Copium
|
||||
{}
|
||||
|
||||
BoundingBox::BoundingBox(glm::vec2 lb, glm::vec2 rt)
|
||||
: lb{lb}, rt{rt}
|
||||
: l{lb.x}, b{lb.y}, r{rt.x}, t{rt.y}
|
||||
{}
|
||||
|
||||
glm::vec2 BoundingBox::GetSize() const
|
||||
{
|
||||
return glm::abs(rt - lb);
|
||||
return glm::abs(AsRt() - AsLb());
|
||||
}
|
||||
|
||||
bool BoundingBox::operator==(const BoundingBox& boundingBox) const
|
||||
@@ -32,4 +32,14 @@ namespace Copium
|
||||
{
|
||||
return !(*this == boundingBox);
|
||||
}
|
||||
|
||||
glm::vec2 BoundingBox::AsLb() const
|
||||
{
|
||||
return glm::vec2{l, b};
|
||||
}
|
||||
|
||||
glm::vec2 BoundingBox::AsRt() const
|
||||
{
|
||||
return glm::vec2{r, t};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,12 +6,10 @@ namespace Copium
|
||||
{
|
||||
struct BoundingBox
|
||||
{
|
||||
union
|
||||
{
|
||||
struct { float l; float b; float r; float t; };
|
||||
struct { glm::vec2 lb; glm::vec2 rt; };
|
||||
struct { glm::vec4 lbrt; };
|
||||
};
|
||||
float l;
|
||||
float b;
|
||||
float r;
|
||||
float t;
|
||||
BoundingBox();
|
||||
BoundingBox(float all);
|
||||
BoundingBox(float l, float b, float r, float t);
|
||||
@@ -21,5 +19,8 @@ namespace Copium
|
||||
|
||||
bool operator==(const BoundingBox& boundingBox) const;
|
||||
bool operator!=(const BoundingBox& boundingBox) const;
|
||||
|
||||
glm::vec2 AsLb() const;
|
||||
glm::vec2 AsRt() const;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <memory>
|
||||
|
||||
#define CP_TERM_RED "\x1B[31m"
|
||||
#define CP_TERM_GREEN "\x1B[32m"
|
||||
@@ -12,42 +13,42 @@
|
||||
#define CP_TERM_GRAY "\x1B[90m"
|
||||
#define CP_TERM_CLEAR "\033[0m"
|
||||
|
||||
#define CP_DEBUG(format, ...) std::cout << CP_TERM_GRAY << "[DBG] " << __func__ << " : " << Copium::String::Format(format, __VA_ARGS__) << CP_TERM_CLEAR << std::endl
|
||||
#define CP_INFO(format, ...) std::cout << "[INF] " << __func__ << " : " << Copium::String::Format(format, __VA_ARGS__) << std::endl
|
||||
#define CP_WARN(format, ...) std::cout << CP_TERM_YELLOW << "[WRN] " << __func__ << " : " << Copium::String::Format(format, __VA_ARGS__) << CP_TERM_CLEAR << std::endl
|
||||
#define CP_ERR(format, ...) std::cout << CP_TERM_RED << "[ERR] " << __func__ << " : " << Copium::String::Format(format, __VA_ARGS__) << CP_TERM_CLEAR << std::endl
|
||||
#define CP_DEBUG(...) std::cout << CP_TERM_GRAY << "[DBG] " << __func__ << " : " << Copium::String::Format(__VA_ARGS__) << CP_TERM_CLEAR << std::endl
|
||||
#define CP_INFO(...) std::cout << "[INF] " << __func__ << " : " << Copium::String::Format(__VA_ARGS__) << std::endl
|
||||
#define CP_WARN(...) std::cout << CP_TERM_YELLOW << "[WRN] " << __func__ << " : " << Copium::String::Format(__VA_ARGS__) << CP_TERM_CLEAR << std::endl
|
||||
#define CP_ERR(...) std::cout << CP_TERM_RED << "[ERR] " << __func__ << " : " << Copium::String::Format(__VA_ARGS__) << CP_TERM_CLEAR << std::endl
|
||||
|
||||
// Continue traces, will not print the [XXX] tag before the log
|
||||
#define CP_DEBUG_CONT(format, ...) std::cout << CP_TERM_GRAY << " " << std::setfill(' ') << std::setw(sizeof(__func__)) << " " << Copium::String::Format(format, __VA_ARGS__) << CP_TERM_CLEAR << std::endl
|
||||
#define CP_INFO_CONT(format, ...) std::cout << " " << std::setfill(' ') << std::setw(sizeof(__func__)) << " " << Copium::String::Format(format, __VA_ARGS__) << std::endl
|
||||
#define CP_WARN_CONT(format, ...) std::cout << CP_TERM_YELLOW << " " << std::setfill(' ') << std::setw(sizeof(__func__)) << " " << Copium::String::Format(format, __VA_ARGS__) << CP_TERM_CLEAR << std::endl
|
||||
#define CP_ERR_CONT(format, ...) std::cout << CP_TERM_RED << " " << std::setfill(' ') << std::setw(sizeof(__func__)) << " " << Copium::String::Format(format, __VA_ARGS__) << CP_TERM_CLEAR << std::endl
|
||||
#define CP_DEBUG_CONT(...) std::cout << CP_TERM_GRAY << " " << std::setfill(' ') << std::setw(sizeof(__func__)) << " " << Copium::String::Format(__VA_ARGS__) << CP_TERM_CLEAR << std::endl
|
||||
#define CP_INFO_CONT(...) std::cout << " " << std::setfill(' ') << std::setw(sizeof(__func__)) << " " << Copium::String::Format(__VA_ARGS__) << std::endl
|
||||
#define CP_WARN_CONT(...) std::cout << CP_TERM_YELLOW << " " << std::setfill(' ') << std::setw(sizeof(__func__)) << " " << Copium::String::Format(__VA_ARGS__) << CP_TERM_CLEAR << std::endl
|
||||
#define CP_ERR_CONT(...) std::cout << CP_TERM_RED << " " << std::setfill(' ') << std::setw(sizeof(__func__)) << " " << Copium::String::Format(__VA_ARGS__) << CP_TERM_CLEAR << std::endl
|
||||
|
||||
#define CP_ABORT(format, ...) \
|
||||
#define CP_ABORT(...) \
|
||||
do \
|
||||
{ \
|
||||
CP_ERR("Aborted at %s:%d", __FILE__, __LINE__); \
|
||||
CP_ERR_CONT(format, __VA_ARGS__); \
|
||||
throw Copium::RuntimeException(Copium::String::Format(format, __VA_ARGS__)); \
|
||||
CP_ERR_CONT(__VA_ARGS__); \
|
||||
throw Copium::RuntimeException(Copium::String::Format(__VA_ARGS__)); \
|
||||
} while(false)
|
||||
#define CP_ASSERT(Function, format, ...) \
|
||||
#define CP_ASSERT(Function, ...) \
|
||||
do \
|
||||
{ \
|
||||
if(!(Function)) \
|
||||
{ \
|
||||
CP_ERR("Assertion failed at %s:%d", __FILE__, __LINE__); \
|
||||
CP_ERR_CONT("%s : %s", #Function, Copium::String::Format(format, __VA_ARGS__).c_str()); \
|
||||
throw Copium::RuntimeException(Copium::String::Format(format, __VA_ARGS__)); \
|
||||
CP_ERR_CONT("%s : %s", #Function, Copium::String::Format(__VA_ARGS__).c_str()); \
|
||||
throw Copium::RuntimeException(Copium::String::Format(__VA_ARGS__)); \
|
||||
} \
|
||||
} while(false)
|
||||
#define CP_VK_ASSERT(Function, format, ...) \
|
||||
#define CP_VK_ASSERT(Function, ...) \
|
||||
do \
|
||||
{ \
|
||||
if(Function != VK_SUCCESS) \
|
||||
{ \
|
||||
CP_ERR("Assertion failed at %s:%d", __FILE__, __LINE__); \
|
||||
CP_ERR_CONT("%s : %s", #Function, Copium::String::Format(format, __VA_ARGS__).c_str()); \
|
||||
throw Copium::VulkanException(Copium::String::Format(format, __VA_ARGS__)); \
|
||||
CP_ERR_CONT("%s : %s", #Function, Copium::String::Format(__VA_ARGS__).c_str()); \
|
||||
throw Copium::VulkanException(Copium::String::Format(__VA_ARGS__)); \
|
||||
} \
|
||||
} while(false)
|
||||
|
||||
@@ -68,6 +69,11 @@ namespace Copium
|
||||
{
|
||||
CP_STATIC_CLASS(String);
|
||||
public:
|
||||
static std::string Format(const std::string& format)
|
||||
{
|
||||
return format;
|
||||
}
|
||||
|
||||
template<typename ... Args>
|
||||
static std::string Format(const std::string& format, Args... args)
|
||||
{
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include <ostream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@@ -15,7 +14,7 @@ namespace NameSpace { \
|
||||
}; \
|
||||
static const std::string& ToString(EnumName enumName) \
|
||||
{ \
|
||||
static std::vector<std::string> enumNames = Copium::EnumPrinter::GetEnumNames(CP_TO_STRING(EnumList)); \
|
||||
static std::vector<std::string> enumNames = Copium::EnumPrinter::GetEnumNames(CP_TO_STRING(#EnumList)); \
|
||||
return enumNames[(int)enumName]; \
|
||||
} \
|
||||
\
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
#include "copium/util/FileSystem.h"
|
||||
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
namespace Copium
|
||||
{
|
||||
std::vector<char> FileSystem::ReadFile(const std::string& filename)
|
||||
|
||||
@@ -2,10 +2,8 @@
|
||||
|
||||
#include "copium/util/Common.h"
|
||||
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
namespace Copium
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
|
||||
namespace Copium
|
||||
{
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
|
||||
namespace Copium
|
||||
{
|
||||
|
||||
class StringUtil
|
||||
{
|
||||
CP_STATIC_CLASS(StringUtil);
|
||||
|
||||
@@ -13,12 +13,12 @@ namespace Copium
|
||||
|
||||
double Timer::Elapsed()
|
||||
{
|
||||
return std::chrono::duration<double>(std::chrono::high_resolution_clock::now() - startTime).count();
|
||||
return std::chrono::duration<double>(std::chrono::steady_clock::now() - startTime).count();
|
||||
}
|
||||
|
||||
double Timer::ElapsedRestart()
|
||||
{
|
||||
std::chrono::time_point<std::chrono::steady_clock> newTime = std::chrono::high_resolution_clock::now();
|
||||
std::chrono::time_point<std::chrono::steady_clock> newTime = std::chrono::steady_clock::now();
|
||||
|
||||
double elapsedTime = std::chrono::duration<double>(newTime - startTime).count();
|
||||
startTime = newTime;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include "copium/util/RuntimeException.h"
|
||||
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
|
||||
namespace Copium
|
||||
{
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
<makegen>
|
||||
<configuration name="Release">
|
||||
<generatehfile>false</generatehfile>
|
||||
<outputdir>bin/Release/</outputdir>
|
||||
<outputname>libimgui.so</outputname>
|
||||
<outputtype>sharedlibrary</outputtype>
|
||||
<projectname>ImGui</projectname>
|
||||
<includedir>../../repos/imgui/</includedir>
|
||||
<includedir>/usr/include/freetype2/</includedir>
|
||||
<sourcefile>../../repos/imgui/imgui.cpp</sourcefile>
|
||||
<sourcefile>../../repos/imgui/imgui_demo.cpp</sourcefile>
|
||||
<sourcefile>../../repos/imgui/imgui_draw.cpp</sourcefile>
|
||||
<sourcefile>../../repos/imgui/imgui_tables.cpp</sourcefile>
|
||||
<sourcefile>../../repos/imgui/imgui_widgets.cpp</sourcefile>
|
||||
<sourcefile>../../repos/imgui/backends/imgui_impl_glfw.cpp</sourcefile>
|
||||
<sourcefile>../../repos/imgui/backends/imgui_impl_vulkan.cpp</sourcefile>
|
||||
<srcdir></srcdir>
|
||||
</configuration>
|
||||
<configuration name="Debug">
|
||||
<cflag>-g3</cflag>
|
||||
<cflag>-w</cflag>
|
||||
<define>_DEBUG</define>
|
||||
<generatehfile>false</generatehfile>
|
||||
<outputdir>bin/Debug/</outputdir>
|
||||
<outputname>libimgui.so</outputname>
|
||||
<outputtype>sharedlibrary</outputtype>
|
||||
<projectname>ImGui</projectname>
|
||||
<includedir>../../repos/imgui/</includedir>
|
||||
<includedir>/usr/include/freetype2/</includedir>
|
||||
<sourcefile>../../repos/imgui/imgui.cpp</sourcefile>
|
||||
<sourcefile>../../repos/imgui/imgui_demo.cpp</sourcefile>
|
||||
<sourcefile>../../repos/imgui/imgui_draw.cpp</sourcefile>
|
||||
<sourcefile>../../repos/imgui/imgui_tables.cpp</sourcefile>
|
||||
<sourcefile>../../repos/imgui/imgui_widgets.cpp</sourcefile>
|
||||
<sourcefile>../../repos/imgui/backends/imgui_impl_glfw.cpp</sourcefile>
|
||||
<sourcefile>../../repos/imgui/backends/imgui_impl_vulkan.cpp</sourcefile>
|
||||
<srcdir></srcdir>
|
||||
</configuration>
|
||||
<target>Debug</target>
|
||||
<version>v1.3.6</version>
|
||||
</makegen>
|
||||
@@ -0,0 +1,33 @@
|
||||
<makegen>
|
||||
<configuration name="Release">
|
||||
<define>MSDF_ATLAS_PUBLIC=</define>
|
||||
<define>MSDFGEN_USE_LIBPNG</define>
|
||||
<generatehfile>false</generatehfile>
|
||||
<outputdir>bin/Release/</outputdir>
|
||||
<outputname>libmsdf-atlas-gen.so</outputname>
|
||||
<outputtype>sharedlibrary</outputtype>
|
||||
<projectname>MsdfAtlasGen</projectname>
|
||||
<includedir>../../repos/msdf-atlas-gen/msdf-atlas-gen/</includedir>
|
||||
<includedir>../../repos/msdf-atlas-gen/msdfgen/</includedir>
|
||||
<includedir>../../repos/msdf-atlas-gen/artery-font-format/</includedir>
|
||||
<srcdir>../../repos/msdf-atlas-gen/msdf-atlas-gen/</srcdir>
|
||||
</configuration>
|
||||
<configuration name="Debug">
|
||||
<cflag>-g3</cflag>
|
||||
<cflag>-w</cflag>
|
||||
<define>_DEBUG</define>
|
||||
<define>MSDF_ATLAS_PUBLIC=</define>
|
||||
<define>MSDFGEN_USE_LIBPNG</define>
|
||||
<generatehfile>false</generatehfile>
|
||||
<outputdir>bin/Debug/</outputdir>
|
||||
<outputname>libmsdf-atlas-gen.so</outputname>
|
||||
<outputtype>sharedlibrary</outputtype>
|
||||
<projectname>MsdfAtlasGen</projectname>
|
||||
<includedir>../../repos/msdf-atlas-gen/msdf-atlas-gen/</includedir>
|
||||
<includedir>../../repos/msdf-atlas-gen/msdfgen/</includedir>
|
||||
<includedir>../../repos/msdf-atlas-gen/artery-font-format/</includedir>
|
||||
<srcdir>../../repos/msdf-atlas-gen/msdf-atlas-gen/</srcdir>
|
||||
</configuration>
|
||||
<target>Debug</target>
|
||||
<version>v1.3.6</version>
|
||||
</makegen>
|
||||
@@ -0,0 +1,31 @@
|
||||
<makegen>
|
||||
<configuration name="Release">
|
||||
<define>MSDF_ATLAS_PUBLIC=</define>
|
||||
<generatehfile>false</generatehfile>
|
||||
<outputdir>bin/Release/</outputdir>
|
||||
<outputname>libmsdfgen-core.so</outputname>
|
||||
<outputtype>sharedlibrary</outputtype>
|
||||
<projectname>MsdfGenCore</projectname>
|
||||
<includedir>../../repos/msdf-atlas-gen/msdf-atlas-gen/</includedir>
|
||||
<includedir>../../repos/msdf-atlas-gen/msdfgen/</includedir>
|
||||
<includedir>../../repos/msdf-atlas-gen/artery-font-format/</includedir>
|
||||
<srcdir>../../repos/msdf-atlas-gen/msdfgen/core/</srcdir>
|
||||
</configuration>
|
||||
<configuration name="Debug">
|
||||
<cflag>-g3</cflag>
|
||||
<cflag>-w</cflag>
|
||||
<define>_DEBUG</define>
|
||||
<define>MSDF_ATLAS_PUBLIC=</define>
|
||||
<generatehfile>false</generatehfile>
|
||||
<outputdir>bin/Debug/</outputdir>
|
||||
<outputname>libmsdfgen-core.so</outputname>
|
||||
<outputtype>sharedlibrary</outputtype>
|
||||
<projectname>MsdfGenCore</projectname>
|
||||
<includedir>../../repos/msdf-atlas-gen/msdf-atlas-gen/</includedir>
|
||||
<includedir>../../repos/msdf-atlas-gen/msdfgen/</includedir>
|
||||
<includedir>../../repos/msdf-atlas-gen/artery-font-format/</includedir>
|
||||
<srcdir>../../repos/msdf-atlas-gen/msdfgen/core/</srcdir>
|
||||
</configuration>
|
||||
<target>Debug</target>
|
||||
<version>v1.3.6</version>
|
||||
</makegen>
|
||||
@@ -0,0 +1,37 @@
|
||||
<makegen>
|
||||
<configuration name="Release">
|
||||
<define>MSDF_ATLAS_PUBLIC=</define>
|
||||
<generatehfile>false</generatehfile>
|
||||
<outputdir>bin/Release/</outputdir>
|
||||
<outputname>libmsdfgen-ext.so</outputname>
|
||||
<outputtype>sharedlibrary</outputtype>
|
||||
<projectname>MsdfGenExt</projectname>
|
||||
<includedir>../../repos/msdf-atlas-gen/msdf-atlas-gen/</includedir>
|
||||
<includedir>../../repos/msdf-atlas-gen/msdfgen/</includedir>
|
||||
<includedir>../../repos/msdf-atlas-gen/artery-font-format/</includedir>
|
||||
<includedir>../../repos/freetype/include/</includedir>
|
||||
<sourcefile>../../repos/msdf-atlas-gen/msdfgen/ext/import-font.cpp</sourcefile>
|
||||
<sourcefile>../../repos/msdf-atlas-gen/msdfgen/ext/save-png.cpp</sourcefile>
|
||||
<srcdir></srcdir>
|
||||
</configuration>
|
||||
<configuration name="Debug">
|
||||
<cflag>-g3</cflag>
|
||||
<cflag>-w</cflag>
|
||||
<define>_DEBUG</define>
|
||||
<define>MSDF_ATLAS_PUBLIC=</define>
|
||||
<generatehfile>false</generatehfile>
|
||||
<outputdir>bin/Debug/</outputdir>
|
||||
<outputname>libmsdfgen-ext.so</outputname>
|
||||
<outputtype>sharedlibrary</outputtype>
|
||||
<projectname>MsdfGenExt</projectname>
|
||||
<includedir>../../repos/msdf-atlas-gen/msdf-atlas-gen/</includedir>
|
||||
<includedir>../../repos/msdf-atlas-gen/msdfgen/</includedir>
|
||||
<includedir>../../repos/msdf-atlas-gen/artery-font-format/</includedir>
|
||||
<includedir>../../repos/freetype/include/</includedir>
|
||||
<sourcefile>../../repos/msdf-atlas-gen/msdfgen/ext/import-font.cpp</sourcefile>
|
||||
<sourcefile>../../repos/msdf-atlas-gen/msdfgen/ext/save-png.cpp</sourcefile>
|
||||
<srcdir></srcdir>
|
||||
</configuration>
|
||||
<target>Debug</target>
|
||||
<version>v1.3.6</version>
|
||||
</makegen>
|
||||
Reference in New Issue
Block a user