Lines Matching refs:tables

259     # Write generate and write dispatch tables to output file
315 # Process commands, adding to appropriate dispatch tables
818 # Creates code to initialize the various dispatch tables
821 tables = ''
832 tables += '// Init Device function pointer dispatch table with core commands\n'
833 tables += 'VKAPI_ATTR void VKAPI_CALL loader_init_device_dispatch_table(struct loader_dev_dispatch_table *dev_table, PFN_vkGetDeviceProcAddr gpa,\n'
834 tables += ' VkDevice dev) {\n'
835 tables += ' VkLayerDispatchTable *table = &dev_table->core_dispatch;\n'
836 tables += ' if (table->magic != DEVICE_DISP_TABLE_MAGIC_NUMBER) { abort(); }\n'
837 tables += ' for (uint32_t i = 0; i < MAX_NUM_UNKNOWN_EXTS; i++) dev_table->ext_dispatch[i] = (PFN_vkDevExt)vkDevExtError;\n'
844 tables += '// Init Device function pointer dispatch table with extension commands\n'
845 tables += 'VKAPI_ATTR void VKAPI_CALL loader_init_device_extension_dispatch_table(struct loader_dev_dispatch_table *dev_table,\n'
846 tables += ' PFN_vkGetInstanceProcAddr gipa,\n'
847 tables += ' PFN_vkGetDeviceProcAddr gdpa,\n'
848 tables += ' VkInstance inst,\n'
849 tables += ' VkDevice dev) {\n'
850 tables += ' VkLayerDispatchTable *table = &dev_table->core_dispatch;\n'
851 tables += ' table->magic = DEVICE_DISP_TABLE_MAGIC_NUMBER;\n'
858 tables += '// Init Instance function pointer dispatch table with core commands\n'
859 tables += 'VKAPI_ATTR void VKAPI_CALL loader_init_instance_core_dispatch_table(VkLayerInstanceDispatchTable *table, PFN_vkGetInstanceProcAddr gpa,\n'
860 tables += ' VkInstance inst) {\n'
867 tables += '// Init Instance function pointer dispatch table with core commands\n'
868 tables += 'VKAPI_ATTR void VKAPI_CALL loader_init_instance_extension_dispatch_table(VkLayerInstanceDispatchTable *table, PFN_vkGetInstanceProcAddr gpa,\n'
869 tables += ' VkInstance inst) {\n'
877 tables += '\n // ---- Core %s commands\n' % version.name
879 tables += '\n // ---- %s extension commands\n' % cur_cmd.ext_name
893 tables += '#if defined(%s)\n' % cur_cmd.protect
899 tables += ' table->GetDeviceProcAddr = gdpa;\n'
901 tables += ' table->%s = (PFN_%s)gipa(inst, "%s");\n' % (base_name, cur_cmd.name, cur_cmd.name)
903 tables += ' table->%s = (PFN_%s)gdpa(dev, "%s");\n' % (base_name, cur_cmd.name, cur_cmd.name)
905 tables += ' table->GetDeviceProcAddr = gpa;\n'
907 tables += ' table->GetInstanceProcAddr = gpa;\n'
909 tables += ' table->%s = (PFN_%s)gpa(%s, "%s");\n' % (base_name, cur_cmd.name, gpa_param, cur_cmd.name)
912 tables += '#endif // %s\n' % cur_cmd.protect
914 tables += '}\n\n'
915 return tables
922 tables = ''
930 tables += '// Device command lookup function\n'
931 tables += 'VKAPI_ATTR void* VKAPI_CALL loader_lookup_device_dispatch_table(const VkLayerDispatchTable *table, const char *name, bool* found_name) {\n'
932 tables += ' if (!name || name[0] != \'v\' || name[1] != \'k\') {\n'
933 tables += ' *found_name = false;\n'
934 tables += ' return NULL;\n'
935 tables += ' }\n'
936 tables += '\n'
937 tables += ' name += 2;\n'
938 tables += ' *found_name = true;\n'
939 tables += ' struct loader_device* dev = (struct loader_device *)table;\n'
940 tables += ' const struct loader_instance* inst = dev->phys_dev_term->this_icd_term->this_instance;\n'
941 tables += ' uint32_t api_version = VK_MAKE_API_VERSION(0, inst->app_api_version.major, inst->app_api_version.minor, inst->app_api_version.patch);\n'
942 tables += '\n'
946 tables += '// Instance command lookup function\n'
947 tables += 'VKAPI_ATTR void* VKAPI_CALL loader_lookup_instance_dispatch_table(const VkLayerInstanceDispatchTable *table, const char *name,\n'
948 tables += ' bool *found_name) {\n'
949 tables += ' if (!name || name[0] != \'v\' || name[1] != \'k\') {\n'
950 tables += ' *found_name = false;\n'
951 tables += ' return NULL;\n'
952 tables += ' }\n'
953 tables += '\n'
954 tables += ' *found_name = true;\n'
955 tables += ' name += 2;\n'
970 tables += '\n // ---- Core %s commands\n' % version.name
975 tables += '\n // ---- %s extension commands\n' % cur_cmd.ext_name
989 tables += '#if defined(%s)\n' % cur_cmd.protect
991 tables += f' if (!strcmp(name, "{base_name}")) '
994 tables += f'{{\n{version_check} return dev->layer_extensions.{cur_cmd.ext_name[3:].lower()}_enabled ? (void *){base_name} : NULL;\n }}\n'
996 tables += f'return dev->layer_extensions.{cur_cmd.ext_name[3:].lower()}_enabled ? (void *){base_name} : NULL;\n'
1000 tables += f'{{\n{version_check} return (void *)table->{base_name};\n }}\n'
1002 tables += f'return (void *)table->{base_name};\n'
1005 tables += '#endif // %s\n' % cur_cmd.protect
1007 tables += '\n'
1008 tables += ' *found_name = false;\n'
1009 tables += ' return NULL;\n'
1010 tables += '}\n\n'
1011 return tables