From 293c49fd0bb93332d78a55a2377f302bcc82b871 Mon Sep 17 00:00:00 2001 From: Hiroki Noda Date: Wed, 10 Dec 2025 03:27:31 +0900 Subject: [PATCH] Generate KHR extension functions instead of aliases for backward compatibility Previously KHR extension functions promoted to core were generated as alias to their core version. This caused compatibility issues when running old drivers only probide the KHR extension function names. --- erupt_dlang.py | 43 +++++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/erupt_dlang.py b/erupt_dlang.py index 698ca13..2ad5fdf 100644 --- a/erupt_dlang.py +++ b/erupt_dlang.py @@ -1054,26 +1054,33 @@ def genCmd( self, cmdinfo, name, alias ): # alias global and DispatchDevice functions if alias: - - # alias global scope functions - self.feature_content[ self.featureName ][ 'Func_Aliases' ].append( - ( 'alias {0}{{LJUST_NAME}} = {1};'.format( name, alias ), name_len ) ) - - # alias dispatch device functions and partially device scope vulkan funcs (for VkDevice and VkCommandBuffer) - if param_0_type in ( 'VkDevice', 'VkCommandBuffer' ): - self.feature_content[ self.featureName ][ 'Conven_Aliases' ].append( - ( 'alias {0}{{LJUST_NAME}} = {1};'.format( name[2:], alias[2:] ), name_len ) ) - self.feature_content[ self.featureName ][ 'Disp_Aliases' ].append( + # Skip alias generation for KHR extensions promoted to core to ensure compatibility + # across different Vulkan driver versions. The Vulkan specification guarantees that + # KHR extension entry points remain available after promotion to core functionality. + # By using the original KHR function name instead of aliasing to the core version, + # we maintain compatibility with both scenarios. + if name.endswith('KHR'): + pass # continue to process as regular function below + else: + # alias global scope functions + self.feature_content[ self.featureName ][ 'Func_Aliases' ].append( ( 'alias {0}{{LJUST_NAME}} = {1};'.format( name, alias ), name_len ) ) - self.max_d_func_name_len = max( self.max_d_func_name_len, name_len ) - # second part of device scope vulkan funcs (for VkQueue, for which no convenience fucs exist) - elif param_0_type == 'VkQueue': - self.feature_content[ self.featureName ][ 'Disp_Aliases' ].append( - ( 'alias {0}{{LJUST_NAME}} = {1};'.format( name, alias ), name_len ) ) - self.max_d_func_name_len = max( self.max_d_func_name_len, name_len ) + # alias dispatch device functions and partially device scope vulkan funcs (for VkDevice and VkCommandBuffer) + if param_0_type in ( 'VkDevice', 'VkCommandBuffer' ): + self.feature_content[ self.featureName ][ 'Conven_Aliases' ].append( + ( 'alias {0}{{LJUST_NAME}} = {1};'.format( name[2:], alias[2:] ), name_len ) ) + self.feature_content[ self.featureName ][ 'Disp_Aliases' ].append( + ( 'alias {0}{{LJUST_NAME}} = {1};'.format( name, alias ), name_len ) ) + self.max_d_func_name_len = max( self.max_d_func_name_len, name_len ) + + # second part of device scope vulkan funcs (for VkQueue, for which no convenience fucs exist) + elif param_0_type == 'VkQueue': + self.feature_content[ self.featureName ][ 'Disp_Aliases' ].append( + ( 'alias {0}{{LJUST_NAME}} = {1};'.format( name, alias ), name_len ) ) + self.max_d_func_name_len = max( self.max_d_func_name_len, name_len ) - return # its either alias or full functions + return # its either alias or full functions # get and modify the return type to align functions for better readability @@ -1254,4 +1261,4 @@ def __init__( self, *args, **kwargs ): reg.apiGen() if print_debug: - tests_file.close() \ No newline at end of file + tests_file.close()