+#include <stdio.h>
+#include <string.h>
+
+#include "resources.h"
+#include "vkutil.h"
+
+ResourceVK::ResourceVK() {}
+ResourceVK::~ResourceVK() {}
+
+bool ResourceVK::create_ds_layout(unsigned int num, VkDescriptorType type,
+ VkShaderStageFlags stage, VkSampler *sampler)
+{
+ res_type = RES_DESC_SET;
+
+ /* layout binding */
+ VkDescriptorSetLayoutBinding bind;
+
+ memset(&bind, 0, sizeof bind);
+ bind.binding = num;
+ bind.descriptorType = type;
+ bind.stageFlags = stage;
+
+ bind.pImmutableSamplers = sampler;
+
+ /* layout : for the moment:
+ * one layout per ds, (=> 1 binding point)
+ * */
+
+ VkDescriptorSetLayoutCreateInfo dslinf;
+ memset(&dslinf, 0, sizeof dslinf);
+ dslinf.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO;
+ dslinf.bindingCount = 1;
+ dslinf.pBindings = &bind;
+
+ if(vkCreateDescriptorSetLayout(vk_device, &dslinf, 0, &layout) != VK_SUCCESS) {
+ fprintf(stderr, "Failed to create descriptor set layout.\n");
+ return false;
+ }
+ return true;
+}