PixelBullet  0.0.1
A C++ game engine
Loading...
Searching...
No Matches
PipelineCompute.hpp
1#pragma once
2
3#include "PixelBullet/Filesystem/File.hpp"
4#include "PixelBullet/Filesystem/VirtualPath.hpp"
5#include "PixelBullet/Graphics/Commands/CommandBuffer.hpp"
6#include "PixelBullet/Graphics/Pipelines/Pipeline.hpp"
7
8#include <glm/glm.hpp>
9
10#include <optional>
11#include <vector>
12
13namespace PixelBullet
14{
19 {
20 public:
27 explicit PipelineCompute(const VirtualPath& shaderStage, std::vector<Shader::Define> defines = {},
28 bool pushDescriptors = false);
30
36 void CmdRender(const CommandBuffer& commandBuffer, const glm::uvec2& extent) const;
37
38 const VirtualPath& GetShaderStage() const
39 {
40 return m_ShaderStage;
41 }
42 const std::vector<Shader::Define>& GetDefines() const
43 {
44 return m_Defines;
45 }
46 bool IsPushDescriptors() const override
47 {
48 return m_PushDescriptors;
49 }
50 const Shader* GetShader() const override
51 {
52 return m_Shader.get();
53 }
54 const VkDescriptorSetLayout& GetDescriptorSetLayout() const override
55 {
56 return m_DescriptorSetLayout;
57 }
58 const VkDescriptorPool& GetDescriptorPool() const override
59 {
60 return m_DescriptorPool;
61 }
62 const VkPipeline& GetPipeline() const override
63 {
64 return m_Pipeline;
65 }
66 const VkPipelineLayout& GetPipelineLayout() const override
67 {
68 return m_PipelineLayout;
69 }
70 const VkPipelineBindPoint& GetPipelineBindPoint() const override
71 {
72 return m_PipelineBindPoint;
73 }
74
75 private:
76 void CreateShaderProgram();
77 void CreateDescriptorLayout();
78 void CreateDescriptorPool();
79 void CreatePipelineLayout();
80 void CreatePipelineCompute();
81
82 private:
83 VirtualPath m_ShaderStage;
84 std::vector<Shader::Define> m_Defines;
85 bool m_PushDescriptors;
86
87 std::unique_ptr<Shader> m_Shader;
88
89 VkShaderModule m_ShaderModule = VK_NULL_HANDLE;
90 VkPipelineShaderStageCreateInfo m_ShaderStageCreateInfo = {};
91
92 VkDescriptorSetLayout m_DescriptorSetLayout = VK_NULL_HANDLE;
93 VkDescriptorPool m_DescriptorPool = VK_NULL_HANDLE;
94
95 VkPipeline m_Pipeline = VK_NULL_HANDLE;
96 VkPipelineLayout m_PipelineLayout = VK_NULL_HANDLE;
97 VkPipelineBindPoint m_PipelineBindPoint;
98 };
99} // namespace PixelBullet
Class that represents a command buffer.
Definition CommandBuffer.hpp:15
Class that represents a compute pipeline.
Definition PipelineCompute.hpp:19
PipelineCompute(const VirtualPath &shaderStage, std::vector< Shader::Define > defines={}, bool pushDescriptors=false)
Definition PipelineCompute.cpp:15
void CmdRender(const CommandBuffer &commandBuffer, const glm::uvec2 &extent) const
Definition PipelineCompute.cpp:50
Class that is used to represent a pipeline.
Definition Pipeline.hpp:12
Class that loads and processes a shader, and provides reflection.
Definition Shader.hpp:22
Definition VirtualPath.hpp:11