X-Git-Url: https://eleni.mutantstargoat.com/git/?p=demo;a=blobdiff_plain;f=src%2Fvulkan%2Fresources.cc;fp=src%2Fvulkan%2Fresources.cc;h=22932a62def7d40bd30159226c986843eaed07da;hp=0000000000000000000000000000000000000000;hb=f6ceb163227d00d7f97df1fc2dfbdd419c56277e;hpb=75b8713addd14a845e2fa8ad9a9d3d4a6a323bec diff --git a/src/vulkan/resources.cc b/src/vulkan/resources.cc new file mode 100644 index 0000000..22932a6 --- /dev/null +++ b/src/vulkan/resources.cc @@ -0,0 +1,40 @@ +#include +#include + +#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; +}