Compare commits

...

4 Commits

Author SHA1 Message Date
Jan Kuhlmann 1dd0f87196
Merge 55b7ba81bc into e511715fce 2025-11-06 11:04:52 +01:00
Sharadh Rajaraman e511715fce
Do not `export import std` as a macro (#2340)
Set Version Tag / set-version-tag (push) Has been cancelled Details
* Do not export-import `std` as a macro

* Move warning expansion to macros file, and create a macro for it
- Also remove macro for `std.compat` and hardcode it
2025-11-06 10:59:34 +01:00
Andreas Süßenbach d0b04b733a
Removed special handling for VkDeviceFaultInfoEXT, which was plainly wrong. (#2343) 2025-11-06 08:22:31 +01:00
Andreas Süßenbach 3a948949cc
Extent function call tests with Sparse resource memory management API commands (optional) (#2341)
Set Version Tag / set-version-tag (push) Has been cancelled Details
2025-11-04 13:48:27 +01:00
10 changed files with 163 additions and 174 deletions

View File

@ -2060,8 +2060,7 @@ std::string VulkanHppGenerator::generateArgumentListEnhanced( std::vector<ParamD
}
else if ( params[i].optional )
{
arguments.push_back( "Optional<" + stripPostfix( composedType, " *" ) + "> " + name +
( ( definition || withAllocators ) ? "" : " = nullptr" ) );
arguments.push_back( "Optional<" + stripPostfix( composedType, " *" ) + "> " + name + ( ( definition || withAllocators ) ? "" : " = nullptr" ) );
hasDefaultAssignment = true;
}
else
@ -2079,8 +2078,7 @@ std::string VulkanHppGenerator::generateArgumentListEnhanced( std::vector<ParamD
assert( params[i].type.type == "char" );
if ( params[i].optional )
{
arguments.push_back( "Optional<const std::string> " + name +
( ( definition || withAllocators ) ? "" : " = nullptr" ) );
arguments.push_back( "Optional<const std::string> " + name + ( ( definition || withAllocators ) ? "" : " = nullptr" ) );
hasDefaultAssignment = true;
}
else
@ -11977,82 +11975,6 @@ std::string VulkanHppGenerator::generateStructure( std::pair<std::string, Struct
std::string str = "\n" + enter;
std::string constructorsAndSetters;
if ( strcmp( &structure.first[0], "VkDeviceFaultInfoEXT" ) == 0 )
{
// special handling for this structure, as it is filled with dynamic memory on VULKAN_HPP_NAMESPACE::Device::getFaultInfoEXT!
constructorsAndSetters += R"(
#if !defined( VULKAN_HPP_NO_CONSTRUCTORS ) && !defined( VULKAN_HPP_NO_STRUCT_CONSTRUCTORS )
VULKAN_HPP_CONSTEXPR_14 DeviceFaultInfoEXT( std::array<char, VK_MAX_DESCRIPTION_SIZE> const & description_ = {},
DeviceFaultAddressInfoEXT * pAddressInfos_ = {},
DeviceFaultVendorInfoEXT * pVendorInfos_ = {},
void * pVendorBinaryData_ = {},
void * pNext_ = nullptr ) VULKAN_HPP_NOEXCEPT
: pNext{ pNext_ }
, description{ description_ }
, pAddressInfos{ pAddressInfos_ }
, pVendorInfos{ pVendorInfos_ }
, pVendorBinaryData{ pVendorBinaryData_ }
{
}
# ifdef VULKAN_HPP_DISABLE_ENHANCED_MODE
VULKAN_HPP_CONSTEXPR_14 DeviceFaultInfoEXT( DeviceFaultInfoEXT const & rhs ) VULKAN_HPP_NOEXCEPT = default;
DeviceFaultInfoEXT( VkDeviceFaultInfoEXT const & rhs ) VULKAN_HPP_NOEXCEPT : DeviceFaultInfoEXT( *reinterpret_cast<DeviceFaultInfoEXT const *>( &rhs ) ) {}
DeviceFaultInfoEXT & operator=( DeviceFaultInfoEXT const & rhs ) VULKAN_HPP_NOEXCEPT = default;
# else
DeviceFaultInfoEXT( DeviceFaultInfoEXT const & ) = delete;
DeviceFaultInfoEXT & operator=( DeviceFaultInfoEXT const & ) = delete;
DeviceFaultInfoEXT( DeviceFaultInfoEXT && rhs ) VULKAN_HPP_NOEXCEPT
: pNext{ rhs.pNext }
, pAddressInfos{ rhs.pAddressInfos }
, pVendorInfos{ rhs.pVendorInfos }
, pVendorBinaryData{ rhs.pVendorBinaryData }
{
memcpy( description, rhs.description, VK_MAX_DESCRIPTION_SIZE );
rhs.pNext = nullptr;
memset( rhs.description, 0, VK_MAX_DESCRIPTION_SIZE );
rhs.pAddressInfos = nullptr;
rhs.pVendorInfos = nullptr;
rhs.pVendorBinaryData = nullptr;
}
DeviceFaultInfoEXT & operator=( DeviceFaultInfoEXT && rhs ) VULKAN_HPP_NOEXCEPT
{
free( pAddressInfos );
free( pVendorInfos );
free( pVendorBinaryData );
pNext = rhs.pNext;
memcpy( description, rhs.description, VK_MAX_DESCRIPTION_SIZE );
pAddressInfos = rhs.pAddressInfos;
pVendorInfos = rhs.pVendorInfos;
pVendorBinaryData = rhs.pVendorBinaryData;
rhs.pNext = nullptr;
memset( rhs.description, 0, VK_MAX_DESCRIPTION_SIZE );
rhs.pAddressInfos = nullptr;
rhs.pVendorInfos = nullptr;
rhs.pVendorBinaryData = nullptr;
return *this;
}
~DeviceFaultInfoEXT() VULKAN_HPP_NOEXCEPT
{
free( pAddressInfos );
free( pVendorInfos );
free( pVendorBinaryData );
}
# endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/
#endif /*VULKAN_HPP_NO_CONSTRUCTORS*/
)";
}
else
{
static const std::string constructorsTemplate = R"(
#if !defined( VULKAN_HPP_NO_CONSTRUCTORS ) && !defined( VULKAN_HPP_NO_STRUCT_CONSTRUCTORS )
${pushIgnored}${constructors}
@ -12108,7 +12030,6 @@ ${deprecatedConstructors}
{ "pushIgnored", pushIgnored },
{ "structName", stripPrefix( structure.first, "Vk" ) },
{ "subConstructors", generateStructSubConstructor( structure ) } } );
}
if ( !structure.second.returnedOnly )
{

View File

@ -13,12 +13,7 @@ module;
"To silence this warning, define the VULKAN_HPP_CXX_MODULE_EXPERIMENTAL_WARNING macro.\n\n" \
"For feedback, go to: https://github.com/KhronosGroup/Vulkan-Hpp/issues"
# if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__)
_Pragma(VULKAN_HPP_STRINGIFY(GCC warning VULKAN_HPP_CXX_MODULE_EXPERIMENTAL_WARNING))
# elif defined(_MSC_VER)
_Pragma(VULKAN_HPP_STRINGIFY(message(__FILE__ "(" VULKAN_HPP_STRINGIFY(__LINE__) "): warning: " VULKAN_HPP_CXX_MODULE_EXPERIMENTAL_WARNING)))
# endif
VULKAN_HPP_COMPILE_WARNING( VULKAN_HPP_CXX_MODULE_EXPERIMENTAL_WARNING )
#endif
#include <vulkan/${api}.hpp>
@ -29,7 +24,7 @@ _Pragma(VULKAN_HPP_STRINGIFY(message(__FILE__ "(" VULKAN_HPP_STRINGIFY(__LINE__)
#include <vulkan/${api}_shared.hpp>
export module ${api}_hpp;
export import VULKAN_HPP_STD_MODULE;
export import std.compat;
export namespace VULKAN_HPP_NAMESPACE
{

View File

@ -30,6 +30,20 @@ ${licenseHeader}
# include <ciso646>
#endif
#define VULKAN_HPP_STRINGIFY2( text ) #text
#define VULKAN_HPP_STRINGIFY( text ) VULKAN_HPP_STRINGIFY2( text )
#define VULKAN_HPP_NAMESPACE_STRING VULKAN_HPP_STRINGIFY( VULKAN_HPP_NAMESPACE )
#if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__)
# define VULKAN_HPP_COMPILE_WARNING( text ) \
_Pragma( VULKAN_HPP_STRINGIFY( GCC warning text ))
#elif defined(_MSC_VER)
# define VULKAN_HPP_COMPILE_WARNING( text ) \
_Pragma( VULKAN_HPP_STRINGIFY( message(__FILE__ "(" VULKAN_HPP_STRINGIFY(__LINE__) "): warning: " text )))
#else
# define VULKAN_HPP_COMPILE_WARNING( text )
#endif
#if defined( VULKAN_HPP_DISABLE_ENHANCED_MODE )
# if !defined( VULKAN_HPP_NO_SMART_HANDLE )
# define VULKAN_HPP_NO_SMART_HANDLE
@ -82,8 +96,8 @@ ${licenseHeader}
# define VULKAN_HPP_SUPPORT_SPAN
#endif
#if !defined( VULKAN_HPP_STD_MODULE ) && defined( __cpp_modules ) && defined( __cpp_lib_modules )
# define VULKAN_HPP_STD_MODULE std.compat
#if defined( VULKAN_HPP_CXX_MODULE ) && !( defined( __cpp_modules ) && defined( __cpp_lib_modules ) )
VULKAN_HPP_COMPILE_WARNING( "This is a non-conforming implementation of C++ named modules and the standard library module." )
#endif
${vulkan_64_bit_ptr_defines}
@ -213,10 +227,6 @@ ${vulkan_64_bit_ptr_defines}
# define VULKAN_HPP_NAMESPACE vk
#endif
#define VULKAN_HPP_STRINGIFY2( text ) #text
#define VULKAN_HPP_STRINGIFY( text ) VULKAN_HPP_STRINGIFY2( text )
#define VULKAN_HPP_NAMESPACE_STRING VULKAN_HPP_STRINGIFY( VULKAN_HPP_NAMESPACE )
#if !defined( VULKAN_HPP_DISPATCH_LOADER_DYNAMIC )
# if defined( VK_NO_PROTOTYPES )
# define VULKAN_HPP_DISPATCH_LOADER_DYNAMIC 1

View File

@ -28,7 +28,7 @@
# include <cassert>
# include <cstring>
# include <cstdlib>
import VULKAN_HPP_STD_MODULE;
import std.compat;
#endif
#include <vulkan/${vulkan_h}>

View File

@ -426,6 +426,84 @@ int main( int /*argc*/, char ** /*argv*/ )
vk::MemoryRequirements memoryRequirements = device.getImageMemoryRequirements( image );
}
// Sparse resource memory management API commands (optional)
{
vk::Device device;
vk::Image image;
uint32_t sparseMemoryRequirementCount;
device.getImageSparseMemoryRequirements( image, &sparseMemoryRequirementCount, nullptr );
if ( sparseMemoryRequirementCount )
{
std::vector<vk::SparseImageMemoryRequirements> sparseImageMemoryRequirements( sparseMemoryRequirementCount );
device.getImageSparseMemoryRequirements( image, &sparseMemoryRequirementCount, sparseImageMemoryRequirements.data() );
}
}
{
vk::Device device;
vk::Image image;
std::vector<vk::SparseImageMemoryRequirements> sparseImageMemoryRequirementss = device.getImageSparseMemoryRequirements( image );
}
{
vk::Device device;
vk::Image image;
using Allocator = std::allocator<vk::SparseImageMemoryRequirements>;
Allocator allocator;
std::vector<vk::SparseImageMemoryRequirements, Allocator> sparseImageMemoryRequirementss = device.getImageSparseMemoryRequirements( image, allocator );
}
{
vk::PhysicalDevice physicalDevice;
vk::Format format = {};
vk::ImageType type = {};
vk::SampleCountFlagBits samples = {};
vk::ImageUsageFlags usage = {};
vk::ImageTiling tiling = {};
uint32_t propertyCount = 0;
physicalDevice.getSparseImageFormatProperties( format, type, samples, usage, tiling, &propertyCount, nullptr );
if ( propertyCount )
{
std::vector<vk::SparseImageFormatProperties> sparseImageFormatProperties( propertyCount );
physicalDevice.getSparseImageFormatProperties( format, type, samples, usage, tiling, &propertyCount, sparseImageFormatProperties.data() );
}
}
{
vk::PhysicalDevice physicalDevice;
vk::Format format = {};
vk::ImageType type = {};
vk::SampleCountFlagBits samples = {};
vk::ImageUsageFlags usage = {};
vk::ImageTiling tiling = {};
std::vector<vk::SparseImageFormatProperties> sparseImageFormatProperties =
physicalDevice.getSparseImageFormatProperties( format, type, samples, usage, tiling );
}
{
vk::PhysicalDevice physicalDevice;
vk::Format format = {};
vk::ImageType type = {};
vk::SampleCountFlagBits samples = {};
vk::ImageUsageFlags usage = {};
vk::ImageTiling tiling = {};
using Allocator = std::allocator<vk::SparseImageFormatProperties>;
Allocator allocator;
std::vector<vk::SparseImageFormatProperties, Allocator> sparseImageFormatProperties =
physicalDevice.getSparseImageFormatProperties( format, type, samples, usage, tiling, allocator );
}
{
vk::Queue queue;
uint32_t bindInfoCount = 1;
vk::BindSparseInfo bindSparseInfo;
vk::Fence fence;
vk::Result result = queue.bindSparse( bindInfoCount, &bindSparseInfo, fence );
}
{
vk::Queue queue;
vk::BindSparseInfo bindSparseInfo;
vk::Fence fence;
queue.bindSparse( bindSparseInfo, fence );
}
#if 0
{
vk::PhysicalDevice physicalDevice;

View File

@ -216,5 +216,29 @@ int main( int /*argc*/, char ** /*argv*/ )
vk::MemoryRequirements memoryRequirements = image.getMemoryRequirements();
}
// Sparse resource memory management API commands (optional)
{
vk::raii::Image image = nullptr;
std::vector<vk::SparseImageMemoryRequirements> sparseImageMemoryRequirements = image.getSparseMemoryRequirements();
}
{
vk::raii::PhysicalDevice physicalDevice = nullptr;
vk::Format format = {};
vk::ImageType type = {};
vk::SampleCountFlagBits samples = {};
vk::ImageUsageFlags usage = {};
vk::ImageTiling tiling = {};
std::vector<vk::SparseImageFormatProperties> sparseImageFormatProperties =
physicalDevice.getSparseImageFormatProperties( format, type, samples, usage, tiling );
}
{
vk::raii::Queue queue = nullptr;
vk::BindSparseInfo bindSparseInfo;
vk::Fence fence;
queue.bindSparse( bindSparseInfo, fence );
}
return 0;
}

View File

@ -18,11 +18,7 @@ module;
"To silence this warning, define the VULKAN_HPP_CXX_MODULE_EXPERIMENTAL_WARNING macro.\n\n" \
"For feedback, go to: https://github.com/KhronosGroup/Vulkan-Hpp/issues"
# if defined( __clang__ ) || defined( __GNUC__ ) || defined( __GNUG__ )
_Pragma( VULKAN_HPP_STRINGIFY( GCC warning VULKAN_HPP_CXX_MODULE_EXPERIMENTAL_WARNING ) )
# elif defined( _MSC_VER )
_Pragma( VULKAN_HPP_STRINGIFY( message( __FILE__ "(" VULKAN_HPP_STRINGIFY( __LINE__ ) "): warning: " VULKAN_HPP_CXX_MODULE_EXPERIMENTAL_WARNING ) ) )
# endif
VULKAN_HPP_COMPILE_WARNING( VULKAN_HPP_CXX_MODULE_EXPERIMENTAL_WARNING )
#endif
#include <vulkan/vulkan.hpp>
@ -33,7 +29,7 @@ _Pragma( VULKAN_HPP_STRINGIFY( message( __FILE__ "(" VULKAN_HPP_STRINGIFY( __LIN
#include <vulkan/vulkan_shared.hpp>
export module vulkan_hpp;
export import VULKAN_HPP_STD_MODULE;
export import std.compat;
export namespace VULKAN_HPP_NAMESPACE
{
@ -9369,8 +9365,7 @@ export namespace std
#endif
} // namespace std
export
{
export {
// This VkFlags type is used as part of a bitfield in some structures.
// As it can't be mimicked by vk-data types, we need to export just that.
using ::VkGeometryInstanceFlagsKHR;

View File

@ -38,7 +38,7 @@
# include <cassert>
# include <cstdlib>
# include <cstring>
import VULKAN_HPP_STD_MODULE;
import std.compat;
#endif
#include <vulkan/vulkan.h>

View File

@ -35,6 +35,18 @@
# include <ciso646>
#endif
#define VULKAN_HPP_STRINGIFY2( text ) #text
#define VULKAN_HPP_STRINGIFY( text ) VULKAN_HPP_STRINGIFY2( text )
#define VULKAN_HPP_NAMESPACE_STRING VULKAN_HPP_STRINGIFY( VULKAN_HPP_NAMESPACE )
#if defined( __clang__ ) || defined( __GNUC__ ) || defined( __GNUG__ )
# define VULKAN_HPP_COMPILE_WARNING( text ) _Pragma( VULKAN_HPP_STRINGIFY( GCC warning text ) )
#elif defined( _MSC_VER )
# define VULKAN_HPP_COMPILE_WARNING( text ) _Pragma( VULKAN_HPP_STRINGIFY( message( __FILE__ "(" VULKAN_HPP_STRINGIFY( __LINE__ ) "): warning: " text ) ) )
#else
# define VULKAN_HPP_COMPILE_WARNING( text )
#endif
#if defined( VULKAN_HPP_DISABLE_ENHANCED_MODE )
# if !defined( VULKAN_HPP_NO_SMART_HANDLE )
# define VULKAN_HPP_NO_SMART_HANDLE
@ -87,8 +99,8 @@
# define VULKAN_HPP_SUPPORT_SPAN
#endif
#if !defined( VULKAN_HPP_STD_MODULE ) && defined( __cpp_modules ) && defined( __cpp_lib_modules )
# define VULKAN_HPP_STD_MODULE std.compat
#if defined( VULKAN_HPP_CXX_MODULE ) && !( defined( __cpp_modules ) && defined( __cpp_lib_modules ) )
VULKAN_HPP_COMPILE_WARNING( "This is a non-conforming implementation of C++ named modules and the standard library module." )
#endif
#ifndef VK_USE_64_BIT_PTR_DEFINES
@ -225,10 +237,6 @@
# define VULKAN_HPP_NAMESPACE vk
#endif
#define VULKAN_HPP_STRINGIFY2( text ) #text
#define VULKAN_HPP_STRINGIFY( text ) VULKAN_HPP_STRINGIFY2( text )
#define VULKAN_HPP_NAMESPACE_STRING VULKAN_HPP_STRINGIFY( VULKAN_HPP_NAMESPACE )
#if !defined( VULKAN_HPP_DISPATCH_LOADER_DYNAMIC )
# if defined( VK_NO_PROTOTYPES )
# define VULKAN_HPP_DISPATCH_LOADER_DYNAMIC 1

View File

@ -39031,61 +39031,19 @@ namespace VULKAN_HPP_NAMESPACE
{
}
# ifdef VULKAN_HPP_DISABLE_ENHANCED_MODE
VULKAN_HPP_CONSTEXPR_14 DeviceFaultInfoEXT( DeviceFaultInfoEXT const & rhs ) VULKAN_HPP_NOEXCEPT = default;
DeviceFaultInfoEXT( VkDeviceFaultInfoEXT const & rhs ) VULKAN_HPP_NOEXCEPT : DeviceFaultInfoEXT( *reinterpret_cast<DeviceFaultInfoEXT const *>( &rhs ) ) {}
DeviceFaultInfoEXT & operator=( DeviceFaultInfoEXT const & rhs ) VULKAN_HPP_NOEXCEPT = default;
# else
DeviceFaultInfoEXT( DeviceFaultInfoEXT const & ) = delete;
DeviceFaultInfoEXT & operator=( DeviceFaultInfoEXT const & ) = delete;
#endif /*VULKAN_HPP_NO_CONSTRUCTORS*/
DeviceFaultInfoEXT( DeviceFaultInfoEXT && rhs ) VULKAN_HPP_NOEXCEPT
: pNext{ rhs.pNext }
, pAddressInfos{ rhs.pAddressInfos }
, pVendorInfos{ rhs.pVendorInfos }
, pVendorBinaryData{ rhs.pVendorBinaryData }
DeviceFaultInfoEXT & operator=( VkDeviceFaultInfoEXT const & rhs ) VULKAN_HPP_NOEXCEPT
{
memcpy( description, rhs.description, VK_MAX_DESCRIPTION_SIZE );
rhs.pNext = nullptr;
memset( rhs.description, 0, VK_MAX_DESCRIPTION_SIZE );
rhs.pAddressInfos = nullptr;
rhs.pVendorInfos = nullptr;
rhs.pVendorBinaryData = nullptr;
}
DeviceFaultInfoEXT & operator=( DeviceFaultInfoEXT && rhs ) VULKAN_HPP_NOEXCEPT
{
free( pAddressInfos );
free( pVendorInfos );
free( pVendorBinaryData );
pNext = rhs.pNext;
memcpy( description, rhs.description, VK_MAX_DESCRIPTION_SIZE );
pAddressInfos = rhs.pAddressInfos;
pVendorInfos = rhs.pVendorInfos;
pVendorBinaryData = rhs.pVendorBinaryData;
rhs.pNext = nullptr;
memset( rhs.description, 0, VK_MAX_DESCRIPTION_SIZE );
rhs.pAddressInfos = nullptr;
rhs.pVendorInfos = nullptr;
rhs.pVendorBinaryData = nullptr;
*this = *reinterpret_cast<DeviceFaultInfoEXT const *>( &rhs );
return *this;
}
~DeviceFaultInfoEXT() VULKAN_HPP_NOEXCEPT
{
free( pAddressInfos );
free( pVendorInfos );
free( pVendorBinaryData );
}
# endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/
#endif /*VULKAN_HPP_NO_CONSTRUCTORS*/
operator VkDeviceFaultInfoEXT const &() const VULKAN_HPP_NOEXCEPT
{
return *reinterpret_cast<const VkDeviceFaultInfoEXT *>( this );