Compare commits
No commits in common. '9e0b0af5e81ca6aa89aff4a88f8e4f773e79a1af' and '405411337cb798d07addd7886d876a6b6e7cf1d6' have entirely different histories.
9e0b0af5e8
...
405411337c
10 changed files with 98 additions and 253 deletions
@ -1,34 +1,16 @@ |
|||||||
#pragma once |
#pragma once |
||||||
|
|
||||||
#include <vulkan/vulkan.h> |
#include <vulkan/vulkan.h> |
||||||
#include <glm/gtc/matrix_transform.hpp> |
|
||||||
|
|
||||||
class Instance; |
class Instance; |
||||||
class Buffer; |
|
||||||
|
|
||||||
struct UniformBufferObject { |
|
||||||
alignas(16) glm::mat4 model; |
|
||||||
glm::mat4 view; |
|
||||||
glm::mat4 projection; |
|
||||||
}; |
|
||||||
|
|
||||||
|
|
||||||
class Pipeline { |
class Pipeline { |
||||||
public: |
public: |
||||||
explicit Pipeline(Instance* instance, VkRenderPass renderPass); |
explicit Pipeline(Instance* instance, VkRenderPass renderPass); |
||||||
~Pipeline(); |
~Pipeline(); |
||||||
VkPipeline handle = VK_NULL_HANDLE; |
VkPipeline graphicsPipeline = VK_NULL_HANDLE; |
||||||
VkPipelineLayout layout = VK_NULL_HANDLE; |
|
||||||
VkDescriptorSet descriptorSet = VK_NULL_HANDLE; |
|
||||||
void createDescriptorSet(Buffer* buffer); |
|
||||||
private: |
private: |
||||||
VkShaderModule createShaderModule(const std::vector<char> &code); |
VkShaderModule createShaderModule(const std::vector<char> &code); |
||||||
|
VkPipelineLayout pipelineLayout = VK_NULL_HANDLE; |
||||||
VkDescriptorPool descriptorPool = VK_NULL_HANDLE; |
|
||||||
VkDescriptorSetLayout descriptorSetLayout = VK_NULL_HANDLE; |
|
||||||
|
|
||||||
Instance* instance = nullptr; |
Instance* instance = nullptr; |
||||||
void createDescriptorSetLayout(); |
|
||||||
void createDescriptorPool(); |
|
||||||
|
|
||||||
}; |
}; |
@ -1,25 +1 @@ |
|||||||
#include "vertex.hpp" |
#include "vertex.hpp" |
||||||
|
|
||||||
VkVertexInputBindingDescription Vertex::getBindingDescription() { |
|
||||||
VkVertexInputBindingDescription bindingDescription {}; |
|
||||||
bindingDescription.binding = 0; |
|
||||||
bindingDescription.stride = sizeof(Vertex); |
|
||||||
bindingDescription.inputRate = VK_VERTEX_INPUT_RATE_VERTEX; |
|
||||||
return bindingDescription; |
|
||||||
} |
|
||||||
|
|
||||||
std::array<VkVertexInputAttributeDescription, 2> Vertex::getAttributeDescriptions() { |
|
||||||
std::array<VkVertexInputAttributeDescription, 2> attributeDescriptions {}; |
|
||||||
|
|
||||||
attributeDescriptions[0].binding = 0; |
|
||||||
attributeDescriptions[0].location = 0; |
|
||||||
attributeDescriptions[0].format = VK_FORMAT_R32G32B32_SFLOAT; |
|
||||||
attributeDescriptions[0].offset = offsetof(Vertex, pos); |
|
||||||
|
|
||||||
attributeDescriptions[1].binding = 0; |
|
||||||
attributeDescriptions[1].location = 1; |
|
||||||
attributeDescriptions[1].format = VK_FORMAT_R32G32B32_SFLOAT; |
|
||||||
attributeDescriptions[1].offset = offsetof(Vertex, color); |
|
||||||
|
|
||||||
return attributeDescriptions; |
|
||||||
} |
|
||||||
|
Loading…
Reference in new issue