Lines Matching refs:funcs

1017         funcs = ''
1058 funcs += '\n// ---- Core %s trampoline/terminators\n\n' % version.name
1060 funcs += '\n// ---- %s extension trampoline/terminators\n\n' % ext_cmd.ext_name
1064 funcs += '#if defined(%s)\n' % ext_cmd.protect
1124 funcs += tramp_header
1127 funcs += ' const VkLayerInstanceDispatchTable *disp;\n'
1128 funcs += ' VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(%s);\n' % (phys_dev_var_name)
1129 funcs += ' if (VK_NULL_HANDLE == unwrapped_phys_dev) {\n'
1130 funcs += ' loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,\n'
1131 funcs += ' "%s: Invalid %s "\n' % (ext_cmd.name, phys_dev_var_name)
1132 funcs += ' "[VUID-%s-%s-parameter]");\n' % (ext_cmd.name, phys_dev_var_name)
1133 funcs += ' abort(); /* Intentionally fail so user can correct issue. */\n'
1134 funcs += ' }\n'
1135 funcs += ' disp = loader_get_instance_layer_dispatch(%s);\n' % (phys_dev_var_name)
1137 funcs += ' struct loader_instance *inst = loader_get_instance(%s);\n' % (instance_var_name)
1138 funcs += ' if (NULL == inst) {\n'
1139 funcs += ' loader_log(\n'
1140 funcs += ' NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,\n'
1141 funcs += ' "%s: Invalid instance [VUID-%s-%s-parameter]");\n' % (ext_cmd.name, ext_cmd.name, instance_var_name)
1142 funcs += ' abort(); /* Intentionally fail so user can correct issue. */\n'
1143 funcs += ' }\n'
1144 funcs += '#error("Not implemented. Likely needs to be manually generated!");\n'
1146 funcs += ' const VkLayerDispatchTable *disp = loader_get_dispatch('
1147 funcs += ext_cmd.params[0].name
1148 funcs += ');\n'
1149 funcs += ' if (NULL == disp) {\n'
1150 funcs += ' loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,\n'
1151 funcs += ' "%s: Invalid %s "\n' % (ext_cmd.name, ext_cmd.params[0].name)
1152 funcs += ' "[VUID-%s-%s-parameter]");\n' % (ext_cmd.name, ext_cmd.params[0].name)
1153 funcs += ' abort(); /* Intentionally fail so user can correct issue. */\n'
1154 funcs += ' }\n'
1157 funcs += ' VkDebugMarkerObjectNameInfoEXT local_name_info;\n'
1158 funcs += ' memcpy(&local_name_info, pNameInfo, sizeof(VkDebugMarkerObjectNameInfoEXT));\n'
1159 funcs += ' // If this is a physical device, we have to replace it with the proper one for the next call.\n'
1160 funcs += ' if (pNameInfo->objectType == VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT) {\n'
1161 funcs += ' struct loader_physical_device_tramp *phys_dev_tramp = (struct loader_physical_device_tramp *)(uintptr_t)pNameInfo->object;\n'
1162 funcs += ' local_name_info.object = (uint64_t)(uintptr_t)phys_dev_tramp->phys_dev;\n'
1163 funcs += ' }\n'
1164 funcs += ' if (pNameInfo->objectType == VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT) {\n'
1165 funcs += ' struct loader_instance* instance = (struct loader_instance *)(uintptr_t)pNameInfo->object;\n'
1166 funcs += ' local_name_info.object = (uint64_t)(uintptr_t)instance->instance;\n'
1167 funcs += ' }\n'
1169 funcs += ' VkDebugMarkerObjectTagInfoEXT local_tag_info;\n'
1170 funcs += ' memcpy(&local_tag_info, pTagInfo, sizeof(VkDebugMarkerObjectTagInfoEXT));\n'
1171 funcs += ' // If this is a physical device, we have to replace it with the proper one for the next call.\n'
1172 funcs += ' if (pTagInfo->objectType == VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT) {\n'
1173 funcs += ' struct loader_physical_device_tramp *phys_dev_tramp = (struct loader_physical_device_tramp *)(uintptr_t)pTagInfo->object;\n'
1174 funcs += ' local_tag_info.object = (uint64_t)(uintptr_t)phys_dev_tramp->phys_dev;\n'
1175 funcs += ' }\n'
1176 funcs += ' if (pTagInfo->objectType == VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT) {\n'
1177 funcs += ' struct loader_instance* instance = (struct loader_instance *)(uintptr_t)pTagInfo->object;\n'
1178 funcs += ' local_tag_info.object = (uint64_t)(uintptr_t)instance->instance;\n'
1179 funcs += ' }\n'
1181 funcs += ' VkDebugUtilsObjectNameInfoEXT local_name_info;\n'
1182 funcs += ' memcpy(&local_name_info, pNameInfo, sizeof(VkDebugUtilsObjectNameInfoEXT));\n'
1183 funcs += ' // If this is a physical device, we have to replace it with the proper one for the next call.\n'
1184 funcs += ' if (pNameInfo->objectType == VK_OBJECT_TYPE_PHYSICAL_DEVICE) {\n'
1185 funcs += ' struct loader_physical_device_tramp *phys_dev_tramp = (struct loader_physical_device_tramp *)(uintptr_t)pNameInfo->objectHandle;\n'
1186 funcs += ' local_name_info.objectHandle = (uint64_t)(uintptr_t)phys_dev_tramp->phys_dev;\n'
1187 funcs += ' }\n'
1188 funcs += ' if (pNameInfo->objectType == VK_OBJECT_TYPE_INSTANCE) {\n'
1189 funcs += ' struct loader_instance* instance = (struct loader_instance *)(uintptr_t)pNameInfo->objectHandle;\n'
1190 funcs += ' local_name_info.objectHandle = (uint64_t)(uintptr_t)instance->instance;\n'
1191 funcs += ' }\n'
1193 funcs += ' VkDebugUtilsObjectTagInfoEXT local_tag_info;\n'
1194 funcs += ' memcpy(&local_tag_info, pTagInfo, sizeof(VkDebugUtilsObjectTagInfoEXT));\n'
1195 funcs += ' // If this is a physical device, we have to replace it with the proper one for the next call.\n'
1196 funcs += ' if (pTagInfo->objectType == VK_OBJECT_TYPE_PHYSICAL_DEVICE) {\n'
1197 funcs += ' struct loader_physical_device_tramp *phys_dev_tramp = (struct loader_physical_device_tramp *)(uintptr_t)pTagInfo->objectHandle;\n'
1198 funcs += ' local_tag_info.objectHandle = (uint64_t)(uintptr_t)phys_dev_tramp->phys_dev;\n'
1199 funcs += ' }\n'
1200 funcs += ' if (pTagInfo->objectType == VK_OBJECT_TYPE_INSTANCE) {\n'
1201 funcs += ' struct loader_instance* instance = (struct loader_instance *)(uintptr_t)pTagInfo->objectHandle;\n'
1202 funcs += ' local_tag_info.objectHandle = (uint64_t)(uintptr_t)instance->instance;\n'
1203 funcs += ' }\n'
1206 funcs += ' if (disp->' + base_name + ' != NULL) {\n'
1207 funcs += ' '
1208 funcs += return_prefix
1210 funcs += 'inst->'
1211 funcs += 'disp->'
1212 funcs += base_name
1213 funcs += '('
1217 funcs += ', '
1220 funcs += 'unwrapped_phys_dev'
1222 funcs += '&local_name_info'
1224 funcs += '&local_tag_info'
1226 funcs += param.name
1229 funcs += ');\n'
1232 funcs += ' } else {\n'
1233 funcs += ' return VK_SUCCESS;\n'
1234 funcs += ' }\n'
1235 funcs += '}\n\n'
1237 funcs += term_header
1239 funcs += ' struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)%s;\n' % (phys_dev_var_name)
1240 funcs += ' struct loader_icd_term *icd_term = phys_dev_term->this_icd_term;\n'
1241 funcs += ' if (NULL == icd_term->dispatch.'
1242 funcs += base_name
1243 funcs += ') {\n'
1245 funcs += f' loader_log(icd_term->this_instance, {fatal_error_bit}VULKAN_LOADER_ERROR_BIT, 0,\n'
1246 funcs += ' "ICD associated with VkPhysicalDevice does not support '
1247 funcs += base_name
1248 funcs += '");\n'
1253 funcs += ' return VK_ERROR_EXTENSION_NOT_PRESENT;\n'
1255 funcs += ' abort(); /* Intentionally fail so user can correct issue. */\n'
1256 funcs += ' }\n'
1259 funcs += ' VkIcdSurface *icd_surface = (VkIcdSurface *)(%s);\n' % (surface_var_name)
1260 funcs += ' uint8_t icd_index = phys_dev_term->icd_index;\n'
1261 funcs += ' if (NULL != icd_surface->real_icd_surfaces && NULL != (void *)icd_surface->real_icd_surfaces[icd_index]) {\n'
1265 funcs += update_structure_string
1267 funcs += ' ' + return_prefix + 'icd_term->dispatch.'
1268 funcs += base_name
1269 funcs += '('
1273 funcs += ', '
1277 funcs += surface_name_replacement
1279 funcs += physdev_name_replacement
1281 funcs += param.name
1283 funcs += param.name
1286 funcs += ');\n'
1288 funcs += ' return;\n'
1289 funcs += ' }\n'
1291 funcs += return_prefix
1292 funcs += 'icd_term->dispatch.'
1293 funcs += base_name
1294 funcs += '('
1298 funcs += ', '
1301 funcs += 'phys_dev_term->phys_dev'
1303 funcs += param.name
1306 funcs += ');\n'
1310 funcs += ' struct loader_instance *inst = loader_get_instance(%s);\n' % (instance_var_name)
1311 funcs += ' if (NULL == inst) {\n'
1312 funcs += ' loader_log(\n'
1313 funcs += ' NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,\n'
1314 funcs += ' "%s: Invalid instance [VUID-%s-%s-parameter]");\n' % (ext_cmd.name, ext_cmd.name, instance_var_name)
1315 funcs += ' abort(); /* Intentionally fail so user can correct issue. */\n'
1316 funcs += ' }\n'
1317 funcs += '#error("Not implemented. Likely needs to be manually generated!");\n'
1328 funcs += ' uint32_t icd_index = 0;\n'
1329 funcs += ' struct loader_device *dev;\n'
1330 funcs += f' struct loader_icd_term *icd_term = loader_get_icd_and_device({ ext_cmd.params[0].name}, &dev, &icd_index);\n'
1331 funcs += f' if (NULL == icd_term || NULL == dev) {{\n'
1332 funcs += f' loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "{ext_cmd.name[2:]}: Invalid device handle");\n'
1333 funcs += ' abort(); /* Intentionally fail so user can correct issue. */\n'
1334 funcs += ' }\n'
1335 funcs += f' { ext_cmd.params[1].type} {local_struct};\n'
1336 funcs += f' memcpy(&{local_struct}, {debug_struct_name}, sizeof({ ext_cmd.params[1].type}));\n'
1337 funcs += ' // If this is a physical device, we have to replace it with the proper one for the next call.\n'
1338 funcs += f' if ({debug_struct_name}->objectType == {phys_dev_check}) {{\n'
1339 funcs += f' struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)(uintptr_t){debug_struct_name}->{member_name};\n'
1340 funcs += f' {local_struct}.{member_name} = (uint64_t)(uintptr_t)phys_dev_term->phys_dev;\n'
1341 funcs += ' // If this is a KHR_surface, and the ICD has created its own, we have to replace it with the proper one for the next call.\n'
1342 funcs += f' }} else if ({debug_struct_name}->objectType == {surf_check}) {{\n'
1343 funcs += ' if (NULL != dev && NULL != dev->loader_dispatch.core_dispatch.CreateSwapchainKHR) {\n'
1344 funcs += f' VkIcdSurface *icd_surface = (VkIcdSurface *)(uintptr_t){debug_struct_name}->{member_name};\n'
1345 funcs += ' if (NULL != icd_surface->real_icd_surfaces) {\n'
1346 funcs += f' {local_struct}.{member_name} = (uint64_t)icd_surface->real_icd_surfaces[icd_index];\n'
1347 funcs += ' }\n'
1348 funcs += ' }\n'
1349 funcs += ' // If this is an instance we have to replace it with the proper one for the next call.\n'
1350 funcs += f' }} else if ({debug_struct_name}->objectType == {inst_check}) {{\n'
1351 funcs += f' {local_struct}.{member_name} = (uint64_t)(uintptr_t)icd_term->instance;\n'
1352 funcs += ' }\n'
1353 funcs += ' // Exit early if the driver does not support the function - this can happen as a layer or the loader itself supports\n'
1354 funcs += ' // debug utils but the driver does not.\n'
1355 funcs += f' if (NULL == dev->loader_dispatch.extension_terminator_dispatch.{ext_cmd.name[2:]})\n return VK_SUCCESS;\n'
1358 funcs += f' struct loader_dev_dispatch_table *dispatch_table = loader_get_dev_dispatch({ext_cmd.params[0].name});\n'
1359 funcs += f' if (NULL == dispatch_table) {{\n'
1360 funcs += f' loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0, "{ext_cmd.ext_name}: Invalid device handle");\n'
1361 funcs += ' abort(); /* Intentionally fail so user can correct issue. */\n'
1362 funcs += ' }\n'
1363 funcs += ' // Only call down if the device supports the function\n'
1364 funcs += f' if (NULL != dispatch_table->extension_terminator_dispatch.{base_name})\n '
1366 funcs += ' '
1368 funcs += 'return '
1369 funcs += f'{dispatch}extension_terminator_dispatch.{base_name}('
1373 funcs += ', '
1376 funcs += 'phys_dev_term->phys_dev'
1378 funcs += 'icd_surface->real_icd_surfaces[icd_index]'
1380 funcs += '&local_name_info'
1382 funcs += '&local_tag_info'
1384 funcs += param.name
1387 funcs += ');\n'
1390 funcs += '#error("Unknown error path!");\n'
1392 funcs += '}\n\n'
1394 funcs += tramp_header
1396 funcs += ' const VkLayerDispatchTable *disp = loader_get_dispatch('
1397 funcs += ext_cmd.params[0].name
1398 funcs += ');\n'
1399 funcs += ' if (NULL == disp) {\n'
1400 funcs += ' loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,\n'
1401 funcs += ' "%s: Invalid %s "\n' % (ext_cmd.name, ext_cmd.params[0].name)
1402 funcs += ' "[VUID-%s-%s-parameter]");\n' % (ext_cmd.name, ext_cmd.params[0].name)
1403 funcs += ' abort(); /* Intentionally fail so user can correct issue. */\n'
1404 funcs += ' }\n'
1407 funcs += ' if (disp->' + base_name + ' != NULL) {\n'
1408 funcs += ' '
1409 funcs += return_prefix
1410 funcs += 'disp->'
1411 funcs += base_name
1412 funcs += '('
1416 funcs += ', '
1417 funcs += param.name
1419 funcs += ');\n'
1422 funcs += ' } else {\n'
1423 funcs += ' return VK_SUCCESS;\n'
1424 funcs += ' }\n'
1425 funcs += '}\n\n'
1428 funcs += '#endif // %s\n' % ext_cmd.protect
1430 return funcs