bool VulkanContext::createPools()

in RenderScriptMigrationSample/app/src/main/cpp/VulkanContext.cpp [186:224]


bool VulkanContext::createPools() {
    // Create descriptor pool
    mDescriptorPool = VulkanDescriptorPool(mDevice.handle());
    const std::vector<VkDescriptorPoolSize> descriptorPoolSizes = {
            {
                    .type = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
                    // We have three pipelines, each need 1 combined image sampler descriptor.
                    .descriptorCount = 3,
            },
            {
                    .type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE,
                    // We have three pipelines, each need 1 storage image descriptor.
                    .descriptorCount = 3,
            },
            {
                    .type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,
                    // We have three pipelines, each need 1 uniform buffer.
                    .descriptorCount = 3,
            },
    };
    const VkDescriptorPoolCreateInfo descriptorPoolDesc = {
            .sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO,
            .maxSets = 3,
            .poolSizeCount = static_cast<uint32_t>(descriptorPoolSizes.size()),
            .pPoolSizes = descriptorPoolSizes.data(),
    };
    CALL_VK(vkCreateDescriptorPool, mDevice.handle(), &descriptorPoolDesc, nullptr,
            mDescriptorPool.pHandle());

    // Create command pool
    mCommandPool = VulkanCommandPool(mDevice.handle());
    const VkCommandPoolCreateInfo cmdpoolDesc = {
            .sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO,
            .flags = VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT,
            .queueFamilyIndex = mQueueFamilyIndex,
    };
    CALL_VK(vkCreateCommandPool, mDevice.handle(), &cmdpoolDesc, nullptr, mCommandPool.pHandle());
    return true;
}