HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RV_VKPipelineLayout.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: RV_VKPipelineLayout.h ( RV Library, C++)
7  *
8  * COMMENTS:
9  * Class Representing a Vulkan Graphics Pipeline Layout
10  * And sub-classes used in layout creation
11  */
12 
13 #ifndef RV_VKPipelineLayout_h
14 #define RV_VKPipelineLayout_h
15 
16 #include "RV_API.h"
17 
18 #include <UT/UT_Array.h>
19 #include <UT/UT_Map.h>
20 #include <UT/UT_StringHolder.h>
21 #include <UT/UT_UniquePtr.h>
22 
23 #include "RV_VK.h"
24 #include "RV_Type.h"
25 #include "RV_VKDescriptorSet.h"
26 
27 class RV_Instance;
28 class RV_VKShaderModule;
29 
31 {
32 public:
34  int location = -1;
36 };
37 
38 // ------------------------
39 // RV_VKPushConstantRange
41 {
44  int myOffset;
45  int mySize;
46 };
47 
48 // -----------------------
49 // Push Constant info
51 {
52 public:
53  RV_VKPushConstantInfo() = default;
55  UT_Array<RV_Uniform>&& members,
57  int offset,
58  int size);
59 
61  { return myRanges; }
62 
63  bool merge(const RV_VKPushConstantInfo& other);
64  bool merge(const RV_VKPushConstantRange& new_range);
65 
66 private:
68  friend class RV_VKPipelineLayout;
69 };
70 
71 // -----------------------
72 // RV_VKPipelineLayoutInfo
73 //
74 // NOTE: unlike other info classes, this one owns resource handles
75 // so can't be directly copied
76 // It shouldn't need to be, as shader layouts are unique
77 //
78 // tracks Pipeline create info that will be constant accross all pipelines
79 // created from the same set of shaders. This includes all of the data for creating the
80 // pipeline layout, and SOME of the structs for the final pipeline
81 // Effectively just the pipeline layout + the vertex attribute formats
83 {
84 public:
87  // Maps shader stage to idx in `myShaderModules`
89 
90  // NOTE: currently, since pipeline layouts are built from shader
91  // files, they must be a specific shader type, and we
92  // will not have layouts that can be used with multiple
93  // pipeline types (e.g. graphics + compute) .. if changing
94  // this, pipeline type will need to be provided at higher
95  // level
97 
101 
102  // TODO: list of specialization constants
103  //UT_Array<RV_SpecializaitonConstant>
104 
105  // Creation Structs
106  bool hasShaderStage(VkShaderStageFlagBits stage) const;
108 };
109 
110 // ----------------------
111 // RV_VKPipelineLayout
112 //
113 // RAII wrapper for VkPipelineLayout, created using RV_VKPipelineLayoutInfo
115 {
116 public:
117  VkPipelineLayout getVkLayout() const { return myVkPipelineLayout; }
118  const RV_VKPipelineLayoutInfo& getInfo() const { return *myInfo; }
119 
121  RV_Instance* inst,
122  VkPipelineLayout pipe_layout,
123  RV_VKPipelineLayoutInfo&& info);
124 
125  RV_VKPipelineLayout(const RV_VKPipelineLayout&) = delete;
126  RV_VKPipelineLayout &operator=(const RV_VKPipelineLayout&) = delete;
127 
129 protected:
130  RV_Instance* myInst = nullptr;
131  VkPipelineLayout myVkPipelineLayout = VK_NULL_HANDLE;
132 
134 };
135 
137  RV_Instance* inst,
138  const char* name,
140 
142  RV_Instance* inst,
143  const char* name,
144  const UT_StringArray& filenames);
145 
146 #endif
#define VK_NULL_HANDLE
Definition: vulkan_core.h:45
VkShaderStageFlags myStages
const UT_Array< RV_VKPushConstantRange > & getRanges() const
RV_API RV_VKPipelineLayout * RVcreatePipelineLayout(RV_Instance *inst, const char *name, UT_Array< UT_UniquePtr< RV_VKShaderModule >> shaders)
UT_UniquePtr< RV_VKPipelineLayoutInfo > myInfo
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
Definition: UT_UniquePtr.h:39
GLintptr offset
Definition: glcorearb.h:665
const RV_VKPipelineLayoutInfo & getInfo() const
GLint GLint GLsizei GLint GLenum format
Definition: glcorearb.h:108
#define RV_API
Definition: RV_API.h:10
bool addShaderModule(UT_UniquePtr< RV_VKShaderModule > shader_module)
GLint location
Definition: glcorearb.h:805
UT_StringHolder myName
UT_Array< RV_VKAttributeInfo > myInputs
VkShaderStageFlagBits
Definition: vulkan_core.h:2594
UT_Array< UT_UniquePtr< RV_VKShaderModule > > myShaderModules
GLuint const GLchar * name
Definition: glcorearb.h:786
GLsizei GLsizei GLuint * shaders
Definition: glcorearb.h:797
VkPipelineLayout getVkLayout() const
Handle to the main interface of Vulkan.
Definition: RV_Instance.h:36
RV_ShaderType
Definition: RV_Type.h:405
GLsizeiptr size
Definition: glcorearb.h:664
RV_VKPushConstantInfo myPushConstants
VkFormat
Definition: vulkan_core.h:1386
UT_Array< RV_VKDescriptorSetInfo > myDescriptorSets
bool hasShaderStage(VkShaderStageFlagBits stage) const
UT_Map< VkShaderStageFlagBits, uint32_t > myShaderStageMap
UT_Array< RV_Uniform > myMembers
VkFlags VkShaderStageFlags
Definition: vulkan_core.h:2660