Lines Matching refs:layer

32 // export the enumeration functions instance|device+layer|extension
81 TestLayer layer;
83 FRAMEWORK_EXPORT TestLayer* get_test_layer_func() { return &layer; }
85 layer.~TestLayer();
86 return new (&layer) TestLayer();
91 return layer.instance_extensions.end() !=
92 std::find_if(layer.instance_extensions.begin(), layer.instance_extensions.end(),
97 return layer.enabled_instance_extensions.end() !=
98 std::find_if(layer.enabled_instance_extensions.begin(), layer.enabled_instance_extensions.end(),
103 for (auto& device : layer.created_devices) {
143 if (*pPropertyCount < layer.injected_instance_extensions.size()) {
146 for (size_t i = 0; i < layer.injected_instance_extensions.size(); i++) {
147 pProperties[i] = layer.injected_instance_extensions.at(i).get();
149 *pPropertyCount = static_cast<uint32_t>(layer.injected_instance_extensions.size());
151 *pPropertyCount = static_cast<uint32_t>(layer.injected_instance_extensions.size());
158 hardware_prop_count = *pPropertyCount - static_cast<uint32_t>(layer.injected_instance_extensions.size());
162 layer.instance_dispatch_table.EnumerateInstanceExtensionProperties(pLayerName, &hardware_prop_count, pProperties);
168 *pPropertyCount = hardware_prop_count + static_cast<uint32_t>(layer.injected_instance_extensions.size());
170 if (hardware_prop_count + layer.injected_instance_extensions.size() > *pPropertyCount) {
174 for (size_t i = 0; i < layer.injected_instance_extensions.size(); i++) {
175 pProperties[hardware_prop_count + i] = layer.injected_instance_extensions.at(i).get();
177 *pPropertyCount = hardware_prop_count + static_cast<uint32_t>(layer.injected_instance_extensions.size());
195 if (*pPropertyCount < static_cast<uint32_t>(layer.injected_device_extensions.size())) {
198 for (size_t i = 0; i < layer.injected_device_extensions.size(); i++) {
199 pProperties[i] = layer.injected_device_extensions.at(i).get();
201 *pPropertyCount = static_cast<uint32_t>(layer.injected_device_extensions.size());
203 *pPropertyCount = static_cast<uint32_t>(layer.injected_device_extensions.size());
210 hardware_prop_count = *pPropertyCount - static_cast<uint32_t>(layer.injected_device_extensions.size());
213 VkResult res = layer.instance_dispatch_table.EnumerateDeviceExtensionProperties(physicalDevice, pLayerName,
220 *pPropertyCount = hardware_prop_count + static_cast<uint32_t>(layer.injected_device_extensions.size());
222 if (hardware_prop_count + layer.injected_device_extensions.size() > *pPropertyCount) {
226 for (size_t i = 0; i < layer.injected_device_extensions.size(); i++) {
227 pProperties[hardware_prop_count + i] = layer.injected_device_extensions.at(i).get();
229 *pPropertyCount = hardware_prop_count + static_cast<uint32_t>(layer.injected_device_extensions.size());
252 if (layer.call_create_device_while_create_device_is_called) {
254 layer.callback_vkCreateDevice = createDeviceCallback->u.layerDevice.pfnLayerCreateDevice;
255 layer.callback_vkDestroyDevice = createDeviceCallback->u.layerDevice.pfnLayerDestroyDevice;
260 layer.next_vkGetInstanceProcAddr = fpGetInstanceProcAddr;
273 if (layer.alter_api_version != VK_API_VERSION_1_0 && pCreateInfo && pCreateInfo->pApplicationInfo) {
274 application_info.apiVersion = layer.alter_api_version;
280 if (layer.clobber_pInstance) {
289 layer.instance_handle = *pInstance;
290 if (layer.use_gipa_GetPhysicalDeviceProcAddr) {
291 layer.next_GetPhysicalDeviceProcAddr =
294 layer.next_GetPhysicalDeviceProcAddr = fpGetPhysicalDeviceProcAddr;
296 // Init layer's dispatch table using GetInstanceProcAddr of
297 // next layer in the chain.
298 layer_init_instance_dispatch_table(layer.instance_handle, &layer.instance_dispatch_table, fpGetInstanceProcAddr);
301 layer.enabled_instance_extensions.push_back({pCreateInfo->ppEnabledExtensionNames[i]});
304 if (layer.create_instance_callback) result = layer.create_instance_callback(layer);
306 for (auto& func : layer.custom_physical_device_interception_functions) {
307 auto next_func = layer.next_GetPhysicalDeviceProcAddr(*pInstance, func.name.c_str());
308 layer.custom_dispatch_functions.at(func.name.c_str()) = next_func;
311 for (auto& func : layer.custom_device_interception_functions) {
312 auto next_func = layer.next_vkGetInstanceProcAddr(*pInstance, func.name.c_str());
313 layer.custom_dispatch_functions.at(func.name.c_str()) = next_func;
316 if (layer.do_spurious_allocations_in_create_instance && pAllocator && pAllocator->pfnAllocation) {
317 layer.spurious_instance_memory_allocation =
319 if (layer.spurious_instance_memory_allocation == nullptr) {
324 if (!layer.make_spurious_log_in_create_instance.empty()) {
331 data.pMessage = layer.make_spurious_log_in_create_instance.c_str();
340 if (layer.buggy_query_of_vkCreateDevice) {
341 layer.instance_dispatch_table.CreateDevice =
345 if (layer.call_create_device_while_create_device_is_called) {
347 result = layer.instance_dispatch_table.EnumeratePhysicalDevices(layer.instance_handle, &phys_dev_count, nullptr);
351 layer.queried_physical_devices.resize(phys_dev_count);
352 result = layer.instance_dispatch_table.EnumeratePhysicalDevices(layer.instance_handle, &phys_dev_count,
353 layer.queried_physical_devices.data());
359 if (layer.check_if_EnumDevExtProps_is_same_as_queried_function) {
361 fpGetInstanceProcAddr(layer.instance_handle, "vkEnumerateDeviceExtensionProperties"));
362 if (chain_info_EnumDeviceExtProps != layer.instance_dispatch_table.EnumerateDeviceExtensionProperties) {
376 if (layer.spurious_instance_memory_allocation && pAllocator && pAllocator->pfnFree) {
377 pAllocator->pfnFree(pAllocator->pUserData, layer.spurious_instance_memory_allocation);
378 layer.spurious_instance_memory_allocation = nullptr;
381 layer.instance_dispatch_table.DestroyInstance(instance, pAllocator);
390 VkInstance instance_to_use = layer.buggy_query_of_vkCreateDevice ? NULL : layer.instance_handle;
396 layer.next_vkGetDeviceProcAddr = fpGetDeviceProcAddr;
398 if (layer.check_if_EnumDevExtProps_is_same_as_queried_function) {
400 fpGetInstanceProcAddr(layer.instance_handle, "vkEnumerateDeviceExtensionProperties"));
401 if (chain_info_EnumDeviceExtProps != layer.instance_dispatch_table.EnumerateDeviceExtensionProperties) {
408 if (layer.clobber_pDevice) {
419 // initialize layer's dispatch table
426 for (auto& func : layer.custom_device_interception_functions) {
427 auto next_func = layer.next_vkGetDeviceProcAddr(*pDevice, func.name.c_str());
428 layer.custom_dispatch_functions.at(func.name.c_str()) = next_func;
431 if (layer.create_device_callback) {
432 result = layer.create_device_callback(layer);
436 layer.created_devices.push_back(device);
438 if (layer.do_spurious_allocations_in_create_device && pAllocator && pAllocator->pfnAllocation) {
443 layer.spurious_device_memory_allocations.push_back({allocation, device.device_handle});
447 if (layer.call_create_device_while_create_device_is_called) {
448 PFN_vkGetDeviceProcAddr next_gdpa = layer.next_vkGetDeviceProcAddr;
449 result = layer.callback_vkCreateDevice(
450 instance_to_use, layer.queried_physical_devices.at(layer.physical_device_index_to_use_during_create_device),
451 pCreateInfo, pAllocator, &layer.second_device_created_during_create_device.device_handle, get_instance_func,
457 layer_init_device_dispatch_table(layer.second_device_created_during_create_device.device_handle,
458 &layer.second_device_created_during_create_device.dispatch_table, next_gdpa);
466 if (layer.add_phys_devs || layer.remove_phys_devs || layer.reorder_phys_devs) {
469 if (layer.complete_physical_devices.size() == 0) {
474 layer.instance_dispatch_table.EnumeratePhysicalDevices(instance, &icd_count, nullptr);
477 layer.instance_dispatch_table.EnumeratePhysicalDevices(instance, &icd_count, tmp_vector.data());
478 layer.complete_physical_devices.clear();
480 if (layer.remove_phys_devs) {
482 layer.removed_physical_devices.push_back(tmp_vector[3]);
483 layer.removed_physical_devices.push_back(tmp_vector[4]);
488 if (layer.add_phys_devs) {
492 layer.added_physical_devices.push_back(new_phys_dev);
495 layer.added_physical_devices.push_back(new_phys_dev);
498 layer.added_physical_devices.push_back(new_phys_dev);
502 if (layer.reorder_phys_devs) {
505 layer.complete_physical_devices.push_back(tmp_vector[dev]);
510 layer.complete_physical_devices.push_back(tmp_vector[dev]);
516 *pPhysicalDeviceCount = static_cast<uint32_t>(layer.complete_physical_devices.size());
518 uint32_t adj_count = static_cast<uint32_t>(layer.complete_physical_devices.size());
524 pPhysicalDevices[dev] = layer.complete_physical_devices[dev];
531 return layer.instance_dispatch_table.EnumeratePhysicalDevices(instance, pPhysicalDeviceCount, pPhysicalDevices);
537 if (std::find(layer.removed_physical_devices.begin(), layer.removed_physical_devices.end(), physicalDevice) !=
538 layer.removed_physical_devices.end()) {
541 } else if (std::find(layer.added_physical_devices.begin(), layer.added_physical_devices.end(), physicalDevice) !=
542 layer.added_physical_devices.end()) {
555 layer.instance_dispatch_table.GetPhysicalDeviceProperties(physicalDevice, pProperties);
561 if (layer.add_phys_devs || layer.remove_phys_devs || layer.reorder_phys_devs) {
564 if (layer.complete_physical_device_groups.size() == 0) {
573 layer.instance_dispatch_table.EnumeratePhysicalDeviceGroups(instance, &icd_group_count, nullptr);
576 layer.instance_dispatch_table.EnumeratePhysicalDeviceGroups(instance, &icd_group_count, tmp_vector.data());
577 layer.complete_physical_device_groups.clear();
579 if (layer.remove_phys_devs) {
581 for (uint32_t rem_dev = 0; rem_dev < layer.removed_physical_devices.size(); ++rem_dev) {
584 if (tmp_vector[group].physicalDevices[grp_dev] == layer.removed_physical_devices[rem_dev]) {
595 layer.removed_physical_device_groups.push_back(tmp_vector[group]);
602 if (layer.add_phys_devs) {
604 for (uint32_t dev = 0; dev < layer.added_physical_devices.size(); ++dev) {
607 props.physicalDevices[0] = layer.added_physical_devices[dev];
609 layer.added_physical_device_groups.push_back(props);
613 if (layer.reorder_phys_devs) {
616 layer.complete_physical_device_groups.push_back(tmp_vector[dev]);
621 layer.complete_physical_device_groups.push_back(tmp_vector[dev]);
627 *pPhysicalDeviceGroupCount = static_cast<uint32_t>(layer.complete_physical_device_groups.size());
629 uint32_t adj_count = static_cast<uint32_t>(layer.complete_physical_device_groups.size());
635 pPhysicalDeviceGroupProperties[dev] = layer.complete_physical_device_groups[dev];
642 return layer.instance_dispatch_table.EnumeratePhysicalDeviceGroups(instance, pPhysicalDeviceGroupCount,
650 for (uint32_t i = 0; i < layer.spurious_device_memory_allocations.size();) {
651 auto& allocation = layer.spurious_device_memory_allocations[i];
654 layer.spurious_device_memory_allocations.erase(layer.spurious_device_memory_allocations.begin() + i);
660 if (layer.call_create_device_while_create_device_is_called) {
661 layer.callback_vkDestroyDevice(layer.second_device_created_during_create_device.device_handle, pAllocator,
662 layer.second_device_created_during_create_device.dispatch_table.DestroyDevice);
665 auto it = std::find_if(std::begin(layer.created_devices), std::end(layer.created_devices),
667 if (it != std::end(layer.created_devices)) {
669 layer.created_devices.erase(it);
677 if (layer.instance_dispatch_table.CreateDebugUtilsMessengerEXT) {
678 return layer.instance_dispatch_table.CreateDebugUtilsMessengerEXT(instance, pCreateInfo, pAllocator, pMessenger);
686 if (layer.instance_dispatch_table.DestroyDebugUtilsMessengerEXT)
687 return layer.instance_dispatch_table.DestroyDebugUtilsMessengerEXT(instance, messenger, pAllocator);
692 for (const auto& d : layer.created_devices) {
704 for (const auto& d : layer.created_devices) {
717 if (layer.created_devices[0].dispatch_table.CmdDebugMarkerBeginEXT)
718 layer.created_devices[0].dispatch_table.CmdDebugMarkerBeginEXT(cmd_buf, marker_info);
722 if (layer.created_devices[0].dispatch_table.CmdDebugMarkerEndEXT)
723 layer.created_devices[0].dispatch_table.CmdDebugMarkerEndEXT(cmd_buf);
727 if (layer.created_devices[0].dispatch_table.CmdDebugMarkerInsertEXT)
728 layer.created_devices[0].dispatch_table.CmdDebugMarkerInsertEXT(cmd_buf, marker_info);
732 for (const auto& d : layer.created_devices) {
744 for (const auto& d : layer.created_devices) {
757 if (layer.created_devices[0].dispatch_table.QueueBeginDebugUtilsLabelEXT)
758 layer.created_devices[0].dispatch_table.QueueBeginDebugUtilsLabelEXT(queue, label);
762 if (layer.created_devices[0].dispatch_table.QueueEndDebugUtilsLabelEXT)
763 layer.created_devices[0].dispatch_table.QueueEndDebugUtilsLabelEXT(queue);
767 if (layer.created_devices[0].dispatch_table.QueueInsertDebugUtilsLabelEXT)
768 layer.created_devices[0].dispatch_table.QueueInsertDebugUtilsLabelEXT(queue, label);
772 if (layer.created_devices[0].dispatch_table.CmdBeginDebugUtilsLabelEXT)
773 layer.created_devices[0].dispatch_table.CmdBeginDebugUtilsLabelEXT(cmd_buf, label);
777 if (layer.created_devices[0].dispatch_table.CmdEndDebugUtilsLabelEXT)
778 layer.created_devices[0].dispatch_table.CmdEndDebugUtilsLabelEXT(cmd_buf);
782 if (layer.created_devices[0].dispatch_table.CmdInsertDebugUtilsLabelEXT)
783 layer.created_devices[0].dispatch_table.CmdInsertDebugUtilsLabelEXT(cmd_buf, label);
817 for (auto& func : layer.custom_device_interception_functions) {
823 for (auto& func : layer.custom_device_implementation_functions) {
836 return layer.next_vkGetDeviceProcAddr(device, pName);
847 for (auto& func : layer.custom_physical_device_interception_functions) {
853 for (auto& func : layer.custom_physical_device_implementation_functions) {
890 return layer.next_vkGetInstanceProcAddr(instance, pName);
903 *pPropertyCount = layer.reported_layer_props;
905 uint32_t count = layer.reported_layer_props;
906 if (*pPropertyCount < layer.reported_layer_props) {
924 *pPropertyCount = layer.reported_extension_props;
926 uint32_t count = layer.reported_extension_props;
927 if (*pPropertyCount < layer.reported_extension_props) {
942 *pApiVersion = layer.reported_instance_version;
1012 return layer.next_GetPhysicalDeviceProcAddr(instance, pName);
1028 if (pVersionStruct->loaderLayerInterfaceVersion < layer.min_implementation_version) {
1032 pVersionStruct->loaderLayerInterfaceVersion = layer.implementation_version;