本文整理汇总了C++中VkLayerDispatchTable::CreateDescriptorSetLayout方法的典型用法代码示例。如果您正苦于以下问题:C++ VkLayerDispatchTable::CreateDescriptorSetLayout方法的具体用法?C++ VkLayerDispatchTable::CreateDescriptorSetLayout怎么用?C++ VkLayerDispatchTable::CreateDescriptorSetLayout使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VkLayerDispatchTable
的用法示例。
在下文中一共展示了VkLayerDispatchTable::CreateDescriptorSetLayout方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: after_device_create
//.........这里部分代码省略.........
#ifdef OVERLAY_DEBUG
printf("Font upload done.\n");
#endif
/* create a sampler to use with the texture */
VkSamplerCreateInfo sci;
sci.sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO;
sci.pNext = nullptr;
sci.flags = 0;
sci.magFilter = VK_FILTER_NEAREST;
sci.minFilter = VK_FILTER_NEAREST;
sci.mipmapMode = VK_SAMPLER_MIPMAP_MODE_NEAREST;
sci.addressModeU = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE;
sci.addressModeV = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE;
sci.addressModeW = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE;
sci.mipLodBias = 0.0f;
sci.anisotropyEnable = false;
sci.maxAnisotropy = 1;
sci.compareEnable = false;
sci.compareOp = VK_COMPARE_OP_NEVER;
sci.minLod = 0.0f;
sci.maxLod = 0.0f;
sci.borderColor = VK_BORDER_COLOR_FLOAT_OPAQUE_WHITE;
sci.unnormalizedCoordinates = VK_FALSE;
err = pTable->CreateSampler(device, &sci, nullptr, &data->sampler);
assert(!err);
/* descriptor set stuff so we can use the texture from a shader. */
VkDescriptorSetLayoutBinding dslb[1];
dslb[0].binding = 0;
dslb[0].descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER;
dslb[0].descriptorCount = 1;
dslb[0].stageFlags = VK_SHADER_STAGE_FRAGMENT_BIT;
dslb[0].pImmutableSamplers = nullptr;
VkDescriptorSetLayoutCreateInfo dslci;
memset(&dslci, 0, sizeof(dslci));
dslci.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO;
dslci.pNext = nullptr;
dslci.bindingCount = 1;
dslci.pBindings = dslb;
err = pTable->CreateDescriptorSetLayout(device, &dslci, nullptr, &data->dsl);
assert(!err);
VkPipelineLayoutCreateInfo plci;
memset(&plci, 0, sizeof(plci));
plci.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO;
plci.setLayoutCount = 1;
plci.pSetLayouts = &data->dsl;
err = pTable->CreatePipelineLayout(device, &plci, nullptr, &data->pl);
assert(!err);
VkDescriptorPoolSize dtc[1];
dtc[0].type = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER;
dtc[0].descriptorCount = 1;
VkDescriptorPoolCreateInfo dpci;
dpci.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO;
dpci.pNext = nullptr;
dpci.flags = 0;
dpci.maxSets = 1;
dpci.poolSizeCount = 1;
dpci.pPoolSizes = dtc;
err = pTable->CreateDescriptorPool(device, &dpci, nullptr, &data->desc_pool);
assert(!err);
VkDescriptorSetAllocateInfo dsai;
dsai.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO;
dsai.pNext = nullptr;
dsai.descriptorPool = data->desc_pool;
dsai.descriptorSetCount = 1;
dsai.pSetLayouts = &data->dsl;
err = pTable->AllocateDescriptorSets(device, &dsai, &data->desc_set);
assert(!err);
VkDescriptorImageInfo descs[1];
descs[0].sampler = data->sampler;
descs[0].imageView = data->fontGlyphsImageView;
descs[0].imageLayout = VK_IMAGE_LAYOUT_GENERAL; // TODO: cube does this, is it correct?
VkWriteDescriptorSet writes[1];
memset(&writes, 0, sizeof(writes));
writes[0].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET;
writes[0].dstSet = data->desc_set;
writes[0].dstBinding = 0;
writes[0].descriptorCount = 1;
writes[0].descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER;
writes[0].pImageInfo = descs;
pTable->UpdateDescriptorSets(device, 1, writes, 0, nullptr);
VkFenceCreateInfo fci;
fci.sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO;
fci.pNext = NULL;
fci.flags = VK_FENCE_CREATE_SIGNALED_BIT;
pTable->CreateFence(device, &fci, NULL, &data->fence);
}