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 <VE/VE_VK.h>
24 #include "RV_Type.h"
25 #include "RV_TypePtrs.h"
26 #include "RV_VKDescriptorSet.h"
27 
28 class RV_Instance;
29 class RV_VKShaderModule;
30 
32 {
33 public:
35  int location = -1;
37 };
38 
39 // ------------------------
40 // RV_VKPushConstantRange
42 {
45  int myOffset;
46  int mySize;
47 };
48 
49 // -----------------------
50 // Push Constant info
52 {
53 public:
54  RV_VKPushConstantInfo() = default;
56  UT_Array<RV_Uniform>&& members,
58  int offset,
59  int size);
60 
62  { return myRanges; }
63 
64  bool merge(const RV_VKPushConstantInfo& other);
65  bool merge(const RV_VKPushConstantRange& new_range);
66 
67 private:
69  friend class RV_VKPipelineLayout;
70 };
71 
72 // -----------------------
73 // RV_VKPipelineLayoutInfo
74 //
75 // NOTE: unlike other info classes, this one owns resource handles
76 // so can't be directly copied
77 // It shouldn't need to be, as shader layouts are unique
78 //
79 // tracks Pipeline create info that will be constant accross all pipelines
80 // created from the same set of shaders. This includes all of the data for creating the
81 // pipeline layout, and SOME of the structs for the final pipeline
82 // Effectively just the pipeline layout + the vertex attribute formats
84 {
85 public:
88  // Maps shader stage to idx in `myShaderModules`
90 
91  // NOTE: currently, since pipeline layouts are built from shader
92  // files, they must be a specific shader type, and we
93  // will not have layouts that can be used with multiple
94  // pipeline types (e.g. graphics + compute) .. if changing
95  // this, pipeline type will need to be provided at higher
96  // level
98 
102 
103  // TODO: list of specialization constants
104  //UT_Array<RV_SpecializaitonConstant>
105 
106  // Creation Structs
107  bool hasShaderStage(VkShaderStageFlagBits stage) const;
109 };
110 
111 // ----------------------
112 // RV_VKPipelineLayout
113 //
114 // RAII wrapper for VkPipelineLayout, created using RV_VKPipelineLayoutInfo
116 {
117 public:
118  VkPipelineLayout getVkLayout() const { return myVkPipelineLayout; }
119  const RV_VKPipelineLayoutInfo& getInfo() const { return *myInfo; }
120 
122  RV_Instance* inst,
123  VkPipelineLayout pipe_layout,
124  RV_VKPipelineLayoutInfo&& info);
125 
126  RV_VKPipelineLayout(const RV_VKPipelineLayout&) = delete;
128 
130 protected:
131  RV_Instance* myInst = nullptr;
132  VkPipelineLayout myVkPipelineLayout = VK_NULL_HANDLE;
133 
135 };
136 
138  RV_Instance* inst,
139  const char* name,
141 
143  RV_Instance* inst,
144  const char* name,
145  const UT_StringArray& filenames);
146 
147 #endif
#define VK_NULL_HANDLE
Definition: vulkan_core.h:45
VkShaderStageFlags myStages
const UT_Array< RV_VKPushConstantRange > & getRanges() const
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:38
RV_ShaderType
Definition: RV_Type.h:427
GLsizeiptr size
Definition: glcorearb.h:664
RV_VKPushConstantInfo myPushConstants
LeafData & operator=(const LeafData &)=delete
UT_UniquePtr< RV_VKPipelineLayout > RV_VKPipelineLayoutPtr
Definition: RV_TypePtrs.h:63
VkFormat
Definition: vulkan_core.h:1386
RV_API RV_VKPipelineLayoutPtr RVcreatePipelineLayout(RV_Instance *inst, const char *name, UT_Array< UT_UniquePtr< RV_VKShaderModule >> shaders)
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