From bc19e479f957953468375c38c49a14931ecafe25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20S=C3=BC=C3=9Fenbach?= Date: Tue, 13 Jun 2023 14:24:10 +0200 Subject: [PATCH] Fix determination of StructureChainAllocater usage for returned parameters. (#1591) --- VulkanHppGenerator.cpp | 30 +++++++++++++++---- VulkanHppGenerator.hpp | 2 ++ tests/CMakeLists.txt | 1 + tests/EnableBetaExtensions/CMakeLists.txt | 17 +++++++++++ .../EnableBetaExtensions.cpp | 24 +++++++++++++++ vulkan/vulkan_funcs.hpp | 4 +-- vulkan/vulkan_handles.hpp | 10 +++---- 7 files changed, 76 insertions(+), 12 deletions(-) create mode 100644 tests/EnableBetaExtensions/CMakeLists.txt create mode 100644 tests/EnableBetaExtensions/EnableBetaExtensions.cpp diff --git a/VulkanHppGenerator.cpp b/VulkanHppGenerator.cpp index 9991af6..dcb540b 100644 --- a/VulkanHppGenerator.cpp +++ b/VulkanHppGenerator.cpp @@ -2099,6 +2099,7 @@ std::string VulkanHppGenerator::generateArgumentListEnhanced( std::vector const & skippedParams, std::set const & singularParams, std::set const & templatedParams, + std::vector const & chainedReturnParams, bool definition, CommandFlavourFlags flavourFlags, bool withDispatcher ) const @@ -2212,7 +2213,22 @@ std::string VulkanHppGenerator::generateArgumentListEnhanced( std::vector const & returnParams, std::map const & vectorParams, + std::vector const & chainedReturnParams, bool definition, std::vector const & dataTypes, CommandFlavourFlags flavourFlags ) const @@ -10502,7 +10519,10 @@ std::string VulkanHppGenerator::generateTypenameCheck( std::vector const { if ( vectorParams.find( returnParams[i] ) != vectorParams.end() ) { - std::string elementType = ( flavourFlags & CommandFlavourFlagBits::chained ) ? "StructureChain" : stripPrefix( dataTypes[i], "VULKAN_HPP_NAMESPACE::" ); + std::string elementType = ( ( flavourFlags & CommandFlavourFlagBits::chained ) && + ( std::find( chainedReturnParams.begin(), chainedReturnParams.end(), returnParams[i] ) != chainedReturnParams.end() ) ) + ? "StructureChain" + : stripPrefix( dataTypes[i], "VULKAN_HPP_NAMESPACE::" ); std::string extendedElementType = elementType; if ( flavourFlags & CommandFlavourFlagBits::unique ) { @@ -11973,7 +11993,7 @@ void VulkanHppGenerator::readExtension( tinyxml2::XMLElement const * element ) { "(VK_KHR_get_physical_device_properties2,VK_VERSION_1_1)+(VK_KHR_dynamic_rendering,VK_VERSION_1_3)", "VK_KHR_get_physical_device_properties2+VK_KHR_dynamic_rendering,VK_VERSION_1_1+VK_KHR_dynamic_rendering,VK_VERSION_1_3" } }; - auto canonicalIt = complexToCanonicalDepends.find( attribute.second ); + auto canonicalIt = complexToCanonicalDepends.find( attribute.second ); std::string depends; if ( canonicalIt == complexToCanonicalDepends.end() ) { diff --git a/VulkanHppGenerator.hpp b/VulkanHppGenerator.hpp index 942edd2..4fc95ae 100644 --- a/VulkanHppGenerator.hpp +++ b/VulkanHppGenerator.hpp @@ -491,6 +491,7 @@ private: std::set const & skippedParams, std::set const & singularParams, std::set const & templatedParams, + std::vector const & chainedReturnParams, bool definition, CommandFlavourFlags flavourFlags, bool withDispatcher ) const; @@ -886,6 +887,7 @@ private: std::string generateThrowResultException() const; std::string generateTypenameCheck( std::vector const & returnParams, std::map const & vectorParams, + std::vector const & chainedReturnParams, bool definition, std::vector const & dataTypes, CommandFlavourFlags flavourFlags ) const; diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index e9861f0..2955ad0 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -20,6 +20,7 @@ add_subdirectory( DispatchLoaderDynamic ) add_subdirectory( DispatchLoaderDynamicSharedLibrary ) add_subdirectory( DispatchLoaderDynamicSharedLibraryClient ) add_subdirectory( DispatchLoaderStatic ) +add_subdirectory( EnableBetaExtensions ) add_subdirectory( ExtensionInspection ) add_subdirectory( Flags ) add_subdirectory( FormatTraits ) diff --git a/tests/EnableBetaExtensions/CMakeLists.txt b/tests/EnableBetaExtensions/CMakeLists.txt new file mode 100644 index 0000000..1117203 --- /dev/null +++ b/tests/EnableBetaExtensions/CMakeLists.txt @@ -0,0 +1,17 @@ +# Copyright(c) 2023, NVIDIA CORPORATION. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +if( NOT VULKAN_HPP_TESTS_BUILD_ONLY_DYNAMIC ) + vulkan_hpp__setup_test( NAME EnableBetaExtensions ) +endif() \ No newline at end of file diff --git a/tests/EnableBetaExtensions/EnableBetaExtensions.cpp b/tests/EnableBetaExtensions/EnableBetaExtensions.cpp new file mode 100644 index 0000000..f3b0ef3 --- /dev/null +++ b/tests/EnableBetaExtensions/EnableBetaExtensions.cpp @@ -0,0 +1,24 @@ +// Copyright(c) 2023, NVIDIA CORPORATION. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// VulkanHpp Tests : EnableBetaExtensions +// Compile test with VK_ENABLE_BETA_EXTENSIONS defined + +#define VK_ENABLE_BETA_EXTENSIONS +#include + +int main(int /*argc*/, char** /*argv*/) +{ + return 0; +} diff --git a/vulkan/vulkan_funcs.hpp b/vulkan/vulkan_funcs.hpp index 0d7174a..e99c5a0 100644 --- a/vulkan/vulkan_funcs.hpp +++ b/vulkan/vulkan_funcs.hpp @@ -18684,11 +18684,11 @@ namespace VULKAN_HPP_NAMESPACE typename Uint8_tAllocator, typename Dispatch, typename B2, - typename std::enable_if::value, int>::type> + typename std::enable_if::value, int>::type> VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE typename ResultValueType, std::vector>>::type Device::getEncodedVideoSessionParametersKHR( const VULKAN_HPP_NAMESPACE::VideoEncodeSessionParametersGetInfoKHR & videoSessionParametersInfo, - StructureChainAllocator & structureChainAllocator, + Uint8_tAllocator & uint8_tAllocator, Dispatch const & d ) const { VULKAN_HPP_ASSERT( d.getVkHeaderVersion() == VK_HEADER_VERSION ); diff --git a/vulkan/vulkan_handles.hpp b/vulkan/vulkan_handles.hpp index 567f51d..b464613 100644 --- a/vulkan/vulkan_handles.hpp +++ b/vulkan/vulkan_handles.hpp @@ -12198,13 +12198,13 @@ namespace VULKAN_HPP_NAMESPACE template , - typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE, - typename B2 = StructureChainAllocator, - typename std::enable_if::value, int>::type = 0> + typename Uint8_tAllocator = std::allocator, + typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE, + typename B2 = Uint8_tAllocator, + typename std::enable_if::value, int>::type = 0> VULKAN_HPP_NODISCARD typename ResultValueType, std::vector>>::type getEncodedVideoSessionParametersKHR( const VULKAN_HPP_NAMESPACE::VideoEncodeSessionParametersGetInfoKHR & videoSessionParametersInfo, - StructureChainAllocator & structureChainAllocator, + Uint8_tAllocator & uint8_tAllocator, Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const; # endif /* VULKAN_HPP_DISABLE_ENHANCED_MODE */ #endif /*VK_ENABLE_BETA_EXTENSIONS*/