From 42ad3f90faec009b9435383ee89910846d6a91ba Mon Sep 17 00:00:00 2001 From: Jon Leech Date: Sun, 8 Sep 2019 21:57:00 -0700 Subject: Update for Vulkan-Docs 1.1.122 --- include/vulkan/vulkan.hpp | 632 +++++++++++++++++++++---------------------- include/vulkan/vulkan_core.h | 6 +- registry/cgenerator.py | 261 +++++++++--------- registry/conventions.py | 7 + registry/generator.py | 473 ++++++++++++++++++-------------- registry/genvk.py | 35 ++- registry/reg.py | 541 +++++++++++++++++++----------------- registry/validusage.json | 42 +-- registry/vk.xml | 10 +- registry/vkconventions.py | 47 +++- 10 files changed, 1103 insertions(+), 951 deletions(-) diff --git a/include/vulkan/vulkan.hpp b/include/vulkan/vulkan.hpp index ee74848..91f2437 100644 --- a/include/vulkan/vulkan.hpp +++ b/include/vulkan/vulkan.hpp @@ -56,7 +56,7 @@ # define VULKAN_HPP_ASSERT assert #endif -static_assert( VK_HEADER_VERSION == 121 , "Wrong VK_HEADER_VERSION!" ); +static_assert( VK_HEADER_VERSION == 122 , "Wrong VK_HEADER_VERSION!" ); // 32-bit vulkan is not typesafe for handles, so don't allow copy constructors on this platform by default. // To enable this feature on 32-bit platforms please define VULKAN_HPP_TYPESAFE_CONVERSION @@ -18035,8 +18035,8 @@ namespace VULKAN_HPP_NAMESPACE { GeometryDataNV( vk::GeometryTrianglesNV triangles_ = vk::GeometryTrianglesNV(), vk::GeometryAABBNV aabbs_ = vk::GeometryAABBNV() ) - : triangles( triangles_ ) - , aabbs( aabbs_ ) + : triangles( triangles_ ) + , aabbs( aabbs_ ) {} GeometryDataNV( VkGeometryDataNV const & rhs ) @@ -18650,12 +18650,12 @@ namespace VULKAN_HPP_NAMESPACE PFN_vkFreeFunction pfnFree_ = nullptr, PFN_vkInternalAllocationNotification pfnInternalAllocation_ = nullptr, PFN_vkInternalFreeNotification pfnInternalFree_ = nullptr ) - : pUserData( pUserData_ ) - , pfnAllocation( pfnAllocation_ ) - , pfnReallocation( pfnReallocation_ ) - , pfnFree( pfnFree_ ) - , pfnInternalAllocation( pfnInternalAllocation_ ) - , pfnInternalFree( pfnInternalFree_ ) + : pUserData( pUserData_ ) + , pfnAllocation( pfnAllocation_ ) + , pfnReallocation( pfnReallocation_ ) + , pfnFree( pfnFree_ ) + , pfnInternalAllocation( pfnInternalAllocation_ ) + , pfnInternalFree( pfnInternalFree_ ) {} AllocationCallbacks( VkAllocationCallbacks const & rhs ) @@ -18747,10 +18747,10 @@ namespace VULKAN_HPP_NAMESPACE vk::ComponentSwizzle g_ = vk::ComponentSwizzle::eIdentity, vk::ComponentSwizzle b_ = vk::ComponentSwizzle::eIdentity, vk::ComponentSwizzle a_ = vk::ComponentSwizzle::eIdentity ) - : r( r_ ) - , g( g_ ) - , b( b_ ) - , a( a_ ) + : r( r_ ) + , g( g_ ) + , b( b_ ) + , a( a_ ) {} ComponentMapping( VkComponentMapping const & rhs ) @@ -19272,15 +19272,15 @@ namespace VULKAN_HPP_NAMESPACE vk::AttachmentStoreOp stencilStoreOp_ = vk::AttachmentStoreOp::eStore, vk::ImageLayout initialLayout_ = vk::ImageLayout::eUndefined, vk::ImageLayout finalLayout_ = vk::ImageLayout::eUndefined ) - : flags( flags_ ) - , format( format_ ) - , samples( samples_ ) - , loadOp( loadOp_ ) - , storeOp( storeOp_ ) - , stencilLoadOp( stencilLoadOp_ ) - , stencilStoreOp( stencilStoreOp_ ) - , initialLayout( initialLayout_ ) - , finalLayout( finalLayout_ ) + : flags( flags_ ) + , format( format_ ) + , samples( samples_ ) + , loadOp( loadOp_ ) + , storeOp( storeOp_ ) + , stencilLoadOp( stencilLoadOp_ ) + , stencilStoreOp( stencilStoreOp_ ) + , initialLayout( initialLayout_ ) + , finalLayout( finalLayout_ ) {} AttachmentDescription( VkAttachmentDescription const & rhs ) @@ -19566,8 +19566,8 @@ namespace VULKAN_HPP_NAMESPACE { AttachmentReference( uint32_t attachment_ = 0, vk::ImageLayout layout_ = vk::ImageLayout::eUndefined ) - : attachment( attachment_ ) - , layout( layout_ ) + : attachment( attachment_ ) + , layout( layout_ ) {} AttachmentReference( VkAttachmentReference const & rhs ) @@ -19731,8 +19731,8 @@ namespace VULKAN_HPP_NAMESPACE { Extent2D( uint32_t width_ = 0, uint32_t height_ = 0 ) - : width( width_ ) - , height( height_ ) + : width( width_ ) + , height( height_ ) {} Extent2D( VkExtent2D const & rhs ) @@ -19790,8 +19790,8 @@ namespace VULKAN_HPP_NAMESPACE { SampleLocationEXT( float x_ = 0, float y_ = 0 ) - : x( x_ ) - , y( y_ ) + : x( x_ ) + , y( y_ ) {} SampleLocationEXT( VkSampleLocationEXT const & rhs ) @@ -19966,8 +19966,8 @@ namespace VULKAN_HPP_NAMESPACE { AttachmentSampleLocationsEXT( uint32_t attachmentIndex_ = 0, vk::SampleLocationsInfoEXT sampleLocationsInfo_ = vk::SampleLocationsInfoEXT() ) - : attachmentIndex( attachmentIndex_ ) - , sampleLocationsInfo( sampleLocationsInfo_ ) + : attachmentIndex( attachmentIndex_ ) + , sampleLocationsInfo( sampleLocationsInfo_ ) {} AttachmentSampleLocationsEXT( VkAttachmentSampleLocationsEXT const & rhs ) @@ -20508,8 +20508,8 @@ namespace VULKAN_HPP_NAMESPACE { Offset2D( int32_t x_ = 0, int32_t y_ = 0 ) - : x( x_ ) - , y( y_ ) + : x( x_ ) + , y( y_ ) {} Offset2D( VkOffset2D const & rhs ) @@ -20567,8 +20567,8 @@ namespace VULKAN_HPP_NAMESPACE { Rect2D( vk::Offset2D offset_ = vk::Offset2D(), vk::Extent2D extent_ = vk::Extent2D() ) - : offset( offset_ ) - , extent( extent_ ) + : offset( offset_ ) + , extent( extent_ ) {} Rect2D( VkRect2D const & rhs ) @@ -21031,11 +21031,11 @@ namespace VULKAN_HPP_NAMESPACE vk::DeviceMemory memory_ = vk::DeviceMemory(), vk::DeviceSize memoryOffset_ = 0, vk::SparseMemoryBindFlags flags_ = vk::SparseMemoryBindFlags() ) - : resourceOffset( resourceOffset_ ) - , size( size_ ) - , memory( memory_ ) - , memoryOffset( memoryOffset_ ) - , flags( flags_ ) + : resourceOffset( resourceOffset_ ) + , size( size_ ) + , memory( memory_ ) + , memoryOffset( memoryOffset_ ) + , flags( flags_ ) {} SparseMemoryBind( VkSparseMemoryBind const & rhs ) @@ -21118,9 +21118,9 @@ namespace VULKAN_HPP_NAMESPACE SparseBufferMemoryBindInfo( vk::Buffer buffer_ = vk::Buffer(), uint32_t bindCount_ = 0, const vk::SparseMemoryBind* pBinds_ = nullptr ) - : buffer( buffer_ ) - , bindCount( bindCount_ ) - , pBinds( pBinds_ ) + : buffer( buffer_ ) + , bindCount( bindCount_ ) + , pBinds( pBinds_ ) {} SparseBufferMemoryBindInfo( VkSparseBufferMemoryBindInfo const & rhs ) @@ -21187,9 +21187,9 @@ namespace VULKAN_HPP_NAMESPACE SparseImageOpaqueMemoryBindInfo( vk::Image image_ = vk::Image(), uint32_t bindCount_ = 0, const vk::SparseMemoryBind* pBinds_ = nullptr ) - : image( image_ ) - , bindCount( bindCount_ ) - , pBinds( pBinds_ ) + : image( image_ ) + , bindCount( bindCount_ ) + , pBinds( pBinds_ ) {} SparseImageOpaqueMemoryBindInfo( VkSparseImageOpaqueMemoryBindInfo const & rhs ) @@ -21256,9 +21256,9 @@ namespace VULKAN_HPP_NAMESPACE ImageSubresource( vk::ImageAspectFlags aspectMask_ = vk::ImageAspectFlags(), uint32_t mipLevel_ = 0, uint32_t arrayLayer_ = 0 ) - : aspectMask( aspectMask_ ) - , mipLevel( mipLevel_ ) - , arrayLayer( arrayLayer_ ) + : aspectMask( aspectMask_ ) + , mipLevel( mipLevel_ ) + , arrayLayer( arrayLayer_ ) {} ImageSubresource( VkImageSubresource const & rhs ) @@ -21325,9 +21325,9 @@ namespace VULKAN_HPP_NAMESPACE Offset3D( int32_t x_ = 0, int32_t y_ = 0, int32_t z_ = 0 ) - : x( x_ ) - , y( y_ ) - , z( z_ ) + : x( x_ ) + , y( y_ ) + , z( z_ ) {} explicit Offset3D( Offset2D const& offset2D, @@ -21335,7 +21335,6 @@ namespace VULKAN_HPP_NAMESPACE : x( offset2D.x ) , y( offset2D.y ) , z( z_ ) - {} Offset3D( VkOffset3D const & rhs ) @@ -21402,9 +21401,9 @@ namespace VULKAN_HPP_NAMESPACE Extent3D( uint32_t width_ = 0, uint32_t height_ = 0, uint32_t depth_ = 0 ) - : width( width_ ) - , height( height_ ) - , depth( depth_ ) + : width( width_ ) + , height( height_ ) + , depth( depth_ ) {} explicit Extent3D( Extent2D const& extent2D, @@ -21412,7 +21411,6 @@ namespace VULKAN_HPP_NAMESPACE : width( extent2D.width ) , height( extent2D.height ) , depth( depth_ ) - {} Extent3D( VkExtent3D const & rhs ) @@ -21482,12 +21480,12 @@ namespace VULKAN_HPP_NAMESPACE vk::DeviceMemory memory_ = vk::DeviceMemory(), vk::DeviceSize memoryOffset_ = 0, vk::SparseMemoryBindFlags flags_ = vk::SparseMemoryBindFlags() ) - : subresource( subresource_ ) - , offset( offset_ ) - , extent( extent_ ) - , memory( memory_ ) - , memoryOffset( memoryOffset_ ) - , flags( flags_ ) + : subresource( subresource_ ) + , offset( offset_ ) + , extent( extent_ ) + , memory( memory_ ) + , memoryOffset( memoryOffset_ ) + , flags( flags_ ) {} SparseImageMemoryBind( VkSparseImageMemoryBind const & rhs ) @@ -21578,9 +21576,9 @@ namespace VULKAN_HPP_NAMESPACE SparseImageMemoryBindInfo( vk::Image image_ = vk::Image(), uint32_t bindCount_ = 0, const vk::SparseImageMemoryBind* pBinds_ = nullptr ) - : image( image_ ) - , bindCount( bindCount_ ) - , pBinds( pBinds_ ) + : image( image_ ) + , bindCount( bindCount_ ) + , pBinds( pBinds_ ) {} SparseImageMemoryBindInfo( VkSparseImageMemoryBindInfo const & rhs ) @@ -21830,9 +21828,9 @@ namespace VULKAN_HPP_NAMESPACE BufferCopy( vk::DeviceSize srcOffset_ = 0, vk::DeviceSize dstOffset_ = 0, vk::DeviceSize size_ = 0 ) - : srcOffset( srcOffset_ ) - , dstOffset( dstOffset_ ) - , size( size_ ) + : srcOffset( srcOffset_ ) + , dstOffset( dstOffset_ ) + , size( size_ ) {} BufferCopy( VkBufferCopy const & rhs ) @@ -22207,10 +22205,10 @@ namespace VULKAN_HPP_NAMESPACE uint32_t mipLevel_ = 0, uint32_t baseArrayLayer_ = 0, uint32_t layerCount_ = 0 ) - : aspectMask( aspectMask_ ) - , mipLevel( mipLevel_ ) - , baseArrayLayer( baseArrayLayer_ ) - , layerCount( layerCount_ ) + : aspectMask( aspectMask_ ) + , mipLevel( mipLevel_ ) + , baseArrayLayer( baseArrayLayer_ ) + , layerCount( layerCount_ ) {} ImageSubresourceLayers( VkImageSubresourceLayers const & rhs ) @@ -22288,12 +22286,12 @@ namespace VULKAN_HPP_NAMESPACE vk::ImageSubresourceLayers imageSubresource_ = vk::ImageSubresourceLayers(), vk::Offset3D imageOffset_ = vk::Offset3D(), vk::Extent3D imageExtent_ = vk::Extent3D() ) - : bufferOffset( bufferOffset_ ) - , bufferRowLength( bufferRowLength_ ) - , bufferImageHeight( bufferImageHeight_ ) - , imageSubresource( imageSubresource_ ) - , imageOffset( imageOffset_ ) - , imageExtent( imageExtent_ ) + : bufferOffset( bufferOffset_ ) + , bufferRowLength( bufferRowLength_ ) + , bufferImageHeight( bufferImageHeight_ ) + , imageSubresource( imageSubresource_ ) + , imageOffset( imageOffset_ ) + , imageExtent( imageExtent_ ) {} BufferImageCopy( VkBufferImageCopy const & rhs ) @@ -22940,8 +22938,8 @@ namespace VULKAN_HPP_NAMESPACE { ClearDepthStencilValue( float depth_ = 0, uint32_t stencil_ = 0 ) - : depth( depth_ ) - , stencil( stencil_ ) + : depth( depth_ ) + , stencil( stencil_ ) {} ClearDepthStencilValue( VkClearDepthStencilValue const & rhs ) @@ -23042,9 +23040,9 @@ namespace VULKAN_HPP_NAMESPACE ClearAttachment( vk::ImageAspectFlags aspectMask_ = vk::ImageAspectFlags(), uint32_t colorAttachment_ = 0, vk::ClearValue clearValue_ = vk::ClearValue() ) - : aspectMask( aspectMask_ ) - , colorAttachment( colorAttachment_ ) - , clearValue( clearValue_ ) + : aspectMask( aspectMask_ ) + , colorAttachment( colorAttachment_ ) + , clearValue( clearValue_ ) {} ClearAttachment( VkClearAttachment const & rhs ) @@ -23099,9 +23097,9 @@ namespace VULKAN_HPP_NAMESPACE ClearRect( vk::Rect2D rect_ = vk::Rect2D(), uint32_t baseArrayLayer_ = 0, uint32_t layerCount_ = 0 ) - : rect( rect_ ) - , baseArrayLayer( baseArrayLayer_ ) - , layerCount( layerCount_ ) + : rect( rect_ ) + , baseArrayLayer( baseArrayLayer_ ) + , layerCount( layerCount_ ) {} ClearRect( VkClearRect const & rhs ) @@ -23168,9 +23166,9 @@ namespace VULKAN_HPP_NAMESPACE IndirectCommandsTokenNVX( vk::IndirectCommandsTokenTypeNVX tokenType_ = vk::IndirectCommandsTokenTypeNVX::ePipeline, vk::Buffer buffer_ = vk::Buffer(), vk::DeviceSize offset_ = 0 ) - : tokenType( tokenType_ ) - , buffer( buffer_ ) - , offset( offset_ ) + : tokenType( tokenType_ ) + , buffer( buffer_ ) + , offset( offset_ ) {} IndirectCommandsTokenNVX( VkIndirectCommandsTokenNVX const & rhs ) @@ -23526,9 +23524,9 @@ namespace VULKAN_HPP_NAMESPACE CoarseSampleLocationNV( uint32_t pixelX_ = 0, uint32_t pixelY_ = 0, uint32_t sample_ = 0 ) - : pixelX( pixelX_ ) - , pixelY( pixelY_ ) - , sample( sample_ ) + : pixelX( pixelX_ ) + , pixelY( pixelY_ ) + , sample( sample_ ) {} CoarseSampleLocationNV( VkCoarseSampleLocationNV const & rhs ) @@ -23596,10 +23594,10 @@ namespace VULKAN_HPP_NAMESPACE uint32_t sampleCount_ = 0, uint32_t sampleLocationCount_ = 0, const vk::CoarseSampleLocationNV* pSampleLocations_ = nullptr ) - : shadingRate( shadingRate_ ) - , sampleCount( sampleCount_ ) - , sampleLocationCount( sampleLocationCount_ ) - , pSampleLocations( pSampleLocations_ ) + : shadingRate( shadingRate_ ) + , sampleCount( sampleCount_ ) + , sampleLocationCount( sampleLocationCount_ ) + , pSampleLocations( pSampleLocations_ ) {} CoarseSampleOrderCustomNV( VkCoarseSampleOrderCustomNV const & rhs ) @@ -24193,9 +24191,9 @@ namespace VULKAN_HPP_NAMESPACE SpecializationMapEntry( uint32_t constantID_ = 0, uint32_t offset_ = 0, size_t size_ = 0 ) - : constantID( constantID_ ) - , offset( offset_ ) - , size( size_ ) + : constantID( constantID_ ) + , offset( offset_ ) + , size( size_ ) {} SpecializationMapEntry( VkSpecializationMapEntry const & rhs ) @@ -24263,10 +24261,10 @@ namespace VULKAN_HPP_NAMESPACE const vk::SpecializationMapEntry* pMapEntries_ = nullptr, size_t dataSize_ = 0, const void* pData_ = nullptr ) - : mapEntryCount( mapEntryCount_ ) - , pMapEntries( pMapEntries_ ) - , dataSize( dataSize_ ) - , pData( pData_ ) + : mapEntryCount( mapEntryCount_ ) + , pMapEntries( pMapEntries_ ) + , dataSize( dataSize_ ) + , pData( pData_ ) {} SpecializationInfo( VkSpecializationInfo const & rhs ) @@ -24704,10 +24702,10 @@ namespace VULKAN_HPP_NAMESPACE uint8_t minor_ = 0, uint8_t subminor_ = 0, uint8_t patch_ = 0 ) - : major( major_ ) - , minor( minor_ ) - , subminor( subminor_ ) - , patch( patch_ ) + : major( major_ ) + , minor( minor_ ) + , subminor( subminor_ ) + , patch( patch_ ) {} ConformanceVersionKHR( VkConformanceVersionKHR const & rhs ) @@ -26555,9 +26553,9 @@ namespace VULKAN_HPP_NAMESPACE DescriptorBufferInfo( vk::Buffer buffer_ = vk::Buffer(), vk::DeviceSize offset_ = 0, vk::DeviceSize range_ = 0 ) - : buffer( buffer_ ) - , offset( offset_ ) - , range( range_ ) + : buffer( buffer_ ) + , offset( offset_ ) + , range( range_ ) {} DescriptorBufferInfo( VkDescriptorBufferInfo const & rhs ) @@ -26624,9 +26622,9 @@ namespace VULKAN_HPP_NAMESPACE DescriptorImageInfo( vk::Sampler sampler_ = vk::Sampler(), vk::ImageView imageView_ = vk::ImageView(), vk::ImageLayout imageLayout_ = vk::ImageLayout::eUndefined ) - : sampler( sampler_ ) - , imageView( imageView_ ) - , imageLayout( imageLayout_ ) + : sampler( sampler_ ) + , imageView( imageView_ ) + , imageLayout( imageLayout_ ) {} DescriptorImageInfo( VkDescriptorImageInfo const & rhs ) @@ -26692,8 +26690,8 @@ namespace VULKAN_HPP_NAMESPACE { DescriptorPoolSize( vk::DescriptorType type_ = vk::DescriptorType::eSampler, uint32_t descriptorCount_ = 0 ) - : type( type_ ) - , descriptorCount( descriptorCount_ ) + : type( type_ ) + , descriptorCount( descriptorCount_ ) {} DescriptorPoolSize( VkDescriptorPoolSize const & rhs ) @@ -27061,11 +27059,11 @@ namespace VULKAN_HPP_NAMESPACE uint32_t descriptorCount_ = 0, vk::ShaderStageFlags stageFlags_ = vk::ShaderStageFlags(), const vk::Sampler* pImmutableSamplers_ = nullptr ) - : binding( binding_ ) - , descriptorType( descriptorType_ ) - , descriptorCount( descriptorCount_ ) - , stageFlags( stageFlags_ ) - , pImmutableSamplers( pImmutableSamplers_ ) + : binding( binding_ ) + , descriptorType( descriptorType_ ) + , descriptorCount( descriptorCount_ ) + , stageFlags( stageFlags_ ) + , pImmutableSamplers( pImmutableSamplers_ ) {} DescriptorSetLayoutBinding( VkDescriptorSetLayoutBinding const & rhs ) @@ -27563,12 +27561,12 @@ namespace VULKAN_HPP_NAMESPACE vk::DescriptorType descriptorType_ = vk::DescriptorType::eSampler, size_t offset_ = 0, size_t stride_ = 0 ) - : dstBinding( dstBinding_ ) - , dstArrayElement( dstArrayElement_ ) - , descriptorCount( descriptorCount_ ) - , descriptorType( descriptorType_ ) - , offset( offset_ ) - , stride( stride_ ) + : dstBinding( dstBinding_ ) + , dstArrayElement( dstArrayElement_ ) + , descriptorCount( descriptorCount_ ) + , descriptorType( descriptorType_ ) + , offset( offset_ ) + , stride( stride_ ) {} DescriptorUpdateTemplateEntry( VkDescriptorUpdateTemplateEntry const & rhs ) @@ -27989,61 +27987,61 @@ namespace VULKAN_HPP_NAMESPACE vk::Bool32 sparseResidencyAliased_ = 0, vk::Bool32 variableMultisampleRate_ = 0, vk::Bool32 inheritedQueries_ = 0 ) - : robustBufferAccess( robustBufferAccess_ ) - , fullDrawIndexUint32( fullDrawIndexUint32_ ) - , imageCubeArray( imageCubeArray_ ) - , independentBlend( independentBlend_ ) - , geometryShader( geometryShader_ ) - , tessellationShader( tessellationShader_ ) - , sampleRateShading( sampleRateShading_ ) - , dualSrcBlend( dualSrcBlend_ ) - , logicOp( logicOp_ ) - , multiDrawIndirect( multiDrawIndirect_ ) - , drawIndirectFirstInstance( drawIndirectFirstInstance_ ) - , depthClamp( depthClamp_ ) - , depthBiasClamp( depthBiasClamp_ ) - , fillModeNonSolid( fillModeNonSolid_ ) - , depthBounds( depthBounds_ ) - , wideLines( wideLines_ ) - , largePoints( largePoints_ ) - , alphaToOne( alphaToOne_ ) - , multiViewport( multiViewport_ ) - , samplerAnisotropy( samplerAnisotropy_ ) - , textureCompressionETC2( textureCompressionETC2_ ) - , textureCompressionASTC_LDR( textureCompressionASTC_LDR_ ) - , textureCompressionBC( textureCompressionBC_ ) - , occlusionQueryPrecise( occlusionQueryPrecise_ ) - , pipelineStatisticsQuery( pipelineStatisticsQuery_ ) - , vertexPipelineStoresAndAtomics( vertexPipelineStoresAndAtomics_ ) - , fragmentStoresAndAtomics( fragmentStoresAndAtomics_ ) - , shaderTessellationAndGeometryPointSize( shaderTessellationAndGeometryPointSize_ ) - , shaderImageGatherExtended( shaderImageGatherExtended_ ) - , shaderStorageImageExtendedFormats( shaderStorageImageExtendedFormats_ ) - , shaderStorageImageMultisample( shaderStorageImageMultisample_ ) - , shaderStorageImageReadWithoutFormat( shaderStorageImageReadWithoutFormat_ ) - , shaderStorageImageWriteWithoutFormat( shaderStorageImageWriteWithoutFormat_ ) - , shaderUniformBufferArrayDynamicIndexing( shaderUniformBufferArrayDynamicIndexing_ ) - , shaderSampledImageArrayDynamicIndexing( shaderSampledImageArrayDynamicIndexing_ ) - , shaderStorageBufferArrayDynamicIndexing( shaderStorageBufferArrayDynamicIndexing_ ) - , shaderStorageImageArrayDynamicIndexing( shaderStorageImageArrayDynamicIndexing_ ) - , shaderClipDistance( shaderClipDistance_ ) - , shaderCullDistance( shaderCullDistance_ ) - , shaderFloat64( shaderFloat64_ ) - , shaderInt64( shaderInt64_ ) - , shaderInt16( shaderInt16_ ) - , shaderResourceResidency( shaderResourceResidency_ ) - , shaderResourceMinLod( shaderResourceMinLod_ ) - , sparseBinding( sparseBinding_ ) - , sparseResidencyBuffer( sparseResidencyBuffer_ ) - , sparseResidencyImage2D( sparseResidencyImage2D_ ) - , sparseResidencyImage3D( sparseResidencyImage3D_ ) - , sparseResidency2Samples( sparseResidency2Samples_ ) - , sparseResidency4Samples( sparseResidency4Samples_ ) - , sparseResidency8Samples( sparseResidency8Samples_ ) - , sparseResidency16Samples( sparseResidency16Samples_ ) - , sparseResidencyAliased( sparseResidencyAliased_ ) - , variableMultisampleRate( variableMultisampleRate_ ) - , inheritedQueries( inheritedQueries_ ) + : robustBufferAccess( robustBufferAccess_ ) + , fullDrawIndexUint32( fullDrawIndexUint32_ ) + , imageCubeArray( imageCubeArray_ ) + , independentBlend( independentBlend_ ) + , geometryShader( geometryShader_ ) + , tessellationShader( tessellationShader_ ) + , sampleRateShading( sampleRateShading_ ) + , dualSrcBlend( dualSrcBlend_ ) + , logicOp( logicOp_ ) + , multiDrawIndirect( multiDrawIndirect_ ) + , drawIndirectFirstInstance( drawIndirectFirstInstance_ ) + , depthClamp( depthClamp_ ) + , depthBiasClamp( depthBiasClamp_ ) + , fillModeNonSolid( fillModeNonSolid_ ) + , depthBounds( depthBounds_ ) + , wideLines( wideLines_ ) + , largePoints( largePoints_ ) + , alphaToOne( alphaToOne_ ) + , multiViewport( multiViewport_ ) + , samplerAnisotropy( samplerAnisotropy_ ) + , textureCompressionETC2( textureCompressionETC2_ ) + , textureCompressionASTC_LDR( textureCompressionASTC_LDR_ ) + , textureCompressionBC( textureCompressionBC_ ) + , occlusionQueryPrecise( occlusionQueryPrecise_ ) + , pipelineStatisticsQuery( pipelineStatisticsQuery_ ) + , vertexPipelineStoresAndAtomics( vertexPipelineStoresAndAtomics_ ) + , fragmentStoresAndAtomics( fragmentStoresAndAtomics_ ) + , shaderTessellationAndGeometryPointSize( shaderTessellationAndGeometryPointSize_ ) + , shaderImageGatherExtended( shaderImageGatherExtended_ ) + , shaderStorageImageExtendedFormats( shaderStorageImageExtendedFormats_ ) + , shaderStorageImageMultisample( shaderStorageImageMultisample_ ) + , shaderStorageImageReadWithoutFormat( shaderStorageImageReadWithoutFormat_ ) + , shaderStorageImageWriteWithoutFormat( shaderStorageImageWriteWithoutFormat_ ) + , shaderUniformBufferArrayDynamicIndexing( shaderUniformBufferArrayDynamicIndexing_ ) + , shaderSampledImageArrayDynamicIndexing( shaderSampledImageArrayDynamicIndexing_ ) + , shaderStorageBufferArrayDynamicIndexing( shaderStorageBufferArrayDynamicIndexing_ ) + , shaderStorageImageArrayDynamicIndexing( shaderStorageImageArrayDynamicIndexing_ ) + , shaderClipDistance( shaderClipDistance_ ) + , shaderCullDistance( shaderCullDistance_ ) + , shaderFloat64( shaderFloat64_ ) + , shaderInt64( shaderInt64_ ) + , shaderInt16( shaderInt16_ ) + , shaderResourceResidency( shaderResourceResidency_ ) + , shaderResourceMinLod( shaderResourceMinLod_ ) + , sparseBinding( sparseBinding_ ) + , sparseResidencyBuffer( sparseResidencyBuffer_ ) + , sparseResidencyImage2D( sparseResidencyImage2D_ ) + , sparseResidencyImage3D( sparseResidencyImage3D_ ) + , sparseResidency2Samples( sparseResidency2Samples_ ) + , sparseResidency4Samples( sparseResidency4Samples_ ) + , sparseResidency8Samples( sparseResidency8Samples_ ) + , sparseResidency16Samples( sparseResidency16Samples_ ) + , sparseResidencyAliased( sparseResidencyAliased_ ) + , variableMultisampleRate( variableMultisampleRate_ ) + , inheritedQueries( inheritedQueries_ ) {} PhysicalDeviceFeatures( VkPhysicalDeviceFeatures const & rhs ) @@ -30030,9 +30028,9 @@ namespace VULKAN_HPP_NAMESPACE DispatchIndirectCommand( uint32_t x_ = 0, uint32_t y_ = 0, uint32_t z_ = 0 ) - : x( x_ ) - , y( y_ ) - , z( z_ ) + : x( x_ ) + , y( y_ ) + , z( z_ ) {} DispatchIndirectCommand( VkDispatchIndirectCommand const & rhs ) @@ -30182,8 +30180,8 @@ namespace VULKAN_HPP_NAMESPACE { DisplayModeParametersKHR( vk::Extent2D visibleRegion_ = vk::Extent2D(), uint32_t refreshRate_ = 0 ) - : visibleRegion( visibleRegion_ ) - , refreshRate( refreshRate_ ) + : visibleRegion( visibleRegion_ ) + , refreshRate( refreshRate_ ) {} DisplayModeParametersKHR( VkDisplayModeParametersKHR const & rhs ) @@ -31219,11 +31217,11 @@ namespace VULKAN_HPP_NAMESPACE uint32_t firstIndex_ = 0, int32_t vertexOffset_ = 0, uint32_t firstInstance_ = 0 ) - : indexCount( indexCount_ ) - , instanceCount( instanceCount_ ) - , firstIndex( firstIndex_ ) - , vertexOffset( vertexOffset_ ) - , firstInstance( firstInstance_ ) + : indexCount( indexCount_ ) + , instanceCount( instanceCount_ ) + , firstIndex( firstIndex_ ) + , vertexOffset( vertexOffset_ ) + , firstInstance( firstInstance_ ) {} DrawIndexedIndirectCommand( VkDrawIndexedIndirectCommand const & rhs ) @@ -31307,10 +31305,10 @@ namespace VULKAN_HPP_NAMESPACE uint32_t instanceCount_ = 0, uint32_t firstVertex_ = 0, uint32_t firstInstance_ = 0 ) - : vertexCount( vertexCount_ ) - , instanceCount( instanceCount_ ) - , firstVertex( firstVertex_ ) - , firstInstance( firstInstance_ ) + : vertexCount( vertexCount_ ) + , instanceCount( instanceCount_ ) + , firstVertex( firstVertex_ ) + , firstInstance( firstInstance_ ) {} DrawIndirectCommand( VkDrawIndirectCommand const & rhs ) @@ -31384,8 +31382,8 @@ namespace VULKAN_HPP_NAMESPACE { DrawMeshTasksIndirectCommandNV( uint32_t taskCount_ = 0, uint32_t firstTask_ = 0 ) - : taskCount( taskCount_ ) - , firstTask( firstTask_ ) + : taskCount( taskCount_ ) + , firstTask( firstTask_ ) {} DrawMeshTasksIndirectCommandNV( VkDrawMeshTasksIndirectCommandNV const & rhs ) @@ -33996,9 +33994,9 @@ namespace VULKAN_HPP_NAMESPACE VertexInputBindingDescription( uint32_t binding_ = 0, uint32_t stride_ = 0, vk::VertexInputRate inputRate_ = vk::VertexInputRate::eVertex ) - : binding( binding_ ) - , stride( stride_ ) - , inputRate( inputRate_ ) + : binding( binding_ ) + , stride( stride_ ) + , inputRate( inputRate_ ) {} VertexInputBindingDescription( VkVertexInputBindingDescription const & rhs ) @@ -34066,10 +34064,10 @@ namespace VULKAN_HPP_NAMESPACE uint32_t binding_ = 0, vk::Format format_ = vk::Format::eUndefined, uint32_t offset_ = 0 ) - : location( location_ ) - , binding( binding_ ) - , format( format_ ) - , offset( offset_ ) + : location( location_ ) + , binding( binding_ ) + , format( format_ ) + , offset( offset_ ) {} VertexInputAttributeDescription( VkVertexInputAttributeDescription const & rhs ) @@ -34476,12 +34474,12 @@ namespace VULKAN_HPP_NAMESPACE float height_ = 0, float minDepth_ = 0, float maxDepth_ = 0 ) - : x( x_ ) - , y( y_ ) - , width( width_ ) - , height( height_ ) - , minDepth( minDepth_ ) - , maxDepth( maxDepth_ ) + : x( x_ ) + , y( y_ ) + , width( width_ ) + , height( height_ ) + , minDepth( minDepth_ ) + , maxDepth( maxDepth_ ) {} Viewport( VkViewport const & rhs ) @@ -35048,13 +35046,13 @@ namespace VULKAN_HPP_NAMESPACE uint32_t compareMask_ = 0, uint32_t writeMask_ = 0, uint32_t reference_ = 0 ) - : failOp( failOp_ ) - , passOp( passOp_ ) - , depthFailOp( depthFailOp_ ) - , compareOp( compareOp_ ) - , compareMask( compareMask_ ) - , writeMask( writeMask_ ) - , reference( reference_ ) + : failOp( failOp_ ) + , passOp( passOp_ ) + , depthFailOp( depthFailOp_ ) + , compareOp( compareOp_ ) + , compareMask( compareMask_ ) + , writeMask( writeMask_ ) + , reference( reference_ ) {} StencilOpState( VkStencilOpState const & rhs ) @@ -35341,14 +35339,14 @@ namespace VULKAN_HPP_NAMESPACE vk::BlendFactor dstAlphaBlendFactor_ = vk::BlendFactor::eZero, vk::BlendOp alphaBlendOp_ = vk::BlendOp::eAdd, vk::ColorComponentFlags colorWriteMask_ = vk::ColorComponentFlags() ) - : blendEnable( blendEnable_ ) - , srcColorBlendFactor( srcColorBlendFactor_ ) - , dstColorBlendFactor( dstColorBlendFactor_ ) - , colorBlendOp( colorBlendOp_ ) - , srcAlphaBlendFactor( srcAlphaBlendFactor_ ) - , dstAlphaBlendFactor( dstAlphaBlendFactor_ ) - , alphaBlendOp( alphaBlendOp_ ) - , colorWriteMask( colorWriteMask_ ) + : blendEnable( blendEnable_ ) + , srcColorBlendFactor( srcColorBlendFactor_ ) + , dstColorBlendFactor( dstColorBlendFactor_ ) + , colorBlendOp( colorBlendOp_ ) + , srcAlphaBlendFactor( srcAlphaBlendFactor_ ) + , dstAlphaBlendFactor( dstAlphaBlendFactor_ ) + , alphaBlendOp( alphaBlendOp_ ) + , colorWriteMask( colorWriteMask_ ) {} PipelineColorBlendAttachmentState( VkPipelineColorBlendAttachmentState const & rhs ) @@ -35961,8 +35959,8 @@ namespace VULKAN_HPP_NAMESPACE { XYColorEXT( float x_ = 0, float y_ = 0 ) - : x( x_ ) - , y( y_ ) + : x( x_ ) + , y( y_ ) {} XYColorEXT( VkXYColorEXT const & rhs ) @@ -36365,11 +36363,11 @@ namespace VULKAN_HPP_NAMESPACE std::array const& srcOffsets_ = { { vk::Offset3D() } }, vk::ImageSubresourceLayers dstSubresource_ = vk::ImageSubresourceLayers(), std::array const& dstOffsets_ = { { vk::Offset3D() } } ) - : srcSubresource( srcSubresource_ ) - , dstSubresource( dstSubresource_ ) + : srcSubresource( srcSubresource_ ) + , dstSubresource( dstSubresource_ ) { - memcpy( &srcOffsets, srcOffsets_.data(), 2 * sizeof( vk::Offset3D ) ); - memcpy( &dstOffsets, dstOffsets_.data(), 2 * sizeof( vk::Offset3D ) ); + memcpy( &srcOffsets, srcOffsets_.data(), 2 * sizeof( vk::Offset3D ) ); + memcpy( &dstOffsets, dstOffsets_.data(), 2 * sizeof( vk::Offset3D ) ); } @@ -36447,11 +36445,11 @@ namespace VULKAN_HPP_NAMESPACE vk::ImageSubresourceLayers dstSubresource_ = vk::ImageSubresourceLayers(), vk::Offset3D dstOffset_ = vk::Offset3D(), vk::Extent3D extent_ = vk::Extent3D() ) - : srcSubresource( srcSubresource_ ) - , srcOffset( srcOffset_ ) - , dstSubresource( dstSubresource_ ) - , dstOffset( dstOffset_ ) - , extent( extent_ ) + : srcSubresource( srcSubresource_ ) + , srcOffset( srcOffset_ ) + , dstSubresource( dstSubresource_ ) + , dstOffset( dstOffset_ ) + , extent( extent_ ) {} ImageCopy( VkImageCopy const & rhs ) @@ -37200,11 +37198,11 @@ namespace VULKAN_HPP_NAMESPACE uint32_t levelCount_ = 0, uint32_t baseArrayLayer_ = 0, uint32_t layerCount_ = 0 ) - : aspectMask( aspectMask_ ) - , baseMipLevel( baseMipLevel_ ) - , levelCount( levelCount_ ) - , baseArrayLayer( baseArrayLayer_ ) - , layerCount( layerCount_ ) + : aspectMask( aspectMask_ ) + , baseMipLevel( baseMipLevel_ ) + , levelCount( levelCount_ ) + , baseArrayLayer( baseArrayLayer_ ) + , layerCount( layerCount_ ) {} ImageSubresourceRange( VkImageSubresourceRange const & rhs ) @@ -37716,11 +37714,11 @@ namespace VULKAN_HPP_NAMESPACE vk::ImageSubresourceLayers dstSubresource_ = vk::ImageSubresourceLayers(), vk::Offset3D dstOffset_ = vk::Offset3D(), vk::Extent3D extent_ = vk::Extent3D() ) - : srcSubresource( srcSubresource_ ) - , srcOffset( srcOffset_ ) - , dstSubresource( dstSubresource_ ) - , dstOffset( dstOffset_ ) - , extent( extent_ ) + : srcSubresource( srcSubresource_ ) + , srcOffset( srcOffset_ ) + , dstSubresource( dstSubresource_ ) + , dstOffset( dstOffset_ ) + , extent( extent_ ) {} ImageResolve( VkImageResolve const & rhs ) @@ -39449,10 +39447,10 @@ namespace VULKAN_HPP_NAMESPACE uint32_t bindingUnit_ = 0, uint32_t dynamicCount_ = 0, uint32_t divisor_ = 0 ) - : tokenType( tokenType_ ) - , bindingUnit( bindingUnit_ ) - , dynamicCount( dynamicCount_ ) - , divisor( divisor_ ) + : tokenType( tokenType_ ) + , bindingUnit( bindingUnit_ ) + , dynamicCount( dynamicCount_ ) + , divisor( divisor_ ) {} IndirectCommandsLayoutTokenNVX( VkIndirectCommandsLayoutTokenNVX const & rhs ) @@ -39728,9 +39726,9 @@ namespace VULKAN_HPP_NAMESPACE InputAttachmentAspectReference( uint32_t subpass_ = 0, uint32_t inputAttachmentIndex_ = 0, vk::ImageAspectFlags aspectMask_ = vk::ImageAspectFlags() ) - : subpass( subpass_ ) - , inputAttachmentIndex( inputAttachmentIndex_ ) - , aspectMask( aspectMask_ ) + : subpass( subpass_ ) + , inputAttachmentIndex( inputAttachmentIndex_ ) + , aspectMask( aspectMask_ ) {} InputAttachmentAspectReference( VkInputAttachmentAspectReference const & rhs ) @@ -41634,8 +41632,8 @@ namespace VULKAN_HPP_NAMESPACE { ObjectTableEntryNVX( vk::ObjectEntryTypeNVX type_ = vk::ObjectEntryTypeNVX::eDescriptorSet, vk::ObjectEntryUsageFlagsNVX flags_ = vk::ObjectEntryUsageFlagsNVX() ) - : type( type_ ) - , flags( flags_ ) + : type( type_ ) + , flags( flags_ ) {} ObjectTableEntryNVX( VkObjectTableEntryNVX const & rhs ) @@ -41695,10 +41693,10 @@ namespace VULKAN_HPP_NAMESPACE vk::ObjectEntryUsageFlagsNVX flags_ = vk::ObjectEntryUsageFlagsNVX(), vk::PipelineLayout pipelineLayout_ = vk::PipelineLayout(), vk::DescriptorSet descriptorSet_ = vk::DescriptorSet() ) - : type( type_ ) - , flags( flags_ ) - , pipelineLayout( pipelineLayout_ ) - , descriptorSet( descriptorSet_ ) + : type( type_ ) + , flags( flags_ ) + , pipelineLayout( pipelineLayout_ ) + , descriptorSet( descriptorSet_ ) {} explicit ObjectTableDescriptorSetEntryNVX( ObjectTableEntryNVX const& objectTableEntryNVX, @@ -41708,7 +41706,6 @@ namespace VULKAN_HPP_NAMESPACE , flags( objectTableEntryNVX.flags ) , pipelineLayout( pipelineLayout_ ) , descriptorSet( descriptorSet_ ) - {} ObjectTableDescriptorSetEntryNVX( VkObjectTableDescriptorSetEntryNVX const & rhs ) @@ -41784,10 +41781,10 @@ namespace VULKAN_HPP_NAMESPACE vk::ObjectEntryUsageFlagsNVX flags_ = vk::ObjectEntryUsageFlagsNVX(), vk::Buffer buffer_ = vk::Buffer(), vk::IndexType indexType_ = vk::IndexType::eUint16 ) - : type( type_ ) - , flags( flags_ ) - , buffer( buffer_ ) - , indexType( indexType_ ) + : type( type_ ) + , flags( flags_ ) + , buffer( buffer_ ) + , indexType( indexType_ ) {} explicit ObjectTableIndexBufferEntryNVX( ObjectTableEntryNVX const& objectTableEntryNVX, @@ -41797,7 +41794,6 @@ namespace VULKAN_HPP_NAMESPACE , flags( objectTableEntryNVX.flags ) , buffer( buffer_ ) , indexType( indexType_ ) - {} ObjectTableIndexBufferEntryNVX( VkObjectTableIndexBufferEntryNVX const & rhs ) @@ -41872,9 +41868,9 @@ namespace VULKAN_HPP_NAMESPACE ObjectTablePipelineEntryNVX( vk::ObjectEntryTypeNVX type_ = vk::ObjectEntryTypeNVX::eDescriptorSet, vk::ObjectEntryUsageFlagsNVX flags_ = vk::ObjectEntryUsageFlagsNVX(), vk::Pipeline pipeline_ = vk::Pipeline() ) - : type( type_ ) - , flags( flags_ ) - , pipeline( pipeline_ ) + : type( type_ ) + , flags( flags_ ) + , pipeline( pipeline_ ) {} explicit ObjectTablePipelineEntryNVX( ObjectTableEntryNVX const& objectTableEntryNVX, @@ -41882,7 +41878,6 @@ namespace VULKAN_HPP_NAMESPACE : type( objectTableEntryNVX.type ) , flags( objectTableEntryNVX.flags ) , pipeline( pipeline_ ) - {} ObjectTablePipelineEntryNVX( VkObjectTablePipelineEntryNVX const & rhs ) @@ -41950,10 +41945,10 @@ namespace VULKAN_HPP_NAMESPACE vk::ObjectEntryUsageFlagsNVX flags_ = vk::ObjectEntryUsageFlagsNVX(), vk::PipelineLayout pipelineLayout_ = vk::PipelineLayout(), vk::ShaderStageFlags stageFlags_ = vk::ShaderStageFlags() ) - : type( type_ ) - , flags( flags_ ) - , pipelineLayout( pipelineLayout_ ) - , stageFlags( stageFlags_ ) + : type( type_ ) + , flags( flags_ ) + , pipelineLayout( pipelineLayout_ ) + , stageFlags( stageFlags_ ) {} explicit ObjectTablePushConstantEntryNVX( ObjectTableEntryNVX const& objectTableEntryNVX, @@ -41963,7 +41958,6 @@ namespace VULKAN_HPP_NAMESPACE , flags( objectTableEntryNVX.flags ) , pipelineLayout( pipelineLayout_ ) , stageFlags( stageFlags_ ) - {} ObjectTablePushConstantEntryNVX( VkObjectTablePushConstantEntryNVX const & rhs ) @@ -42038,9 +42032,9 @@ namespace VULKAN_HPP_NAMESPACE ObjectTableVertexBufferEntryNVX( vk::ObjectEntryTypeNVX type_ = vk::ObjectEntryTypeNVX::eDescriptorSet, vk::ObjectEntryUsageFlagsNVX flags_ = vk::ObjectEntryUsageFlagsNVX(), vk::Buffer buffer_ = vk::Buffer() ) - : type( type_ ) - , flags( flags_ ) - , buffer( buffer_ ) + : type( type_ ) + , flags( flags_ ) + , buffer( buffer_ ) {} explicit ObjectTableVertexBufferEntryNVX( ObjectTableEntryNVX const& objectTableEntryNVX, @@ -42048,7 +42042,6 @@ namespace VULKAN_HPP_NAMESPACE : type( objectTableEntryNVX.type ) , flags( objectTableEntryNVX.flags ) , buffer( buffer_ ) - {} ObjectTableVertexBufferEntryNVX( VkObjectTableVertexBufferEntryNVX const & rhs ) @@ -42584,8 +42577,8 @@ namespace VULKAN_HPP_NAMESPACE { PerformanceValueINTEL( vk::PerformanceValueTypeINTEL type_ = vk::PerformanceValueTypeINTEL::eUint32, vk::PerformanceValueDataINTEL data_ = vk::PerformanceValueDataINTEL() ) - : type( type_ ) - , data( data_ ) + : type( type_ ) + , data( data_ ) {} PerformanceValueINTEL( VkPerformanceValueINTEL const & rhs ) @@ -52556,9 +52549,9 @@ namespace VULKAN_HPP_NAMESPACE PushConstantRange( vk::ShaderStageFlags stageFlags_ = vk::ShaderStageFlags(), uint32_t offset_ = 0, uint32_t size_ = 0 ) - : stageFlags( stageFlags_ ) - , offset( offset_ ) - , size( size_ ) + : stageFlags( stageFlags_ ) + , offset( offset_ ) + , size( size_ ) {} PushConstantRange( VkPushConstantRange const & rhs ) @@ -53570,8 +53563,8 @@ namespace VULKAN_HPP_NAMESPACE { VertexInputBindingDivisorDescriptionEXT( uint32_t binding_ = 0, uint32_t divisor_ = 0 ) - : binding( binding_ ) - , divisor( divisor_ ) + : binding( binding_ ) + , divisor( divisor_ ) {} VertexInputBindingDivisorDescriptionEXT( VkVertexInputBindingDivisorDescriptionEXT const & rhs ) @@ -53925,8 +53918,8 @@ namespace VULKAN_HPP_NAMESPACE { ShadingRatePaletteNV( uint32_t shadingRatePaletteEntryCount_ = 0, const vk::ShadingRatePaletteEntryNV* pShadingRatePaletteEntries_ = nullptr ) - : shadingRatePaletteEntryCount( shadingRatePaletteEntryCount_ ) - , pShadingRatePaletteEntries( pShadingRatePaletteEntries_ ) + : shadingRatePaletteEntryCount( shadingRatePaletteEntryCount_ ) + , pShadingRatePaletteEntries( pShadingRatePaletteEntries_ ) {} ShadingRatePaletteNV( VkShadingRatePaletteNV const & rhs ) @@ -54092,10 +54085,10 @@ namespace VULKAN_HPP_NAMESPACE vk::ViewportCoordinateSwizzleNV y_ = vk::ViewportCoordinateSwizzleNV::ePositiveX, vk::ViewportCoordinateSwizzleNV z_ = vk::ViewportCoordinateSwizzleNV::ePositiveX, vk::ViewportCoordinateSwizzleNV w_ = vk::ViewportCoordinateSwizzleNV::ePositiveX ) - : x( x_ ) - , y( y_ ) - , z( z_ ) - , w( w_ ) + : x( x_ ) + , y( y_ ) + , z( z_ ) + , w( w_ ) {} ViewportSwizzleNV( VkViewportSwizzleNV const & rhs ) @@ -54275,8 +54268,8 @@ namespace VULKAN_HPP_NAMESPACE { ViewportWScalingNV( float xcoeff_ = 0, float ycoeff_ = 0 ) - : xcoeff( xcoeff_ ) - , ycoeff( ycoeff_ ) + : xcoeff( xcoeff_ ) + , ycoeff( ycoeff_ ) {} ViewportWScalingNV( VkViewportWScalingNV const & rhs ) @@ -54667,9 +54660,9 @@ namespace VULKAN_HPP_NAMESPACE RectLayerKHR( vk::Offset2D offset_ = vk::Offset2D(), vk::Extent2D extent_ = vk::Extent2D(), uint32_t layer_ = 0 ) - : offset( offset_ ) - , extent( extent_ ) - , layer( layer_ ) + : offset( offset_ ) + , extent( extent_ ) + , layer( layer_ ) {} explicit RectLayerKHR( Rect2D const& rect2D, @@ -54677,7 +54670,6 @@ namespace VULKAN_HPP_NAMESPACE : offset( rect2D.offset ) , extent( rect2D.extent ) , layer( layer_ ) - {} RectLayerKHR( VkRectLayerKHR const & rhs ) @@ -54743,8 +54735,8 @@ namespace VULKAN_HPP_NAMESPACE { PresentRegionKHR( uint32_t rectangleCount_ = 0, const vk::RectLayerKHR* pRectangles_ = nullptr ) - : rectangleCount( rectangleCount_ ) - , pRectangles( pRectangles_ ) + : rectangleCount( rectangleCount_ ) + , pRectangles( pRectangles_ ) {} PresentRegionKHR( VkPresentRegionKHR const & rhs ) @@ -54897,8 +54889,8 @@ namespace VULKAN_HPP_NAMESPACE { PresentTimeGOOGLE( uint32_t presentID_ = 0, uint64_t desiredPresentTime_ = 0 ) - : presentID( presentID_ ) - , desiredPresentTime( desiredPresentTime_ ) + : presentID( presentID_ ) + , desiredPresentTime( desiredPresentTime_ ) {} PresentTimeGOOGLE( VkPresentTimeGOOGLE const & rhs ) @@ -56045,16 +56037,16 @@ namespace VULKAN_HPP_NAMESPACE const vk::AttachmentReference* pDepthStencilAttachment_ = nullptr, uint32_t preserveAttachmentCount_ = 0, const uint32_t* pPreserveAttachments_ = nullptr ) - : flags( flags_ ) - , pipelineBindPoint( pipelineBindPoint_ ) - , inputAttachmentCount( inputAttachmentCount_ ) - , pInputAttachments( pInputAttachments_ ) - , colorAttachmentCount( colorAttachmentCount_ ) - , pColorAttachments( pColorAttachments_ ) - , pResolveAttachments( pResolveAttachments_ ) - , pDepthStencilAttachment( pDepthStencilAttachment_ ) - , preserveAttachmentCount( preserveAttachmentCount_ ) - , pPreserveAttachments( pPreserveAttachments_ ) + : flags( flags_ ) + , pipelineBindPoint( pipelineBindPoint_ ) + , inputAttachmentCount( inputAttachmentCount_ ) + , pInputAttachments( pInputAttachments_ ) + , colorAttachmentCount( colorAttachmentCount_ ) + , pColorAttachments( pColorAttachments_ ) + , pResolveAttachments( pResolveAttachments_ ) + , pDepthStencilAttachment( pDepthStencilAttachment_ ) + , preserveAttachmentCount( preserveAttachmentCount_ ) + , pPreserveAttachments( pPreserveAttachments_ ) {} SubpassDescription( VkSubpassDescription const & rhs ) @@ -56181,13 +56173,13 @@ namespace VULKAN_HPP_NAMESPACE vk::AccessFlags srcAccessMask_ = vk::AccessFlags(), vk::AccessFlags dstAccessMask_ = vk::AccessFlags(), vk::DependencyFlags dependencyFlags_ = vk::DependencyFlags() ) - : srcSubpass( srcSubpass_ ) - , dstSubpass( dstSubpass_ ) - , srcStageMask( srcStageMask_ ) - , dstStageMask( dstStageMask_ ) - , srcAccessMask( srcAccessMask_ ) - , dstAccessMask( dstAccessMask_ ) - , dependencyFlags( dependencyFlags_ ) + : srcSubpass( srcSubpass_ ) + , dstSubpass( dstSubpass_ ) + , srcStageMask( srcStageMask_ ) + , dstStageMask( dstStageMask_ ) + , srcAccessMask( srcAccessMask_ ) + , dstAccessMask( dstAccessMask_ ) + , dependencyFlags( dependencyFlags_ ) {} SubpassDependency( VkSubpassDependency const & rhs ) @@ -57280,8 +57272,8 @@ namespace VULKAN_HPP_NAMESPACE { SubpassSampleLocationsEXT( uint32_t subpassIndex_ = 0, vk::SampleLocationsInfoEXT sampleLocationsInfo_ = vk::SampleLocationsInfoEXT() ) - : subpassIndex( subpassIndex_ ) - , sampleLocationsInfo( sampleLocationsInfo_ ) + : subpassIndex( subpassIndex_ ) + , sampleLocationsInfo( sampleLocationsInfo_ ) {} SubpassSampleLocationsEXT( VkSubpassSampleLocationsEXT const & rhs ) diff --git a/include/vulkan/vulkan_core.h b/include/vulkan/vulkan_core.h index 50f72f6..36aa30a 100644 --- a/include/vulkan/vulkan_core.h +++ b/include/vulkan/vulkan_core.h @@ -44,7 +44,7 @@ extern "C" { #define VK_VERSION_MINOR(version) (((uint32_t)(version) >> 12) & 0x3ff) #define VK_VERSION_PATCH(version) ((uint32_t)(version) & 0xfff) // Version of this file -#define VK_HEADER_VERSION 121 +#define VK_HEADER_VERSION 122 #define VK_NULL_HANDLE 0 @@ -6993,7 +6993,7 @@ typedef struct VkExportMemoryAllocateInfoNV { #define VK_EXT_validation_flags 1 -#define VK_EXT_VALIDATION_FLAGS_SPEC_VERSION 1 +#define VK_EXT_VALIDATION_FLAGS_SPEC_VERSION 2 #define VK_EXT_VALIDATION_FLAGS_EXTENSION_NAME "VK_EXT_validation_flags" typedef enum VkValidationCheckEXT { @@ -9729,7 +9729,7 @@ typedef struct VkPhysicalDeviceYcbcrImageArraysFeaturesEXT { #define VK_EXT_headless_surface 1 -#define VK_EXT_HEADLESS_SURFACE_SPEC_VERSION 0 +#define VK_EXT_HEADLESS_SURFACE_SPEC_VERSION 1 #define VK_EXT_HEADLESS_SURFACE_EXTENSION_NAME "VK_EXT_headless_surface" typedef VkFlags VkHeadlessSurfaceCreateFlagsEXT; typedef struct VkHeadlessSurfaceCreateInfoEXT { diff --git a/registry/cgenerator.py b/registry/cgenerator.py index 75e03cf..a416e7d 100644 --- a/registry/cgenerator.py +++ b/registry/cgenerator.py @@ -16,119 +16,120 @@ import os import re -import sys from generator import (GeneratorOptions, OutputGenerator, noneStr, regSortFeatures, write) -# CGeneratorOptions - subclass of GeneratorOptions. -# -# Adds options used by COutputGenerator objects during C language header -# generation. -# -# Additional members -# prefixText - list of strings to prefix generated header with -# (usually a copyright statement + calling convention macros). -# protectFile - True if multiple inclusion protection should be -# generated (based on the filename) around the entire header. -# protectFeature - True if #ifndef..#endif protection should be -# generated around a feature interface in the header file. -# genFuncPointers - True if function pointer typedefs should be -# generated -# protectProto - If conditional protection should be generated -# around prototype declarations, set to either '#ifdef' -# to require opt-in (#ifdef protectProtoStr) or '#ifndef' -# to require opt-out (#ifndef protectProtoStr). Otherwise -# set to None. -# protectProtoStr - #ifdef/#ifndef symbol to use around prototype -# declarations, if protectProto is set -# apicall - string to use for the function declaration prefix, -# such as APICALL on Windows. -# apientry - string to use for the calling convention macro, -# in typedefs, such as APIENTRY. -# apientryp - string to use for the calling convention macro -# in function pointer typedefs, such as APIENTRYP. -# directory - directory into which to generate include files -# indentFuncProto - True if prototype declarations should put each -# parameter on a separate line -# indentFuncPointer - True if typedefed function pointers should put each -# parameter on a separate line -# alignFuncParam - if nonzero and parameters are being put on a -# separate line, align parameter names at the specified column -# genEnumBeginEndRange - True if BEGIN_RANGE / END_RANGE macros should -# be generated for enumerated types -# genAliasMacro - True if the OpenXR alias macro should be generated -# for aliased types (unclear what other circumstances this is useful) -# aliasMacro - alias macro to inject when genAliasMacro is True + class CGeneratorOptions(GeneratorOptions): - """Represents options during C interface generation for headers""" + """CGeneratorOptions - subclass of GeneratorOptions. + + Adds options used by COutputGenerator objects during C language header + generation.""" def __init__(self, - conventions = None, - filename = None, - directory = '.', - apiname = None, - profile = None, - versions = '.*', - emitversions = '.*', - defaultExtensions = None, - addExtensions = None, - removeExtensions = None, - emitExtensions = None, - sortProcedure = regSortFeatures, - prefixText = "", - genFuncPointers = True, - protectFile = True, - protectFeature = True, - protectProto = None, - protectProtoStr = None, - apicall = '', - apientry = '', - apientryp = '', - indentFuncProto = True, - indentFuncPointer = False, - alignFuncParam = 0, - genEnumBeginEndRange = False, - genAliasMacro = False, - aliasMacro = '' - ): - GeneratorOptions.__init__(self, conventions, filename, directory, apiname, profile, - versions, emitversions, defaultExtensions, - addExtensions, removeExtensions, - emitExtensions, sortProcedure) - self.prefixText = prefixText + prefixText="", + genFuncPointers=True, + protectFile=True, + protectFeature=True, + protectProto=None, + protectProtoStr=None, + apicall='', + apientry='', + apientryp='', + indentFuncProto=True, + indentFuncPointer=False, + alignFuncParam=0, + genEnumBeginEndRange=False, + genAliasMacro=False, + aliasMacro='', + **kwargs + ): + """Constructor. + Additional parameters beyond parent class: + + - prefixText - list of strings to prefix generated header with + (usually a copyright statement + calling convention macros). + - protectFile - True if multiple inclusion protection should be + generated (based on the filename) around the entire header. + - protectFeature - True if #ifndef..#endif protection should be + generated around a feature interface in the header file. + - genFuncPointers - True if function pointer typedefs should be + generated + - protectProto - If conditional protection should be generated + around prototype declarations, set to either '#ifdef' + to require opt-in (#ifdef protectProtoStr) or '#ifndef' + to require opt-out (#ifndef protectProtoStr). Otherwise + set to None. + - protectProtoStr - #ifdef/#ifndef symbol to use around prototype + declarations, if protectProto is set + - apicall - string to use for the function declaration prefix, + such as APICALL on Windows. + - apientry - string to use for the calling convention macro, + in typedefs, such as APIENTRY. + - apientryp - string to use for the calling convention macro + in function pointer typedefs, such as APIENTRYP. + - indentFuncProto - True if prototype declarations should put each + parameter on a separate line + - indentFuncPointer - True if typedefed function pointers should put each + parameter on a separate line + - alignFuncParam - if nonzero and parameters are being put on a + separate line, align parameter names at the specified column + - genEnumBeginEndRange - True if BEGIN_RANGE / END_RANGE macros should + be generated for enumerated types + - genAliasMacro - True if the OpenXR alias macro should be generated + for aliased types (unclear what other circumstances this is useful) + - aliasMacro - alias macro to inject when genAliasMacro is True""" + GeneratorOptions.__init__(self, **kwargs) + + self.prefixText = prefixText + """list of strings to prefix generated header with (usually a copyright statement + calling convention macros).""" + self.genFuncPointers = genFuncPointers - self.protectFile = protectFile - self.protectFeature = protectFeature - self.protectProto = protectProto + """True if function pointer typedefs should be generated""" + + self.protectFile = protectFile + """True if multiple inclusion protection should be generated (based on the filename) around the entire header.""" + + self.protectFeature = protectFeature + """True if #ifndef..#endif protection should be generated around a feature interface in the header file.""" + + self.protectProto = protectProto + """If conditional protection should be generated around prototype declarations, set to either '#ifdef' to require opt-in (#ifdef protectProtoStr) or '#ifndef' to require opt-out (#ifndef protectProtoStr). Otherwise set to None.""" + self.protectProtoStr = protectProtoStr - self.apicall = apicall - self.apientry = apientry - self.apientryp = apientryp + """#ifdef/#ifndef symbol to use around prototype declarations, if protectProto is set""" + + self.apicall = apicall + """string to use for the function declaration prefix, such as APICALL on Windows.""" + + self.apientry = apientry + """string to use for the calling convention macro, in typedefs, such as APIENTRY.""" + + self.apientryp = apientryp + """string to use for the calling convention macro in function pointer typedefs, such as APIENTRYP.""" + self.indentFuncProto = indentFuncProto + """True if prototype declarations should put each parameter on a separate line""" + self.indentFuncPointer = indentFuncPointer - self.alignFuncParam = alignFuncParam + """True if typedefed function pointers should put each parameter on a separate line""" + + self.alignFuncParam = alignFuncParam + """if nonzero and parameters are being put on a separate line, align parameter names at the specified column""" + self.genEnumBeginEndRange = genEnumBeginEndRange - self.genAliasMacro = genAliasMacro - self.aliasMacro = aliasMacro + """True if BEGIN_RANGE / END_RANGE macros should be generated for enumerated types""" + + self.genAliasMacro = genAliasMacro + """True if the OpenXR alias macro should be generated for aliased types (unclear what other circumstances this is useful)""" + + self.aliasMacro = aliasMacro + """alias macro to inject when genAliasMacro is True""" + -# COutputGenerator - subclass of OutputGenerator. -# Generates C-language API interfaces. -# -# ---- methods ---- -# COutputGenerator(errFile, warnFile, diagFile) - args as for -# OutputGenerator. Defines additional internal state. -# ---- methods overriding base class ---- -# beginFile(genOpts) -# endFile() -# beginFeature(interface, emit) -# endFeature() -# genType(typeinfo,name) -# genStruct(typeinfo,name) -# genGroup(groupinfo,name) -# genEnum(enuminfo, name) -# genCmd(cmdinfo) class COutputGenerator(OutputGenerator): - """Generate specified API interfaces in a specific style, such as a C header""" + """Generates C-language API interfaces.""" + # This is an ordered list of sections in the header file. TYPE_SECTIONS = ['include', 'define', 'basetype', 'handle', 'enum', 'group', 'bitmask', 'funcpointer', 'struct'] @@ -189,8 +190,8 @@ class COutputGenerator(OutputGenerator): self.feature_not_empty = False def endFeature(self): + "Actually write the interface to the output file." # C-specific - # Actually write the interface to the output file. if self.emit: if self.feature_not_empty: if self.genOpts.conventions.writeFeature(self.featureExtraProtect, self.genOpts.filename): @@ -214,7 +215,7 @@ class COutputGenerator(OutputGenerator): if self.sections['command']: if self.genOpts.protectProto: write(self.genOpts.protectProto, - self.genOpts.protectProtoStr, file=self.outFile) + self.genOpts.protectProtoStr, file=self.outFile) write('\n'.join(self.sections['command']), end='', file=self.outFile) if self.genOpts.protectProto: write('#endif', file=self.outFile) @@ -227,14 +228,14 @@ class COutputGenerator(OutputGenerator): # Finish processing in superclass OutputGenerator.endFeature(self) - # Append a definition to the specified section def appendSection(self, section, text): + "Append a definition to the specified section" # self.sections[section].append('SECTION: ' + section + '\n') self.sections[section].append(text) self.feature_not_empty = True - # Type generation def genType(self, typeinfo, name, alias): + "Generate type." OutputGenerator.genType(self, typeinfo, name, alias) typeElem = typeinfo.elem @@ -275,12 +276,13 @@ class COutputGenerator(OutputGenerator): body += '\n' self.appendSection(section, body) - # Protection string generation - # Protection strings are the strings defining the OS/Platform/Graphics - # requirements for a given OpenXR command. When generating the - # language header files, we need to make sure the items specific to a - # graphics API or OS platform are properly wrapped in #ifs. def genProtectString(self, protect_str): + """Generate protection string. + + Protection strings are the strings defining the OS/Platform/Graphics + requirements for a given OpenXR command. When generating the + language header files, we need to make sure the items specific to a + graphics API or OS platform are properly wrapped in #ifs.""" protect_if_str = '' protect_end_str = '' if not protect_str: @@ -315,16 +317,18 @@ class COutputGenerator(OutputGenerator): if x is not None)) return typeName in self.may_alias - # Struct (e.g. C "struct" type) generation. - # This is a special case of the tag where the contents are - # interpreted as a set of tags instead of freeform C - # C type declarations. The tags are just like - # tags - they are a declaration of a struct or union member. - # Only simple member declarations are supported (no nested - # structs etc.) - # If alias is not None, then this struct aliases another; just - # generate a typedef of that alias. def genStruct(self, typeinfo, typeName, alias): + """Generate struct (e.g. C "struct" type). + + This is a special case of the tag where the contents are + interpreted as a set of tags instead of freeform C + C type declarations. The tags are just like + tags - they are a declaration of a struct or union member. + Only simple member declarations are supported (no nested + structs etc.) + + If alias is not None, then this struct aliases another; just + generate a typedef of that alias.""" OutputGenerator.genStruct(self, typeinfo, typeName, alias) typeElem = typeinfo.elem @@ -356,11 +360,13 @@ class COutputGenerator(OutputGenerator): self.appendSection('struct', body) - # Group (e.g. C "enum" type) generation. - # These are concatenated together with other types. - # If alias is not None, it is the name of another group type - # which aliases this type; just generate that alias. - def genGroup(self, groupinfo, groupName, alias = None): + def genGroup(self, groupinfo, groupName, alias=None): + """Generate groups (e.g. C "enum" type). + + These are concatenated together with other types. + + If alias is not None, it is the name of another group type + which aliases this type; just generate that alias.""" OutputGenerator.genGroup(self, groupinfo, groupName, alias) groupElem = groupinfo.elem @@ -380,17 +386,18 @@ class COutputGenerator(OutputGenerator): (section, body) = self.buildEnumCDecl(self.genOpts.genEnumBeginEndRange, groupinfo, groupName) self.appendSection(section, "\n" + body) - # Enumerant generation - # tags may specify their values in several ways, but are usually - # just integers. def genEnum(self, enuminfo, name, alias): + """Generate enumerants. + + tags may specify their values in several ways, but are usually + just integers.""" OutputGenerator.genEnum(self, enuminfo, name, alias) (_, strVal) = self.enumToValue(enuminfo.elem, False) body = '#define ' + name.ljust(33) + ' ' + strVal self.appendSection('enum', body) - # Command generation def genCmd(self, cmdinfo, name, alias): + "Command generation" OutputGenerator.genCmd(self, cmdinfo, name, alias) # if alias: diff --git a/registry/conventions.py b/registry/conventions.py index 8991b17..e95cf2b 100644 --- a/registry/conventions.py +++ b/registry/conventions.py @@ -314,3 +314,10 @@ class ConventionsBase: May override.""" return typename in TYPES_KNOWN_ALWAYS_VALID + + @property + def should_skip_checking_codes(self): + """Return True if more than the basic validation of return codes should + be skipped for a command.""" + + return False diff --git a/registry/generator.py b/registry/generator.py index 1e4be14..08179b1 100644 --- a/registry/generator.py +++ b/registry/generator.py @@ -13,6 +13,7 @@ # 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. +"""Base class for source/header/doc generators, as well as some utility functions.""" from __future__ import unicode_literals @@ -35,111 +36,82 @@ def write(*args, **kwargs): file.write(' '.join(str(arg) for arg in args)) file.write(end) -# noneStr - returns string argument, or "" if argument is None. -# Used in converting etree Elements into text. -# s - string to convert + def noneStr(s): + """Return string argument, or "" if argument is None. + + Used in converting etree Elements into text. + s - string to convert""" if s: return s return "" -# noneInt - returns string argument as an integer, or default if argument is -# None. -# Used in converting etree Elements into integers. -# s - string to convert -# default - default value -def noneInt(s, default = 0): - if s: - return int(s) - else: - return default - -# enquote - returns string argument with surrounding quotes, -# for serialization into Python code. def enquote(s): + """Return string argument with surrounding quotes, + for serialization into Python code.""" if s: return "'{}'".format(s) return None -# 1st sort key for regSortFeatures. -# Sorts by category of the feature name string: -# Core API features (those defined with a tag) -# ARB/KHR/OES (Khronos extensions) -# other (EXT/vendor extensions) -# This will need changing for Vulkan! def regSortCategoryKey(feature): + """Primary sort key for regSortFeatures. + + Sorts by category of the feature name string: + + - Core API features (those defined with a `` tag) + - ARB/KHR/OES (Khronos extensions) + - other (EXT/vendor extensions) + + This may need to change for some APIs""" + if feature.elem.tag == 'feature': return 0 - if (feature.category == 'ARB' or - feature.category == 'KHR' or - feature.category == 'OES'): + if (feature.category == 'ARB' + or feature.category == 'KHR' + or feature.category == 'OES'): return 1 return 2 -# 2nd sort key for regSortFeatures. -# Sorts by sortorder attribute def regSortOrderKey(feature): + """Secondary sort key for regSortFeatures. + Sorts by sortorder attribute.""" + return feature.sortorder -# 3rd sort key for regSortFeatures. -# Sorts by feature version. elements all have version number "0" def regSortFeatureVersionKey(feature): + """Tertiary sort key for regSortFeatures. + + Sorts by feature version. + `` elements all have version number 0.""" + return float(feature.versionNumber) -# 4th sort key for regSortFeatures. -# Sorts by extension number. elements all have extension number 0. def regSortExtensionNumberKey(feature): + """Last sort key for regSortFeatures. + + Sorts by extension number. + `` elements all have extension number 0.""" + return int(feature.number) -# regSortFeatures - default sort procedure for features. -# Sorts by primary key of feature category ('feature', or extension tag) -# then by sort order within the category -# then by version number (for features) -# then by extension number (for extensions) def regSortFeatures(featureList): + """Default sort procedure for features. + + - Sorts by primary key of feature category ('feature' or 'extension'), + - then by sort order within the category + - then by version number (for features) + - then by extension number (for extensions)""" featureList.sort(key=regSortExtensionNumberKey) featureList.sort(key=regSortFeatureVersionKey) featureList.sort(key=regSortOrderKey) featureList.sort(key=regSortCategoryKey) -# GeneratorOptions - base class for options used during header production -# These options are target language independent, and used by -# Registry.apiGen() and by base OutputGenerator objects. -# -# Members -# conventions - may be mandatory for some generators: -# an object that implements ConventionsBase -# filename - basename of file to generate, or None to write to stdout. -# directory - directory in which to generate filename -# apiname - string matching 'apiname' attribute, e.g. 'gl'. -# profile - string specifying API profile , e.g. 'core', or None. -# versions - regex matching API versions to process interfaces for. -# Normally '.*' or '[0-9]\.[0-9]' to match all defined versions. -# emitversions - regex matching API versions to actually emit -# interfaces for (though all requested versions are considered -# when deciding which interfaces to generate). For GL 4.3 glext.h, -# this might be '1\.[2-5]|[2-4]\.[0-9]'. -# defaultExtensions - If not None, a string which must in its -# entirety match the pattern in the "supported" attribute of -# the . Defaults to None. Usually the same as apiname. -# addExtensions - regex matching names of additional extensions -# to include. Defaults to None. -# removeExtensions - regex matching names of extensions to -# remove (after defaultExtensions and addExtensions). Defaults -# to None. -# emitExtensions - regex matching names of extensions to actually emit -# interfaces for (though all requested versions are considered when -# deciding which interfaces to generate). -# sortProcedure - takes a list of FeatureInfo objects and sorts -# them in place to a preferred order in the generated output. -# Default is core API versions, ARB/KHR/OES extensions, all other -# extensions, by core API version number or extension number in -# each group. -# The regex patterns can be None or empty, in which case they match -# nothing. class GeneratorOptions: - """Represents options during header production from an API registry""" + """Base class for options used during header/documentation production. + + These options are target language independent, and used by + Registry.apiGen() and by base OutputGenerator objects.""" def __init__(self, conventions=None, @@ -154,71 +126,108 @@ class GeneratorOptions: removeExtensions=None, emitExtensions=None, sortProcedure=regSortFeatures): - self.conventions = conventions - self.filename = filename - self.directory = directory - self.apiname = apiname - self.profile = profile - self.versions = self.emptyRegex(versions) - self.emitversions = self.emptyRegex(emitversions) + """Constructor. + + Arguments: + + - conventions - may be mandatory for some generators: + an object that implements ConventionsBase + - filename - basename of file to generate, or None to write to stdout. + - directory - directory in which to generate filename + - apiname - string matching `` 'apiname' attribute, e.g. 'gl'. + - profile - string specifying API profile , e.g. 'core', or None. + - versions - regex matching API versions to process interfaces for. + Normally `'.*'` or `'[0-9][.][0-9]'` to match all defined versions. + - emitversions - regex matching API versions to actually emit + interfaces for (though all requested versions are considered + when deciding which interfaces to generate). For GL 4.3 glext.h, + this might be `'1[.][2-5]|[2-4][.][0-9]'`. + - defaultExtensions - If not None, a string which must in its + entirety match the pattern in the "supported" attribute of + the ``. Defaults to None. Usually the same as apiname. + - addExtensions - regex matching names of additional extensions + to include. Defaults to None. + - removeExtensions - regex matching names of extensions to + remove (after defaultExtensions and addExtensions). Defaults + to None. + - emitExtensions - regex matching names of extensions to actually emit + interfaces for (though all requested versions are considered when + deciding which interfaces to generate). + - sortProcedure - takes a list of FeatureInfo objects and sorts + them in place to a preferred order in the generated output. + Default is core API versions, ARB/KHR/OES extensions, all other + extensions, by core API version number or extension number in each + group. + + The regex patterns can be None or empty, in which case they match + nothing.""" + self.conventions = conventions + """may be mandatory for some generators: + an object that implements ConventionsBase""" + + self.filename = filename + "basename of file to generate, or None to write to stdout." + + self.directory = directory + "directory in which to generate filename" + + self.apiname = apiname + "string matching `` 'apiname' attribute, e.g. 'gl'." + + self.profile = profile + "string specifying API profile , e.g. 'core', or None." + + self.versions = self.emptyRegex(versions) + """regex matching API versions to process interfaces for. + Normally `'.*'` or `'[0-9][.][0-9]'` to match all defined versions.""" + + self.emitversions = self.emptyRegex(emitversions) + """regex matching API versions to actually emit + interfaces for (though all requested versions are considered + when deciding which interfaces to generate). For GL 4.3 glext.h, + this might be `'1[.][2-5]|[2-4][.][0-9]'`.""" + self.defaultExtensions = defaultExtensions - self.addExtensions = self.emptyRegex(addExtensions) - self.removeExtensions = self.emptyRegex(removeExtensions) - self.emitExtensions = self.emptyRegex(emitExtensions) - self.sortProcedure = sortProcedure + """If not None, a string which must in its + entirety match the pattern in the "supported" attribute of + the ``. Defaults to None. Usually the same as apiname.""" + + self.addExtensions = self.emptyRegex(addExtensions) + """regex matching names of additional extensions + to include. Defaults to None.""" + + self.removeExtensions = self.emptyRegex(removeExtensions) + """regex matching names of extensions to + remove (after defaultExtensions and addExtensions). Defaults + to None.""" + + self.emitExtensions = self.emptyRegex(emitExtensions) + """regex matching names of extensions to actually emit + interfaces for (though all requested versions are considered when + deciding which interfaces to generate).""" + + self.sortProcedure = sortProcedure + """takes a list of FeatureInfo objects and sorts + them in place to a preferred order in the generated output. + Default is core API versions, ARB/KHR/OES extensions, all + other extensions, alphabetically within each group.""" - # Substitute a regular expression which matches no version - # or extension names for None or the empty string. def emptyRegex(self, pat): - if pat is None or pat == '': + """Substitute a regular expression which matches no version + or extension names for None or the empty string.""" + if not pat: return '_nomatch_^' return pat -# OutputGenerator - base class for generating API interfaces. -# Manages basic logic, logging, and output file control -# Derived classes actually generate formatted output. -# -# ---- methods ---- -# OutputGenerator(errFile, warnFile, diagFile) -# errFile, warnFile, diagFile - file handles to write errors, -# warnings, diagnostics to. May be None to not write. -# logMsg(level, *args) - log messages of different categories -# level - 'error', 'warn', or 'diag'. 'error' will also -# raise a UserWarning exception -# *args - print()-style arguments -# setExtMap(map) - specify a dictionary map from extension names to -# numbers, used in creating values for extension enumerants. -# makeDir(directory) - create a directory, if not already done. -# Generally called from derived generators creating hierarchies. -# beginFile(genOpts) - start a new interface file -# genOpts - GeneratorOptions controlling what's generated and how -# endFile() - finish an interface file, closing it when done -# beginFeature(interface, emit) - write interface for a feature -# and tag generated features as having been done. -# interface - element for the / to generate -# emit - actually write to the header only when True -# endFeature() - finish an interface. -# genType(typeinfo,name,alias) - generate interface for a type -# typeinfo - TypeInfo for a type -# genStruct(typeinfo,name,alias) - generate interface for a C "struct" type. -# typeinfo - TypeInfo for a type interpreted as a struct -# genGroup(groupinfo,name,alias) - generate interface for a group of enums (C "enum") -# groupinfo - GroupInfo for a group -# genEnum(enuminfo,name,alias) - generate interface for an enum (constant) -# enuminfo - EnumInfo for an enum -# name - enum name -# genCmd(cmdinfo,name,alias) - generate interface for a command -# cmdinfo - CmdInfo for a command -# isEnumRequired(enumElem) - return True if this element is required -# elem - element to test -# makeCDecls(cmd) - return C prototype and function pointer typedef for a -# Element, as a list of two strings -# cmd - Element for the -# newline() - print a newline to the output file (utility function) -# + class OutputGenerator: - """Generate specified API interfaces in a specific style, such as a C header""" + """Generate specified API interfaces in a specific style, such as a C header. + + Base class for generating API interfaces. + Manages basic logic, logging, and output file control. + Derived classes actually generate formatted output. + """ # categoryToPath - map XML 'category' to include file directory name categoryToPath = { @@ -230,11 +239,11 @@ class OutputGenerator: 'basetype': 'basetypes', } - # Constructor - def __init__(self, - errFile=sys.stderr, - warnFile=sys.stderr, - diagFile=sys.stdout): + def __init__(self, errFile=sys.stderr, warnFile=sys.stderr, diagFile=sys.stdout): + """Constructor + + - errFile, warnFile, diagFile - file handles to write errors, + warnings, diagnostics to. May be None to not write.""" self.outFile = None self.errFile = errFile self.warnFile = warnFile @@ -248,15 +257,16 @@ class OutputGenerator: self.extBlockSize = 1000 self.madeDirs = {} - # logMsg - write a message of different categories to different - # destinations. - # level - - # 'diag' (diagnostic, voluminous) - # 'warn' (warning) - # 'error' (fatal error - raises exception after logging) - # *args - print()-style arguments to direct to corresponding log def logMsg(self, level, *args): - """Log a message at the given level. Can be ignored or log to a file""" + """Write a message of different categories to different + destinations. + + - `level` + - 'diag' (diagnostic, voluminous) + - 'warn' (warning) + - 'error' (fatal error - raises exception after logging) + + - `*args` - print()-style arguments to direct to corresponding log""" if level == 'error': strfile = io.StringIO() write('ERROR:', *args, file=strfile) @@ -273,26 +283,30 @@ class OutputGenerator: raise UserWarning( '*** FATAL ERROR in Generator.logMsg: unknown level:' + level) - # enumToValue - parses and converts an tag into a value. - # Returns a list - # first element - integer representation of the value, or None - # if needsNum is False. The value must be a legal number - # if needsNum is True. - # second element - string representation of the value - # There are several possible representations of values. - # A 'value' attribute simply contains the value. - # A 'bitpos' attribute defines a value by specifying the bit - # position which is set in that value. - # A 'offset','extbase','extends' triplet specifies a value - # as an offset to a base value defined by the specified - # 'extbase' extension name, which is then cast to the - # typename specified by 'extends'. This requires probing - # the registry database, and imbeds knowledge of the - # API extension enum scheme in this function. - # A 'alias' attribute contains the name of another enum - # which this is an alias of. The other enum must be - # declared first when emitting this enum. def enumToValue(self, elem, needsNum): + """Parse and convert an `` tag into a value. + + Returns a list: + + - first element - integer representation of the value, or None + if needsNum is False. The value must be a legal number + if needsNum is True. + - second element - string representation of the value + + There are several possible representations of values. + + - A 'value' attribute simply contains the value. + - A 'bitpos' attribute defines a value by specifying the bit + position which is set in that value. + - An 'offset','extbase','extends' triplet specifies a value + as an offset to a base value defined by the specified + 'extbase' extension name, which is then cast to the + typename specified by 'extends'. This requires probing + the registry database, and imbeds knowledge of the + API extension enum scheme in this function. + - An 'alias' attribute contains the name of another enum + which this is an alias of. The other enum must be + declared first when emitting this enum.""" name = elem.get('name') numVal = None if 'value' in elem.keys(): @@ -340,10 +354,12 @@ class OutputGenerator: return [None, elem.get('alias')] return [None, None] - # checkDuplicateEnums - sanity check for enumerated values - # enums - list of Elements - # returns the list with duplicates stripped def checkDuplicateEnums(self, enums): + """Sanity check enumerated values. + + - enums - list of `` Elements + + returns the list with duplicates stripped""" # Dictionaries indexed by name and numeric value. # Entries are [ Element, numVal, strVal ] matching name or value @@ -362,15 +378,15 @@ class OutputGenerator: # Duplicate enum values for the same name are benign. This # happens when defining the same enum conditionally in # several extension blocks. - if (strVal2 == strVal or (numVal is not None and - numVal == numVal2)): + if (strVal2 == strVal or (numVal is not None + and numVal == numVal2)): True # self.logMsg('info', 'checkDuplicateEnums: Duplicate enum (' + name + # ') found with the same value:' + strVal) else: - self.logMsg('warn', 'checkDuplicateEnums: Duplicate enum (' + name + - ') found with different values:' + strVal + - ' and ' + strVal2) + self.logMsg('warn', 'checkDuplicateEnums: Duplicate enum (' + name + + ') found with different values:' + strVal + + ' and ' + strVal2) # Don't add the duplicate to the returned list continue @@ -380,8 +396,8 @@ class OutputGenerator: (name2, numVal2, strVal2) = valueMap[numVal] try: - self.logMsg('warn', 'Two enums found with the same value: ' - + name + ' = ' + name2.get('name') + ' = ' + strVal) + self.logMsg('warn', 'Two enums found with the same value: ' + + name + ' = ' + name2.get('name') + ' = ' + strVal) except: pdb.set_trace() @@ -396,9 +412,8 @@ class OutputGenerator: # Return the list return stripped - # buildEnumCDecl - # Generates the C declaration for an enum def buildEnumCDecl(self, expand, groupinfo, groupName): + """Generate the C declaration for an enum""" groupElem = groupinfo.elem if self.genOpts.conventions.constFlagBits and groupElem.get('type') == 'bitmask': @@ -406,10 +421,9 @@ class OutputGenerator: else: return self.buildEnumCDecl_Enum(expand, groupinfo, groupName) - # buildEnumCDecl_Bitmask - # Generates the C declaration for an "enum" that is actually a - # set of flag bits def buildEnumCDecl_Bitmask(self, groupinfo, groupName): + """Generate the C declaration for an "enum" that is actually a + set of flag bits""" groupElem = groupinfo.elem flagTypeName = groupinfo.flagType.elem.get('name') @@ -429,8 +443,8 @@ class OutputGenerator: return ("bitmask", body) - # Generates the C declaration for an enumerated type def buildEnumCDecl_Enum(self, expand, groupinfo, groupName): + """Generate the C declaration for an enumerated type""" groupElem = groupinfo.elem # Break the group name into prefix and suffix portions for range @@ -522,6 +536,9 @@ class OutputGenerator: return (section, '\n'.join(body)) def makeDir(self, path): + """Create a directory, if not already done. + + Generally called from derived generators creating hierarchies.""" self.logMsg('diag', 'OutputGenerator::makeDir(' + path + ')') if path not in self.madeDirs: # This can get race conditions with multiple writers, see @@ -531,6 +548,9 @@ class OutputGenerator: self.madeDirs[path] = None def beginFile(self, genOpts): + """Start a new interface file + + - genOpts - GeneratorOptions controlling what's generated and how""" self.genOpts = genOpts self.should_insert_may_alias_macro = \ self.genOpts.conventions.should_insert_may_alias_macro(self.genOpts) @@ -564,29 +584,42 @@ class OutputGenerator: self.genOpts = None def beginFeature(self, interface, emit): + """Write interface for a feature and tag generated features as having been done. + + - interface - element for the `` / `` to generate + - emit - actually write to the header only when True""" self.emit = emit self.featureName = interface.get('name') # If there's an additional 'protect' attribute in the feature, save it self.featureExtraProtect = interface.get('protect') def endFeature(self): - # Derived classes responsible for emitting feature + """Finish an interface file, closing it when done. + + Derived classes responsible for emitting feature""" self.featureName = None self.featureExtraProtect = None - # Utility method to validate we're generating something only inside a - # tag def validateFeature(self, featureType, featureName): + """Validate we're generating something only inside a `` tag""" if self.featureName is None: raise UserWarning('Attempt to generate', featureType, featureName, 'when not in feature') - # Type generation def genType(self, typeinfo, name, alias): + """Generate interface for a type + + - typeinfo - TypeInfo for a type + + Extend to generate as desired in your derived class.""" self.validateFeature('type', name) - # Struct (e.g. C "struct" type) generation def genStruct(self, typeinfo, typeName, alias): + """Generate interface for a C "struct" type. + + - typeinfo - TypeInfo for a type interpreted as a struct + + Extend to generate as desired in your derived class.""" self.validateFeature('struct', typeName) # The mixed-mode tags may contain no-op tags. @@ -596,35 +629,52 @@ class OutputGenerator: for comment in member.findall('comment'): member.remove(comment) - # Group (e.g. C "enum" type) generation def genGroup(self, groupinfo, groupName, alias): + """Generate interface for a group of enums (C "enum") + + - groupinfo - GroupInfo for a group. + + Extend to generate as desired in your derived class.""" + self.validateFeature('group', groupName) - # Enumerant (really, constant) generation def genEnum(self, enuminfo, typeName, alias): + """Generate interface for an enum (constant). + + - enuminfo - EnumInfo for an enum + - name - enum name + + Extend to generate as desired in your derived class.""" self.validateFeature('enum', typeName) - # Command generation def genCmd(self, cmd, cmdinfo, alias): + """Generate interface for a command. + + - cmdinfo - CmdInfo for a command + + Extend to generate as desired in your derived class.""" self.validateFeature('command', cmdinfo) - # Utility functions - turn a into C-language prototype - # and typedef declarations for that name. - # name - contents of tag - # tail - whatever text follows that tag in the Element def makeProtoName(self, name, tail): + """Turn a `` `` into C-language prototype + and typedef declarations for that name. + + - name - contents of `` tag + - tail - whatever text follows that tag in the Element""" return self.genOpts.apientry + name + tail def makeTypedefName(self, name, tail): + """Make the function-pointer typedef name for a command.""" return '(' + self.genOpts.apientryp + 'PFN_' + name + tail + ')' - # makeCParamDecl - return a string which is an indented, formatted - # declaration for a or block (e.g. function parameter - # or structure/union member). - # param - Element ( or ) to format - # aligncol - if non-zero, attempt to align the nested element - # at this column def makeCParamDecl(self, param, aligncol): + """Return a string which is an indented, formatted + declaration for a `` or `` block (e.g. function parameter + or structure/union member). + + - param - Element (`` or ``) to format + - aligncol - if non-zero, attempt to align the nested `` element + at this column""" indent = ' ' paramdecl = indent + noneStr(param.text) for elem in param: @@ -647,23 +697,24 @@ class OutputGenerator: self.logMsg('diag', 'Adjust length of parameter decl from', oldLen, 'to', newLen, ':', paramdecl) paramdecl += text + tail if aligncol == 0: - # Squeeze out multiple spaces other than the identation + # Squeeze out multiple spaces other than the indentation paramdecl = indent + ' '.join(paramdecl.split()) return paramdecl - # getCParamTypeLength - return the length of the type field in an - # indented, formatted declaration for a or block (e.g. - # function parameter or structure/union member). This relies on the - # presence of the tag; if not present, return zero. - # param - Element ( or ) to identify def getCParamTypeLength(self, param): + """Return the length of the type field is an indented, formatted + declaration for a `` or `` block (e.g. function parameter + or structure/union member). + + - param - Element (`` or ``) to identify""" + # Allow for missing tag newLen = 0 paramdecl = ' ' + noneStr(param.text) for elem in param: text = noneStr(elem.text) tail = noneStr(elem.tail) - if self.genOpts.conventions.is_voidpointer_alias(elem.tag, text, tail): + if self.should_insert_may_alias_macro and self.genOpts.conventions.is_voidpointer_alias(elem.tag, text, tail): # OpenXR-specific macro insertion tail = self.genOpts.conventions.make_voidpointer_alias(tail) if elem.tag == 'name': @@ -677,7 +728,7 @@ class OutputGenerator: def getMaxCParamTypeLength(self, info): """Return the length of the longest type field for a member/parameter. - info - TypeInfo or CommandInfo. + - info - TypeInfo or CommandInfo. """ lengths = (self.getCParamTypeLength(member) for member in info.getMembers()) @@ -763,10 +814,11 @@ class OutputGenerator: return True - # isEnumRequired(elem) - return True if this element is - # required, False otherwise - # elem - element to test def isEnumRequired(self, elem): + """Return True if this `` element is + required, False otherwise + + - elem - `` element to test""" required = elem.get('required') is not None self.logMsg('diag', 'isEnumRequired:', elem.get('name'), '->', required) @@ -792,11 +844,11 @@ class OutputGenerator: return required - # makeCDecls - return C prototype and function pointer typedef for a - # command, as a two-element list of strings. - # cmd - Element containing a tag def makeCDecls(self, cmd): - """Generate C function pointer typedef for Element""" + """Return C prototype and function pointer typedef for a + `` Element, as a two-element list of strings. + + - cmd - Element containing a `` tag""" proto = cmd.find('proto') params = cmd.findall('param') # Begin accumulating prototype and typedef strings @@ -858,6 +910,7 @@ class OutputGenerator: return [pdecl + indentdecl, tdecl + paramdecl] def newline(self): + """Print a newline to the output file (utility function)""" write('', file=self.outFile) def setRegistry(self, registry): diff --git a/registry/genvk.py b/registry/genvk.py index 84cad3c..1311a87 100755 --- a/registry/genvk.py +++ b/registry/genvk.py @@ -32,6 +32,7 @@ from reg import Registry from validitygenerator import ValidityOutputGenerator from vkconventions import VulkanConventions + # Simple timer functions startTime = None @@ -41,6 +42,7 @@ def startTimer(timeit): if timeit: startTime = time.process_time() + def endTimer(timeit, msg): global startTime if timeit: @@ -57,12 +59,13 @@ def makeREstring(strings, default=None, strings_are_regex=False): return '^(' + '|'.join(strings) + ')$' return default -# Returns a directory of [ generator function, generator options ] indexed -# by specified short names. The generator options incorporate the following -# parameters: -# -# args is an parsed argument object; see below for the fields that are used. + def makeGenOpts(args): + """Returns a directory of [ generator function, generator options ] indexed + by specified short names. The generator options incorporate the following + parameters: + + args is an parsed argument object; see below for the fields that are used.""" global genOpts genOpts = {} @@ -403,16 +406,18 @@ def makeGenOpts(args): alignFuncParam = 36) ] -# Generate a target based on the options in the matching genOpts{} object. -# This is encapsulated in a function so it can be profiled and/or timed. -# The args parameter is an parsed argument object containing the following -# fields that are used: -# target - target to generate -# directory - directory to generate it in -# protect - True if re-inclusion wrappers should be created -# extensions - list of additional extensions to include in generated -# interfaces + def genTarget(args): + """Generate a target based on the options in the matching genOpts{} object. + + This is encapsulated in a function so it can be profiled and/or timed. + The args parameter is an parsed argument object containing the following + fields that are used: + + - target - target to generate + - directory - directory to generate it in + - protect - True if re-inclusion wrappers should be created + - extensions - list of additional extensions to include in generated interfaces""" # Create generator options with specified parameters makeGenOpts(args) @@ -522,7 +527,7 @@ if __name__ == '__main__': if args.dump: write('* Dumping registry to regdump.txt', file=sys.stderr) - reg.dumpReg(filehandle = open('regdump.txt', 'w', encoding='utf-8')) + reg.dumpReg(filehandle=open('regdump.txt', 'w', encoding='utf-8')) # create error/warning & diagnostic files if args.errfile: diff --git a/registry/reg.py b/registry/reg.py index 27164c8..d684abc 100755 --- a/registry/reg.py +++ b/registry/reg.py @@ -13,101 +13,117 @@ # 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. +"""Types and classes for manipulating an API registry.""" import copy import re import sys import xml.etree.ElementTree as etree from collections import defaultdict, namedtuple -from generator import OutputGenerator, write, noneInt -import pdb - -# matchAPIProfile - returns whether an API and profile -# being generated matches an element's profile -# api - string naming the API to match -# profile - string naming the profile to match -# elem - Element which (may) have 'api' and 'profile' -# attributes to match to. -# If a tag is not present in the Element, the corresponding API -# or profile always matches. -# Otherwise, the tag must exactly match the API or profile. -# Thus, if 'profile' = core: -# with no attribute will match -# will match -# will not match -# Possible match conditions: -# Requested Element -# Profile Profile -# --------- -------- -# None None Always matches -# 'string' None Always matches -# None 'string' Does not match. Can't generate multiple APIs -# or profiles, so if an API/profile constraint -# is present, it must be asked for explicitly. -# 'string' 'string' Strings must match -# -# ** In the future, we will allow regexes for the attributes, -# not just strings, so that api="^(gl|gles2)" will match. Even -# this isn't really quite enough, we might prefer something -# like "gl(core)|gles1(common-lite)". +from generator import OutputGenerator, write + def matchAPIProfile(api, profile, elem): - """Match a requested API & profile name to a api & profile attributes of an Element""" + """Return whether an API and profile + being generated matches an element's profile + + - api - string naming the API to match + - profile - string naming the profile to match + - elem - Element which (may) have 'api' and 'profile' + attributes to match to. + + If a tag is not present in the Element, the corresponding API + or profile always matches. + + Otherwise, the tag must exactly match the API or profile. + + Thus, if 'profile' = core: + + - `` with no attribute will match + - `` will match + - `` will not match + + Possible match conditions: + + ``` + Requested Element + Profile Profile + --------- -------- + None None Always matches + 'string' None Always matches + None 'string' Does not match. Can't generate multiple APIs + or profiles, so if an API/profile constraint + is present, it must be asked for explicitly. + 'string' 'string' Strings must match + ``` + + ** In the future, we will allow regexes for the attributes, + not just strings, so that `api="^(gl|gles2)"` will match. Even + this isn't really quite enough, we might prefer something + like `"gl(core)|gles1(common-lite)"`.""" # Match 'api', if present elem_api = elem.get('api') if elem_api: if api is None: - raise UserWarning("No API requested, but 'api' attribute is present with value '" + - elem_api + "'") + raise UserWarning("No API requested, but 'api' attribute is present with value '" + + elem_api + "'") elif api != elem_api: # Requested API doesn't match attribute return False elem_profile = elem.get('profile') if elem_profile: if profile is None: - raise UserWarning("No profile requested, but 'profile' attribute is present with value '" + - elem_profile + "'") + raise UserWarning("No profile requested, but 'profile' attribute is present with value '" + + elem_profile + "'") elif profile != elem_profile: # Requested profile doesn't match attribute return False return True -# Print all the keys in an Element - only for diagnostics # def printKeys(msg, elem): +# """Print all the keys in an Element - only for diagnostics""" # print('printKeys:', msg, file=sys.stderr) # for key in elem.keys(): # print(' {} -> {}'.format(key, elem.get(key)), file=sys.stderr) -# BaseInfo - base class for information about a registry feature -# (type/group/enum/command/API/extension). -# required - should this feature be defined during header generation -# (has it been removed by a profile or version)? -# declared - has this feature been defined already? -# elem - etree Element for this feature -# resetState() - reset required/declared to initial values. Used -# prior to generating a new API interface. -# compareElem(info) - return True if self.elem and info.elem have the -# same definition. class BaseInfo: - """Represents the state of a registry feature, used during API generation""" + """Base class for information about a registry feature + (type/group/enum/command/API/extension). + + Represents the state of a registry feature, used during API generation. + """ + def __init__(self, elem): self.required = False + """should this feature be defined during header generation + (has it been removed by a profile or version)?""" + self.declared = False + "has this feature been defined already?" + self.elem = elem + "etree Element for this feature" + def resetState(self): + """Reset required/declared to initial values. Used + prior to generating a new API interface.""" self.required = False self.declared = False + def compareKeys(self, info, key, required = False): - # Return True if self.elem and info.elem have the same attribute - # value for key. - # If 'required' is not True, also returns True if neither element - # has an attribute value for key. + """Return True if self.elem and info.elem have the same attribute + value for key. + If 'required' is not True, also returns True if neither element + has an attribute value for key.""" + if required and key not in self.elem.keys(): return False return self.elem.get(key) == info.elem.get(key) + def compareElem(self, info, infoName): - # Return True if self.elem and info.elem have the same definition - # info - the other object - # infoName - 'type' / 'group' / 'enum' / 'command' / 'feature' / 'extension' + """Return True if self.elem and info.elem have the same definition. + info - the other object + infoName - 'type' / 'group' / 'enum' / 'command' / 'feature' / + 'extension'""" if infoName == 'enum': if self.compareKeys(info, 'extends'): @@ -132,16 +148,18 @@ class BaseInfo: # Non-s should never be redefined return False -# TypeInfo - registry information about a type. No additional state -# beyond BaseInfo is required. + class TypeInfo(BaseInfo): - """Represents the state of a registry type""" + """Registry information about a type. No additional state + beyond BaseInfo is required.""" + def __init__(self, elem): BaseInfo.__init__(self, elem) self.additionalValidity = [] self.removedValidity = [] def getMembers(self): + """Get a collection of all member elements for this type, if any.""" return self.elem.findall('member') def resetState(self): @@ -149,33 +167,37 @@ class TypeInfo(BaseInfo): self.additionalValidity = [] self.removedValidity = [] -# GroupInfo - registry information about a group of related enums -# in an block, generally corresponding to a C "enum" type. + class GroupInfo(BaseInfo): - """Represents the state of a registry group""" + """Registry information about a group of related enums + in an block, generally corresponding to a C "enum" type.""" + def __init__(self, elem): BaseInfo.__init__(self, elem) -# EnumInfo - registry information about an enum -# type - numeric type of the value of the tag -# ( '' for GLint, 'u' for GLuint, 'ull' for GLuint64 ) + class EnumInfo(BaseInfo): - """Represents the state of a registry enum""" + """Registry information about an enum""" + def __init__(self, elem): BaseInfo.__init__(self, elem) self.type = elem.get('type') + """numeric type of the value of the tag + ( '' for GLint, 'u' for GLuint, 'ull' for GLuint64 )""" if self.type is None: self.type = '' -# CmdInfo - registry information about a command + class CmdInfo(BaseInfo): - """Represents the state of a registry command""" + """Registry information about a command""" + def __init__(self, elem): BaseInfo.__init__(self, elem) self.additionalValidity = [] self.removedValidity = [] def getParams(self): + """Get a collection of all param elements for this command, if any.""" return self.elem.findall('param') def resetState(self): @@ -183,33 +205,35 @@ class CmdInfo(BaseInfo): self.additionalValidity = [] self.removedValidity = [] -# FeatureInfo - registry information about an API -# or -# name - feature name string (e.g. 'VK_KHR_surface') -# category - category, e.g. VERSION or khr/vendor tag -# version - feature name string -# features are unversioned and assigned version number 0. -# ** This is confusingly taken from the 'number' attribute of . -# Needs fixing. -# versionNumber - API version number, taken from the 'number' attribute -# of . Extensions do not have API version numbers and are -# assigned number 0. -# number - extension number, used for ordering and for -# assigning enumerant offsets. features do -# not have extension numbers and are assigned number 0. -# emit - has this feature been defined already? class FeatureInfo(BaseInfo): - """Represents the state of an API feature (version/extension)""" + """Registry information about an API + or .""" + def __init__(self, elem): BaseInfo.__init__(self, elem) self.name = elem.get('name') - self.sortorder = noneInt(elem.get('sortorder'), 0) + "feature name string (e.g. 'VK_KHR_surface')" + + self.emit = False + "has this feature been defined already?" + + self.sortorder = int(elem.get('sortorder', 0)) + """explicit numeric sort key within feature and extension groups. + Defaults to 0.""" if elem.tag == 'feature': # Element category (vendor) is meaningless for self.category = 'VERSION' + "category, e.g. VERSION or khr/vendor tag" + self.version = elem.get('name') + """feature name string""" + self.versionNumber = elem.get('number') + """versionNumber - API version number, taken from the 'number' + attribute of . Extensions do not have API version + numbers and are assigned number 0.""" + self.number = "0" self.supported = None else: @@ -218,78 +242,77 @@ class FeatureInfo(BaseInfo): self.version = "0" self.versionNumber = "0" self.number = elem.get('number') + """extension number, used for ordering and for assigning + enumerant offsets. features do not have extension + numbers and are assigned number 0.""" + # If there's no 'number' attribute, use 0, so sorting works if self.number is None: self.number = 0 self.supported = elem.get('supported') - self.emit = False -# Registry - object representing an API registry, loaded from an XML file -# Members -# tree - ElementTree containing the root -# typedict - dictionary of TypeInfo objects keyed by type name -# groupdict - dictionary of GroupInfo objects keyed by group name -# enumdict - dictionary of EnumInfo objects keyed by enum name -# cmddict - dictionary of CmdInfo objects keyed by command name -# apidict - dictionary of Elements keyed by API name -# extensions - list of Elements -# extdict - dictionary of Elements keyed by extension name -# gen - OutputGenerator object used to write headers / messages -# genOpts - GeneratorOptions object used to control which -# fetures to write and how to format them -# emitFeatures - True to actually emit features for a version / extension, -# or False to just treat them as emitted -# breakPat - regexp pattern to break on when generatng names -# Public methods -# loadElementTree(etree) - load registry from specified ElementTree -# loadFile(filename) - load registry from XML file -# setGenerator(gen) - OutputGenerator to use -# breakOnName() - specify a feature name regexp to break on when -# generating features. -# parseTree() - parse the registry once loaded & create dictionaries -# dumpReg(maxlen, filehandle) - diagnostic to dump the dictionaries -# to specified file handle (default stdout). Truncates type / -# enum / command elements to maxlen characters (default 80) -# generator(g) - specify the output generator object -# apiGen(apiname, genOpts) - generate API headers for the API type -# and profile specified in genOpts, but only for the versions and -# extensions specified there. -# apiReset() - call between calls to apiGen() to reset internal state -# Private methods -# addElementInfo(elem,info,infoName,dictionary) - add feature info to dict -# lookupElementInfo(fname,dictionary) - lookup feature info in dict + class Registry: - """Represents an API registry loaded from XML""" + """Object representing an API registry, loaded from an XML file.""" + def __init__(self): - self.tree = None - self.typedict = {} - self.groupdict = {} - self.enumdict = {} - self.cmddict = {} - self.apidict = {} - self.extensions = [] - self.requiredextensions = [] # Hack - can remove it after validity generator goes away + self.tree = None + "ElementTree containing the root ``" + + self.typedict = {} + "dictionary of TypeInfo objects keyed by type name" + + self.groupdict = {} + "dictionary of GroupInfo objects keyed by group name" + + self.enumdict = {} + "dictionary of EnumInfo objects keyed by enum name" + + self.cmddict = {} + "dictionary of CmdInfo objects keyed by command name" + + self.apidict = {} + "dictionary of FeatureInfo objects for `` elements keyed by API name" + + self.extensions = [] + "list of `` Elements" + + self.extdict = {} + "dictionary of FeatureInfo objects for `` elements keyed by extension name" + + # A default output generator, so commands prior to apiGen can report + # errors via the generator object. + self.gen = OutputGenerator() + "OutputGenerator object used to write headers / messages" + + self.genOpts = None + """GeneratorOptions object used to control which + features to write and how to format them""" + + self.emitFeatures = False + """True to actually emit features for a version / extension, + or False to just treat them as emitted""" + + self.breakPat = None + "regexp pattern to break on when generatng names" + # self.breakPat = re.compile('VkFenceImportFlagBits.*') + + self.requiredextensions = [] # Hack - can remove it after validity generator goes away + # ** Global types for automatic source generation ** # Length Member data self.commandextensiontuple = namedtuple('commandextensiontuple', - ['command', # The name of the command being modified - 'value', # The value to append to the command - 'extension']) # The name of the extension that added it + ['command', # The name of the command being modified + 'value', # The value to append to the command + 'extension']) # The name of the extension that added it self.validextensionstructs = defaultdict(list) self.commandextensionsuccesses = [] self.commandextensionerrors = [] - self.extdict = {} - # A default output generator, so commands prior to apiGen can report - # errors via the generator object. - self.gen = OutputGenerator() - self.genOpts = None - self.emitFeatures = False - self.breakPat = None - # self.breakPat = re.compile('VkFenceImportFlagBits.*') + self.filename = None def loadElementTree(self, tree): - """Load ElementTree into a Registry object and parse it""" + """Load ElementTree into a Registry object and parse it.""" self.tree = tree self.parseTree() @@ -300,20 +323,25 @@ class Registry: self.parseTree() def setGenerator(self, gen): - """Specify output generator object. None restores the default generator""" + """Specify output generator object. + + `None` restores the default generator.""" self.gen = gen self.gen.setRegistry(self) - # addElementInfo - add information about an element to the - # corresponding dictionary - # elem - ///// Element - # info - corresponding {Type|Group|Enum|Cmd|Feature}Info object - # infoName - 'type' / 'group' / 'enum' / 'command' / 'feature' / 'extension' - # dictionary - self.{type|group|enum|cmd|api|ext}dict - # If the Element has an 'api' attribute, the dictionary key is the - # tuple (name,api). If not, the key is the name. 'name' is an - # attribute of the Element def addElementInfo(self, elem, info, infoName, dictionary): + """Add information about an element to the corresponding dictionary. + + Intended for internal use only. + + - elem - ``/``/``/``/``/`` Element + - info - corresponding {Type|Group|Enum|Cmd|Feature}Info object + - infoName - 'type' / 'group' / 'enum' / 'command' / 'feature' / 'extension' + - dictionary - self.{type|group|enum|cmd|api|ext}dict + + If the Element has an 'api' attribute, the dictionary key is the + tuple (name,api). If not, the key is the name. 'name' is an + attribute of the Element""" # self.gen.logMsg('diag', 'Adding ElementInfo.required =', # info.required, 'name =', elem.get('name')) api = elem.get('api') @@ -333,11 +361,15 @@ class Registry: else: dictionary[key] = info - # lookupElementInfo - find a {Type|Enum|Cmd}Info object by name. - # If an object qualified by API name exists, use that. - # fname - name of type / enum / command - # dictionary - self.{type|enum|cmd}dict def lookupElementInfo(self, fname, dictionary): + """Find a {Type|Enum|Cmd}Info object by name. + + Intended for internal use only. + + If an object qualified by API name exists, use that. + + - fname - name of type / enum / command + - dictionary - self.{type|enum|cmd}dict""" key = (fname, self.genOpts.apiname) if key in dictionary: # self.gen.logMsg('diag', 'Found API-specific element for feature', fname) @@ -349,6 +381,7 @@ class Registry: return None def breakOnName(self, regexp): + """Specify a feature name regexp to break on when generating features.""" self.breakPat = re.compile(regexp) def parseTree(self): @@ -424,7 +457,7 @@ class Registry: # name - if it exists. for (name, alias, cmd) in cmdAlias: if alias in self.cmddict: - #@ pdb.set_trace() + # @ pdb.set_trace() aliasInfo = self.cmddict[alias] cmdElem = copy.deepcopy(aliasInfo.elem) cmdElem.find('proto/name').text = name @@ -434,11 +467,11 @@ class Registry: # Replace the dictionary entry for the CmdInfo element self.cmddict[name] = ci - #@ newString = etree.tostring(base, encoding="unicode").replace(aliasValue, aliasName) - #@elem.append(etree.fromstring(replacement)) + # @ newString = etree.tostring(base, encoding="unicode").replace(aliasValue, aliasName) + # @elem.append(etree.fromstring(replacement)) else: self.gen.logMsg('warn', 'No matching found for command', - cmd.get('name'), 'alias', alias) + cmd.get('name'), 'alias', alias) # Create dictionaries of API and extension interfaces # from toplevel and tags. @@ -496,7 +529,7 @@ class Registry: pass else: self.gen.logMsg('warn', 'NO matching group', - groupName, 'for enum', enum.get('name'), 'found.') + groupName, 'for enum', enum.get('name'), 'found.') addEnumInfo = True elif enum.get('value') or enum.get('bitpos') or enum.get('alias'): # self.gen.logMsg('diag', 'Adding extension constant "enum"', @@ -550,7 +583,7 @@ class Registry: pass else: self.gen.logMsg('warn', 'NO matching group', - groupName, 'for enum', enum.get('name'), 'found.') + groupName, 'for enum', enum.get('name'), 'found.') addEnumInfo = True elif enum.get('value') or enum.get('bitpos') or enum.get('alias'): # self.gen.logMsg('diag', 'Adding extension constant "enum"', @@ -577,8 +610,11 @@ class Registry: for parent in self.validextensionstructs: self.validextensionstructs[parent].sort() - def dumpReg(self, maxlen = 120, filehandle = sys.stdout): - """Dump all the dictionaries constructed from the Registry object""" + def dumpReg(self, maxlen=120, filehandle=sys.stdout): + """Dump all the dictionaries constructed from the Registry object. + + Diagnostic to dump the dictionaries to specified file handle (default stdout). + Truncates type / enum / command elements to maxlen characters (default 120)""" write('***************************************', file=filehandle) write(' ** Dumping Registry contents **', file=filehandle) write('***************************************', file=filehandle) @@ -601,20 +637,18 @@ class Registry: write('// APIs', file=filehandle) for key in self.apidict: write(' API Version ', key, '->', - etree.tostring(self.apidict[key].elem)[0:maxlen], file=filehandle) + etree.tostring(self.apidict[key].elem)[0:maxlen], file=filehandle) write('// Extensions', file=filehandle) for key in self.extdict: write(' Extension', key, '->', - etree.tostring(self.extdict[key].elem)[0:maxlen], file=filehandle) - # write('***************************************', file=filehandle) - # write(' ** Dumping XML ElementTree **', file=filehandle) - # write('***************************************', file=filehandle) - # write(etree.tostring(self.tree.getroot(),pretty_print=True), file=filehandle) - - # typename - name of type - # required - boolean (to tag features as required or not) + etree.tostring(self.extdict[key].elem)[0:maxlen], file=filehandle) + def markTypeRequired(self, typename, required): - """Require (along with its dependencies) or remove (but not its dependencies) a type""" + """Require (along with its dependencies) or remove (but not its dependencies) a type. + + - typename - name of type + - required - boolean (to tag features as required or not) + """ self.gen.logMsg('diag', 'tagging type:', typename, '-> required =', required) # Get TypeInfo object for tag corresponding to typename typeinfo = self.lookupElementInfo(typename, self.typedict) @@ -623,11 +657,11 @@ class Registry: # Tag type dependencies in 'alias' and 'required' attributes as # required. This DOES NOT un-tag dependencies in a # tag. See comments in markRequired() below for the reason. - for attrib_name in [ 'requires', 'alias' ]: + for attrib_name in ['requires', 'alias']: depname = typeinfo.elem.get(attrib_name) if depname: self.gen.logMsg('diag', 'Generating dependent type', - depname, 'for', attrib_name, 'type', typename) + depname, 'for', attrib_name, 'type', typename) # Don't recurse on self-referential structures. if typename != depname: self.markTypeRequired(depname, required) @@ -654,7 +688,7 @@ class Registry: depType = typeinfo.elem.get('bitvalues') if depType: self.gen.logMsg('diag', 'Generating bitflag type', - depType, 'for type', typename) + depType, 'for type', typename) self.markTypeRequired(depType, required) group = self.lookupElementInfo(depType, self.groupdict) if group is not None: @@ -662,11 +696,13 @@ class Registry: typeinfo.required = required elif '.h' not in typename: - self.gen.logMsg('warn', 'type:', typename , 'IS NOT DEFINED') + self.gen.logMsg('warn', 'type:', typename, 'IS NOT DEFINED') - # enumname - name of enum - # required - boolean (to tag features as required or not) def markEnumRequired(self, enumname, required): + """Mark an enum as required or not. + + - enumname - name of enum + - required - boolean (to tag features as required or not)""" self.gen.logMsg('diag', 'tagging enum:', enumname, '-> required =', required) enum = self.lookupElementInfo(enumname, self.enumdict) if enum is not None: @@ -675,14 +711,16 @@ class Registry: depname = enum.elem.get('alias') if depname: self.gen.logMsg('diag', 'Generating dependent enum', - depname, 'for alias', enumname, 'required =', enum.required) + depname, 'for alias', enumname, 'required =', enum.required) self.markEnumRequired(depname, required) else: - self.gen.logMsg('warn', 'enum:', enumname , 'IS NOT DEFINED') + self.gen.logMsg('warn', 'enum:', enumname, 'IS NOT DEFINED') - # cmdname - name of command - # required - boolean (to tag features as required or not) def markCmdRequired(self, cmdname, required): + """Mark a command as required or not. + + - cmdname - name of command + - required - boolean (to tag features as required or not)""" self.gen.logMsg('diag', 'tagging command:', cmdname, '-> required =', required) cmd = self.lookupElementInfo(cmdname, self.cmddict) if cmd is not None: @@ -691,7 +729,7 @@ class Registry: depname = cmd.elem.get('alias') if depname: self.gen.logMsg('diag', 'Generating dependent command', - depname, 'for alias', cmdname) + depname, 'for alias', cmdname) self.markCmdRequired(depname, required) # Tag all parameter types of this command as required. # This DOES NOT remove types of commands in a @@ -707,11 +745,12 @@ class Registry: else: self.gen.logMsg('warn', 'command:', cmdname, 'IS NOT DEFINED') - # featurename - name of the feature - # feature - Element for or tag - # required - boolean (to tag features as required or not) def markRequired(self, featurename, feature, required): - """Require or remove features specified in the Element""" + """Require or remove features specified in the Element. + + - featurename - name of the feature + - feature - Element for `` or `` tag + - required - boolean (to tag features as required or not)""" self.gen.logMsg('diag', 'markRequired (feature = , required =', required, ')') # Loop over types, enums, and commands in the tag @@ -745,13 +784,14 @@ class Registry: else: self.gen.logMsg('warn', 'extend type:', extendType, 'IS NOT SUPPORTED') - # interface - Element for or , containing - # and tags - # featurename - name of the feature - # api - string specifying API name being generated - # profile - string specifying API profile being generated def requireAndRemoveFeatures(self, interface, featurename, api, profile): - """Process and tags for a or """ + """Process `` and `` tags for a `` or ``. + + - interface - Element for `` or ``, containing + `` and `` tags + - featurename - name of the feature + - api - string specifying API name being generated + - profile - string specifying API profile being generated""" # marks things that are required by this version/profile for feature in interface.findall('require'): if matchAPIProfile(api, profile, feature): @@ -780,15 +820,16 @@ class Registry: if v.get('struct'): self.typedict[v.get('struct')].removedValidity.append(copy.deepcopy(v)) - # generateFeature - generate a single type / enum group / enum / command, - # and all its dependencies as needed. - # fname - name of feature (//) - # ftype - type of feature, 'type' | 'enum' | 'command' - # dictionary - of *Info objects - self.{type|enum|cmd}dict def generateFeature(self, fname, ftype, dictionary): - #@ # Break to debugger on matching name pattern - #@ if self.breakPat and re.match(self.breakPat, fname): - #@ pdb.set_trace() + """Generate a single type / enum group / enum / command, + and all its dependencies as needed. + + - fname - name of feature (``/``/``) + - ftype - type of feature, 'type' | 'enum' | 'command' + - dictionary - of *Info objects - self.{type|enum|cmd}dict""" + # @ # Break to debugger on matching name pattern + # @ if self.breakPat and re.match(self.breakPat, fname): + # @ pdb.set_trace() self.gen.logMsg('diag', 'generateFeature: generating', ftype, fname) f = self.lookupElementInfo(fname, dictionary) @@ -840,14 +881,14 @@ class Registry: # not just immediate children for subtype in f.elem.findall('.//type'): self.gen.logMsg('diag', 'Generating required dependent ', - subtype.text) + subtype.text) self.generateFeature(subtype.text, 'type', self.typedict) # Generate enums used in defining this type, for example in # member[MEMBER_SIZE] for subtype in f.elem.findall('.//enum'): self.gen.logMsg('diag', 'Generating required dependent ', - subtype.text) + subtype.text) self.generateFeature(subtype.text, 'enum', self.enumdict) # If the type is an enum group, look up the corresponding @@ -866,22 +907,22 @@ class Registry: f = self.lookupElementInfo(alias, self.groupdict) elif group is None: self.gen.logMsg('warn', 'Skipping enum type', fname, - ': No matching enumerant group') + ': No matching enumerant group') return else: genProc = self.gen.genGroup f = group - #@ The enum group is not ready for generation. At this - #@ point, it contains all tags injected by - #@ tags without any verification of whether - #@ they're required or not. It may also contain - #@ duplicates injected by multiple consistent - #@ definitions of an . + # @ The enum group is not ready for generation. At this + # @ point, it contains all tags injected by + # @ tags without any verification of whether + # @ they're required or not. It may also contain + # @ duplicates injected by multiple consistent + # @ definitions of an . - #@ Pass over each enum, marking its enumdict[] entry as - #@ required or not. Mark aliases of enums as required, - #@ too. + # @ Pass over each enum, marking its enumdict[] entry as + # @ required or not. Mark aliases of enums as required, + # @ too. enums = group.elem.findall('enum') @@ -923,7 +964,7 @@ class Registry: elem.set('required', 'true') self.gen.logMsg('diag', '* also need to require alias', name) if f.elem.get('category') == 'bitmask': - followupFeature = f.elem.get( 'bitvalues' ) + followupFeature = f.elem.get('bitvalues') elif ftype == 'command': # Generate command dependencies in 'alias' attribute if alias: @@ -949,16 +990,15 @@ class Registry: self.gen.logMsg('diag', 'Skipping', ftype, fname, '(should not be emitted)') - if followupFeature : + if followupFeature: self.gen.logMsg('diag', 'Generating required bitvalues ', - followupFeature) + followupFeature) self.generateFeature(followupFeature, "type", self.typedict) - # generateRequiredInterface - generate all interfaces required - # by an API version or extension - # interface - Element for or def generateRequiredInterface(self, interface): - """Generate required C interface for specified API version/extension""" + """Generate all interfaces required by an API version or extension. + + - interface - Element for `` or ``""" # Loop over all features inside all tags. for features in interface.findall('require'): @@ -969,12 +1009,11 @@ class Registry: for c in features.findall('command'): self.generateFeature(c.get('name'), 'command', self.cmddict) - # apiGen(genOpts) - generate interface for specified versions - # genOpts - GeneratorOptions object with parameters used - # by the Generator object. def apiGen(self, genOpts): - """Generate interfaces for the specified API type and range of versions""" + """Generate interface for specified versions + - genOpts - GeneratorOptions object with parameters used + by the Generator object.""" self.gen.logMsg('diag', '*******************************************') self.gen.logMsg('diag', ' Registry.apiGen file:', genOpts.filename, 'api:', genOpts.apiname, @@ -1009,20 +1048,20 @@ class Registry: features.append(fi) if not fi.emit: self.gen.logMsg('diag', 'NOT tagging feature api =', api, - 'name =', fi.name, 'version =', fi.version, - 'for emission (does not match emitversions pattern)') + 'name =', fi.name, 'version =', fi.version, + 'for emission (does not match emitversions pattern)') else: self.gen.logMsg('diag', 'Including feature api =', api, - 'name =', fi.name, 'version =', fi.version, - 'for emission (matches emitversions pattern)') + 'name =', fi.name, 'version =', fi.version, + 'for emission (matches emitversions pattern)') else: self.gen.logMsg('diag', 'NOT including feature api =', api, - 'name =', fi.name, 'version =', fi.version, - '(does not match requested versions)') + 'name =', fi.name, 'version =', fi.version, + '(does not match requested versions)') else: self.gen.logMsg('diag', 'NOT including feature api =', api, - 'name =', fi.name, - '(does not match requested API)') + 'name =', fi.name, + '(does not match requested API)') if not apiMatch: self.gen.logMsg('warn', 'No matching API versions found!') @@ -1032,7 +1071,7 @@ class Registry: # being generated. Add extensions matching the pattern specified in # regExtensions, then remove extensions matching the pattern # specified in regRemoveExtensions - for (extName,ei) in sorted(self.extdict.items(),key = lambda x : x[1].number if x[1].number is not None else '0'): + for (extName, ei) in sorted(self.extdict.items(), key=lambda x: x[1].number if x[1].number is not None else '0'): extName = ei.name include = False @@ -1041,10 +1080,10 @@ class Registry: # 'supported' must exactly match defaultExtensions, so bracket # it with ^(pat)$. pat = '^(' + ei.elem.get('supported') + ')$' - if (self.genOpts.defaultExtensions and - re.match(pat, self.genOpts.defaultExtensions)): + if (self.genOpts.defaultExtensions + and re.match(pat, self.genOpts.defaultExtensions)): self.gen.logMsg('diag', 'Including extension', - extName, "(defaultExtensions matches the 'supported' attribute)") + extName, "(defaultExtensions matches the 'supported' attribute)") include = True # Include additional extensions if the extension name matches @@ -1053,7 +1092,7 @@ class Registry: # tagged appropriately in the registry. if regAddExtensions.match(extName) is not None: self.gen.logMsg('diag', 'Including extension', - extName, '(matches explicitly requested extensions to add)') + extName, '(matches explicitly requested extensions to add)') include = True # Remove extensions if the name matches the regexp specified # in generator options. This allows forcing removal of @@ -1061,7 +1100,7 @@ class Registry: # way in the registry. if regRemoveExtensions.match(extName) is not None: self.gen.logMsg('diag', 'Removing extension', - extName, '(matches explicitly requested extensions to remove)') + extName, '(matches explicitly requested extensions to remove)') include = False # If the extension is to be included, add it to the @@ -1071,8 +1110,8 @@ class Registry: features.append(ei) if not ei.emit: self.gen.logMsg('diag', 'NOT tagging extension', - extName, - 'for emission (does not match emitextensions pattern)') + extName, + 'for emission (does not match emitextensions pattern)') # Hack - can be removed when validity generator goes away # (Jon) I'm not sure what this does, or if it should respect @@ -1080,7 +1119,7 @@ class Registry: self.requiredextensions.append(extName) else: self.gen.logMsg('diag', 'NOT including extension', - extName, '(does not match api attribute or explicitly requested extensions)') + extName, '(does not match api attribute or explicitly requested extensions)') # Sort the features list, if a sort procedure is defined if self.genOpts.sortProcedure: @@ -1097,7 +1136,7 @@ class Registry: self.gen.logMsg('diag', 'PASS 1: TAG FEATURES') for f in features: self.gen.logMsg('diag', 'PASS 1: Tagging required and removed features for', - f.name) + f.name) self.requireAndRemoveFeatures(f.elem, f.name, self.genOpts.apiname, self.genOpts.profile) self.assignAdditionalValidity(f.elem, self.genOpts.apiname, self.genOpts.profile) @@ -1108,11 +1147,11 @@ class Registry: self.gen.beginFile(self.genOpts) for f in features: self.gen.logMsg('diag', 'PASS 2: Generating interface for', - f.name) + f.name) emit = self.emitFeatures = f.emit if not emit: self.gen.logMsg('diag', 'PASS 2: NOT declaring feature', - f.elem.get('name'), 'because it is not tagged for emission') + f.elem.get('name'), 'because it is not tagged for emission') # Generate the interface (or just tag its elements as having been # emitted, if they haven't been). self.gen.beginFeature(f.elem, emit) @@ -1120,9 +1159,10 @@ class Registry: self.gen.endFeature() self.gen.endFile() - # apiReset - use between apiGen() calls to reset internal state def apiReset(self): - """Reset type/enum/command dictionaries before generating another API""" + """Reset type/enum/command dictionaries before generating another API. + + Use between apiGen() calls to reset internal state.""" for datatype in self.typedict: self.typedict[datatype].resetState() for enum in self.enumdict: @@ -1132,9 +1172,10 @@ class Registry: for cmd in self.apidict: self.apidict[cmd].resetState() - # validateGroups - check that group= attributes match actual groups def validateGroups(self): - """Validate group= attributes on and tags""" + """Validate `group=` attributes on `` and `` tags. + + Check that `group=` attributes match actual groups""" # Keep track of group names not in tags badGroup = {} self.gen.logMsg('diag', 'VALIDATING GROUP ATTRIBUTES') @@ -1147,7 +1188,7 @@ class Registry: if group not in badGroup: badGroup[group] = 1 else: - badGroup[group] = badGroup[group] + 1 + badGroup[group] = badGroup[group] + 1 for param in cmd.findall('param'): pname = param.find('name') @@ -1161,7 +1202,7 @@ class Registry: if group not in badGroup: badGroup[group] = 1 else: - badGroup[group] = badGroup[group] + 1 + badGroup[group] = badGroup[group] + 1 if badGroup: self.gen.logMsg('diag', 'SUMMARY OF UNRECOGNIZED GROUPS') diff --git a/registry/validusage.json b/registry/validusage.json index fed2e68..aeaf2f8 100644 --- a/registry/validusage.json +++ b/registry/validusage.json @@ -1,9 +1,9 @@ { "version info": { "schema version": 2, - "api version": "1.1.121", - "comment": "from git branch: github-master commit: 59750fe4c72a9295a94e22474060d3a1635e92c8", - "date": "2019-08-25 10:57:34Z" + "api version": "1.1.122", + "comment": "from git branch: github-master commit: 194a7f4d0d552e78d6f1a2fa2ae0ddbe0215090a", + "date": "2019-09-09 03:41:35Z" }, "validation": { "vkGetInstanceProcAddr": { @@ -4062,7 +4062,7 @@ }, { "vuid": "VUID-VkFramebufferCreateInfo-pAttachments-00880", - "text": " If flags does not include VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT_KHR, each element of pAttachments must have been created with an VkFormat value that matches the VkFormat specified by the corresponding VkAttachmentDescription in renderPass" + "text": " If flags does not include VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT_KHR, each element of pAttachments must have been created with a VkFormat value that matches the VkFormat specified by the corresponding VkAttachmentDescription in renderPass" }, { "vuid": "VUID-VkFramebufferCreateInfo-pAttachments-00881", @@ -4940,7 +4940,7 @@ "(VK_NV_glsl_shader)": [ { "vuid": "VUID-VkShaderModuleCreateInfo-pCode-01376", - "text": " If pCode points to SPIR-V code, codeSize must be a multiple of 4" + "text": " If pCode is a pointer to SPIR-V code, codeSize must be a multiple of 4" }, { "vuid": "VUID-VkShaderModuleCreateInfo-pCode-01377", @@ -4948,11 +4948,11 @@ }, { "vuid": "VUID-VkShaderModuleCreateInfo-pCode-01378", - "text": " If pCode points to SPIR-V code, that code must adhere to the validation rules described by the Validation Rules within a Module section of the SPIR-V Environment appendix" + "text": " If pCode is a pointer to SPIR-V code, that code must adhere to the validation rules described by the Validation Rules within a Module section of the SPIR-V Environment appendix" }, { "vuid": "VUID-VkShaderModuleCreateInfo-pCode-01379", - "text": " If pCode points to GLSL code, it must be valid GLSL code written to the GL_KHR_vulkan_glsl GLSL extension specification" + "text": " If pCode is a pointer to GLSL code, it must be valid GLSL code written to the GL_KHR_vulkan_glsl GLSL extension specification" } ] }, @@ -8477,12 +8477,20 @@ ], "(VK_EXT_separate_stencil_usage)": [ { - "vuid": "VUID-VkImageCreateInfo-format-02534", - "text": " If format is a depth-stencil format and the pNext chain contains an instance of VkImageStencilUsageCreateInfoEXT, then its stencilUsage member must only include VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT if usage also includes it" + "vuid": "VUID-VkImageCreateInfo-format-02795", + "text": " If format is a depth-stencil format, usage includes VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT, and the pNext chain contains an instance of VkImageStencilUsageCreateInfoEXT, then VkImageStencilUsageCreateInfoEXT::stencilUsage member must also include VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT" }, { - "vuid": "VUID-VkImageCreateInfo-format-02535", - "text": " If format is a depth-stencil format and the pNext chain contains an instance of VkImageStencilUsageCreateInfoEXT, then its stencilUsage member must only include VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT if usage also includes it" + "vuid": "VUID-VkImageCreateInfo-format-02796", + "text": " If format is a depth-stencil format, usage does not include VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT, and the pNext chain contains an instance of VkImageStencilUsageCreateInfoEXT, then VkImageStencilUsageCreateInfoEXT::stencilUsage member must also not include VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT" + }, + { + "vuid": "VUID-VkImageCreateInfo-format-02797", + "text": " If format is a depth-stencil format, usage includes VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT, and the pNext chain contains an instance of VkImageStencilUsageCreateInfoEXT, then VkImageStencilUsageCreateInfoEXT::stencilUsage member must also include VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT" + }, + { + "vuid": "VUID-VkImageCreateInfo-format-02798", + "text": " If format is a depth-stencil format, usage does not include VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT, and the pNext chain contains an instance of VkImageStencilUsageCreateInfoEXT, then VkImageStencilUsageCreateInfoEXT::stencilUsage member must also not include VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT" }, { "vuid": "VUID-VkImageCreateInfo-Format-02536", @@ -8534,7 +8542,7 @@ "(VK_EXT_separate_stencil_usage)": [ { "vuid": "VUID-VkImageStencilUsageCreateInfoEXT-stencilUsage-02539", - "text": " If stencilUsage includes VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT, then bits other than VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT, and VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT must not be set" + "text": " If stencilUsage includes VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT, it must not include bits other than VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT or VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT" }, { "vuid": "VUID-VkImageStencilUsageCreateInfoEXT-sType-sType", @@ -9054,7 +9062,7 @@ "(VK_KHR_image_format_list)": [ { "vuid": "VUID-VkImageViewCreateInfo-pNext-01585", - "text": " If a VkImageFormatListCreateInfoKHR structure was included in the pNext chain of the VkImageCreateInfo struct used when creating image and the viewFormatCount field of VkImageFormatListCreateInfoKHR is not zero then format must be one of the formats in VkImageFormatListCreateInfoKHR::pViewFormats." + "text": " If a VkImageFormatListCreateInfoKHR structure was included in the pNext chain of the VkImageCreateInfo structure used when creating image and the viewFormatCount field of VkImageFormatListCreateInfoKHR is not zero then format must be one of the formats in VkImageFormatListCreateInfoKHR::pViewFormats." } ], "(VK_VERSION_1_1,VK_KHR_sampler_ycbcr_conversion)": [ @@ -10020,11 +10028,11 @@ }, { "vuid": "VUID-VkBindImageMemoryDeviceGroupInfo-extent-01640", - "text": " The extent.width member of any element of pSplitInstanceBindRegions must either be a multiple of the sparse image block width of all non-metadata aspects of the image, or else extent.width + offset.x must equal the width of the image subresource" + "text": " The extent.width member of any element of pSplitInstanceBindRegions must either be a multiple of the sparse image block width of all non-metadata aspects of the image, or else extent.width + offset.x must equal the width of the image subresource" }, { "vuid": "VUID-VkBindImageMemoryDeviceGroupInfo-extent-01641", - "text": " The extent.height member of any element of pSplitInstanceBindRegions must either be a multiple of the sparse image block height of all non-metadata aspects of the image, or else extent.height
offset.y must equal the width of the image subresource" + "text": " The extent.height member of any element of pSplitInstanceBindRegions must either be a multiple of the sparse image block height of all non-metadata aspects of the image, or else extent.height + offset.y must equal the width of the image subresource" }, { "vuid": "VUID-VkBindImageMemoryDeviceGroupInfo-sType-sType", @@ -12216,7 +12224,7 @@ "(VK_VERSION_1_1,VK_KHR_descriptor_update_template)": [ { "vuid": "VUID-vkUpdateDescriptorSetWithTemplate-pData-01685", - "text": " pData must be a valid pointer to a memory that contains one or more valid instances of VkDescriptorImageInfo, VkDescriptorBufferInfo, or VkBufferView in a layout defined by descriptorUpdateTemplate when it was created with vkCreateDescriptorUpdateTemplate" + "text": " pData must be a valid pointer to a memory containing one or more valid instances of VkDescriptorImageInfo, VkDescriptorBufferInfo, or VkBufferView in a layout defined by descriptorUpdateTemplate when it was created with vkCreateDescriptorUpdateTemplate" }, { "vuid": "VUID-vkUpdateDescriptorSetWithTemplate-device-parameter", @@ -12360,7 +12368,7 @@ }, { "vuid": "VUID-vkCmdPushDescriptorSetWithTemplateKHR-pData-01686", - "text": " pData must be a valid pointer to a memory that contains one or more valid instances of VkDescriptorImageInfo, VkDescriptorBufferInfo, or VkBufferView in a layout defined by descriptorUpdateTemplate when it was created with vkCreateDescriptorUpdateTemplateKHR" + "text": " pData must be a valid pointer to a memory containing one or more valid instances of VkDescriptorImageInfo, VkDescriptorBufferInfo, or VkBufferView in a layout defined by descriptorUpdateTemplate when it was created with vkCreateDescriptorUpdateTemplateKHR" }, { "vuid": "VUID-vkCmdPushDescriptorSetWithTemplateKHR-commandBuffer-parameter", diff --git a/registry/vk.xml b/registry/vk.xml index 60d035a..c4a1fea 100644 --- a/registry/vk.xml +++ b/registry/vk.xml @@ -154,7 +154,7 @@ server. // Vulkan 1.1 version number #define VK_API_VERSION_1_1 VK_MAKE_VERSION(1, 1, 0)// Patch version should always be set to 0 // Version of this file -#define VK_HEADER_VERSION 121 +#define VK_HEADER_VERSION 122
#define VK_DEFINE_HANDLE(object) typedef struct object##_T* object; @@ -8881,7 +8881,7 @@ typedef void CAMetalLayer;
- + @@ -9028,9 +9028,9 @@ typedef void CAMetalLayer; - + - + @@ -11264,7 +11264,7 @@ typedef void CAMetalLayer; - + diff --git a/registry/vkconventions.py b/registry/vkconventions.py index 7230fa2..929aebe 100644 --- a/registry/vkconventions.py +++ b/registry/vkconventions.py @@ -25,6 +25,31 @@ from conventions import ConventionsBase # Modified from default implementation - see category_requires_validation() below CATEGORIES_REQUIRING_VALIDATION = set(('handle', 'enum', 'bitmask')) +# Tokenize into "words" for structure types, approximately per spec "Implicit Valid Usage" section 2.7.2 +# This first set is for things we recognize explicitly as words, +# as exceptions to the general regex. +# Ideally these would be listed in the spec as exceptions, as OpenXR does. +SPECIAL_WORDS = set(( + '16Bit', # VkPhysicalDevice16BitStorageFeatures + '8Bit', # VkPhysicalDevice8BitStorageFeaturesKHR + 'AABB', # VkGeometryAABBNV + 'ASTC', # VkPhysicalDeviceTextureCompressionASTCHDRFeaturesEXT + 'D3D12', # VkD3D12FenceSubmitInfoKHR + 'Float16', # VkPhysicalDeviceShaderFloat16Int8FeaturesKHR + 'ImagePipe', # VkImagePipeSurfaceCreateInfoFUCHSIA + 'Int64', # VkPhysicalDeviceShaderAtomicInt64FeaturesKHR + 'Int8', # VkPhysicalDeviceShaderFloat16Int8FeaturesKHR + 'MacOS', # VkMacOSSurfaceCreateInfoMVK + 'Uint8', # VkPhysicalDeviceIndexTypeUint8FeaturesEXT + 'Win32', # VkWin32SurfaceCreateInfoKHR +)) +# A regex to match any of the SPECIAL_WORDS +EXCEPTION_PATTERN = r'(?P{})'.format( + '|'.join('(%s)' % re.escape(w) for w in SPECIAL_WORDS)) +MAIN_RE = re.compile( + # the negative lookahead is to prevent the all-caps pattern from being too greedy. + r'({}|([0-9]+)|([A-Z][a-z]+)|([A-Z][A-Z]*(?![a-z])))'.format(EXCEPTION_PATTERN)) + class VulkanConventions(ConventionsBase): def formatExtension(self, name): @@ -68,11 +93,12 @@ class VulkanConventions(ConventionsBase): """Generate a structure type name, like VK_STRUCTURE_TYPE_CREATE_INSTANCE_INFO""" structure_type_parts = [] # Tokenize into "words" - for elem in re.findall(r'(([A-Z][a-z]+)|([A-Z][A-Z]+))', structname): - if elem[0] == 'Vk': + for elem in MAIN_RE.findall(structname): + word = elem[0] + if word == 'Vk': structure_type_parts.append('VK_STRUCTURE_TYPE') else: - structure_type_parts.append(elem[0].upper()) + structure_type_parts.append(word.upper()) return '_'.join(structure_type_parts) @property @@ -172,7 +198,7 @@ class VulkanConventions(ConventionsBase): @property def unified_flag_refpages(self): - """Returns True if Flags/FlagBits refpages are unified, False if + """Return True if Flags/FlagBits refpages are unified, False if they're separate. """ return False @@ -198,3 +224,16 @@ class VulkanConventions(ConventionsBase): Overridden because Vulkan doesn't require "valid" text for basetype in the spec right now.""" return category in CATEGORIES_REQUIRING_VALIDATION + + @property + def should_skip_checking_codes(self): + """Return True if more than the basic validation of return codes should + be skipped for a command. + + Vulkan mostly relies on the validation layers rather than API + builtin error checking, so these checks are not appropriate. + + For example, passing in a VkFormat parameter will not potentially + generate a VK_ERROR_FORMAT_NOT_SUPPORTED code.""" + + return True -- cgit v1.2.3