text
stringlengths
1
24.5M
#pragma once #include <rocket.hpp> #include "Export.hpp" #ifdef major #undef major #endif #ifdef minor #undef minor #endif namespace acid { class ACID_EXPORT Version { public: Version(uint8_t major, uint8_t minor, uint8_t patch) : major(major), minor(minor), patch(patch) { } uint8_t major, minor, patch; }...
#include "Engine.hpp" #include "Config.hpp" namespace acid { Engine *Engine::Instance = nullptr; Engine::Engine(std::string argv0, ModuleFilter &&moduleFilter) : argv0(std::move(argv0)), version{ACID_VERSION_MAJOR, ACID_VERSION_MINOR, ACID_VERSION_PATCH}, fpsLimit(-1.0f), running(true), elapsedUpdate(15.77ms), ...
#pragma once #include <cmath> #include "Utils/NonCopyable.hpp" #include "Maths/ElapsedTime.hpp" #include "Maths/Time.hpp" #include "Module.hpp" #include "Log.hpp" #include "App.hpp" namespace acid { class ACID_EXPORT Delta { public: void Update() { currentFrameTime = Time::Now(); change = currentFrameTime - las...
#include "Log.hpp" namespace acid { std::mutex Log::WriteMutex; std::ofstream Log::FileStream; void Log::OpenLog(const std::filesystem::path &filepath) { //std::unique_lock<std::mutex> lock(WriteMutex); if (auto parentPath = filepath.parent_path(); !parentPath.empty()) std::filesystem::create_directories(parentPa...
#pragma once #include <cassert> #include <sstream> #include <mutex> #include <filesystem> #include <string_view> #include <iostream> #include <fstream> #include "Maths/Time.hpp" namespace acid { /** * @brief A logging class used in Acid, will write output to the standard stream and into a file. */ class ACID_EXPOR...
#pragma once #include <bitset> #include <unordered_map> #include <memory> #include <functional> #include "Utils/NonCopyable.hpp" #include "Utils/TypeInfo.hpp" namespace acid { template<typename Base> class ModuleFactory { public: class TCreateValue { public: std::function<std::unique_ptr<Base>()> create; typen...
#include "File.hpp" #include "Engine/Engine.hpp" #include "Json/Json.hpp" #include "Xml/Xml.hpp" #include "Files.hpp" namespace acid { File::File(std::unique_ptr<NodeFormat> &&type, const Node &node) : node(node), type(std::move(type)) { } File::File(std::unique_ptr<NodeFormat> &&type, Node &&node) : node(std::mo...
#pragma once #include "Files/Node.hpp" namespace acid { /** * @brief Class that represents a readable and writable file format using {@link Node} as storage. */ class ACID_EXPORT File { public: File() = default; File(std::unique_ptr<NodeFormat> &&type, const Node &node); explicit File(std::unique_ptr<NodeFormat>...
#include "FileObserver.hpp" namespace acid { FileObserver::FileObserver(std::filesystem::path path, const Time &delay) : path(std::move(path)), delay(delay), running(true), thread(&FileObserver::QueueLoop, this) { DoWithFilesInPath([this](const std::filesystem::path &file) { paths[file.string()] = std::filesyst...
#pragma once #include <filesystem> #include <unordered_map> #include <thread> #include <rocket.hpp> #include "Maths/Time.hpp" namespace acid { /** * @brief Class that can listen to file changes on a path recursively. */ class ACID_EXPORT FileObserver { public: enum class Status { Created, Modified, Erased }; ...
#include "Files.hpp" #include <iterator> #include <physfs.h> #include "Engine/Engine.hpp" #include "Config.hpp" namespace acid { using std::streambuf; using std::ios_base; class FBuffer : public streambuf, NonCopyable { public: explicit FBuffer(PHYSFS_File *file, std::size_t bufferSize = 2048) : bufferSize(buffer...
#pragma once #include "Engine/Engine.hpp" struct PHYSFS_File; namespace acid { enum class FileMode { Read, Write, Append }; class ACID_EXPORT BaseFStream { public: explicit BaseFStream(PHYSFS_File *file); virtual ~BaseFStream(); size_t length(); protected: PHYSFS_File *file; }; class ACID_EXPORT IFStream : p...
#include "Node.hpp" #include <algorithm> namespace acid { static const NodeProperty NullNode = NodeProperty("", Node() = nullptr); void Node::Clear() { properties.clear(); } bool Node::IsValid() const { switch (type) { case NodeType::Token: case NodeType::Unknown: return false; case NodeType::Object: case N...
#pragma once #include <ostream> #include "NodeFormat.hpp" #include "NodeView.hpp" namespace acid { /** * @brief Class that is used to represent a tree of UFT-8 values, used in serialization. */ class ACID_EXPORT Node final { public: Node() {} // = default; Node(const Node &node) = default; Node(Node &&node) noe...
#include "NodeConstView.hpp" #include "Node.hpp" namespace acid { NodeConstView::NodeConstView(const Node *parent, Key key, const Node *value) : parent(parent), value(value), keys{std::move(key)} { } NodeConstView::NodeConstView(const NodeConstView *parent, Key key) : parent(parent->parent), keys(parent->keys) ...
#pragma once #include <cstdint> #include <string> #include <variant> #include <vector> #include "Export.hpp" namespace acid { class Node; enum class NodeType : uint8_t { Object, Array, String, Boolean, Integer, Decimal, Null, // Type of node value. Unknown, Token, EndOfFile, // Used in tokenizers. }; using NodeVa...
#pragma once #include <codecvt> #include <sstream> #include "NodeView.hpp" namespace acid { /** * @brief Class that represents an abstract node format parser and writer. */ class ACID_EXPORT NodeFormat { public: /** * @brief Tokens used in tokenizers. */ class Token { public: constexpr Token() = default; ...
#include "NodeView.hpp" #include "Node.hpp" namespace acid { NodeView::NodeView(Node *parent, Key key, Node *value) : NodeConstView(parent, std::move(key), value) { } NodeView::NodeView(NodeView *parent, Key key) : NodeConstView(parent, std::move(key)) { } Node *NodeView::get() { if (!has_value()) { // This wi...
#pragma once #include "NodeConstView.hpp" namespace acid { /** * @brief Class that extends the usage of {@link NodeConstView} to mutable nodes. */ class ACID_EXPORT NodeView : public NodeConstView { friend class Node; protected: NodeView() = default; NodeView(Node *parent, Key key, Node *value); NodeView(NodeVi...
#include "Json.hpp" #define ATTRIBUTE_TEXT_SUPPORT 1 namespace acid { static std::string FixEscapedChars(std::string str) { static const std::vector<std::pair<char, std::string_view>> replaces = {{'\\', "\\\\"}, {'\n', "\\n"}, {'\r', "\\r"}, {'\t', "\\t"}, {'\"', "\\\""}}; for (const auto &[from, to] : replaces) {...
#pragma once #include <vector> #include "Files/Node.hpp" namespace acid { class ACID_EXPORT Json : public NodeFormatType<Json> { public: // Do not call Load and Write directly, use Node::ParseString<Json> and Node::WriteStream<Json>. static void Load(Node &node, std::string_view string); static void Write(const N...
#include "Xml.hpp" namespace acid { void Xml::Load(Node &node, std::string_view string) { // Tokenizes the string view into small views that are used to build a Node tree. std::vector<Token> tokens; std::size_t tokenStart = 0; enum class QuoteState : char { None, Single, Double } quoteState = QuoteState::None;...
#pragma once #include <vector> #include "Files/Node.hpp" namespace acid { class ACID_EXPORT Xml : public NodeFormatType<Xml> { public: constexpr static char AttributePrefix = '@'; // Do not call Load and Write directly, use Node::ParseString<Xml> and Node::WriteStream<Xml>. static void Load(Node &node, std::stri...
#pragma once #include "Files/Node.hpp" namespace acid { /** * @brief Class that allows {@link Node::Get()} to handle returning XML container types (std::vector, std::array) * where the XML array may contain 1 or n objects. */ template<typename T, typename = std::enable_if_t<is_container_v<std::remove_reference_t<T...
#include "FontsSubrender.hpp" #include "Uis/Uis.hpp" #include "Text.hpp" namespace acid { FontsSubrender::FontsSubrender(const Pipeline::Stage &pipelineStage) : Subrender(pipelineStage), pipeline(pipelineStage, {"Shaders/Fonts/Font.vert", "Shaders/Fonts/Font.frag"}, {VertexText::GetVertexInput()}) { } void FontsSu...
#pragma once #include "Graphics/Subrender.hpp" #include "Graphics/Pipelines/PipelineGraphics.hpp" namespace acid { class ACID_EXPORT FontsSubrender : public Subrender { public: explicit FontsSubrender(const Pipeline::Stage &pipelineStage); void Render(const CommandBuffer &commandBuffer) override; private: Pipeli...
#include "FontType.hpp" #include <tiny_msdf.hpp> #include <ft2build.h> #include FT_FREETYPE_H #include "Files/Files.hpp" #include "Resources/Resources.hpp" #include "Graphics/Graphics.hpp" namespace acid { static const std::wstring_view NEHE = L" \t\r\nABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890\"...
#pragma once #include "Resources/Resource.hpp" #include "Graphics/Images/Image2dArray.hpp" #include "Graphics/Pipelines/PipelineGraphics.hpp" typedef struct FT_LibraryRec_ *FT_Library; typedef struct FT_FaceRec_ *FT_Face; namespace acid { /** * @brief Resource that is used when creating a font mesh. */ class ACID_...
#include "Text.hpp" #include "Models/Shapes/RectangleModel.hpp" namespace acid { void Text::UpdateObject() { dirty |= GetScreenSize() != lastSize; if (dirty) LoadText(); // Updates uniforms. uniformObject.Push("modelView", GetModelView()); uniformObject.Push("alpha", GetScreenAlpha()); uniformObject.Push("c...
#pragma once #include "Maths/Colour.hpp" #include "Maths/Vector2.hpp" #include "Uis/Drivers/UiDriver.hpp" #include "Models/Model.hpp" #include "Models/Vertex2d.hpp" #include "Graphics/Descriptors/DescriptorsHandler.hpp" #include "Graphics/Buffers/UniformHandler.hpp" #include "Graphics/Pipelines/PipelineGraphics.hpp" #...
#include "Gizmo.hpp" namespace acid { Gizmo::Gizmo(const std::shared_ptr<GizmoType> &gizmoType, const Transform &transform, const std::optional<Colour> &colour) : gizmoType(gizmoType), transform(transform), colour(colour ? *colour : gizmoType->GetColour()) { } bool Gizmo::operator==(const Gizmo &rhs) const { retu...
#pragma once #include "Maths/Transform.hpp" #include "GizmoType.hpp" namespace acid { /** * @brief A instance of a gizmo type. */ class ACID_EXPORT Gizmo { friend class GizmoType; public: /** * Creates a new gizmo object. * @param gizmoType The gizmo template to build from. * @param transform The gizmos ini...
#include "Gizmos.hpp" namespace acid { Gizmos::Gizmos() { } void Gizmos::Update() { for (auto it = gizmos.begin(); it != gizmos.end();) { if (it->second.empty()) { it = gizmos.erase(it); continue; } (*it).first->Update((*it).second); ++it; } } Gizmo *Gizmos::AddGizmo(std::unique_ptr<Gizmo> &&gizmo) ...
#pragma once #include "Scenes/System.hpp" #include "Gizmo.hpp" namespace acid { /** * @brief Module used for that manages debug gizmos. */ class ACID_EXPORT Gizmos : public System { public: using GizmosContainer = std::map<std::shared_ptr<GizmoType>, std::vector<std::unique_ptr<Gizmo>>>; Gizmos(); void Update(...
#include "GizmosSubrender.hpp" #include "Models/Vertex3d.hpp" #include "Scenes/Scenes.hpp" #include "Gizmos.hpp" namespace acid { GizmosSubrender::GizmosSubrender(const Pipeline::Stage &pipelineStage) : Subrender(pipelineStage), pipeline(pipelineStage, {"Shaders/Gizmos/Gizmo.vert", "Shaders/Gizmos/Gizmo.frag"}, {Ve...
#pragma once #include "Graphics/Subrender.hpp" #include "Graphics/Buffers/UniformHandler.hpp" #include "Graphics/Pipelines/PipelineGraphics.hpp" namespace acid { class ACID_EXPORT GizmosSubrender : public Subrender { public: explicit GizmosSubrender(const Pipeline::Stage &pipelineStage); void Render(const CommandB...
#include "GizmoType.hpp" #include "Resources/Resources.hpp" #include "Scenes/Scenes.hpp" #include "Gizmo.hpp" namespace acid { static const uint32_t MAX_INSTANCES = 512; //static const uint32_t INSTANCE_STEPS = 128; //static const float FRUSTUM_BUFFER = 1.4f; std::shared_ptr<GizmoType> GizmoType::Create(const Node &...
#pragma once #include "Maths/Colour.hpp" #include "Maths/Matrix4.hpp" #include "Models/Model.hpp" #include "Graphics/Buffers/InstanceBuffer.hpp" #include "Graphics/Descriptors/DescriptorsHandler.hpp" #include "Graphics/Pipelines/PipelineGraphics.hpp" #include "Resources/Resource.hpp" #include "Files/Node.hpp" namespa...
#include "Graphics.hpp" #include <cstring> #include <SPIRV/GlslangToSpv.h> #include "Devices/Windows.hpp" #include "Subrender.hpp" namespace acid { Graphics::Graphics() : elapsedPurge(5s), instance(std::make_unique<Instance>()), physicalDevice(std::make_unique<PhysicalDevice>(*instance)), logicalDevice(std::make...
#pragma once #include "Engine/Engine.hpp" #include "Commands/CommandBuffer.hpp" #include "Commands/CommandPool.hpp" #include "Devices/Instance.hpp" #include "Devices/LogicalDevice.hpp" #include "Devices/PhysicalDevice.hpp" #include "Devices/Surface.hpp" #include "Devices/Windows.hpp" #include "Renderer.hpp" namespace...
#pragma once #include "RenderStage.hpp" #include "SubrenderHolder.hpp" namespace acid { /** * @brief Class used to manage {@link Subrender} objects to create a list of render pass. */ class ACID_EXPORT Renderer { friend class Graphics; public: /** * Creates a new renderer, fill {@link renderStages} in your subc...
#include "RenderStage.hpp" #include "Devices/Windows.hpp" #include "Graphics.hpp" namespace acid { RenderStage::RenderStage(std::vector<Attachment> images, std::vector<SubpassType> subpasses, const Viewport &viewport) : attachments(std::move(images)), subpasses(std::move(subpasses)), viewport(viewport), subpassAt...
#pragma once #include "Maths/Colour.hpp" #include "Maths/Vector2.hpp" #include "Images/ImageDepth.hpp" #include "Renderpass/Framebuffers.hpp" #include "Renderpass/Renderpass.hpp" #include "Renderpass/Swapchain.hpp" namespace acid { /** * @brief Class that represents an attachment in a renderpass. */ class ACID_EXPO...
#pragma once #include "Commands/CommandBuffer.hpp" #include "Graphics/Pipelines/Pipeline.hpp" #include "Utils/NonCopyable.hpp" #include "Utils/TypeInfo.hpp" namespace acid { /** * @brief Represents a render pipeline that is used to render a type of pipeline. */ class ACID_EXPORT Subrender : NonCopyable { public: /...
#include "SubrenderHolder.hpp" namespace acid { void SubrenderHolder::Clear() { stages.clear(); } void SubrenderHolder::RemoveSubrenderStage(const TypeId &id) { for (auto it = stages.begin(); it != stages.end();) { if (it->second == id) { it = stages.erase(it); } else { ++it; } } } void SubrenderHolde...
#pragma once #include "Engine/Log.hpp" #include "Utils/NonCopyable.hpp" #include "Pipelines/Pipeline.hpp" #include "Subrender.hpp" namespace acid { /** * @brief Class that contains and manages subrenders registered to a render manager. */ class ACID_EXPORT SubrenderHolder : NonCopyable { friend class Graphics; pub...
#include "Buffer.hpp" #include <cstring> #include "Graphics/Graphics.hpp" namespace acid { Buffer::Buffer(VkDeviceSize size, VkBufferUsageFlags usage, VkMemoryPropertyFlags properties, const void *data) : size(size) { auto logicalDevice = Graphics::Get()->GetLogicalDevice(); auto graphicsFamily = logicalDevice->...
#pragma once #include "Graphics/Descriptors/DescriptorSet.hpp" namespace acid { /** * @brief Interface that represents a buffer. */ class ACID_EXPORT Buffer { public: enum class Status { Reset, Changed, Normal }; /** * Creates a new buffer with optional data. * @param size Size of the buffer in bytes. ...
#include "InstanceBuffer.hpp" #include <cstring> #include "Graphics/Graphics.hpp" namespace acid { InstanceBuffer::InstanceBuffer(VkDeviceSize size) : Buffer(size, VK_BUFFER_USAGE_VERTEX_BUFFER_BIT, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) { } void InstanceBuffer::Update(const CommandBuffer &commandBuffer, const void ...
#pragma once #include "Buffer.hpp" namespace acid { class ACID_EXPORT InstanceBuffer : public Buffer { public: explicit InstanceBuffer(VkDeviceSize size); void Update(const CommandBuffer &commandBuffer, const void *newData); }; }
#include "PushHandler.hpp" namespace acid { PushHandler::PushHandler(bool multipipeline) : multipipeline(multipipeline) { } PushHandler::PushHandler(const Shader::UniformBlock &uniformBlock, bool multipipeline) : multipipeline(multipipeline), uniformBlock(uniformBlock), data(std::make_unique<char[]>(this->uniform...
#pragma once #include <cstring> #include "Graphics/Pipelines/Pipeline.hpp" namespace acid { /** * @brief Class that handles a pipeline push constant. */ class ACID_EXPORT PushHandler { public: explicit PushHandler(bool multipipeline = false); explicit PushHandler(const Shader::UniformBlock &uniformBlock, bool mu...
#include "StorageBuffer.hpp" #include <cstring> #include "Graphics/Graphics.hpp" namespace acid { StorageBuffer::StorageBuffer(VkDeviceSize size, const void *data) : Buffer(size, VK_BUFFER_USAGE_TRANSFER_DST_BIT | VK_BUFFER_USAGE_STORAGE_BUFFER_BIT, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHE...
#pragma once #include "Graphics/Descriptors/Descriptor.hpp" #include "Buffer.hpp" namespace acid { class ACID_EXPORT StorageBuffer : public Descriptor, public Buffer { public: explicit StorageBuffer(VkDeviceSize size, const void *data = nullptr); void Update(const void *newData); WriteDescriptorSet GetWriteDe...
#include "StorageHandler.hpp" namespace acid { StorageHandler::StorageHandler(bool multipipeline) : multipipeline(multipipeline), handlerStatus(Buffer::Status::Reset) { } StorageHandler::StorageHandler(const Shader::UniformBlock &uniformBlock, bool multipipeline) : multipipeline(multipipeline), uniformBlock(unifo...
#pragma once #include <cstring> #include "StorageBuffer.hpp" namespace acid { /** * @brief Class that handles a storage buffer. */ class ACID_EXPORT StorageHandler { public: explicit StorageHandler(bool multipipeline = false); explicit StorageHandler(const Shader::UniformBlock &uniformBlock, bool multipipeline =...
#include "UniformBuffer.hpp" #include <cstring> #include "Graphics/Graphics.hpp" namespace acid { UniformBuffer::UniformBuffer(VkDeviceSize size, const void *data) : Buffer(size, VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT, data) { } void UniformBu...
#pragma once #include "Graphics/Descriptors/Descriptor.hpp" #include "Buffer.hpp" namespace acid { class ACID_EXPORT UniformBuffer : public Descriptor, public Buffer { public: explicit UniformBuffer(VkDeviceSize size, const void *data = nullptr); void Update(const void *newData); WriteDescriptorSet GetWriteDe...
#include "UniformHandler.hpp" namespace acid { UniformHandler::UniformHandler(bool multipipeline) : multipipeline(multipipeline), handlerStatus(Buffer::Status::Normal) { } UniformHandler::UniformHandler(const Shader::UniformBlock &uniformBlock, bool multipipeline) : multipipeline(multipipeline), uniformBlock(unif...
#pragma once #include <cstring> #include "UniformBuffer.hpp" namespace acid { /** * @brief Class that handles a uniform buffer. */ class ACID_EXPORT UniformHandler { public: explicit UniformHandler(bool multipipeline = false); explicit UniformHandler(const Shader::UniformBlock &uniformBlock, bool multipipeline =...
#include "CommandBuffer.hpp" #include "Graphics/Graphics.hpp" namespace acid { CommandBuffer::CommandBuffer(bool begin, VkQueueFlagBits queueType, VkCommandBufferLevel bufferLevel) : commandPool(Graphics::Get()->GetCommandPool()), queueType(queueType) { auto logicalDevice = Graphics::Get()->GetLogicalDevice(); V...
#pragma once #include "CommandPool.hpp" #include <memory> namespace acid { /** * @brief Class that represents a command buffer. */ class ACID_EXPORT CommandBuffer { public: /** * Creates a new command buffer. * @param begin If recording will start right away, if true {@link CommandBuffer#Begin} is called. *...
#include "CommandPool.hpp" #include "Graphics/Graphics.hpp" namespace acid { CommandPool::CommandPool(const std::thread::id &threadId) : threadId(threadId) { auto logicalDevice = Graphics::Get()->GetLogicalDevice(); auto graphicsFamily = logicalDevice->GetGraphicsFamily(); VkCommandPoolCreateInfo commandPoolCrea...
#pragma once #include <thread> #include <volk.h> #include "Export.hpp" namespace acid { /** * @brief Class that represents a command pool. */ class ACID_EXPORT CommandPool { public: explicit CommandPool(const std::thread::id &threadId = std::this_thread::get_id()); ~CommandPool(); operator const VkCommandPool...
#pragma once #include <cstdint> #include <optional> #include <memory> #include <volk.h> #include "Export.hpp" namespace acid { class ACID_EXPORT OffsetSize { public: OffsetSize(uint32_t offset, uint32_t size) : offset(offset), size(size) { } uint32_t GetOffset() const { return offset; } uint32_t GetSize() c...
#include "DescriptorSet.hpp" #include "Graphics/Graphics.hpp" namespace acid { DescriptorSet::DescriptorSet(const Pipeline &pipeline) : pipelineLayout(pipeline.GetPipelineLayout()), pipelineBindPoint(pipeline.GetPipelineBindPoint()), descriptorPool(pipeline.GetDescriptorPool()) { auto logicalDevice = Graphics::Ge...
#pragma once #include "Graphics/Commands/CommandBuffer.hpp" #include "Graphics/Pipelines/Pipeline.hpp" namespace acid { class ACID_EXPORT DescriptorSet { public: explicit DescriptorSet(const Pipeline &pipeline); ~DescriptorSet(); static void Update(const std::vector<VkWriteDescriptorSet> &descriptorWrites); voi...
#include "DescriptorsHandler.hpp" #include "Graphics/Graphics.hpp" namespace acid { DescriptorsHandler::DescriptorsHandler(const Pipeline &pipeline) : shader(pipeline.GetShader()), pushDescriptors(pipeline.IsPushDescriptors()), descriptorSet(std::make_unique<DescriptorSet>(pipeline)), changed(true) { } void Desc...
#pragma once #include <iomanip> #include "Engine/Log.hpp" #include "Utils/ConstExpr.hpp" #include "Graphics/Descriptors/DescriptorSet.hpp" #include "Graphics/Buffers/UniformHandler.hpp" #include "Graphics/Buffers/StorageHandler.hpp" #include "Graphics/Buffers/PushHandler.hpp" #include "Graphics/Pipelines/Shader.hpp" ...
#include "Instance.hpp" #include <iomanip> #include "Devices/Windows.hpp" #include "Graphics/Graphics.hpp" #ifndef VK_EXT_DEBUG_UTILS_EXTENSION_NAME #define VK_EXT_DEBUG_UTILS_EXTENSION_NAME "VK_EXT_debug_utils" #endif namespace acid { #if USE_DEBUG_MESSENGER const std::vector<const char *> Instance::ValidationLaye...
#pragma once #include <vector> #include <volk.h> #include "Export.hpp" #ifndef VK_API_VERSION_1_1 #define VK_API_VERSION_1_1 VK_MAKE_VERSION(1, 1, 0) #endif // Debug messenger is a newer Vulkan feature, but extremely useful if available. #define USE_DEBUG_MESSENGER VK_HEADER_VERSION >= 121 namespace acid { class AC...
#include "LogicalDevice.hpp" #include "Graphics/Graphics.hpp" #include "Instance.hpp" #include "PhysicalDevice.hpp" namespace acid { const std::vector<const char *> LogicalDevice::DeviceExtensions = {VK_KHR_SWAPCHAIN_EXTENSION_NAME}; // VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME LogicalDevice::LogicalDevice(const Instanc...
#pragma once #include <vector> #include <volk.h> #include "Export.hpp" namespace acid { class Instance; class PhysicalDevice; class ACID_EXPORT LogicalDevice { friend class Graphics; public: LogicalDevice(const Instance &instance, const PhysicalDevice &physicalDevice); ~LogicalDevice(); operator const VkDevice...
#include "PhysicalDevice.hpp" #include <iomanip> #include "Graphics/Graphics.hpp" #include "Instance.hpp" namespace acid { static const std::vector<VkSampleCountFlagBits> STAGE_FLAG_BITS = { VK_SAMPLE_COUNT_64_BIT, VK_SAMPLE_COUNT_32_BIT, VK_SAMPLE_COUNT_16_BIT, VK_SAMPLE_COUNT_8_BIT, VK_SAMPLE_COUNT_4_BIT, VK_SAM...
#pragma once #include <volk.h> #include <vector> #include "Export.hpp" namespace acid { class Instance; class ACID_EXPORT PhysicalDevice { friend class Graphics; public: explicit PhysicalDevice(const Instance &instance); operator const VkPhysicalDevice &() const { return physicalDevice; } const VkPhysicalDevi...
#include "Surface.hpp" #include "Devices/Windows.hpp" #include "Graphics/Graphics.hpp" #include "Instance.hpp" #include "LogicalDevice.hpp" #include "PhysicalDevice.hpp" namespace acid { Surface::Surface(const Instance &instance, const PhysicalDevice &physicalDevice, const LogicalDevice &logicalDevice, const Window &...
#pragma once #include <volk.h> #include "Export.hpp" namespace acid { class Instance; class LogicalDevice; class PhysicalDevice; class Window; class ACID_EXPORT Surface { friend class Graphics; public: Surface(const Instance &instance, const PhysicalDevice &physicalDevice, const LogicalDevice &logicalDevice, cons...
#include "Image.hpp" #include <cstring> #include "Bitmaps/Bitmap.hpp" #include "Graphics/Graphics.hpp" #include "Graphics/Buffers/Buffer.hpp" #include "Files/Files.hpp" namespace acid { constexpr static float ANISOTROPY = 16.0f; Image::Image(VkFilter filter, VkSamplerAddressMode addressMode, VkSampleCountFlagBits s...
#pragma once #include <vector> #include "Graphics/Commands/CommandBuffer.hpp" #include "Graphics/Descriptors/Descriptor.hpp" #include "Maths/Vector2.hpp" namespace acid { class Bitmap; /** * @brief A representation of a Vulkan image, sampler, and view. */ class ACID_EXPORT Image : public Descriptor { public: /**...
#include "Image2d.hpp" #include <cstring> #include "Bitmaps/Bitmap.hpp" #include "Graphics/Buffers/Buffer.hpp" #include "Graphics/Graphics.hpp" #include "Resources/Resources.hpp" #include "Files/Node.hpp" #include "Image.hpp" namespace acid { std::shared_ptr<Image2d> Image2d::Create(const Node &node) { if (auto res...
#pragma once #include "Bitmaps/Bitmap.hpp" #include "Resources/Resource.hpp" #include "Image.hpp" namespace acid { /** * @brief Resource that represents a 2D image. */ class ACID_EXPORT Image2d : public Image, public Resource { public: /** * Creates a new 2D image, or finds one with the same values. * @param n...
#include "Image2dArray.hpp" #include "Bitmaps/Bitmap.hpp" #include "Graphics/Buffers/Buffer.hpp" namespace acid { Image2dArray::Image2dArray(const Vector2ui &extent, uint32_t arrayLayers, VkFormat format, VkImageLayout layout, VkImageUsageFlags usage, VkFilter filter, VkSamplerAddressMode addressMode, bool anisotrop...
#pragma once #include "Image.hpp" namespace acid { /** * @brief Resource that represents an array of 2D images. */ class ACID_EXPORT Image2dArray : public Image { public: /** * Creates a new array of 2D images. * @param extent The images extent in pixels. * @param arrayLayers The number of layers in the imag...
#include "ImageCube.hpp" #include <cstring> #include "Bitmaps/Bitmap.hpp" #include "Graphics/Buffers/Buffer.hpp" #include "Graphics/Graphics.hpp" #include "Resources/Resources.hpp" #include "Image.hpp" namespace acid { std::shared_ptr<ImageCube> ImageCube::Create(const Node &node) { if (auto resource = Resources::G...
#pragma once #include "Resources/Resource.hpp" #include "Image.hpp" namespace acid { class Bitmap; /** * @brief Resource that represents a cubemap image. */ class ACID_EXPORT ImageCube : public Image, public Resource { public: /** * Creates a new cubemap image, or finds one with the same values. * @param node...
#include "ImageDepth.hpp" #include "Graphics/Graphics.hpp" namespace acid { static const std::vector<VkFormat> TRY_FORMATS = { VK_FORMAT_D32_SFLOAT_S8_UINT, VK_FORMAT_D32_SFLOAT, VK_FORMAT_D24_UNORM_S8_UINT, VK_FORMAT_D16_UNORM_S8_UINT, VK_FORMAT_D16_UNORM }; ImageDepth::ImageDepth(const Vector2ui &extent, VkSampl...
#pragma once #include "Image.hpp" namespace acid { /** * @brief Resource that represents a depth stencil image. */ class ACID_EXPORT ImageDepth : public Image { public: explicit ImageDepth(const Vector2ui &extent, VkSampleCountFlagBits samples = VK_SAMPLE_COUNT_1_BIT); }; }
#pragma once #include "Graphics/Commands/CommandBuffer.hpp" #include "Shader.hpp" namespace acid { /** * @brief Class that is used to represent a pipeline. */ class ACID_EXPORT Pipeline { public: /** * Represents position in the render structure, first value being the renderpass and second for subpass. */ usi...
#include "PipelineCompute.hpp" #include "Graphics/Graphics.hpp" #include "Files/Files.hpp" namespace acid { PipelineCompute::PipelineCompute(std::filesystem::path shaderStage, std::vector<Shader::Define> defines, bool pushDescriptors) : shaderStage(std::move(shaderStage)), defines(std::move(defines)), pushDescript...
#pragma once #include "Graphics/Commands/CommandBuffer.hpp" #include "Maths/Vector2.hpp" #include "Pipeline.hpp" namespace acid { /** * @brief Class that represents a compute compute pipeline. */ class ACID_EXPORT PipelineCompute : public Pipeline { public: /** * Creates a new compute pipeline. * @param shader...
#include "PipelineGraphics.hpp" #include "Graphics/Graphics.hpp" #include "Files/Files.hpp" namespace acid { const std::vector<VkDynamicState> DYNAMIC_STATES = {VK_DYNAMIC_STATE_VIEWPORT, VK_DYNAMIC_STATE_SCISSOR, VK_DYNAMIC_STATE_LINE_WIDTH}; PipelineGraphics::PipelineGraphics(Stage stage, std::vector<std::filesyst...
#pragma once #include <array> #include "Maths/Vector2.hpp" #include "Files/Node.hpp" #include "Pipeline.hpp" #include "Graphics/RenderStage.hpp" namespace acid { class ImageDepth; class Image2d; /** * @brief Class that represents a graphics pipeline. */ class ACID_EXPORT PipelineGraphics : public Pipeline { pu...
#include "Shader.hpp" #include <cstring> #include <iomanip> #include <SPIRV/GlslangToSpv.h> #include <glslang/Public/ShaderLang.h> #include "Graphics/Graphics.hpp" #include "Files/Files.hpp" #include "Utils/String.hpp" #include "Graphics/Buffers/StorageBuffer.hpp" #include "Graphics/Buffers/UniformBuffer.hpp" #includ...
#pragma once #include <array> #include <volk.h> #include "Files/Node.hpp" namespace glslang { class TProgram; class TType; } namespace acid { /** * @brief Class that loads and processes a shader, and provides a reflection. */ class ACID_EXPORT Shader { public: /** * A define added to the start of a shader, fir...
#include "Framebuffers.hpp" #include "Graphics/Images/ImageDepth.hpp" #include "Graphics/Renderpass/Renderpass.hpp" #include "Graphics/Graphics.hpp" #include "Graphics/RenderStage.hpp" namespace acid { Framebuffers::Framebuffers(const LogicalDevice &logicalDevice, const Swapchain &swapchain, const RenderStage &render...
#pragma once #include "Graphics/Images/Image2d.hpp" #include "Swapchain.hpp" namespace acid { class LogicalDevice; class ImageDepth; class Renderpass; class RenderStage; class ACID_EXPORT Framebuffers : NonCopyable { public: Framebuffers(const LogicalDevice &logicalDevice, const Swapchain &swapchain, const Rende...
#include "Renderpass.hpp" #include "Graphics/Graphics.hpp" #include "Graphics/RenderStage.hpp" namespace acid { Renderpass::Renderpass(const LogicalDevice &logicalDevice, const RenderStage &renderStage, VkFormat depthFormat, VkFormat surfaceFormat, VkSampleCountFlagBits samples) : logicalDevice(logicalDevice) { // ...
#pragma once #include <optional> #include <vector> #include <volk.h> #include "Utils/NonCopyable.hpp" namespace acid { class LogicalDevice; class ImageDepth; class RenderStage; class ACID_EXPORT Renderpass { public: class SubpassDescription : NonCopyable { public: SubpassDescription(VkPipelineBindPoint bindPoin...
#include "Swapchain.hpp" #include "Graphics/Graphics.hpp" namespace acid { static const std::vector<VkCompositeAlphaFlagBitsKHR> COMPOSITE_ALPHA_FLAGS = { VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR, VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR, VK_COMPOSITE_ALPHA_POST_MULTIPLIED_BIT_KHR, VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR, }; ...
#pragma once #include <volk.h> #include <vector> #include "Export.hpp" namespace acid { class PhysicalDevice; class Surface; class LogicalDevice; class ACID_EXPORT Swapchain { public: Swapchain(const PhysicalDevice &physicalDevice, const Surface &surface, const LogicalDevice &logicalDevice, const VkExtent2D &exten...