Skip to content

Commit f6e752d

Browse files
authored
Add some special handling for vkReleaseDisplayEXT (#2509)
1 parent 5078ed2 commit f6e752d

File tree

5 files changed

+65
-12
lines changed

5 files changed

+65
-12
lines changed

VulkanHppGenerator.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3843,7 +3843,8 @@ std::string VulkanHppGenerator::generateCommandDefinitions( std::string const &
38433843
std::string commandName = generateCommandName( command, commandIt->second.params, 1 );
38443844
if ( ( command == commandIt->first ) && ( ( ( command.substr( 2, 7 ) == "Destroy" ) && ( commandName != "destroy" ) ) ||
38453845
( command.substr( 2, 4 ) == "Free" ) ||
3846-
( command == "vkReleasePerformanceConfigurationINTEL" ) ) )
3846+
( command == "vkReleasePerformanceConfigurationINTEL" ) ||
3847+
( command == "vkReleaseDisplayEXT" ) ) )
38473848
{
38483849
CommandData specialCommandData = commandIt->second;
38493850
assert( ( 1 < specialCommandData.params.size() ) && ( specialCommandData.params[0].type.type == handle ) );
@@ -3861,7 +3862,7 @@ std::string VulkanHppGenerator::generateCommandDefinitions( std::string const &
38613862
}
38623863
else
38633864
{
3864-
assert( command == "vkReleasePerformanceConfigurationINTEL" );
3865+
assert( ( command == "vkReleasePerformanceConfigurationINTEL" ) || ( command == "vkReleaseDisplayEXT" ) );
38653866
shortenedName = "release";
38663867
}
38673868
size_t pos = destroyCommandString.find( commandName );
@@ -5626,7 +5627,8 @@ std::string VulkanHppGenerator::generateDestroyCommand( std::string const & name
56265627
std::string commandName = generateCommandName( name, commandData.params, 1 );
56275628
if ( m_commands.contains( name ) && ( ( ( name.substr( 2, 7 ) == "Destroy" ) && ( commandName != "destroy" ) ) ||
56285629
( name.substr( 2, 4 ) == "Free" ) ||
5629-
( name == "vkReleasePerformanceConfigurationINTEL" ) ) )
5630+
( name == "vkReleasePerformanceConfigurationINTEL" ) ||
5631+
( name == "vkReleaseDisplayEXT" ) ) )
56305632
{
56315633
assert( 1 < commandData.params.size() );
56325634
// make sure, the object to destroy/free/release is not optional in the shortened version!
@@ -5646,7 +5648,7 @@ std::string VulkanHppGenerator::generateDestroyCommand( std::string const & name
56465648
}
56475649
else
56485650
{
5649-
assert( name == "vkReleasePerformanceConfigurationINTEL" );
5651+
assert( ( name == "vkReleasePerformanceConfigurationINTEL" ) || ( name == "vkReleaseDisplayEXT" ) );
56505652
shortenedName = "release";
56515653
}
56525654
size_t pos = destroyCommandString.find( commandName );
@@ -16404,7 +16406,7 @@ bool VulkanHppGenerator::structureHoldsVector( StructData const & structData ) c
1640416406
return findVectorMember( structData.members ) != structData.members.end();
1640516407
}
1640616408

