Add depth buffer

- Add depth testing to swapchain
- Add Shader abstraction
- Add CommandBuffer abstraction
This commit is contained in:
Thraix
2023-01-29 23:22:17 +01:00
parent 87ed5739b3
commit 9de2ff594b
25 changed files with 927 additions and 488 deletions
+10 -6
View File
@@ -1,19 +1,23 @@
#pragma once
#include "Common.h"
#include "VertexDescriptor.h"
#include <vulkan/vulkan.hpp>
#include <vulkan/vulkan.hpp>
#include <map>
class PipelineCreator
{
struct DescriptorSetLayout
struct DescriptorSetBinding
{
uint32_t binding;
VkDescriptorType type;
uint32_t count;
VkShaderStageFlags flags;
};
friend class Pipeline;
private:
std::map<uint32_t, DescriptorSetLayout> descriptorSetLayouts{};
std::map<uint32_t, std::vector<DescriptorSetBinding>> descriptorSetLayouts{};
std::string vertexShader;
std::string fragmentShader;
@@ -22,7 +26,6 @@ private:
VkCullModeFlags cullMode = VK_CULL_MODE_BACK_BIT;
VkFrontFace frontFace = VK_FRONT_FACE_CLOCKWISE;
public:
PipelineCreator(const std::string& vertexShader, const std::string& fragmentShader)
: vertexShader{vertexShader}, fragmentShader{fragmentShader}
@@ -33,9 +36,10 @@ public:
vertexDescriptor = descriptor;
}
void AddDescriptorSetLayoutBinding(uint32_t set, VkDescriptorType type, VkShaderStageFlags stageFlags)
void AddDescriptorSetLayoutBinding(uint32_t set, uint32_t binding, VkDescriptorType type, uint32_t count, VkShaderStageFlags stageFlags)
{
descriptorSetLayouts.emplace(set, DescriptorSetLayout{type, stageFlags});
CP_ASSERT(set <= descriptorSetLayouts.size(), "Cannot add descriptor set with set number greater than the current set count");
descriptorSetLayouts[set].emplace_back(DescriptorSetBinding{binding, type, count, stageFlags});
}
void SetPrimitiveTopology(VkPrimitiveTopology primitiveTopology)