From 8045b8ba04aae39a4cf9733e72413f648b6ebe2b Mon Sep 17 00:00:00 2001 From: tylermurphy534 Date: Sun, 18 Sep 2022 21:20:51 -0400 Subject: stanford dragon rendering --- engine/xe_pipeline.hpp | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100755 engine/xe_pipeline.hpp (limited to 'engine/xe_pipeline.hpp') diff --git a/engine/xe_pipeline.hpp b/engine/xe_pipeline.hpp new file mode 100755 index 0000000..06bcf0f --- /dev/null +++ b/engine/xe_pipeline.hpp @@ -0,0 +1,61 @@ +#pragma once + +#include "xe_device.hpp" + +#include +#include +#include +#include + +namespace xe { + +struct PipelineConfigInfo { + PipelineConfigInfo(const PipelineConfigInfo&) = delete; + PipelineConfigInfo& operator=(const PipelineConfigInfo&) = delete; + + VkPipelineViewportStateCreateInfo viewportInfo; + VkPipelineInputAssemblyStateCreateInfo inputAssemblyInfo; + VkPipelineRasterizationStateCreateInfo rasterizationInfo; + VkPipelineMultisampleStateCreateInfo multisampleInfo; + VkPipelineColorBlendAttachmentState colorBlendAttachment; + VkPipelineColorBlendStateCreateInfo colorBlendInfo; + VkPipelineDepthStencilStateCreateInfo depthStencilInfo; + std::vector dynamicStateEnables; + VkPipelineDynamicStateCreateInfo dynamicStateInfo; + VkPipelineLayout pipelineLayout = nullptr; + VkRenderPass renderPass = nullptr; + uint32_t subpass = 0; +}; + +class XePipeline { + public: + XePipeline( + XeDevice &device, + const std::string& vertFilepath, + const std::string& fragFilepath, + const PipelineConfigInfo& configInfo); + ~XePipeline(); + + XePipeline(const XePipeline&) = delete; + XePipeline operator=(const XePipeline&) = delete; + + void bind(VkCommandBuffer commandBuffer); + static void defaultPipelineConfigInfo(PipelineConfigInfo& configInfo); + + private: + static std::vector readFile(const std::string& filePath); + + void createGraphicsPipeline( + const std::string& vertFilePath, + const std::string& fragFilepath, + const PipelineConfigInfo& configInfo); + + void createShaderModule(const std::vector& code, VkShaderModule* shaderModule); + + XeDevice& xeDevice; + VkPipeline graphicsPipeline; + VkShaderModule vertShaderModule; + VkShaderModule fragShaderModule; +}; + +} \ No newline at end of file -- cgit v1.2.3-freya