Skip to content

Commit

Permalink
Restrict commands taking an allocator as template argument to allocat…
Browse files Browse the repository at this point in the history
…ors of the correct data type (#1980)
  • Loading branch information
asuessenbach authored Oct 24, 2024
1 parent eecf79d commit e80b3fa
Show file tree
Hide file tree
Showing 9 changed files with 1,011 additions and 308 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ int main( int /*argc*/, char ** /*argv*/ )

std::cout << "PhysicalDevice " << i << " :" << std::endl;

// need to explicitly specify all the template arguments for getQueueFamilyProperties2 to make the compiler happy
using Chain = vk::StructureChain<vk::QueueFamilyProperties2, vk::QueueFamilyCheckpointPropertiesNV>;
auto queueFamilyProperties2 = physicalDevices[i].getQueueFamilyProperties2<Chain>();
for ( size_t j = 0; j < queueFamilyProperties2.size(); j++ )
Expand Down
2 changes: 1 addition & 1 deletion VulkanHppGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12327,7 +12327,7 @@ std::string VulkanHppGenerator::generateTypenameCheck( std::vector<size_t> const
CommandFlavourFlags flavourFlags ) const
{
std::string typenameCheck, enableIf;
if ( !( flavourFlags & CommandFlavourFlagBits::singular ) && ( flavourFlags & CommandFlavourFlagBits::withAllocator ) )
if ( !( flavourFlags & CommandFlavourFlagBits::singular ) )
{
for ( size_t i = 0; i < returnParams.size(); ++i )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,8 @@ int main( int /*argc*/, char ** /*argv*/ )

std::cout << "PhysicalDevice " << i << "\n";

// need to explicitly specify all the template arguments for getQueueFamilyProperties2 to make the compiler happy
using Chain = vk::StructureChain<vk::QueueFamilyProperties2, vk::QueueFamilyCheckpointPropertiesNV>;
auto queueFamilyProperties2 = physicalDevices[i].getQueueFamilyProperties2<Chain, std::allocator<Chain>, vk::DispatchLoaderDynamic>();
auto queueFamilyProperties2 = physicalDevices[i].getQueueFamilyProperties2<Chain>();
for ( size_t j = 0; j < queueFamilyProperties2.size(); j++ )
{
std::cout << std::string( "\t" ) << "QueueFamily " << j << "\n";
Expand Down
3 changes: 1 addition & 2 deletions tests/StructureChain/StructureChain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,7 @@ int main( int /*argc*/, char ** /*argv*/ )
unused( t1 );

using StructureChain = vk::StructureChain<vk::QueueFamilyProperties2, vk::QueueFamilyCheckpointPropertiesNV>;
using AllocatorType = std::vector<StructureChain>::allocator_type;
auto qfd = physicalDevice.getQueueFamilyProperties2<StructureChain, AllocatorType>( VULKAN_HPP_DEFAULT_DISPATCHER );
auto qfd = physicalDevice.getQueueFamilyProperties2<StructureChain>( VULKAN_HPP_DEFAULT_DISPATCHER );
unused( qfd );

// some tests with structures with allowDuplicate == true
Expand Down
455 changes: 364 additions & 91 deletions vulkan/vulkan_funcs.hpp

Large diffs are not rendered by default.

451 changes: 335 additions & 116 deletions vulkan/vulkan_handles.hpp

Large diffs are not rendered by default.

199 changes: 158 additions & 41 deletions vulkan/vulkansc_funcs.hpp

Large diffs are not rendered by default.

202 changes: 148 additions & 54 deletions vulkan/vulkansc_handles.hpp

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions vulkan/vulkansc_raii.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7368,6 +7368,9 @@ namespace VULKAN_HPP_NAMESPACE
VULKAN_HPP_NAMESPACE::Optional<const VULKAN_HPP_NAMESPACE::AllocationCallbacks> allocator ) const
VULKAN_HPP_RAII_CREATE_NOEXCEPT
{
VULKAN_HPP_ASSERT(
createInfo.flags & vk::DescriptorPoolCreateFlagBits::eFreeDescriptorSet &&
"createInfo.flags need to have vk::DescriptorPoolCreateFlagBits::eFreeDesriptors set in order to allow destruction of VULKAN_HPP_NAMESPACE::VULKAN_HPP_RAII_NAMESPACE::DescriptorSet which requires to return individual allocations to the pool" );
VULKAN_HPP_NAMESPACE::DescriptorPool descriptorPool;
VULKAN_HPP_NAMESPACE::Result result = static_cast<VULKAN_HPP_NAMESPACE::Result>( getDispatcher()->vkCreateDescriptorPool(
static_cast<VkDevice>( m_device ),
Expand Down

0 comments on commit e80b3fa

Please sign in to comment.