pipeline generator additions
[demo] / src / vulkan / vkutil-pipeline.h
index 4dac9af..9f8a266 100644 (file)
@@ -3,6 +3,16 @@
 
 #include <vulkan/vulkan.h>
 
+#define VERTEX_ATTRIB_BIT (1 << VKU_BIND_VERTEX)
+#define NORMAL_ATTRIB_BIT (1 << VKU_BIND_NORMAL)
+#define TEX_COORD_ATTRIB_BIT (1 << VKU_BIND_TEX_COORD)
+
+enum VkuVertexBindings {
+       VKU_BIND_VERTEX,
+       VKU_BIND_NORMAL,
+       VKU_BIND_TEX_COORD
+};
+
 enum VkuDynState {
        VKU_DS_VIEWPORT = 1 << 0,
        VKU_DS_SCISSOR  = 1 << 1,
@@ -12,7 +22,6 @@ enum VkuDynState {
 class VkuPipelineGenerator {
 private:
        VkPipelineShaderStageCreateInfo sdri[2];
-       VkPipelineVertexInputStateCreateInfo verti;
        VkPipelineInputAssemblyStateCreateInfo asmi;
        VkPipelineViewportStateCreateInfo viewpi;
        VkPipelineRasterizationStateCreateInfo rasti;
@@ -20,7 +29,13 @@ private:
        VkPipelineDepthStencilStateCreateInfo depthi;
        VkPipelineColorBlendStateCreateInfo cblendi;
 
-       VkPipelineLayout layout;
+       /* attributes */
+       std::vector<VkVertexInputBindingDescription> bind_descriptions;
+       std::vector<VkVertexInputAttributeDescription> attr_descriptions;
+
+       /* uniforms */
+       std::vector<VkDescriptorSetLayout> dset_layouts;
+       std::vector<VkPushConstantRange> push_const_ranges;
 
 public:
        VkuPipelineGenerator();
@@ -29,11 +44,11 @@ public:
        VkPipeline generate(VkuDynState dyn_flags) const;
 
        void set_shader_modules(VkShaderModule vs, VkShaderModule fs);
+       void set_attribute(uint32_t binding, uint32_t stride, uint32_t location,
+                       VkFormat format);
+       void set_descriptor_set_layout(const vku_descriptor &desc);
 
-       // TODO
-       void set_vertex_attributes();
-       void set_blend_state();
-       void set_layout();
+       void set_push_constant(); //TODO
 };
 
 #endif // VKUTIL_PIPELINE_H_