Aeon Engine c550894
AeonGames Open Source Game Engine
Loading...
Searching...
No Matches
VulkanPipeline.hpp
1/*
2Copyright (C) 2017-2019,2021,2025,2026 Rodrigo Jose Hernandez Cordoba
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/
16#ifndef AEONGAMES_VULKANPIPELINE_HPP
17#define AEONGAMES_VULKANPIPELINE_HPP
18#include <cstdint>
19#include <string>
20#include <array>
21#include <vector>
22#include <limits>
23#include <vulkan/vulkan.h>
24#include "aeongames/Pipeline.hpp"
25#include "VulkanDescriptorSet.hpp"
26
27// Forward declarations
28struct SpvReflectShaderModule;
29
30namespace AeonGames
31{
32 class VulkanRenderer;
35 {
36 public:
38 VulkanPipeline ( const VulkanRenderer& aVulkanRenderer, const Pipeline& aPipeline );
41 VulkanPipeline ( VulkanPipeline&& aVulkanPipeline );
42 VulkanPipeline ( const VulkanPipeline& ) = delete;
43 VulkanPipeline& operator= ( const VulkanPipeline& ) = delete;
44 VulkanPipeline& operator= ( VulkanPipeline&& ) = delete;
46 const VkPipelineLayout GetPipelineLayout() const;
48 const VkPipeline GetVkPipeline() const;
50 const Pipeline* GetPipeline() const;
52 const VkDescriptorSetLayout GetDescriptorSetLayout ( uint32_t name ) const;
54 uint32_t GetDescriptorSetIndex ( uint32_t hash ) const;
56 const VkPushConstantRange& GetPushConstantModelMatrix() const;
57 private:
58 void ReflectAttributes ( SpvReflectShaderModule& module );
59 void ReflectDescriptorSets ( SpvReflectShaderModule& module, ShaderType aType );
60 void ReflectPushConstants ( SpvReflectShaderModule& module, ShaderType aType );
61 const VulkanRenderer& mVulkanRenderer;
62 const Pipeline* mPipeline{nullptr};
63 VkPipelineLayout mVkPipelineLayout{ VK_NULL_HANDLE };
64 VkPipeline mVkPipeline{ VK_NULL_HANDLE };
65 uint32_t mVertexStride{0};
66 std::vector<VkVertexInputAttributeDescription> mVertexAttributes{};
67 std::vector<VulkanDescriptorSetInfo> mDescriptorSets{};
68 VkPushConstantRange mPushConstantModelMatrix{};
69 };
70}
71#endif
Rendering pipeline resource.
Definition Pipeline.hpp:122
VulkanPipeline(const VulkanRenderer &aVulkanRenderer, const Pipeline &aPipeline)
Construct from a renderer and pipeline resource.
const Pipeline * GetPipeline() const
Get the source Pipeline resource.
const VkDescriptorSetLayout GetDescriptorSetLayout(uint32_t name) const
Get a descriptor set layout by its name hash.
uint32_t GetDescriptorSetIndex(uint32_t hash) const
Get the descriptor set index for a given hash.
const VkPipeline GetVkPipeline() const
Get the Vulkan pipeline handle.
const VkPushConstantRange & GetPushConstantModelMatrix() const
Get the push constant range used for the model matrix.
const VkPipelineLayout GetPipelineLayout() const
Get the Vulkan pipeline layout handle.
Vulkan rendering backend implementing the Renderer interface.
<- This is here just for the literals
Definition AABB.hpp:31
ShaderType
Shader stage types.
Definition Pipeline.hpp:96