pleascach/Renderer/UniformBuffer.hpp
connellpaxton c9e2877530 Added shader compilation to build process
Created mechanism to construct pipelines, still need to finish debugging that.
2024-01-25 17:07:47 -05:00

35 lines
759 B
C++

#pragma once
#define VULKAN_HPP_NO_STRUCT_CONSTRUCTORS
#include <vulkan/vulkan.hpp>
#include <Memory/Buffer.hpp>
#include <glm/glm.hpp>
struct UniformData {
glm::mat4 mvp;
float time;
};
struct UniformBuffer {
UniformBuffer(vk::PhysicalDevice phys_dev, vk::Device dev);
std::unique_ptr<Buffer> buffer;
void upload(const UniformData& data);
inline operator vk::Buffer& () const {
return *buffer;
}
inline vk::DescriptorSetLayoutBinding binding(uint32_t binding, vk::ShaderStageFlags stages = vk::ShaderStageFlagBits::eAll) {
return vk::DescriptorSetLayoutBinding {
.binding = binding,
.descriptorType = vk::DescriptorType::eUniformBuffer,
.descriptorCount = 1,
.stageFlags = stages,
.pImmutableSamplers = nullptr,
};
}
};