@@ -249,16 +249,6 @@ def print_vk_layer_dispatch_table(self, out):
249249 self .OutputLayerInstanceDispatchTable (out )
250250 self .OutputLayerDeviceDispatchTable (out )
251251
252- # Convert an XML dependency expression to a C expression, taking a callback to replace extension names
253- # See https://registry.khronos.org/vulkan/specs/1.4/registry.html#depends-expressions
254- @staticmethod
255- def ConvertDependencyExpression (expr , replace_func ):
256- # '(' and ')' can pass through unchanged
257- expr = re .sub (',' , ' || ' , expr )
258- expr = re .sub (r'\+' , ' && ' , expr )
259- expr = re .sub (r'\w+' , lambda match : replace_func (match .group ()), expr )
260- return expr
261-
262252 def DescribeBlock (self , command , current_block , out , custom_commands_string = ' commands' , indent = ' ' ):
263253 effective_version_name = APISpecific .getEffectiveVersionName (self .targetApiName , command .version )
264254 if command .extensions != current_block and effective_version_name != current_block :
@@ -664,14 +654,11 @@ def InitDeviceFunctionTerminatorDispatchTable(self, out):
664654 out .append (f'#if defined({ command .protect } )\n ' )
665655
666656 current_block = self .DescribeBlock (command , current_block , out )
667- if command .name == 'vkGetDeviceGroupSurfacePresentModes2EXT' : # command.extensions[0].depends in [x for x in self.vk.commands.values() if x.device]:
668- # Hardcode the dependency expression as vulkan_object.py doesn't expose this information
669- dep_expr = self .ConvertDependencyExpression ('VK_KHR_device_group,VK_VERSION_1_1' , lambda ext_name : f'dev->driver_extensions.{ ext_name [3 :].lower ()} _enabled' )
670- out .append (f' if (dev->driver_extensions.{ command .extensions [0 ][3 :].lower ()} _enabled && ({ dep_expr } ))\n ' )
671- out .append (f' dispatch->{ command .name [2 :]} = (PFN_{ (command .name )} )gpda(dev->icd_device, "{ (command .name )} ");\n ' )
672- else :
673- out .append (f' if (dev->driver_extensions.{ command .extensions [0 ][3 :].lower ()} _enabled)\n ' )
674- out .append (f' dispatch->{ command .name [2 :]} = (PFN_{ (command .name )} )gpda(dev->icd_device, "{ (command .name )} ");\n ' )
657+ enable_extension_expressions = []
658+ for ext in command .extensions :
659+ enable_extension_expressions .append (f'dev->driver_extensions.{ ext [3 :].lower ()} _enabled' )
660+ out .append (f' if ({ " || " .join (enable_extension_expressions )} )\n ' )
661+ out .append (f' dispatch->{ command .name [2 :]} = (PFN_{ (command .name )} )gpda(dev->icd_device, "{ (command .name )} ");\n ' )
675662
676663 if command .protect is not None :
677664 out .append (f'#endif // { command .protect } \n ' )
@@ -1304,12 +1291,10 @@ def DeviceExtensionGetTerminator(self, out):
13041291
13051292 out .append (f' if (!strcmp(name, "{ command .name [2 :]} ")) {{\n ' )
13061293 out .append (' *found_name = true;\n ' )
1307- if command .name == 'vkGetDeviceGroupSurfacePresentModes2EXT' : # command.extensions[0].depends in [x for x in self.vk.commands.values() if x.device]:
1308- # Hardcode the dependency expression as vulkan_object.py doesn't expose this information
1309- dep_expr = self .ConvertDependencyExpression ('VK_KHR_device_group,VK_VERSION_1_1' , lambda ext_name : f'dev->driver_extensions.{ ext_name [3 :].lower ()} _enabled' )
1310- out .append (f' return (dev->driver_extensions.{ command .extensions [0 ][3 :].lower ()} _enabled && ({ dep_expr } )) ?\n ' )
1311- else :
1312- out .append (f' return dev->driver_extensions.{ command .extensions [0 ][3 :].lower ()} _enabled ?\n ' )
1294+ enable_extension_expressions = []
1295+ for ext in command .extensions :
1296+ enable_extension_expressions .append (f'dev->driver_extensions.{ ext [3 :].lower ()} _enabled' )
1297+ out .append (f' return { " || " .join (enable_extension_expressions )} ?\n ' )
13131298 out .append (f' (PFN_vkVoidFunction)terminator_{ (command .name [2 :])} : NULL;\n ' )
13141299 out .append (' }\n ' )
13151300
0 commit comments