KhronosGroup / Vulkan-Hpp

Open-Source Vulkan C++ API
Apache License 2.0
3.08k stars 304 forks source link

vk::PipelineLayoutCreateInfo and vk::raii::DescriptorSetLayout #1915

Closed justinblaber closed 1 month ago

justinblaber commented 2 months ago

I've noticed this in a few places, but this is a specific example where it's slightly problematic. If have a std::vector of vk::raii::DescriptorSetLayout and try to pass it to vk::PipelineLayoutCreateInfo, it results in an error. To make this work you need to create an array of the non-raii version vk::DescriptorSetLayout like:

  layouts_descriptorset = std::vector<vk::DescriptorSetLayout>(
      layouts_descriptorset_raii.begin(), layouts_descriptorset_raii.end()
  );

So you need to create a temporary vector which is kind of annoying. The MultipleSets.cpp example seems to confirm this.

Wondering if having vk::raii::PipelineLayoutCreateInfo would be useful to take arrays of raii parameters so there's no need to mix vk::raii and vk::.

asuessenbach commented 2 months ago

You're right, you need to have an array of vk::DescriptorSetLayouts to pass into a vk::PipelineLayoutCreateInfo. vk::-handles are binary identical to the actual (C-)handles, and thus you can easily pass an array of them into the structure eventually passed into the actual vulkan C-function. vk::raii::-handles carry additional informations and thus are incompatible with the C-handles. Therefore, that copying is needed. Introducing some vk::raii::PipelineLayoutCreateInfo would introduce some potential complexities I'd like to avoid.

asuessenbach commented 1 month ago

Assuming, the question has been answered... Please re-open if not.