16407-
std::string VulkanHppGenerator::toString( TypeCategory category )
16409+
std::string VulkanHppGenerator::toString( TypeCategory category ) const
1640816410
{
1640916411
switch ( category )
1641016412
{

VulkanHppGenerator.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1278,7 +1278,7 @@ class VulkanHppGenerator
12781278
bool structureChainHoldsVector( std::string const & name ) const;
12791279
bool structureHoldsHandle( StructData const & structData ) const;
12801280
bool structureHoldsVector( StructData const & structData ) const;
1281-
std::string toString( TypeCategory category );
1281+
std::string toString( TypeCategory category ) const;
12821282
MemberData const & vectorMemberByStructure( std::string const & structureType ) const;
12831283

12841284
private:

tests/UniqueHandleDefaultArguments/UniqueHandleDefaultArguments.cpp

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616

1717
// Should be used on 64 bit only, as on 32 bit the test is ambiguous.
1818

19+
#if !defined( VULKAN_HPP_DISPATCH_LOADER_DYNAMIC )
20+
# define VULKAN_HPP_DISPATCH_LOADER_DYNAMIC 1
21+
#endif
22+
1923
#ifdef VULKAN_HPP_USE_CXX_MODULE
2024
# include <vulkan/vulkan.h>
2125
import vulkan;
@@ -26,14 +30,24 @@ VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE
2630

2731
int main()
2832
{
29-
VkSurfaceKHR surface = 0;
30-
auto uniqueSurface = vk::UniqueSurfaceKHR( static_cast<vk::SurfaceKHR>( surface ), vk::Instance() );
33+
{
34+
VkSurfaceKHR surface = 0;
35+
auto uniqueSurface = vk::UniqueSurfaceKHR( static_cast<vk::SurfaceKHR>( surface ), vk::Instance() );
36+
}
3137

32-
vk::PhysicalDevice phys = {};
33-
auto uniqueDisplayMode = phys.createDisplayModeKHRUnique( {}, {} );
38+
{
39+
vk::PhysicalDevice phys = {};
40+
auto uniqueDisplayMode = phys.createDisplayModeKHRUnique( {}, {} );
41+
}
3442

35-
vk::Device device = {};
36-
auto uniquePerfConfig = device.acquirePerformanceConfigurationINTELUnique( {} );
43+
{
44+
vk::Device device = {};
45+
auto uniquePerfConfig = device.acquirePerformanceConfigurationINTELUnique( {} );
46+
}
3747

48+
{
49+
vk::PhysicalDevice phys = {};
50+
auto uniqueDisplay = phys.getDrmDisplayEXTUnique( 0, 0 );
51+
}
3852
return 0;
3953
}

vulkan/vulkan_funcs.hpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13978,6 +13978,32 @@ VULKAN_HPP_EXPORT namespace VULKAN_HPP_NAMESPACE
1397813978
}
1397913979
#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/
1398013980

13981+
#ifdef VULKAN_HPP_DISABLE_ENHANCED_MODE
13982+
// wrapper function for command vkReleaseDisplayEXT, see https://registry.khronos.org/vulkan/specs/latest/man/html/vkReleaseDisplayEXT.html
13983+
template <typename Dispatch, typename std::enable_if<IS_DISPATCHED( vkReleaseDisplayEXT ), bool>::type>
13984+
VULKAN_HPP_NODISCARD VULKAN_HPP_INLINE Result PhysicalDevice::release( DisplayKHR display, Dispatch const & d ) const VULKAN_HPP_NOEXCEPT
13985+
{
13986+
VULKAN_HPP_ASSERT( d.getVkHeaderVersion() == VK_HEADER_VERSION );
13987+
return static_cast<Result>( d.vkReleaseDisplayEXT( static_cast<VkPhysicalDevice>( m_physicalDevice ), static_cast<VkDisplayKHR>( display ) ) );
13988+
}
13989+
#else
13990+
// wrapper function for command vkReleaseDisplayEXT, see https://registry.khronos.org/vulkan/specs/latest/man/html/vkReleaseDisplayEXT.html
13991+
template <typename Dispatch, typename std::enable_if<IS_DISPATCHED( vkReleaseDisplayEXT ), bool>::type>
13992+
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS VULKAN_HPP_INLINE typename ResultValueType<void>::type PhysicalDevice::release( DisplayKHR display,
13993+
Dispatch const & d ) const
13994+
{
13995+
VULKAN_HPP_ASSERT( d.getVkHeaderVersion() == VK_HEADER_VERSION );
13996+
# if ( VULKAN_HPP_DISPATCH_LOADER_DYNAMIC == 1 )
13997+
VULKAN_HPP_ASSERT( d.vkReleaseDisplayEXT && "Function <vkReleaseDisplayEXT> requires <VK_EXT_direct_mode_display>" );
13998+
# endif
13999+
14000+
Result result = static_cast<Result>( d.vkReleaseDisplayEXT( m_physicalDevice, static_cast<VkDisplayKHR>( display ) ) );
14001+
detail::resultCheck( result, VULKAN_HPP_NAMESPACE_STRING "::PhysicalDevice::release" );
14002+
14003+
return detail::createResultValueType( result );
14004+
}
14005+
#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/
14006+
1398114007
#if defined( VK_USE_PLATFORM_XLIB_XRANDR_EXT )
1398214008
//=== VK_EXT_acquire_xlib_display ===
1398314009

vulkan/vulkan_handles.hpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20690,6 +20690,17 @@ VULKAN_HPP_EXPORT namespace VULKAN_HPP_NAMESPACE
2069020690
releaseDisplayEXT( DisplayKHR display, Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const;
2069120691
#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/
2069220692

20693+
#ifdef VULKAN_HPP_DISABLE_ENHANCED_MODE
20694+
// wrapper function for command vkReleaseDisplayEXT, see https://registry.khronos.org/vulkan/specs/latest/man/html/vkReleaseDisplayEXT.html
20695+
template <typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE, typename std::enable_if<IS_DISPATCHED( vkReleaseDisplayEXT ), bool>::type = true>
20696+
VULKAN_HPP_NODISCARD Result release( DisplayKHR display, Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const VULKAN_HPP_NOEXCEPT;
20697+
#else
20698+
// wrapper function for command vkReleaseDisplayEXT, see https://registry.khronos.org/vulkan/specs/latest/man/html/vkReleaseDisplayEXT.html
20699+
template <typename Dispatch = VULKAN_HPP_DEFAULT_DISPATCHER_TYPE, typename std::enable_if<IS_DISPATCHED( vkReleaseDisplayEXT ), bool>::type = true>
20700+
VULKAN_HPP_NODISCARD_WHEN_NO_EXCEPTIONS typename ResultValueType<void>::type release( DisplayKHR display,
20701+
Dispatch const & d VULKAN_HPP_DEFAULT_DISPATCHER_ASSIGNMENT ) const;
20702+
#endif /*VULKAN_HPP_DISABLE_ENHANCED_MODE*/
20703+
2069320704
#if defined( VK_USE_PLATFORM_XLIB_XRANDR_EXT )
2069420705
//=== VK_EXT_acquire_xlib_display ===
2069520706

0 commit comments

Comments
 (0)