vsg: include/vsg/state/PipelineLayout.h Source File

vsg 1.1.10 VulkanSceneGraph library |

Loading...
Searching...
No Matches
PipelineLayout.h
1#pragma once
2
3/* <editor-fold desc="MIT License">
4
5Copyright(c) 2018 Robert Osfield
6
7Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
8
9The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
10
11THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
12
13</editor-fold> */
14
15#include <vsg/state/DescriptorSetLayout.h>
16#include <vsg/vk/vk_buffer.h>
17
18namespace vsg
19{
20 // forward declare
21 class Context;
22
23 using PushConstantRanges = std::vector<VkPushConstantRange>;
24
26 class VSG_DECLSPEC PipelineLayout : public Inherit<Object, PipelineLayout>
27 {
28 public:
29 PipelineLayout();
30 PipelineLayout(const PipelineLayout& rhs, const CopyOp& copyop = {});
31 PipelineLayout(const DescriptorSetLayouts& in_setLayouts, const PushConstantRanges& in_pushConstantRanges, VkPipelineLayoutCreateFlags in_flags = 0);
32
34 VkPipelineLayoutCreateFlags flags = 0;
35 DescriptorSetLayouts setLayouts;
36 PushConstantRanges pushConstantRanges;
37
39 VkPipelineLayout vk(uint32_t deviceID) const { return _implementation[deviceID]->_pipelineLayout; }
40
41 void compile(Context& context);
42
43 void release(uint32_t deviceID) { _implementation[deviceID] = {}; }
44 void release() { _implementation.clear(); }
45
46 public:
47 ref_ptr<Object> clone(const CopyOp& copyop = {}) const override { return PipelineLayout::create(*this, copyop); }
48 int compare(const Object& rhs) const override;
49
50 void read(Input& input) override;
51 void write(Output& output) const override;
52
53 protected:
54 virtual ~PipelineLayout();
55
56 struct Implementation : public Inherit<Object, Implementation>
57 {
58 Implementation(Device* device, const DescriptorSetLayouts& descriptorSetLayouts, const PushConstantRanges& pushConstantRanges, VkPipelineLayoutCreateFlags flags = 0);
59
60 virtual ~Implementation();
61
62 VkPipelineLayout _pipelineLayout;
63
64 ref_ptr<Device> _device;
65 };
66
67 vk_buffer<ref_ptr<Implementation>> _implementation;
68 };
69 VSG_type_name(vsg::PipelineLayout);
70
71} // namespace vsg
vsg::Context
Definition Context.h:67
vsg::CopyOp
Definition Object.h:42
vsg::Device
Device encapsulates VkDevice, a logical handle to the PhysicalDevice with capabilities specified duri...
Definition Device.h:39
vsg::Input
Definition Input.h:44
vsg::Object
Definition Object.h:60
vsg::Output
Definition Output.h:41
vsg::PipelineLayout
PipelineLayout encapsulates VkPipelineLayout and the VkPipelineLayoutCreateInfo settings used to set ...
Definition PipelineLayout.h:27
vsg::PipelineLayout::vk
VkPipelineLayout vk(uint32_t deviceID) const
Vulkan VkPipelineLayout handle.
Definition PipelineLayout.h:39
vsg::PipelineLayout::compare
int compare(const Object &rhs) const override
compare two objects, return -1 if this object is less than rhs, return 0 if it's equal,...
vsg::PipelineLayout::clone
ref_ptr< Object > clone(const CopyOp &copyop={}) const override
Definition PipelineLayout.h:47
vsg::PipelineLayout::flags
VkPipelineLayoutCreateFlags flags
VkPipelineLayoutCreateInfo settings.
Definition PipelineLayout.h:34
vsg::ref_ptr
Definition ref_ptr.h:22
vsg::vk_buffer
vk_buffer that manages a single logical device supported.
Definition vk_buffer.h:28