forked from vsg-dev/VulkanSceneGraph
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGraphicsPipelineConfig.h
103 lines (79 loc) · 4.68 KB
/
GraphicsPipelineConfig.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#pragma once
/* <editor-fold desc="MIT License">
Copyright(c) 2022 Robert Osfield
Permission 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:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE 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.
</editor-fold> */
#include <vsg/state/BindDescriptorSet.h>
#include <vsg/state/ColorBlendState.h>
#include <vsg/state/DepthStencilState.h>
#include <vsg/state/DescriptorBuffer.h>
#include <vsg/state/DescriptorImage.h>
#include <vsg/state/DescriptorSetLayout.h>
#include <vsg/state/DynamicState.h>
#include <vsg/state/GraphicsPipeline.h>
#include <vsg/state/InputAssemblyState.h>
#include <vsg/state/MultisampleState.h>
#include <vsg/state/RasterizationState.h>
#include <vsg/state/TessellationState.h>
#include <vsg/state/VertexInputState.h>
#include <vsg/state/ViewportState.h>
#include <vsg/utils/ShaderSet.h>
namespace vsg
{
class VSG_DECLSPEC DescriptorConfig : public vsg::Inherit<Object, DescriptorConfig>
{
public:
DescriptorConfig(ref_ptr<ShaderSet> in_shaderSet = {});
ref_ptr<ShaderSet> shaderSet;
bool blending = false;
bool two_sided = false;
bool assignTexture(const std::string& name, ref_ptr<Data> textureData = {}, ref_ptr<Sampler> sampler = {});
bool assignUniform(const std::string& name, ref_ptr<Data> data = {});
// assign Descriptors to a DescriptorSet
void init();
// filled in by assingTexture(..) and assingUnfiorm(..)
Descriptors descriptors;
std::vector<std::string> defines;
DescriptorSetLayoutBindings descriptorBindings;
// filled in by init()
ref_ptr<DescriptorSet> descriptorSet;
};
VSG_type_name(vsg::DescriptorConfig);
class VSG_DECLSPEC GraphicsPipelineConfig : public vsg::Inherit<Object, GraphicsPipelineConfig>
{
public:
GraphicsPipelineConfig(ref_ptr<ShaderSet> in_shaderSet = {});
// inputs to setup of GraphicsPipeline, the default sets are taken from any provided by ShaderSet::defaultGraphicsPipelineStates
ref_ptr<ColorBlendState> colorBlendState;
ref_ptr<DepthStencilState> depthStencilState;
ref_ptr<DynamicState> dynamicState;
ref_ptr<InputAssemblyState> inputAssemblyState;
ref_ptr<MultisampleState> multisampleState; // typically leave unset as compile traversal with provide MultisampleState
ref_ptr<RasterizationState> rasterizationState;
ref_ptr<TessellationState> tessellationState;
ref_ptr<VertexInputState> vertexInputState; // set by assignArray(..) methods.
ref_ptr<ViewportState> viewportState; // typically leave unset as compile traversal with provide ViewportState
uint32_t subpass = 0;
uint32_t baseAttributeBinding = 0;
ref_ptr<ShaderSet> shaderSet;
ref_ptr<DescriptorSetLayout> additionalDescrptorSetLayout;
void reset();
bool enableArray(const std::string& name, VkVertexInputRate vertexInputRate, uint32_t stride);
bool assignArray(DataList& arrays, const std::string& name, VkVertexInputRate vertexInputRate, ref_ptr<Data> array);
bool assignTexture(Descriptors& descriptors, const std::string& name, ref_ptr<Data> textureData = {}, ref_ptr<Sampler> sampler = {});
bool assignUniform(Descriptors& descriptors, const std::string& name, ref_ptr<Data> data = {});
// setup by assign calls
ref_ptr<ShaderCompileSettings> shaderHints;
vsg::DescriptorSetLayoutBindings descriptorBindings;
int compare(const Object& rhs) const override;
void init();
// setup by init()
ref_ptr<DescriptorSetLayout> descriptorSetLayout;
ref_ptr<PipelineLayout> layout;
ref_ptr<GraphicsPipeline> graphicsPipeline;
ref_ptr<BindGraphicsPipeline> bindGraphicsPipeline;
};
VSG_type_name(vsg::GraphicsPipelineConfig);
} // namespace vsg