vOOlkan
An object oriented approach to Vulkan
PipelineLayout.h
Go to the documentation of this file.
1#ifndef VULKAN_PIPELINELAYOUT
2#define VULKAN_PIPELINELAYOUT
3
4#include <vulkan/vulkan.h>
5#include <concepts>
6
7#include "PipelineLayout.h"
8#include "LogicalDevice.h"
9#include "VulkanException.h"
10#include "Set.h"
11
12
13namespace Vulkan::PipelineOptions { class PipelineLayout; }
14
15
20public:
21
22 template<typename... S> requires (std::derived_from<S, Set> && ...)
23 PipelineLayout(const LogicalDevice& virtualGpu, const S&... sets) : virtualGpu{ virtualGpu } {
24 //put the descriptor set layouts in a vector
25 std::vector<VkDescriptorSetLayout> rawLayouts;
26 (rawLayouts.emplace_back(+sets), ...);
27
28 VkPipelineLayoutCreateInfo pipelineLayoutInfo{};
29 pipelineLayoutInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO;
30 pipelineLayoutInfo.setLayoutCount = rawLayouts.size();
31 pipelineLayoutInfo.pSetLayouts = rawLayouts.data();
32 pipelineLayoutInfo.pushConstantRangeCount = 0;
33 pipelineLayoutInfo.pPushConstantRanges = nullptr;
34
35 if (VkResult result = vkCreatePipelineLayout(+virtualGpu, &pipelineLayoutInfo, nullptr, &pipelineLayout); result != VK_SUCCESS) {
36 throw VulkanException("Failed to create pipeline layout!", result);
37 }
38 }
39
44
46 vkDestroyPipelineLayout(+virtualGpu, pipelineLayout, nullptr);
47 }
48
49
50 const VkPipelineLayout operator+() const {
51 return pipelineLayout;
52 }
53
54
55private:
56 VkPipelineLayout pipelineLayout;
57 const LogicalDevice& virtualGpu;
58};
59
60
61#endif
A logical device is an abstraction of the physical GPU which we can mainly use to send commands.
Definition: LogicalDevice.h:15
This objects is a reference to all of the resources (e.g. uniforms) that the pipeline can access.
Definition: PipelineLayout.h:19
~PipelineLayout()
Definition: PipelineLayout.h:45
PipelineLayout & operator=(PipelineLayout &&)=delete
PipelineLayout(const LogicalDevice &virtualGpu, const S &... sets)
Definition: PipelineLayout.h:23
PipelineLayout & operator=(const PipelineLayout &)=delete
PipelineLayout(const PipelineLayout &)=delete
const VkPipelineLayout operator+() const
Definition: PipelineLayout.h:50
PipelineLayout(PipelineLayout &&)=delete
Generic runtime exception thrown by Vulkan-related functions.
Definition: VulkanException.h:13
Definition: Attachment.h:11