MCPcopy Create free account
hub / github.com/KhronosGroup/Vulkan-Tools / prepare_descriptor_set

Method prepare_descriptor_set

cube/cube.cpp:2541–2570  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2539}
2540
2541void Demo::prepare_descriptor_set() {
2542 auto const alloc_info = vk::DescriptorSetAllocateInfo().setDescriptorPool(desc_pool).setSetLayouts(desc_layout);
2543
2544 auto buffer_info = vk::DescriptorBufferInfo().setOffset(0).setRange(sizeof(vktexcube_vs_uniform));
2545
2546 std::array<vk::DescriptorImageInfo, texture_count> tex_descs;
2547 for (uint32_t i = 0; i < texture_count; i++) {
2548 tex_descs[i].setSampler(textures[i].sampler);
2549 tex_descs[i].setImageView(textures[i].view);
2550 tex_descs[i].setImageLayout(vk::ImageLayout::eShaderReadOnlyOptimal);
2551 }
2552
2553 std::array<vk::WriteDescriptorSet, 2> writes;
2554 writes[0].setDescriptorCount(1).setDescriptorType(vk::DescriptorType::eUniformBuffer).setPBufferInfo(&buffer_info);
2555 writes[1]
2556 .setDstBinding(1)
2557 .setDescriptorCount(texture_count)
2558 .setDescriptorType(vk::DescriptorType::eCombinedImageSampler)
2559 .setImageInfo(tex_descs);
2560
2561 for (auto &submission_resource : submission_resources) {
2562 auto result = device.allocateDescriptorSets(&alloc_info, &submission_resource.descriptor_set);
2563 VERIFY(result == vk::Result::eSuccess);
2564
2565 buffer_info.setBuffer(submission_resource.uniform_buffer);
2566 writes[0].setDstSet(submission_resource.descriptor_set);
2567 writes[1].setDstSet(submission_resource.descriptor_set);
2568 device.updateDescriptorSets(writes, {});
2569 }
2570}
2571
2572void Demo::prepare_framebuffers() {
2573 std::array<vk::ImageView, 2> attachments;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected