15db71995Sopenharmony_ci/*
25db71995Sopenharmony_ci *
35db71995Sopenharmony_ci * Copyright (c) 2015-2023 The Khronos Group Inc.
45db71995Sopenharmony_ci * Copyright (c) 2015-2023 Valve Corporation
55db71995Sopenharmony_ci * Copyright (c) 2015-2023 LunarG, Inc.
65db71995Sopenharmony_ci * Copyright (C) 2015 Google Inc.
75db71995Sopenharmony_ci * Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
85db71995Sopenharmony_ci * Copyright (c) 2023-2023 RasterGrid Kft.
95db71995Sopenharmony_ci *
105db71995Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
115db71995Sopenharmony_ci * you may not use this file except in compliance with the License.
125db71995Sopenharmony_ci * You may obtain a copy of the License at
135db71995Sopenharmony_ci *
145db71995Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
155db71995Sopenharmony_ci *
165db71995Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
175db71995Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
185db71995Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
195db71995Sopenharmony_ci * See the License for the specific language governing permissions and
205db71995Sopenharmony_ci * limitations under the License.
215db71995Sopenharmony_ci *
225db71995Sopenharmony_ci * Author: Courtney Goeltzenleuchter <courtney@lunarg.com>
235db71995Sopenharmony_ci * Author: Jon Ashburn <jon@lunarg.com>
245db71995Sopenharmony_ci * Author: Tony Barbour <tony@LunarG.com>
255db71995Sopenharmony_ci * Author: Chia-I Wu <olv@lunarg.com>
265db71995Sopenharmony_ci * Author: Charles Giessen <charles@lunarg.com>
275db71995Sopenharmony_ci */
285db71995Sopenharmony_ci
295db71995Sopenharmony_ci#include <stdlib.h>
305db71995Sopenharmony_ci#include <string.h>
315db71995Sopenharmony_ci
325db71995Sopenharmony_ci#include "allocation.h"
335db71995Sopenharmony_ci#include "debug_utils.h"
345db71995Sopenharmony_ci#include "gpa_helper.h"
355db71995Sopenharmony_ci#include "loader.h"
365db71995Sopenharmony_ci#include "loader_environment.h"
375db71995Sopenharmony_ci#include "log.h"
385db71995Sopenharmony_ci#include "settings.h"
395db71995Sopenharmony_ci#include "vk_loader_extensions.h"
405db71995Sopenharmony_ci#include "vk_loader_platform.h"
415db71995Sopenharmony_ci#include "wsi.h"
425db71995Sopenharmony_ci
435db71995Sopenharmony_ci// Trampoline entrypoints are in this file for core Vulkan commands
445db71995Sopenharmony_ci
455db71995Sopenharmony_ci/* vkGetInstanceProcAddr: Get global level or instance level entrypoint addresses.
465db71995Sopenharmony_ci * @param instance
475db71995Sopenharmony_ci * @param pName
485db71995Sopenharmony_ci * @return
495db71995Sopenharmony_ci *    If pName is a global level entrypoint:
505db71995Sopenharmony_ci *        If instance == NULL || instance is invalid || (instance is valid && instance.minor_version <= 2):
515db71995Sopenharmony_ci *            return global level functions
525db71995Sopenharmony_ci *        Else:
535db71995Sopenharmony_ci *            return NULL
545db71995Sopenharmony_ci *    Else:
555db71995Sopenharmony_ci *        If instance is valid:
565db71995Sopenharmony_ci *            return a trampoline entry point for all dispatchable Vulkan functions both core and extensions.
575db71995Sopenharmony_ci *        Else:
585db71995Sopenharmony_ci *            return NULL
595db71995Sopenharmony_ci *
605db71995Sopenharmony_ci * Note:
615db71995Sopenharmony_ci * Vulkan header updated 1.2.193 changed the behavior of vkGetInstanceProcAddr for global entrypoints. They used to always be
625db71995Sopenharmony_ci * returned regardless of the value of the instance parameter. The spec was amended in this version to only allow querying global
635db71995Sopenharmony_ci * level entrypoints with a NULL instance. However, as to not break old applications, the new behavior is only applied if the
645db71995Sopenharmony_ci * instance passed in is both valid and minor version is greater than 1.2, which was when this change in behavior occurred. Only
655db71995Sopenharmony_ci * instances with a newer version will get the new behavior.
665db71995Sopenharmony_ci */
675db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetInstanceProcAddr(VkInstance instance, const char *pName) {
685db71995Sopenharmony_ci    // Always should be able to get vkGetInstanceProcAddr if queried, regardless of the value of instance
695db71995Sopenharmony_ci    if (!strcmp(pName, "vkGetInstanceProcAddr")) return (PFN_vkVoidFunction)vkGetInstanceProcAddr;
705db71995Sopenharmony_ci
715db71995Sopenharmony_ci    // Get entrypoint addresses that are global (no dispatchable object)
725db71995Sopenharmony_ci    void *addr = globalGetProcAddr(pName);
735db71995Sopenharmony_ci    if (addr != VK_NULL_HANDLE) {
745db71995Sopenharmony_ci        // Always can get a global entrypoint from vkGetInstanceProcAddr with a NULL instance handle
755db71995Sopenharmony_ci        if (instance == VK_NULL_HANDLE) {
765db71995Sopenharmony_ci            return addr;
775db71995Sopenharmony_ci        } else {
785db71995Sopenharmony_ci            // New behavior only returns a global entrypoint if the instance handle is NULL.
795db71995Sopenharmony_ci            // Old behavior is to return a global entrypoint regardless of the value of the instance handle.
805db71995Sopenharmony_ci            // Use new behavior if: The instance is valid and the minor version of the instance is greater than 1.2, which
815db71995Sopenharmony_ci            // was when the new behavior was added. (eg, it is enforced in the next minor version of vulkan, which will be 1.3)
825db71995Sopenharmony_ci
835db71995Sopenharmony_ci            // First check if instance is valid - loader_get_instance() returns NULL if it isn't.
845db71995Sopenharmony_ci            struct loader_instance *ptr_instance = loader_get_instance(instance);
855db71995Sopenharmony_ci            if (ptr_instance != NULL &&
865db71995Sopenharmony_ci                loader_check_version_meets_required(loader_combine_version(1, 3, 0), ptr_instance->app_api_version)) {
875db71995Sopenharmony_ci                // New behavior
885db71995Sopenharmony_ci                return NULL;
895db71995Sopenharmony_ci            } else {
905db71995Sopenharmony_ci                // Old behavior
915db71995Sopenharmony_ci                return addr;
925db71995Sopenharmony_ci            }
935db71995Sopenharmony_ci        }
945db71995Sopenharmony_ci    } else {
955db71995Sopenharmony_ci        // All other functions require a valid instance handle to get
965db71995Sopenharmony_ci        if (instance == VK_NULL_HANDLE) {
975db71995Sopenharmony_ci            return NULL;
985db71995Sopenharmony_ci        }
995db71995Sopenharmony_ci        struct loader_instance *ptr_instance = loader_get_instance(instance);
1005db71995Sopenharmony_ci        // If we've gotten here and the pointer is NULL, it's invalid
1015db71995Sopenharmony_ci        if (ptr_instance == NULL) {
1025db71995Sopenharmony_ci            loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
1035db71995Sopenharmony_ci                       "vkGetInstanceProcAddr: Invalid instance [VUID-vkGetInstanceProcAddr-instance-parameter]");
1045db71995Sopenharmony_ci            abort(); /* Intentionally fail so user can correct issue. */
1055db71995Sopenharmony_ci        }
1065db71995Sopenharmony_ci        // Return trampoline code for non-global entrypoints including any extensions.
1075db71995Sopenharmony_ci        // Device extensions are returned if a layer or ICD supports the extension.
1085db71995Sopenharmony_ci        // Instance extensions are returned if the extension is enabled and the
1095db71995Sopenharmony_ci        // loader or someone else supports the extension
1105db71995Sopenharmony_ci        return trampoline_get_proc_addr(ptr_instance, pName);
1115db71995Sopenharmony_ci    }
1125db71995Sopenharmony_ci}
1135db71995Sopenharmony_ci
1145db71995Sopenharmony_ci// Get a device level or global level entry point address.
1155db71995Sopenharmony_ci// @param device
1165db71995Sopenharmony_ci// @param pName
1175db71995Sopenharmony_ci// @return
1185db71995Sopenharmony_ci//    If device is valid, returns a device relative entry point for device level
1195db71995Sopenharmony_ci//    entry points both core and extensions.
1205db71995Sopenharmony_ci//    Device relative means call down the device chain.
1215db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetDeviceProcAddr(VkDevice device, const char *pName) {
1225db71995Sopenharmony_ci    if (!pName || pName[0] != 'v' || pName[1] != 'k') return NULL;
1235db71995Sopenharmony_ci
1245db71995Sopenharmony_ci    // For entrypoints that loader must handle (ie non-dispatchable or create object)
1255db71995Sopenharmony_ci    // make sure the loader entrypoint is returned
1265db71995Sopenharmony_ci    const char *name = pName;
1275db71995Sopenharmony_ci    name += 2;
1285db71995Sopenharmony_ci    if (!strcmp(name, "GetDeviceProcAddr")) return (PFN_vkVoidFunction)vkGetDeviceProcAddr;
1295db71995Sopenharmony_ci    if (!strcmp(name, "DestroyDevice")) return (PFN_vkVoidFunction)vkDestroyDevice;
1305db71995Sopenharmony_ci    if (!strcmp(name, "GetDeviceQueue")) return (PFN_vkVoidFunction)vkGetDeviceQueue;
1315db71995Sopenharmony_ci    if (!strcmp(name, "AllocateCommandBuffers")) return (PFN_vkVoidFunction)vkAllocateCommandBuffers;
1325db71995Sopenharmony_ci
1335db71995Sopenharmony_ci    // Although CreateDevice is on device chain it's dispatchable object isn't
1345db71995Sopenharmony_ci    // a VkDevice or child of VkDevice so return NULL.
1355db71995Sopenharmony_ci    if (!strcmp(pName, "CreateDevice")) return NULL;
1365db71995Sopenharmony_ci
1375db71995Sopenharmony_ci    // Because vkGetDeviceQueue2 is a 1.1 entry point, we need to check if the apiVersion provided during instance creation is
1385db71995Sopenharmony_ci    // sufficient
1395db71995Sopenharmony_ci    if (!strcmp(name, "GetDeviceQueue2")) {
1405db71995Sopenharmony_ci        struct loader_device *dev = NULL;
1415db71995Sopenharmony_ci        uint32_t index = 0;
1425db71995Sopenharmony_ci        struct loader_icd_term *icd_term = loader_get_icd_and_device(device, &dev, &index);
1435db71995Sopenharmony_ci        if (NULL != icd_term && dev != NULL) {
1445db71995Sopenharmony_ci            const struct loader_instance *inst = icd_term->this_instance;
1455db71995Sopenharmony_ci            uint32_t api_version =
1465db71995Sopenharmony_ci                VK_MAKE_API_VERSION(0, inst->app_api_version.major, inst->app_api_version.minor, inst->app_api_version.patch);
1475db71995Sopenharmony_ci            return (dev->should_ignore_device_commands_from_newer_version && api_version < VK_API_VERSION_1_1)
1485db71995Sopenharmony_ci                       ? NULL
1495db71995Sopenharmony_ci                       : (PFN_vkVoidFunction)vkGetDeviceQueue2;
1505db71995Sopenharmony_ci        }
1515db71995Sopenharmony_ci        return NULL;
1525db71995Sopenharmony_ci    }
1535db71995Sopenharmony_ci    // Return the dispatch table entrypoint for the fastest case
1545db71995Sopenharmony_ci    const VkLayerDispatchTable *disp_table = loader_get_dispatch(device);
1555db71995Sopenharmony_ci    if (disp_table == NULL) return NULL;
1565db71995Sopenharmony_ci
1575db71995Sopenharmony_ci    bool found_name = false;
1585db71995Sopenharmony_ci    void *addr = loader_lookup_device_dispatch_table(disp_table, pName, &found_name);
1595db71995Sopenharmony_ci    if (found_name) return addr;
1605db71995Sopenharmony_ci
1615db71995Sopenharmony_ci    if (disp_table->GetDeviceProcAddr == NULL) return NULL;
1625db71995Sopenharmony_ci    return disp_table->GetDeviceProcAddr(device, pName);
1635db71995Sopenharmony_ci}
1645db71995Sopenharmony_ci
1655db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceExtensionProperties(const char *pLayerName,
1665db71995Sopenharmony_ci                                                                                    uint32_t *pPropertyCount,
1675db71995Sopenharmony_ci                                                                                    VkExtensionProperties *pProperties) {
1685db71995Sopenharmony_ci    LOADER_PLATFORM_THREAD_ONCE(&once_init, loader_initialize);
1695db71995Sopenharmony_ci
1705db71995Sopenharmony_ci    update_global_loader_settings();
1715db71995Sopenharmony_ci
1725db71995Sopenharmony_ci    // We know we need to call at least the terminator
1735db71995Sopenharmony_ci    VkResult res = VK_SUCCESS;
1745db71995Sopenharmony_ci    VkEnumerateInstanceExtensionPropertiesChain chain_tail = {
1755db71995Sopenharmony_ci        .header =
1765db71995Sopenharmony_ci            {
1775db71995Sopenharmony_ci                .type = VK_CHAIN_TYPE_ENUMERATE_INSTANCE_EXTENSION_PROPERTIES,
1785db71995Sopenharmony_ci                .version = VK_CURRENT_CHAIN_VERSION,
1795db71995Sopenharmony_ci                .size = sizeof(chain_tail),
1805db71995Sopenharmony_ci            },
1815db71995Sopenharmony_ci        .pfnNextLayer = &terminator_EnumerateInstanceExtensionProperties,
1825db71995Sopenharmony_ci        .pNextLink = NULL,
1835db71995Sopenharmony_ci    };
1845db71995Sopenharmony_ci    VkEnumerateInstanceExtensionPropertiesChain *chain_head = &chain_tail;
1855db71995Sopenharmony_ci
1865db71995Sopenharmony_ci    // Get the implicit layers
1875db71995Sopenharmony_ci    struct loader_layer_list layers = {0};
1885db71995Sopenharmony_ci    loader_platform_dl_handle *libs = NULL;
1895db71995Sopenharmony_ci    size_t lib_count = 0;
1905db71995Sopenharmony_ci    memset(&layers, 0, sizeof(layers));
1915db71995Sopenharmony_ci    struct loader_envvar_all_filters layer_filters = {0};
1925db71995Sopenharmony_ci
1935db71995Sopenharmony_ci    res = parse_layer_environment_var_filters(NULL, &layer_filters);
1945db71995Sopenharmony_ci    if (VK_SUCCESS != res) {
1955db71995Sopenharmony_ci        return res;
1965db71995Sopenharmony_ci    }
1975db71995Sopenharmony_ci
1985db71995Sopenharmony_ci    res = loader_scan_for_implicit_layers(NULL, &layers, &layer_filters);
1995db71995Sopenharmony_ci    if (VK_SUCCESS != res) {
2005db71995Sopenharmony_ci        return res;
2015db71995Sopenharmony_ci    }
2025db71995Sopenharmony_ci
2035db71995Sopenharmony_ci    res = loader_init_library_list(&layers, &libs);
2045db71995Sopenharmony_ci    if (VK_SUCCESS != res) {
2055db71995Sopenharmony_ci        return res;
2065db71995Sopenharmony_ci    }
2075db71995Sopenharmony_ci
2085db71995Sopenharmony_ci    // Prepend layers onto the chain if they implement this entry point
2095db71995Sopenharmony_ci    for (uint32_t i = 0; i < layers.count; ++i) {
2105db71995Sopenharmony_ci        // Skip this layer if it doesn't expose the entry-point
2115db71995Sopenharmony_ci        if (NULL == layers.list[i].pre_instance_functions.enumerate_instance_extension_properties) {
2125db71995Sopenharmony_ci            continue;
2135db71995Sopenharmony_ci        }
2145db71995Sopenharmony_ci
2155db71995Sopenharmony_ci        loader_platform_dl_handle layer_lib = loader_platform_open_library(layers.list[i].lib_name);
2165db71995Sopenharmony_ci        if (layer_lib == NULL) {
2175db71995Sopenharmony_ci            loader_log(NULL, VULKAN_LOADER_WARN_BIT | VULKAN_LOADER_LAYER_BIT, 0,
2185db71995Sopenharmony_ci                       "%s: Unable to load implicit layer library \"%s\"", __FUNCTION__, layers.list[i].lib_name);
2195db71995Sopenharmony_ci            continue;
2205db71995Sopenharmony_ci        }
2215db71995Sopenharmony_ci
2225db71995Sopenharmony_ci        libs[lib_count++] = layer_lib;
2235db71995Sopenharmony_ci        void *pfn = loader_platform_get_proc_address(layer_lib,
2245db71995Sopenharmony_ci                                                     layers.list[i].pre_instance_functions.enumerate_instance_extension_properties);
2255db71995Sopenharmony_ci        if (pfn == NULL) {
2265db71995Sopenharmony_ci            loader_log(NULL, VULKAN_LOADER_WARN_BIT | VULKAN_LOADER_LAYER_BIT, 0,
2275db71995Sopenharmony_ci                       "%s: Unable to resolve symbol \"%s\" in implicit layer library \"%s\"", __FUNCTION__,
2285db71995Sopenharmony_ci                       layers.list[i].pre_instance_functions.enumerate_instance_extension_properties, layers.list[i].lib_name);
2295db71995Sopenharmony_ci            continue;
2305db71995Sopenharmony_ci        }
2315db71995Sopenharmony_ci
2325db71995Sopenharmony_ci        VkEnumerateInstanceExtensionPropertiesChain *chain_link =
2335db71995Sopenharmony_ci            loader_alloc(NULL, sizeof(VkEnumerateInstanceExtensionPropertiesChain), VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
2345db71995Sopenharmony_ci        if (chain_link == NULL) {
2355db71995Sopenharmony_ci            res = VK_ERROR_OUT_OF_HOST_MEMORY;
2365db71995Sopenharmony_ci            break;
2375db71995Sopenharmony_ci        }
2385db71995Sopenharmony_ci        memset(chain_link, 0, sizeof(VkEnumerateInstanceLayerPropertiesChain));
2395db71995Sopenharmony_ci        chain_link->header.type = VK_CHAIN_TYPE_ENUMERATE_INSTANCE_EXTENSION_PROPERTIES;
2405db71995Sopenharmony_ci        chain_link->header.version = VK_CURRENT_CHAIN_VERSION;
2415db71995Sopenharmony_ci        chain_link->header.size = sizeof(*chain_link);
2425db71995Sopenharmony_ci        chain_link->pfnNextLayer = pfn;
2435db71995Sopenharmony_ci        chain_link->pNextLink = chain_head;
2445db71995Sopenharmony_ci
2455db71995Sopenharmony_ci        chain_head = chain_link;
2465db71995Sopenharmony_ci    }
2475db71995Sopenharmony_ci
2485db71995Sopenharmony_ci    // Call down the chain
2495db71995Sopenharmony_ci    if (res == VK_SUCCESS) {
2505db71995Sopenharmony_ci        res = chain_head->pfnNextLayer(chain_head->pNextLink, pLayerName, pPropertyCount, pProperties);
2515db71995Sopenharmony_ci    }
2525db71995Sopenharmony_ci
2535db71995Sopenharmony_ci    // Free up the layers
2545db71995Sopenharmony_ci    loader_delete_layer_list_and_properties(NULL, &layers);
2555db71995Sopenharmony_ci
2565db71995Sopenharmony_ci    // Tear down the chain
2575db71995Sopenharmony_ci    while (chain_head != &chain_tail) {
2585db71995Sopenharmony_ci        VkEnumerateInstanceExtensionPropertiesChain *holder = chain_head;
2595db71995Sopenharmony_ci        chain_head = (VkEnumerateInstanceExtensionPropertiesChain *)chain_head->pNextLink;
2605db71995Sopenharmony_ci        loader_free(NULL, holder);
2615db71995Sopenharmony_ci    }
2625db71995Sopenharmony_ci
2635db71995Sopenharmony_ci    // Close the dl handles
2645db71995Sopenharmony_ci    for (size_t i = 0; i < lib_count; ++i) {
2655db71995Sopenharmony_ci        loader_platform_close_library(libs[i]);
2665db71995Sopenharmony_ci    }
2675db71995Sopenharmony_ci    loader_free(NULL, libs);
2685db71995Sopenharmony_ci
2695db71995Sopenharmony_ci    return res;
2705db71995Sopenharmony_ci}
2715db71995Sopenharmony_ci
2725db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceLayerProperties(uint32_t *pPropertyCount,
2735db71995Sopenharmony_ci                                                                                VkLayerProperties *pProperties) {
2745db71995Sopenharmony_ci    LOADER_PLATFORM_THREAD_ONCE(&once_init, loader_initialize);
2755db71995Sopenharmony_ci
2765db71995Sopenharmony_ci    update_global_loader_settings();
2775db71995Sopenharmony_ci
2785db71995Sopenharmony_ci    // We know we need to call at least the terminator
2795db71995Sopenharmony_ci    VkResult res = VK_SUCCESS;
2805db71995Sopenharmony_ci    VkEnumerateInstanceLayerPropertiesChain chain_tail = {
2815db71995Sopenharmony_ci        .header =
2825db71995Sopenharmony_ci            {
2835db71995Sopenharmony_ci                .type = VK_CHAIN_TYPE_ENUMERATE_INSTANCE_LAYER_PROPERTIES,
2845db71995Sopenharmony_ci                .version = VK_CURRENT_CHAIN_VERSION,
2855db71995Sopenharmony_ci                .size = sizeof(chain_tail),
2865db71995Sopenharmony_ci            },
2875db71995Sopenharmony_ci        .pfnNextLayer = &terminator_EnumerateInstanceLayerProperties,
2885db71995Sopenharmony_ci        .pNextLink = NULL,
2895db71995Sopenharmony_ci    };
2905db71995Sopenharmony_ci    VkEnumerateInstanceLayerPropertiesChain *chain_head = &chain_tail;
2915db71995Sopenharmony_ci
2925db71995Sopenharmony_ci    // Get the implicit layers
2935db71995Sopenharmony_ci    struct loader_layer_list layers;
2945db71995Sopenharmony_ci    loader_platform_dl_handle *libs = NULL;
2955db71995Sopenharmony_ci    size_t lib_count = 0;
2965db71995Sopenharmony_ci    memset(&layers, 0, sizeof(layers));
2975db71995Sopenharmony_ci    struct loader_envvar_all_filters layer_filters = {0};
2985db71995Sopenharmony_ci
2995db71995Sopenharmony_ci    res = parse_layer_environment_var_filters(NULL, &layer_filters);
3005db71995Sopenharmony_ci    if (VK_SUCCESS != res) {
3015db71995Sopenharmony_ci        return res;
3025db71995Sopenharmony_ci    }
3035db71995Sopenharmony_ci
3045db71995Sopenharmony_ci    res = loader_scan_for_implicit_layers(NULL, &layers, &layer_filters);
3055db71995Sopenharmony_ci    if (VK_SUCCESS != res) {
3065db71995Sopenharmony_ci        return res;
3075db71995Sopenharmony_ci    }
3085db71995Sopenharmony_ci
3095db71995Sopenharmony_ci    res = loader_init_library_list(&layers, &libs);
3105db71995Sopenharmony_ci    if (VK_SUCCESS != res) {
3115db71995Sopenharmony_ci        return res;
3125db71995Sopenharmony_ci    }
3135db71995Sopenharmony_ci
3145db71995Sopenharmony_ci    // Prepend layers onto the chain if they implement this entry point
3155db71995Sopenharmony_ci    for (uint32_t i = 0; i < layers.count; ++i) {
3165db71995Sopenharmony_ci        // Skip this layer if it doesn't expose the entry-point
3175db71995Sopenharmony_ci        if (NULL == layers.list[i].pre_instance_functions.enumerate_instance_layer_properties) {
3185db71995Sopenharmony_ci            continue;
3195db71995Sopenharmony_ci        }
3205db71995Sopenharmony_ci
3215db71995Sopenharmony_ci        loader_platform_dl_handle layer_lib = loader_platform_open_library(layers.list[i].lib_name);
3225db71995Sopenharmony_ci        if (layer_lib == NULL) {
3235db71995Sopenharmony_ci            loader_log(NULL, VULKAN_LOADER_WARN_BIT, 0, "%s: Unable to load implicit layer library \"%s\"", __FUNCTION__,
3245db71995Sopenharmony_ci                       layers.list[i].lib_name);
3255db71995Sopenharmony_ci            continue;
3265db71995Sopenharmony_ci        }
3275db71995Sopenharmony_ci
3285db71995Sopenharmony_ci        libs[lib_count++] = layer_lib;
3295db71995Sopenharmony_ci        void *pfn =
3305db71995Sopenharmony_ci            loader_platform_get_proc_address(layer_lib, layers.list[i].pre_instance_functions.enumerate_instance_layer_properties);
3315db71995Sopenharmony_ci        if (pfn == NULL) {
3325db71995Sopenharmony_ci            loader_log(NULL, VULKAN_LOADER_WARN_BIT, 0, "%s: Unable to resolve symbol \"%s\" in implicit layer library \"%s\"",
3335db71995Sopenharmony_ci                       __FUNCTION__, layers.list[i].pre_instance_functions.enumerate_instance_layer_properties,
3345db71995Sopenharmony_ci                       layers.list[i].lib_name);
3355db71995Sopenharmony_ci            continue;
3365db71995Sopenharmony_ci        }
3375db71995Sopenharmony_ci
3385db71995Sopenharmony_ci        VkEnumerateInstanceLayerPropertiesChain *chain_link =
3395db71995Sopenharmony_ci            loader_alloc(NULL, sizeof(VkEnumerateInstanceLayerPropertiesChain), VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
3405db71995Sopenharmony_ci        if (chain_link == NULL) {
3415db71995Sopenharmony_ci            res = VK_ERROR_OUT_OF_HOST_MEMORY;
3425db71995Sopenharmony_ci            break;
3435db71995Sopenharmony_ci        }
3445db71995Sopenharmony_ci        memset(chain_link, 0, sizeof(VkEnumerateInstanceLayerPropertiesChain));
3455db71995Sopenharmony_ci        chain_link->header.type = VK_CHAIN_TYPE_ENUMERATE_INSTANCE_LAYER_PROPERTIES;
3465db71995Sopenharmony_ci        chain_link->header.version = VK_CURRENT_CHAIN_VERSION;
3475db71995Sopenharmony_ci        chain_link->header.size = sizeof(*chain_link);
3485db71995Sopenharmony_ci        chain_link->pfnNextLayer = pfn;
3495db71995Sopenharmony_ci        chain_link->pNextLink = chain_head;
3505db71995Sopenharmony_ci
3515db71995Sopenharmony_ci        chain_head = chain_link;
3525db71995Sopenharmony_ci    }
3535db71995Sopenharmony_ci
3545db71995Sopenharmony_ci    // Call down the chain
3555db71995Sopenharmony_ci    if (res == VK_SUCCESS) {
3565db71995Sopenharmony_ci        res = chain_head->pfnNextLayer(chain_head->pNextLink, pPropertyCount, pProperties);
3575db71995Sopenharmony_ci    }
3585db71995Sopenharmony_ci
3595db71995Sopenharmony_ci    // Free up the layers
3605db71995Sopenharmony_ci    loader_delete_layer_list_and_properties(NULL, &layers);
3615db71995Sopenharmony_ci
3625db71995Sopenharmony_ci    // Tear down the chain
3635db71995Sopenharmony_ci    while (chain_head != &chain_tail) {
3645db71995Sopenharmony_ci        VkEnumerateInstanceLayerPropertiesChain *holder = chain_head;
3655db71995Sopenharmony_ci        chain_head = (VkEnumerateInstanceLayerPropertiesChain *)chain_head->pNextLink;
3665db71995Sopenharmony_ci        loader_free(NULL, holder);
3675db71995Sopenharmony_ci    }
3685db71995Sopenharmony_ci
3695db71995Sopenharmony_ci    // Close the dl handles
3705db71995Sopenharmony_ci    for (size_t i = 0; i < lib_count; ++i) {
3715db71995Sopenharmony_ci        loader_platform_close_library(libs[i]);
3725db71995Sopenharmony_ci    }
3735db71995Sopenharmony_ci    loader_free(NULL, libs);
3745db71995Sopenharmony_ci
3755db71995Sopenharmony_ci    return res;
3765db71995Sopenharmony_ci}
3775db71995Sopenharmony_ci
3785db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceVersion(uint32_t *pApiVersion) {
3795db71995Sopenharmony_ci    LOADER_PLATFORM_THREAD_ONCE(&once_init, loader_initialize);
3805db71995Sopenharmony_ci
3815db71995Sopenharmony_ci    update_global_loader_settings();
3825db71995Sopenharmony_ci
3835db71995Sopenharmony_ci    if (NULL == pApiVersion) {
3845db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
3855db71995Sopenharmony_ci                   "vkEnumerateInstanceVersion: \'pApiVersion\' must not be NULL "
3865db71995Sopenharmony_ci                   "(VUID-vkEnumerateInstanceVersion-pApiVersion-parameter");
3875db71995Sopenharmony_ci        // NOTE: This seems silly, but it's the only allowable failure
3885db71995Sopenharmony_ci        return VK_ERROR_OUT_OF_HOST_MEMORY;
3895db71995Sopenharmony_ci    }
3905db71995Sopenharmony_ci
3915db71995Sopenharmony_ci    // We know we need to call at least the terminator
3925db71995Sopenharmony_ci    VkResult res = VK_SUCCESS;
3935db71995Sopenharmony_ci    VkEnumerateInstanceVersionChain chain_tail = {
3945db71995Sopenharmony_ci        .header =
3955db71995Sopenharmony_ci            {
3965db71995Sopenharmony_ci                .type = VK_CHAIN_TYPE_ENUMERATE_INSTANCE_VERSION,
3975db71995Sopenharmony_ci                .version = VK_CURRENT_CHAIN_VERSION,
3985db71995Sopenharmony_ci                .size = sizeof(chain_tail),
3995db71995Sopenharmony_ci            },
4005db71995Sopenharmony_ci        .pfnNextLayer = &terminator_EnumerateInstanceVersion,
4015db71995Sopenharmony_ci        .pNextLink = NULL,
4025db71995Sopenharmony_ci    };
4035db71995Sopenharmony_ci    VkEnumerateInstanceVersionChain *chain_head = &chain_tail;
4045db71995Sopenharmony_ci
4055db71995Sopenharmony_ci    // Get the implicit layers
4065db71995Sopenharmony_ci    struct loader_layer_list layers;
4075db71995Sopenharmony_ci    loader_platform_dl_handle *libs = NULL;
4085db71995Sopenharmony_ci    size_t lib_count = 0;
4095db71995Sopenharmony_ci    memset(&layers, 0, sizeof(layers));
4105db71995Sopenharmony_ci    struct loader_envvar_all_filters layer_filters = {0};
4115db71995Sopenharmony_ci
4125db71995Sopenharmony_ci    res = parse_layer_environment_var_filters(NULL, &layer_filters);
4135db71995Sopenharmony_ci    if (VK_SUCCESS != res) {
4145db71995Sopenharmony_ci        return res;
4155db71995Sopenharmony_ci    }
4165db71995Sopenharmony_ci
4175db71995Sopenharmony_ci    res = loader_scan_for_implicit_layers(NULL, &layers, &layer_filters);
4185db71995Sopenharmony_ci    if (VK_SUCCESS != res) {
4195db71995Sopenharmony_ci        return res;
4205db71995Sopenharmony_ci    }
4215db71995Sopenharmony_ci
4225db71995Sopenharmony_ci    res = loader_init_library_list(&layers, &libs);
4235db71995Sopenharmony_ci    if (VK_SUCCESS != res) {
4245db71995Sopenharmony_ci        return res;
4255db71995Sopenharmony_ci    }
4265db71995Sopenharmony_ci
4275db71995Sopenharmony_ci    // Prepend layers onto the chain if they implement this entry point
4285db71995Sopenharmony_ci    for (uint32_t i = 0; i < layers.count; ++i) {
4295db71995Sopenharmony_ci        // Skip this layer if it doesn't expose the entry-point
4305db71995Sopenharmony_ci        if (NULL == layers.list[i].pre_instance_functions.enumerate_instance_version) {
4315db71995Sopenharmony_ci            continue;
4325db71995Sopenharmony_ci        }
4335db71995Sopenharmony_ci
4345db71995Sopenharmony_ci        loader_platform_dl_handle layer_lib = loader_platform_open_library(layers.list[i].lib_name);
4355db71995Sopenharmony_ci        if (layer_lib == NULL) {
4365db71995Sopenharmony_ci            loader_log(NULL, VULKAN_LOADER_WARN_BIT, 0, "%s: Unable to load implicit layer library \"%s\"", __FUNCTION__,
4375db71995Sopenharmony_ci                       layers.list[i].lib_name);
4385db71995Sopenharmony_ci            continue;
4395db71995Sopenharmony_ci        }
4405db71995Sopenharmony_ci
4415db71995Sopenharmony_ci        libs[lib_count++] = layer_lib;
4425db71995Sopenharmony_ci        void *pfn = loader_platform_get_proc_address(layer_lib, layers.list[i].pre_instance_functions.enumerate_instance_version);
4435db71995Sopenharmony_ci        if (pfn == NULL) {
4445db71995Sopenharmony_ci            loader_log(NULL, VULKAN_LOADER_WARN_BIT, 0, "%s: Unable to resolve symbol \"%s\" in implicit layer library \"%s\"",
4455db71995Sopenharmony_ci                       __FUNCTION__, layers.list[i].pre_instance_functions.enumerate_instance_version, layers.list[i].lib_name);
4465db71995Sopenharmony_ci            continue;
4475db71995Sopenharmony_ci        }
4485db71995Sopenharmony_ci
4495db71995Sopenharmony_ci        VkEnumerateInstanceVersionChain *chain_link =
4505db71995Sopenharmony_ci            loader_alloc(NULL, sizeof(VkEnumerateInstanceVersionChain), VK_SYSTEM_ALLOCATION_SCOPE_COMMAND);
4515db71995Sopenharmony_ci        if (chain_link == NULL) {
4525db71995Sopenharmony_ci            res = VK_ERROR_OUT_OF_HOST_MEMORY;
4535db71995Sopenharmony_ci            break;
4545db71995Sopenharmony_ci        }
4555db71995Sopenharmony_ci        memset(chain_link, 0, sizeof(VkEnumerateInstanceLayerPropertiesChain));
4565db71995Sopenharmony_ci        chain_link->header.type = VK_CHAIN_TYPE_ENUMERATE_INSTANCE_VERSION;
4575db71995Sopenharmony_ci        chain_link->header.version = VK_CURRENT_CHAIN_VERSION;
4585db71995Sopenharmony_ci        chain_link->header.size = sizeof(*chain_link);
4595db71995Sopenharmony_ci        chain_link->pfnNextLayer = pfn;
4605db71995Sopenharmony_ci        chain_link->pNextLink = chain_head;
4615db71995Sopenharmony_ci
4625db71995Sopenharmony_ci        chain_head = chain_link;
4635db71995Sopenharmony_ci    }
4645db71995Sopenharmony_ci
4655db71995Sopenharmony_ci    // Call down the chain
4665db71995Sopenharmony_ci    if (res == VK_SUCCESS) {
4675db71995Sopenharmony_ci        res = chain_head->pfnNextLayer(chain_head->pNextLink, pApiVersion);
4685db71995Sopenharmony_ci    }
4695db71995Sopenharmony_ci
4705db71995Sopenharmony_ci    // Free up the layers
4715db71995Sopenharmony_ci    loader_delete_layer_list_and_properties(NULL, &layers);
4725db71995Sopenharmony_ci
4735db71995Sopenharmony_ci    // Tear down the chain
4745db71995Sopenharmony_ci    while (chain_head != &chain_tail) {
4755db71995Sopenharmony_ci        VkEnumerateInstanceVersionChain *holder = chain_head;
4765db71995Sopenharmony_ci        chain_head = (VkEnumerateInstanceVersionChain *)chain_head->pNextLink;
4775db71995Sopenharmony_ci        loader_free(NULL, holder);
4785db71995Sopenharmony_ci    }
4795db71995Sopenharmony_ci
4805db71995Sopenharmony_ci    // Close the dl handles
4815db71995Sopenharmony_ci    for (size_t i = 0; i < lib_count; ++i) {
4825db71995Sopenharmony_ci        loader_platform_close_library(libs[i]);
4835db71995Sopenharmony_ci    }
4845db71995Sopenharmony_ci    loader_free(NULL, libs);
4855db71995Sopenharmony_ci
4865db71995Sopenharmony_ci    return res;
4875db71995Sopenharmony_ci}
4885db71995Sopenharmony_ci
4895db71995Sopenharmony_ci// Add the "instance-only" debug functions to the list of active debug functions
4905db71995Sopenharmony_ci// at the very end.  This way it doesn't get replaced by any new messengers
4915db71995Sopenharmony_civoid loader_add_instance_only_debug_funcs(struct loader_instance *ptr_instance) {
4925db71995Sopenharmony_ci    VkLayerDbgFunctionNode *cur_node = ptr_instance->current_dbg_function_head;
4935db71995Sopenharmony_ci    if (cur_node == NULL) {
4945db71995Sopenharmony_ci        ptr_instance->current_dbg_function_head = ptr_instance->instance_only_dbg_function_head;
4955db71995Sopenharmony_ci    } else {
4965db71995Sopenharmony_ci        while (cur_node != NULL) {
4975db71995Sopenharmony_ci            if (cur_node == ptr_instance->instance_only_dbg_function_head) {
4985db71995Sopenharmony_ci                // Already added
4995db71995Sopenharmony_ci                break;
5005db71995Sopenharmony_ci            }
5015db71995Sopenharmony_ci            // Last item
5025db71995Sopenharmony_ci            else if (cur_node->pNext == NULL) {
5035db71995Sopenharmony_ci                cur_node->pNext = ptr_instance->instance_only_dbg_function_head;
5045db71995Sopenharmony_ci            }
5055db71995Sopenharmony_ci            cur_node = cur_node->pNext;
5065db71995Sopenharmony_ci        }
5075db71995Sopenharmony_ci    }
5085db71995Sopenharmony_ci}
5095db71995Sopenharmony_ci
5105db71995Sopenharmony_ci// Remove the "instance-only" debug functions from the list of active debug functions.
5115db71995Sopenharmony_ci// It should be added after the last actual debug utils/debug report function.
5125db71995Sopenharmony_civoid loader_remove_instance_only_debug_funcs(struct loader_instance *ptr_instance) {
5135db71995Sopenharmony_ci    VkLayerDbgFunctionNode *cur_node = ptr_instance->current_dbg_function_head;
5145db71995Sopenharmony_ci
5155db71995Sopenharmony_ci    // Only thing in list is the instance only head
5165db71995Sopenharmony_ci    if (cur_node == ptr_instance->instance_only_dbg_function_head) {
5175db71995Sopenharmony_ci        ptr_instance->current_dbg_function_head = NULL;
5185db71995Sopenharmony_ci    }
5195db71995Sopenharmony_ci    while (cur_node != NULL) {
5205db71995Sopenharmony_ci        if (cur_node->pNext == ptr_instance->instance_only_dbg_function_head) {
5215db71995Sopenharmony_ci            cur_node->pNext = NULL;
5225db71995Sopenharmony_ci            break;
5235db71995Sopenharmony_ci        }
5245db71995Sopenharmony_ci        cur_node = cur_node->pNext;
5255db71995Sopenharmony_ci    }
5265db71995Sopenharmony_ci}
5275db71995Sopenharmony_ci
5285db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateInstance(const VkInstanceCreateInfo *pCreateInfo,
5295db71995Sopenharmony_ci                                                              const VkAllocationCallbacks *pAllocator, VkInstance *pInstance) {
5305db71995Sopenharmony_ci    struct loader_instance *ptr_instance = NULL;
5315db71995Sopenharmony_ci    VkInstance created_instance = VK_NULL_HANDLE;
5325db71995Sopenharmony_ci    VkResult res = VK_ERROR_INITIALIZATION_FAILED;
5335db71995Sopenharmony_ci    VkInstanceCreateInfo ici = {0};
5345db71995Sopenharmony_ci    struct loader_envvar_all_filters layer_filters = {0};
5355db71995Sopenharmony_ci
5365db71995Sopenharmony_ci    LOADER_PLATFORM_THREAD_ONCE(&once_init, loader_initialize);
5375db71995Sopenharmony_ci
5385db71995Sopenharmony_ci    if (pCreateInfo == NULL) {
5395db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
5405db71995Sopenharmony_ci                   "vkCreateInstance: \'pCreateInfo\' is NULL (VUID-vkCreateInstance-pCreateInfo-parameter)");
5415db71995Sopenharmony_ci        goto out;
5425db71995Sopenharmony_ci    }
5435db71995Sopenharmony_ci    ici = *pCreateInfo;
5445db71995Sopenharmony_ci
5455db71995Sopenharmony_ci    if (pInstance == NULL) {
5465db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
5475db71995Sopenharmony_ci                   "vkCreateInstance \'pInstance\' not valid (VUID-vkCreateInstance-pInstance-parameter)");
5485db71995Sopenharmony_ci        goto out;
5495db71995Sopenharmony_ci    }
5505db71995Sopenharmony_ci
5515db71995Sopenharmony_ci    ptr_instance =
5525db71995Sopenharmony_ci        (struct loader_instance *)loader_calloc(pAllocator, sizeof(struct loader_instance), VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
5535db71995Sopenharmony_ci
5545db71995Sopenharmony_ci    if (ptr_instance == NULL) {
5555db71995Sopenharmony_ci        res = VK_ERROR_OUT_OF_HOST_MEMORY;
5565db71995Sopenharmony_ci        goto out;
5575db71995Sopenharmony_ci    }
5585db71995Sopenharmony_ci
5595db71995Sopenharmony_ci    loader_platform_thread_lock_mutex(&loader_lock);
5605db71995Sopenharmony_ci    if (pAllocator) {
5615db71995Sopenharmony_ci        ptr_instance->alloc_callbacks = *pAllocator;
5625db71995Sopenharmony_ci    }
5635db71995Sopenharmony_ci    ptr_instance->magic = LOADER_MAGIC_NUMBER;
5645db71995Sopenharmony_ci
5655db71995Sopenharmony_ci    // Save the application version
5665db71995Sopenharmony_ci    if (NULL == pCreateInfo->pApplicationInfo || 0 == pCreateInfo->pApplicationInfo->apiVersion) {
5675db71995Sopenharmony_ci        ptr_instance->app_api_version = LOADER_VERSION_1_0_0;
5685db71995Sopenharmony_ci    } else {
5695db71995Sopenharmony_ci        ptr_instance->app_api_version = loader_make_version(pCreateInfo->pApplicationInfo->apiVersion);
5705db71995Sopenharmony_ci    }
5715db71995Sopenharmony_ci
5725db71995Sopenharmony_ci    // Look for one or more VK_EXT_debug_report or VK_EXT_debug_utils create info structures
5735db71995Sopenharmony_ci    // and setup a callback(s) for each one found.
5745db71995Sopenharmony_ci
5755db71995Sopenharmony_ci    // Handle cases of VK_EXT_debug_utils
5765db71995Sopenharmony_ci    // Setup the temporary messenger(s) here to catch early issues:
5775db71995Sopenharmony_ci    res = util_CreateDebugUtilsMessengers(ptr_instance, pCreateInfo->pNext, pAllocator);
5785db71995Sopenharmony_ci    if (VK_ERROR_OUT_OF_HOST_MEMORY == res) {
5795db71995Sopenharmony_ci        // Failure of setting up one or more of the messenger.
5805db71995Sopenharmony_ci        goto out;
5815db71995Sopenharmony_ci    }
5825db71995Sopenharmony_ci
5835db71995Sopenharmony_ci    // Handle cases of VK_EXT_debug_report
5845db71995Sopenharmony_ci    // Setup the temporary callback(s) here to catch early issues:
5855db71995Sopenharmony_ci    res = util_CreateDebugReportCallbacks(ptr_instance, pCreateInfo->pNext, pAllocator);
5865db71995Sopenharmony_ci    if (VK_ERROR_OUT_OF_HOST_MEMORY == res) {
5875db71995Sopenharmony_ci        // Failure of setting up one or more of the callback.
5885db71995Sopenharmony_ci        goto out;
5895db71995Sopenharmony_ci    }
5905db71995Sopenharmony_ci
5915db71995Sopenharmony_ci    VkResult settings_file_res = get_loader_settings(ptr_instance, &ptr_instance->settings);
5925db71995Sopenharmony_ci    if (settings_file_res == VK_ERROR_OUT_OF_HOST_MEMORY) {
5935db71995Sopenharmony_ci        res = settings_file_res;
5945db71995Sopenharmony_ci        goto out;
5955db71995Sopenharmony_ci    }
5965db71995Sopenharmony_ci    if (ptr_instance->settings.settings_active) {
5975db71995Sopenharmony_ci        log_settings(ptr_instance, &ptr_instance->settings);
5985db71995Sopenharmony_ci    }
5995db71995Sopenharmony_ci
6005db71995Sopenharmony_ci    // Providing an apiVersion less than VK_API_VERSION_1_0 but greater than zero prevents the validation layers from starting
6015db71995Sopenharmony_ci    if (pCreateInfo->pApplicationInfo && pCreateInfo->pApplicationInfo->apiVersion < VK_API_VERSION_1_0) {
6025db71995Sopenharmony_ci        loader_log(ptr_instance, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT, 0,
6035db71995Sopenharmony_ci                   "VkInstanceCreateInfo::pApplicationInfo::apiVersion has value of %u which is not permitted. If apiVersion is "
6045db71995Sopenharmony_ci                   "not 0, then it must be "
6055db71995Sopenharmony_ci                   "greater than or equal to the value of VK_API_VERSION_1_0 [VUID-VkApplicationInfo-apiVersion]",
6065db71995Sopenharmony_ci                   pCreateInfo->pApplicationInfo->apiVersion);
6075db71995Sopenharmony_ci    }
6085db71995Sopenharmony_ci
6095db71995Sopenharmony_ci    // Check the VkInstanceCreateInfoFlags wether to allow the portability enumeration flag
6105db71995Sopenharmony_ci    if ((pCreateInfo->flags & VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR) == 1) {
6115db71995Sopenharmony_ci        ptr_instance->portability_enumeration_flag_bit_set = true;
6125db71995Sopenharmony_ci    }
6135db71995Sopenharmony_ci    // Make sure the extension has been enabled
6145db71995Sopenharmony_ci    if (pCreateInfo->ppEnabledExtensionNames) {
6155db71995Sopenharmony_ci        for (uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; i++) {
6165db71995Sopenharmony_ci            if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME) == 0) {
6175db71995Sopenharmony_ci                ptr_instance->portability_enumeration_extension_enabled = true;
6185db71995Sopenharmony_ci                if (ptr_instance->portability_enumeration_flag_bit_set) {
6195db71995Sopenharmony_ci                    ptr_instance->portability_enumeration_enabled = true;
6205db71995Sopenharmony_ci                    loader_log(ptr_instance, VULKAN_LOADER_INFO_BIT, 0,
6215db71995Sopenharmony_ci                               "Portability enumeration bit was set, enumerating portability drivers.");
6225db71995Sopenharmony_ci                }
6235db71995Sopenharmony_ci            }
6245db71995Sopenharmony_ci        }
6255db71995Sopenharmony_ci    }
6265db71995Sopenharmony_ci
6275db71995Sopenharmony_ci    // Make sure the application provided API version has the correct variant
6285db71995Sopenharmony_ci    if (NULL != pCreateInfo->pApplicationInfo) {
6295db71995Sopenharmony_ci        uint32_t variant_version = VK_API_VERSION_VARIANT(pCreateInfo->pApplicationInfo->apiVersion);
6305db71995Sopenharmony_ci        const uint32_t expected_variant = 0;
6315db71995Sopenharmony_ci        if (expected_variant != variant_version) {
6325db71995Sopenharmony_ci            loader_log(ptr_instance, VULKAN_LOADER_WARN_BIT, 0,
6335db71995Sopenharmony_ci                       "vkCreateInstance: The API Variant specified in pCreateInfo->pApplicationInfo.apiVersion is %d instead of "
6345db71995Sopenharmony_ci                       "the expected value of %d.",
6355db71995Sopenharmony_ci                       variant_version, expected_variant);
6365db71995Sopenharmony_ci        }
6375db71995Sopenharmony_ci    }
6385db71995Sopenharmony_ci
6395db71995Sopenharmony_ci    res = parse_layer_environment_var_filters(ptr_instance, &layer_filters);
6405db71995Sopenharmony_ci    if (VK_SUCCESS != res) {
6415db71995Sopenharmony_ci        goto out;
6425db71995Sopenharmony_ci    }
6435db71995Sopenharmony_ci
6445db71995Sopenharmony_ci    // Due to implicit layers need to get layer list even if
6455db71995Sopenharmony_ci    // enabledLayerCount == 0 and VK_INSTANCE_LAYERS is unset. For now always
6465db71995Sopenharmony_ci    // get layer list via loader_scan_for_layers().
6475db71995Sopenharmony_ci    memset(&ptr_instance->instance_layer_list, 0, sizeof(ptr_instance->instance_layer_list));
6485db71995Sopenharmony_ci    res = loader_scan_for_layers(ptr_instance, &ptr_instance->instance_layer_list, &layer_filters);
6495db71995Sopenharmony_ci    if (VK_SUCCESS != res) {
6505db71995Sopenharmony_ci        goto out;
6515db71995Sopenharmony_ci    }
6525db71995Sopenharmony_ci
6535db71995Sopenharmony_ci    // Validate the app requested layers to be enabled
6545db71995Sopenharmony_ci    if (pCreateInfo->enabledLayerCount > 0) {
6555db71995Sopenharmony_ci        res = loader_validate_layers(ptr_instance, pCreateInfo->enabledLayerCount, pCreateInfo->ppEnabledLayerNames,
6565db71995Sopenharmony_ci                                     &ptr_instance->instance_layer_list);
6575db71995Sopenharmony_ci        if (res != VK_SUCCESS) {
6585db71995Sopenharmony_ci            goto out;
6595db71995Sopenharmony_ci        }
6605db71995Sopenharmony_ci    }
6615db71995Sopenharmony_ci
6625db71995Sopenharmony_ci    // Scan/discover all System and Environment Variable ICD libraries
6635db71995Sopenharmony_ci    bool skipped_portability_drivers = false;
6645db71995Sopenharmony_ci    res = loader_icd_scan(ptr_instance, &ptr_instance->icd_tramp_list, pCreateInfo, &skipped_portability_drivers);
6655db71995Sopenharmony_ci    if (res == VK_ERROR_OUT_OF_HOST_MEMORY) {
6665db71995Sopenharmony_ci        goto out;
6675db71995Sopenharmony_ci    }
6685db71995Sopenharmony_ci
6695db71995Sopenharmony_ci    if (ptr_instance->icd_tramp_list.count == 0) {
6705db71995Sopenharmony_ci        // No drivers found
6715db71995Sopenharmony_ci        if (skipped_portability_drivers) {
6725db71995Sopenharmony_ci            if (ptr_instance->portability_enumeration_extension_enabled && !ptr_instance->portability_enumeration_flag_bit_set) {
6735db71995Sopenharmony_ci                loader_log(ptr_instance, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_DRIVER_BIT, 0,
6745db71995Sopenharmony_ci                           "vkCreateInstance: Found drivers that contain devices which support the portability subset, but "
6755db71995Sopenharmony_ci                           "the instance does not enumerate portability drivers! Applications that wish to enumerate portability "
6765db71995Sopenharmony_ci                           "drivers must set the VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR bit in the VkInstanceCreateInfo "
6775db71995Sopenharmony_ci                           "flags.");
6785db71995Sopenharmony_ci            } else if (ptr_instance->portability_enumeration_flag_bit_set &&
6795db71995Sopenharmony_ci                       !ptr_instance->portability_enumeration_extension_enabled) {
6805db71995Sopenharmony_ci                loader_log(ptr_instance, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_DRIVER_BIT, 0,
6815db71995Sopenharmony_ci                           "VkInstanceCreateInfo: If flags has the VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR bit set, the "
6825db71995Sopenharmony_ci                           "list of enabled extensions in ppEnabledExtensionNames must contain VK_KHR_portability_enumeration "
6835db71995Sopenharmony_ci                           "[VUID-VkInstanceCreateInfo-flags-06559 ]"
6845db71995Sopenharmony_ci                           "Applications that wish to enumerate portability drivers must enable the VK_KHR_portability_enumeration "
6855db71995Sopenharmony_ci                           "instance extension.");
6865db71995Sopenharmony_ci            } else {
6875db71995Sopenharmony_ci                loader_log(ptr_instance, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_DRIVER_BIT, 0,
6885db71995Sopenharmony_ci                           "vkCreateInstance: Found drivers that contain devices which support the portability subset, but "
6895db71995Sopenharmony_ci                           "the instance does not enumerate portability drivers! Applications that wish to enumerate portability "
6905db71995Sopenharmony_ci                           "drivers must set the VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR bit in the VkInstanceCreateInfo "
6915db71995Sopenharmony_ci                           "flags and enable the VK_KHR_portability_enumeration instance extension.");
6925db71995Sopenharmony_ci            }
6935db71995Sopenharmony_ci        }
6945db71995Sopenharmony_ci        loader_log(ptr_instance, VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_DRIVER_BIT, 0, "vkCreateInstance: Found no drivers!");
6955db71995Sopenharmony_ci        res = VK_ERROR_INCOMPATIBLE_DRIVER;
6965db71995Sopenharmony_ci        goto out;
6975db71995Sopenharmony_ci    }
6985db71995Sopenharmony_ci
6995db71995Sopenharmony_ci    // Get extensions from all ICD's, merge so no duplicates, then validate
7005db71995Sopenharmony_ci    res = loader_get_icd_loader_instance_extensions(ptr_instance, &ptr_instance->icd_tramp_list, &ptr_instance->ext_list);
7015db71995Sopenharmony_ci    if (res != VK_SUCCESS) {
7025db71995Sopenharmony_ci        goto out;
7035db71995Sopenharmony_ci    }
7045db71995Sopenharmony_ci    res = loader_validate_instance_extensions(ptr_instance, &ptr_instance->ext_list, &ptr_instance->instance_layer_list,
7055db71995Sopenharmony_ci                                              &layer_filters, &ici);
7065db71995Sopenharmony_ci    if (res != VK_SUCCESS) {
7075db71995Sopenharmony_ci        goto out;
7085db71995Sopenharmony_ci    }
7095db71995Sopenharmony_ci
7105db71995Sopenharmony_ci    ptr_instance->disp = loader_instance_heap_alloc(ptr_instance, sizeof(struct loader_instance_dispatch_table),
7115db71995Sopenharmony_ci                                                    VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
7125db71995Sopenharmony_ci    if (ptr_instance->disp == NULL) {
7135db71995Sopenharmony_ci        loader_log(ptr_instance, VULKAN_LOADER_ERROR_BIT, 0,
7145db71995Sopenharmony_ci                   "vkCreateInstance:  Failed to allocate Loader's full Instance dispatch table.");
7155db71995Sopenharmony_ci        res = VK_ERROR_OUT_OF_HOST_MEMORY;
7165db71995Sopenharmony_ci        goto out;
7175db71995Sopenharmony_ci    }
7185db71995Sopenharmony_ci    memcpy(&ptr_instance->disp->layer_inst_disp, &instance_disp, sizeof(instance_disp));
7195db71995Sopenharmony_ci
7205db71995Sopenharmony_ci    loader_platform_thread_lock_mutex(&loader_global_instance_list_lock);
7215db71995Sopenharmony_ci    ptr_instance->next = loader.instances;
7225db71995Sopenharmony_ci    loader.instances = ptr_instance;
7235db71995Sopenharmony_ci    loader_platform_thread_unlock_mutex(&loader_global_instance_list_lock);
7245db71995Sopenharmony_ci
7255db71995Sopenharmony_ci    // Activate any layers on instance chain
7265db71995Sopenharmony_ci    res = loader_enable_instance_layers(ptr_instance, &ici, &ptr_instance->instance_layer_list, &layer_filters);
7275db71995Sopenharmony_ci    if (res != VK_SUCCESS) {
7285db71995Sopenharmony_ci        goto out;
7295db71995Sopenharmony_ci    }
7305db71995Sopenharmony_ci
7315db71995Sopenharmony_ci    created_instance = (VkInstance)ptr_instance;
7325db71995Sopenharmony_ci    res = loader_create_instance_chain(&ici, pAllocator, ptr_instance, &created_instance);
7335db71995Sopenharmony_ci
7345db71995Sopenharmony_ci    if (VK_SUCCESS == res) {
7355db71995Sopenharmony_ci        // Check for enabled extensions here to setup the loader structures so the loader knows what extensions
7365db71995Sopenharmony_ci        // it needs to worry about.
7375db71995Sopenharmony_ci        // We do it in the terminator and again above the layers here since we may think different extensions
7385db71995Sopenharmony_ci        // are enabled than what's down in the terminator.
7395db71995Sopenharmony_ci        // This is why we don't clear inside of these function calls.
7405db71995Sopenharmony_ci        // The clearing should actually be handled by the overall memset of the pInstance structure above.
7415db71995Sopenharmony_ci        wsi_create_instance(ptr_instance, &ici);
7425db71995Sopenharmony_ci        check_for_enabled_debug_extensions(ptr_instance, &ici);
7435db71995Sopenharmony_ci        extensions_create_instance(ptr_instance, &ici);
7445db71995Sopenharmony_ci
7455db71995Sopenharmony_ci        *pInstance = (VkInstance)ptr_instance;
7465db71995Sopenharmony_ci
7475db71995Sopenharmony_ci        // Finally have the layers in place and everyone has seen
7485db71995Sopenharmony_ci        // the CreateInstance command go by. This allows the layer's
7495db71995Sopenharmony_ci        // GetInstanceProcAddr functions to return valid extension functions
7505db71995Sopenharmony_ci        // if enabled.
7515db71995Sopenharmony_ci        loader_activate_instance_layer_extensions(ptr_instance, created_instance);
7525db71995Sopenharmony_ci        ptr_instance->instance_finished_creation = true;
7535db71995Sopenharmony_ci    } else if (VK_ERROR_EXTENSION_NOT_PRESENT == res && !ptr_instance->create_terminator_invalid_extension) {
7545db71995Sopenharmony_ci        loader_log(ptr_instance, VULKAN_LOADER_WARN_BIT, 0,
7555db71995Sopenharmony_ci                   "vkCreateInstance: Layer returning invalid extension error not triggered by ICD/Loader (Policy #LLP_LAYER_17).");
7565db71995Sopenharmony_ci    }
7575db71995Sopenharmony_ci
7585db71995Sopenharmony_ciout:
7595db71995Sopenharmony_ci
7605db71995Sopenharmony_ci    if (NULL != ptr_instance) {
7615db71995Sopenharmony_ci        if (res != VK_SUCCESS) {
7625db71995Sopenharmony_ci            loader_platform_thread_lock_mutex(&loader_global_instance_list_lock);
7635db71995Sopenharmony_ci            // error path, should clean everything up
7645db71995Sopenharmony_ci            if (loader.instances == ptr_instance) {
7655db71995Sopenharmony_ci                loader.instances = ptr_instance->next;
7665db71995Sopenharmony_ci            }
7675db71995Sopenharmony_ci            loader_platform_thread_unlock_mutex(&loader_global_instance_list_lock);
7685db71995Sopenharmony_ci
7695db71995Sopenharmony_ci            free_loader_settings(ptr_instance, &ptr_instance->settings);
7705db71995Sopenharmony_ci
7715db71995Sopenharmony_ci            loader_instance_heap_free(ptr_instance, ptr_instance->disp);
7725db71995Sopenharmony_ci            // Remove any created VK_EXT_debug_report or VK_EXT_debug_utils items
7735db71995Sopenharmony_ci            destroy_debug_callbacks_chain(ptr_instance, pAllocator);
7745db71995Sopenharmony_ci
7755db71995Sopenharmony_ci            loader_destroy_pointer_layer_list(ptr_instance, &ptr_instance->expanded_activated_layer_list);
7765db71995Sopenharmony_ci            loader_destroy_pointer_layer_list(ptr_instance, &ptr_instance->app_activated_layer_list);
7775db71995Sopenharmony_ci
7785db71995Sopenharmony_ci            loader_delete_layer_list_and_properties(ptr_instance, &ptr_instance->instance_layer_list);
7795db71995Sopenharmony_ci            loader_scanned_icd_clear(ptr_instance, &ptr_instance->icd_tramp_list);
7805db71995Sopenharmony_ci            loader_destroy_generic_list(ptr_instance, (struct loader_generic_list *)&ptr_instance->ext_list);
7815db71995Sopenharmony_ci
7825db71995Sopenharmony_ci            // Free any icd_terms that were created.
7835db71995Sopenharmony_ci            // If an OOM occurs from a layer, terminator_CreateInstance won't be reached where this kind of
7845db71995Sopenharmony_ci            // cleanup normally occurs
7855db71995Sopenharmony_ci            struct loader_icd_term *icd_term = NULL;
7865db71995Sopenharmony_ci            while (NULL != ptr_instance->icd_terms) {
7875db71995Sopenharmony_ci                icd_term = ptr_instance->icd_terms;
7885db71995Sopenharmony_ci                // Call destroy Instance on each driver in case we successfully called down the chain but failed on
7895db71995Sopenharmony_ci                // our way back out of it.
7905db71995Sopenharmony_ci                if (icd_term->instance) {
7915db71995Sopenharmony_ci                    icd_term->dispatch.DestroyInstance(icd_term->instance, pAllocator);
7925db71995Sopenharmony_ci                }
7935db71995Sopenharmony_ci                icd_term->instance = VK_NULL_HANDLE;
7945db71995Sopenharmony_ci                ptr_instance->icd_terms = icd_term->next;
7955db71995Sopenharmony_ci                loader_icd_destroy(ptr_instance, icd_term, pAllocator);
7965db71995Sopenharmony_ci            }
7975db71995Sopenharmony_ci
7985db71995Sopenharmony_ci            free_string_list(ptr_instance, &ptr_instance->enabled_layer_names);
7995db71995Sopenharmony_ci
8005db71995Sopenharmony_ci            loader_instance_heap_free(ptr_instance, ptr_instance);
8015db71995Sopenharmony_ci        } else {
8025db71995Sopenharmony_ci            // success path, swap out created debug callbacks out so they aren't used until instance destruction
8035db71995Sopenharmony_ci            loader_remove_instance_only_debug_funcs(ptr_instance);
8045db71995Sopenharmony_ci        }
8055db71995Sopenharmony_ci        // Only unlock when ptr_instance isn't NULL, as if it is, the above code didn't make it to when loader_lock was locked.
8065db71995Sopenharmony_ci        loader_platform_thread_unlock_mutex(&loader_lock);
8075db71995Sopenharmony_ci    }
8085db71995Sopenharmony_ci
8095db71995Sopenharmony_ci    return res;
8105db71995Sopenharmony_ci}
8115db71995Sopenharmony_ci
8125db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyInstance(VkInstance instance, const VkAllocationCallbacks *pAllocator) {
8135db71995Sopenharmony_ci    const VkLayerInstanceDispatchTable *disp;
8145db71995Sopenharmony_ci    struct loader_instance *ptr_instance = NULL;
8155db71995Sopenharmony_ci
8165db71995Sopenharmony_ci    if (instance == VK_NULL_HANDLE) {
8175db71995Sopenharmony_ci        return;
8185db71995Sopenharmony_ci    }
8195db71995Sopenharmony_ci    loader_platform_thread_lock_mutex(&loader_lock);
8205db71995Sopenharmony_ci
8215db71995Sopenharmony_ci    ptr_instance = loader_get_instance(instance);
8225db71995Sopenharmony_ci    if (ptr_instance == NULL) {
8235db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
8245db71995Sopenharmony_ci                   "vkDestroyInstance: Invalid instance [VUID-vkDestroyInstance-instance-parameter]");
8255db71995Sopenharmony_ci        loader_platform_thread_unlock_mutex(&loader_lock);
8265db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
8275db71995Sopenharmony_ci    }
8285db71995Sopenharmony_ci
8295db71995Sopenharmony_ci    if (pAllocator) {
8305db71995Sopenharmony_ci        ptr_instance->alloc_callbacks = *pAllocator;
8315db71995Sopenharmony_ci    }
8325db71995Sopenharmony_ci
8335db71995Sopenharmony_ci    // Remove any callbacks that weren't cleaned up by the application
8345db71995Sopenharmony_ci    destroy_debug_callbacks_chain(ptr_instance, pAllocator);
8355db71995Sopenharmony_ci
8365db71995Sopenharmony_ci    // Swap in the debug callbacks created during instance creation
8375db71995Sopenharmony_ci    loader_add_instance_only_debug_funcs(ptr_instance);
8385db71995Sopenharmony_ci
8395db71995Sopenharmony_ci    disp = loader_get_instance_layer_dispatch(instance);
8405db71995Sopenharmony_ci    disp->DestroyInstance(ptr_instance->instance, pAllocator);
8415db71995Sopenharmony_ci
8425db71995Sopenharmony_ci    free_loader_settings(ptr_instance, &ptr_instance->settings);
8435db71995Sopenharmony_ci
8445db71995Sopenharmony_ci    loader_destroy_pointer_layer_list(ptr_instance, &ptr_instance->expanded_activated_layer_list);
8455db71995Sopenharmony_ci    loader_destroy_pointer_layer_list(ptr_instance, &ptr_instance->app_activated_layer_list);
8465db71995Sopenharmony_ci
8475db71995Sopenharmony_ci    loader_delete_layer_list_and_properties(ptr_instance, &ptr_instance->instance_layer_list);
8485db71995Sopenharmony_ci
8495db71995Sopenharmony_ci    free_string_list(ptr_instance, &ptr_instance->enabled_layer_names);
8505db71995Sopenharmony_ci
8515db71995Sopenharmony_ci    if (ptr_instance->phys_devs_tramp) {
8525db71995Sopenharmony_ci        for (uint32_t i = 0; i < ptr_instance->phys_dev_count_tramp; i++) {
8535db71995Sopenharmony_ci            loader_instance_heap_free(ptr_instance, ptr_instance->phys_devs_tramp[i]);
8545db71995Sopenharmony_ci        }
8555db71995Sopenharmony_ci        loader_instance_heap_free(ptr_instance, ptr_instance->phys_devs_tramp);
8565db71995Sopenharmony_ci    }
8575db71995Sopenharmony_ci
8585db71995Sopenharmony_ci    // Destroy the debug callbacks created during instance creation
8595db71995Sopenharmony_ci    destroy_debug_callbacks_chain(ptr_instance, pAllocator);
8605db71995Sopenharmony_ci
8615db71995Sopenharmony_ci    loader_instance_heap_free(ptr_instance, ptr_instance->disp);
8625db71995Sopenharmony_ci    loader_instance_heap_free(ptr_instance, ptr_instance);
8635db71995Sopenharmony_ci    loader_platform_thread_unlock_mutex(&loader_lock);
8645db71995Sopenharmony_ci
8655db71995Sopenharmony_ci    // Unload preloaded layers, so if vkEnumerateInstanceExtensionProperties or vkCreateInstance is called again, the ICD's are
8665db71995Sopenharmony_ci    // up to date
8675db71995Sopenharmony_ci    loader_unload_preloaded_icds();
8685db71995Sopenharmony_ci}
8695db71995Sopenharmony_ci
8705db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumeratePhysicalDevices(VkInstance instance, uint32_t *pPhysicalDeviceCount,
8715db71995Sopenharmony_ci                                                                        VkPhysicalDevice *pPhysicalDevices) {
8725db71995Sopenharmony_ci    VkResult res = VK_SUCCESS;
8735db71995Sopenharmony_ci    struct loader_instance *inst;
8745db71995Sopenharmony_ci
8755db71995Sopenharmony_ci    loader_platform_thread_lock_mutex(&loader_lock);
8765db71995Sopenharmony_ci
8775db71995Sopenharmony_ci    inst = loader_get_instance(instance);
8785db71995Sopenharmony_ci    if (NULL == inst) {
8795db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
8805db71995Sopenharmony_ci                   "vkEnumeratePhysicalDevices: Invalid instance [VUID-vkEnumeratePhysicalDevices-instance-parameter]");
8815db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
8825db71995Sopenharmony_ci    }
8835db71995Sopenharmony_ci
8845db71995Sopenharmony_ci    if (NULL == pPhysicalDeviceCount) {
8855db71995Sopenharmony_ci        loader_log(inst, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
8865db71995Sopenharmony_ci                   "vkEnumeratePhysicalDevices: Received NULL pointer for physical device count return value. "
8875db71995Sopenharmony_ci                   "[VUID-vkEnumeratePhysicalDevices-pPhysicalDeviceCount-parameter]");
8885db71995Sopenharmony_ci        res = VK_ERROR_INITIALIZATION_FAILED;
8895db71995Sopenharmony_ci        goto out;
8905db71995Sopenharmony_ci    }
8915db71995Sopenharmony_ci
8925db71995Sopenharmony_ci    // Call down the chain to get the physical device info
8935db71995Sopenharmony_ci    res = inst->disp->layer_inst_disp.EnumeratePhysicalDevices(inst->instance, pPhysicalDeviceCount, pPhysicalDevices);
8945db71995Sopenharmony_ci
8955db71995Sopenharmony_ci    if (NULL != pPhysicalDevices && (VK_SUCCESS == res || VK_INCOMPLETE == res)) {
8965db71995Sopenharmony_ci        // Wrap the PhysDev object for loader usage, return wrapped objects
8975db71995Sopenharmony_ci        VkResult update_res = setup_loader_tramp_phys_devs(inst, *pPhysicalDeviceCount, pPhysicalDevices);
8985db71995Sopenharmony_ci        if (VK_SUCCESS != update_res) {
8995db71995Sopenharmony_ci            res = update_res;
9005db71995Sopenharmony_ci        }
9015db71995Sopenharmony_ci    }
9025db71995Sopenharmony_ci
9035db71995Sopenharmony_ciout:
9045db71995Sopenharmony_ci
9055db71995Sopenharmony_ci    loader_platform_thread_unlock_mutex(&loader_lock);
9065db71995Sopenharmony_ci    return res;
9075db71995Sopenharmony_ci}
9085db71995Sopenharmony_ci
9095db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice,
9105db71995Sopenharmony_ci                                                                     VkPhysicalDeviceFeatures *pFeatures) {
9115db71995Sopenharmony_ci    const VkLayerInstanceDispatchTable *disp;
9125db71995Sopenharmony_ci    VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice);
9135db71995Sopenharmony_ci    if (VK_NULL_HANDLE == unwrapped_phys_dev) {
9145db71995Sopenharmony_ci        loader_log(
9155db71995Sopenharmony_ci            NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
9165db71995Sopenharmony_ci            "vkGetPhysicalDeviceFeatures: Invalid physicalDevice [VUID-vkGetPhysicalDeviceFeatures-physicalDevice-parameter]");
9175db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
9185db71995Sopenharmony_ci    }
9195db71995Sopenharmony_ci    disp = loader_get_instance_layer_dispatch(physicalDevice);
9205db71995Sopenharmony_ci    disp->GetPhysicalDeviceFeatures(unwrapped_phys_dev, pFeatures);
9215db71995Sopenharmony_ci}
9225db71995Sopenharmony_ci
9235db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format,
9245db71995Sopenharmony_ci                                                                             VkFormatProperties *pFormatInfo) {
9255db71995Sopenharmony_ci    const VkLayerInstanceDispatchTable *disp;
9265db71995Sopenharmony_ci    VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice);
9275db71995Sopenharmony_ci    if (VK_NULL_HANDLE == unwrapped_phys_dev) {
9285db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
9295db71995Sopenharmony_ci                   "vkGetPhysicalDeviceFormatProperties: Invalid physicalDevice "
9305db71995Sopenharmony_ci                   "[VUID-vkGetPhysicalDeviceFormatProperties-physicalDevice-parameter]");
9315db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
9325db71995Sopenharmony_ci    }
9335db71995Sopenharmony_ci    disp = loader_get_instance_layer_dispatch(physicalDevice);
9345db71995Sopenharmony_ci    disp->GetPhysicalDeviceFormatProperties(unwrapped_phys_dev, format, pFormatInfo);
9355db71995Sopenharmony_ci}
9365db71995Sopenharmony_ci
9375db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceImageFormatProperties(
9385db71995Sopenharmony_ci    VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage,
9395db71995Sopenharmony_ci    VkImageCreateFlags flags, VkImageFormatProperties *pImageFormatProperties) {
9405db71995Sopenharmony_ci    const VkLayerInstanceDispatchTable *disp;
9415db71995Sopenharmony_ci    VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice);
9425db71995Sopenharmony_ci    if (VK_NULL_HANDLE == unwrapped_phys_dev) {
9435db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
9445db71995Sopenharmony_ci                   "vkGetPhysicalDeviceImageFormatProperties: Invalid physicalDevice "
9455db71995Sopenharmony_ci                   "[VUID-vkGetPhysicalDeviceImageFormatProperties-physicalDevice-parameter]");
9465db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
9475db71995Sopenharmony_ci    }
9485db71995Sopenharmony_ci    disp = loader_get_instance_layer_dispatch(physicalDevice);
9495db71995Sopenharmony_ci    return disp->GetPhysicalDeviceImageFormatProperties(unwrapped_phys_dev, format, type, tiling, usage, flags,
9505db71995Sopenharmony_ci                                                        pImageFormatProperties);
9515db71995Sopenharmony_ci}
9525db71995Sopenharmony_ci
9535db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice,
9545db71995Sopenharmony_ci                                                                       VkPhysicalDeviceProperties *pProperties) {
9555db71995Sopenharmony_ci    const VkLayerInstanceDispatchTable *disp;
9565db71995Sopenharmony_ci    VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice);
9575db71995Sopenharmony_ci    if (VK_NULL_HANDLE == unwrapped_phys_dev) {
9585db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
9595db71995Sopenharmony_ci                   "vkGetPhysicalDeviceProperties: Invalid physicalDevice "
9605db71995Sopenharmony_ci                   "[VUID-vkGetPhysicalDeviceProperties-physicalDevice-parameter]");
9615db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
9625db71995Sopenharmony_ci    }
9635db71995Sopenharmony_ci    disp = loader_get_instance_layer_dispatch(physicalDevice);
9645db71995Sopenharmony_ci    disp->GetPhysicalDeviceProperties(unwrapped_phys_dev, pProperties);
9655db71995Sopenharmony_ci}
9665db71995Sopenharmony_ci
9675db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceQueueFamilyProperties(VkPhysicalDevice physicalDevice,
9685db71995Sopenharmony_ci                                                                                  uint32_t *pQueueFamilyPropertyCount,
9695db71995Sopenharmony_ci                                                                                  VkQueueFamilyProperties *pQueueProperties) {
9705db71995Sopenharmony_ci    const VkLayerInstanceDispatchTable *disp;
9715db71995Sopenharmony_ci    VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice);
9725db71995Sopenharmony_ci    if (VK_NULL_HANDLE == unwrapped_phys_dev) {
9735db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
9745db71995Sopenharmony_ci                   "vkGetPhysicalDeviceQueueFamilyProperties: Invalid physicalDevice "
9755db71995Sopenharmony_ci                   "[VUID-vkGetPhysicalDeviceQueueFamilyProperties-physicalDevice-parameter]");
9765db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
9775db71995Sopenharmony_ci    }
9785db71995Sopenharmony_ci    disp = loader_get_instance_layer_dispatch(physicalDevice);
9795db71995Sopenharmony_ci    disp->GetPhysicalDeviceQueueFamilyProperties(unwrapped_phys_dev, pQueueFamilyPropertyCount, pQueueProperties);
9805db71995Sopenharmony_ci}
9815db71995Sopenharmony_ci
9825db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceMemoryProperties(VkPhysicalDevice physicalDevice,
9835db71995Sopenharmony_ci                                                                             VkPhysicalDeviceMemoryProperties *pMemoryProperties) {
9845db71995Sopenharmony_ci    const VkLayerInstanceDispatchTable *disp;
9855db71995Sopenharmony_ci    VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice);
9865db71995Sopenharmony_ci    if (VK_NULL_HANDLE == unwrapped_phys_dev) {
9875db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
9885db71995Sopenharmony_ci                   "vkGetPhysicalDeviceMemoryProperties: Invalid physicalDevice "
9895db71995Sopenharmony_ci                   "[VUID-vkGetPhysicalDeviceMemoryProperties-physicalDevice-parameter]");
9905db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
9915db71995Sopenharmony_ci    }
9925db71995Sopenharmony_ci    disp = loader_get_instance_layer_dispatch(physicalDevice);
9935db71995Sopenharmony_ci    disp->GetPhysicalDeviceMemoryProperties(unwrapped_phys_dev, pMemoryProperties);
9945db71995Sopenharmony_ci}
9955db71995Sopenharmony_ci
9965db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo,
9975db71995Sopenharmony_ci                                                            const VkAllocationCallbacks *pAllocator, VkDevice *pDevice) {
9985db71995Sopenharmony_ci    if (VK_NULL_HANDLE == loader_unwrap_physical_device(physicalDevice)) {
9995db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
10005db71995Sopenharmony_ci                   "vkCreateDevice: Invalid physicalDevice [VUID-vkCreateDevice-physicalDevice-parameter]");
10015db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
10025db71995Sopenharmony_ci    }
10035db71995Sopenharmony_ci    loader_platform_thread_lock_mutex(&loader_lock);
10045db71995Sopenharmony_ci    VkResult res = loader_layer_create_device(NULL, physicalDevice, pCreateInfo, pAllocator, pDevice, NULL, NULL);
10055db71995Sopenharmony_ci    loader_platform_thread_unlock_mutex(&loader_lock);
10065db71995Sopenharmony_ci    return res;
10075db71995Sopenharmony_ci}
10085db71995Sopenharmony_ci
10095db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyDevice(VkDevice device, const VkAllocationCallbacks *pAllocator) {
10105db71995Sopenharmony_ci    const VkLayerDispatchTable *disp;
10115db71995Sopenharmony_ci
10125db71995Sopenharmony_ci    if (device == VK_NULL_HANDLE) {
10135db71995Sopenharmony_ci        return;
10145db71995Sopenharmony_ci    }
10155db71995Sopenharmony_ci    disp = loader_get_dispatch(device);
10165db71995Sopenharmony_ci    if (NULL == disp) {
10175db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
10185db71995Sopenharmony_ci                   "vkDestroyDevice: Invalid device [VUID-vkDestroyDevice-device-parameter]");
10195db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
10205db71995Sopenharmony_ci    }
10215db71995Sopenharmony_ci
10225db71995Sopenharmony_ci    loader_platform_thread_lock_mutex(&loader_lock);
10235db71995Sopenharmony_ci
10245db71995Sopenharmony_ci    loader_layer_destroy_device(device, pAllocator, disp->DestroyDevice);
10255db71995Sopenharmony_ci
10265db71995Sopenharmony_ci    loader_platform_thread_unlock_mutex(&loader_lock);
10275db71995Sopenharmony_ci}
10285db71995Sopenharmony_ci
10295db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice,
10305db71995Sopenharmony_ci                                                                                  const char *pLayerName, uint32_t *pPropertyCount,
10315db71995Sopenharmony_ci                                                                                  VkExtensionProperties *pProperties) {
10325db71995Sopenharmony_ci    VkResult res = VK_SUCCESS;
10335db71995Sopenharmony_ci    struct loader_physical_device_tramp *phys_dev;
10345db71995Sopenharmony_ci    const VkLayerInstanceDispatchTable *disp;
10355db71995Sopenharmony_ci    phys_dev = (struct loader_physical_device_tramp *)physicalDevice;
10365db71995Sopenharmony_ci    if (VK_NULL_HANDLE == physicalDevice || PHYS_TRAMP_MAGIC_NUMBER != phys_dev->magic) {
10375db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
10385db71995Sopenharmony_ci                   "vkEnumerateDeviceExtensionProperties: Invalid physicalDevice "
10395db71995Sopenharmony_ci                   "[VUID-vkEnumerateDeviceExtensionProperties-physicalDevice-parameter]");
10405db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
10415db71995Sopenharmony_ci    }
10425db71995Sopenharmony_ci
10435db71995Sopenharmony_ci    loader_platform_thread_lock_mutex(&loader_lock);
10445db71995Sopenharmony_ci
10455db71995Sopenharmony_ci    // always pass this call down the instance chain which will terminate
10465db71995Sopenharmony_ci    // in the ICD. This allows layers to filter the extensions coming back
10475db71995Sopenharmony_ci    // up the chain. In the terminator we look up layer extensions from the
10485db71995Sopenharmony_ci    // manifest file if it wasn't provided by the layer itself.
10495db71995Sopenharmony_ci    disp = loader_get_instance_layer_dispatch(physicalDevice);
10505db71995Sopenharmony_ci    res = disp->EnumerateDeviceExtensionProperties(phys_dev->phys_dev, pLayerName, pPropertyCount, pProperties);
10515db71995Sopenharmony_ci
10525db71995Sopenharmony_ci    loader_platform_thread_unlock_mutex(&loader_lock);
10535db71995Sopenharmony_ci    return res;
10545db71995Sopenharmony_ci}
10555db71995Sopenharmony_ci
10565db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice,
10575db71995Sopenharmony_ci                                                                              uint32_t *pPropertyCount,
10585db71995Sopenharmony_ci                                                                              VkLayerProperties *pProperties) {
10595db71995Sopenharmony_ci    uint32_t copy_size;
10605db71995Sopenharmony_ci    struct loader_physical_device_tramp *phys_dev;
10615db71995Sopenharmony_ci    loader_platform_thread_lock_mutex(&loader_lock);
10625db71995Sopenharmony_ci
10635db71995Sopenharmony_ci    // Don't dispatch this call down the instance chain, want all device layers
10645db71995Sopenharmony_ci    // enumerated and instance chain may not contain all device layers
10655db71995Sopenharmony_ci    // TODO re-evaluate the above statement we maybe able to start calling
10665db71995Sopenharmony_ci    // down the chain
10675db71995Sopenharmony_ci
10685db71995Sopenharmony_ci    phys_dev = (struct loader_physical_device_tramp *)physicalDevice;
10695db71995Sopenharmony_ci    if (VK_NULL_HANDLE == physicalDevice || PHYS_TRAMP_MAGIC_NUMBER != phys_dev->magic) {
10705db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
10715db71995Sopenharmony_ci                   "vkEnumerateDeviceLayerProperties: Invalid physicalDevice "
10725db71995Sopenharmony_ci                   "[VUID-vkEnumerateDeviceLayerProperties-physicalDevice-parameter]");
10735db71995Sopenharmony_ci        loader_platform_thread_unlock_mutex(&loader_lock);
10745db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
10755db71995Sopenharmony_ci    }
10765db71995Sopenharmony_ci
10775db71995Sopenharmony_ci    const struct loader_instance *inst = phys_dev->this_instance;
10785db71995Sopenharmony_ci
10795db71995Sopenharmony_ci    uint32_t count = inst->app_activated_layer_list.count;
10805db71995Sopenharmony_ci    if (count == 0 || pProperties == NULL) {
10815db71995Sopenharmony_ci        *pPropertyCount = count;
10825db71995Sopenharmony_ci        loader_platform_thread_unlock_mutex(&loader_lock);
10835db71995Sopenharmony_ci        return VK_SUCCESS;
10845db71995Sopenharmony_ci    }
10855db71995Sopenharmony_ci
10865db71995Sopenharmony_ci    copy_size = (*pPropertyCount < count) ? *pPropertyCount : count;
10875db71995Sopenharmony_ci    for (uint32_t i = 0; i < copy_size; i++) {
10885db71995Sopenharmony_ci        memcpy(&pProperties[i], &(inst->app_activated_layer_list.list[i]->info), sizeof(VkLayerProperties));
10895db71995Sopenharmony_ci    }
10905db71995Sopenharmony_ci    *pPropertyCount = copy_size;
10915db71995Sopenharmony_ci
10925db71995Sopenharmony_ci    if (copy_size < count) {
10935db71995Sopenharmony_ci        loader_platform_thread_unlock_mutex(&loader_lock);
10945db71995Sopenharmony_ci        return VK_INCOMPLETE;
10955db71995Sopenharmony_ci    }
10965db71995Sopenharmony_ci
10975db71995Sopenharmony_ci    loader_platform_thread_unlock_mutex(&loader_lock);
10985db71995Sopenharmony_ci    return VK_SUCCESS;
10995db71995Sopenharmony_ci}
11005db71995Sopenharmony_ci
11015db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetDeviceQueue(VkDevice device, uint32_t queueNodeIndex, uint32_t queueIndex,
11025db71995Sopenharmony_ci                                                          VkQueue *pQueue) {
11035db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
11045db71995Sopenharmony_ci    if (NULL == disp) {
11055db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
11065db71995Sopenharmony_ci                   "vkGetDeviceQueue: Invalid device [VUID-vkGetDeviceQueue-device-parameter]");
11075db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
11085db71995Sopenharmony_ci    }
11095db71995Sopenharmony_ci
11105db71995Sopenharmony_ci    disp->GetDeviceQueue(device, queueNodeIndex, queueIndex, pQueue);
11115db71995Sopenharmony_ci    if (pQueue != NULL && *pQueue != NULL) {
11125db71995Sopenharmony_ci        loader_set_dispatch(*pQueue, disp);
11135db71995Sopenharmony_ci    }
11145db71995Sopenharmony_ci}
11155db71995Sopenharmony_ci
11165db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkQueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo *pSubmits,
11175db71995Sopenharmony_ci                                                           VkFence fence) {
11185db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(queue);
11195db71995Sopenharmony_ci    if (NULL == disp) {
11205db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
11215db71995Sopenharmony_ci                   "vkQueueSubmit: Invalid queue [VUID-vkQueueSubmit-queue-parameter]");
11225db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
11235db71995Sopenharmony_ci    }
11245db71995Sopenharmony_ci
11255db71995Sopenharmony_ci    return disp->QueueSubmit(queue, submitCount, pSubmits, fence);
11265db71995Sopenharmony_ci}
11275db71995Sopenharmony_ci
11285db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkQueueWaitIdle(VkQueue queue) {
11295db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(queue);
11305db71995Sopenharmony_ci    if (NULL == disp) {
11315db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
11325db71995Sopenharmony_ci                   "vkQueueWaitIdle: Invalid queue [VUID-vkQueueWaitIdle-queue-parameter]");
11335db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
11345db71995Sopenharmony_ci    }
11355db71995Sopenharmony_ci
11365db71995Sopenharmony_ci    return disp->QueueWaitIdle(queue);
11375db71995Sopenharmony_ci}
11385db71995Sopenharmony_ci
11395db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkDeviceWaitIdle(VkDevice device) {
11405db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
11415db71995Sopenharmony_ci    if (NULL == disp) {
11425db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
11435db71995Sopenharmony_ci                   "vkDeviceWaitIdle: Invalid device [VUID-vkDeviceWaitIdle-device-parameter]");
11445db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
11455db71995Sopenharmony_ci    }
11465db71995Sopenharmony_ci
11475db71995Sopenharmony_ci    return disp->DeviceWaitIdle(device);
11485db71995Sopenharmony_ci}
11495db71995Sopenharmony_ci
11505db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkAllocateMemory(VkDevice device, const VkMemoryAllocateInfo *pAllocateInfo,
11515db71995Sopenharmony_ci                                                              const VkAllocationCallbacks *pAllocator, VkDeviceMemory *pMemory) {
11525db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
11535db71995Sopenharmony_ci    if (NULL == disp) {
11545db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
11555db71995Sopenharmony_ci                   "vkAllocateMemory: Invalid device [VUID-vkAllocateMemory-device-parameter]");
11565db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
11575db71995Sopenharmony_ci    }
11585db71995Sopenharmony_ci
11595db71995Sopenharmony_ci    return disp->AllocateMemory(device, pAllocateInfo, pAllocator, pMemory);
11605db71995Sopenharmony_ci}
11615db71995Sopenharmony_ci
11625db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkFreeMemory(VkDevice device, VkDeviceMemory mem,
11635db71995Sopenharmony_ci                                                      const VkAllocationCallbacks *pAllocator) {
11645db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
11655db71995Sopenharmony_ci    if (NULL == disp) {
11665db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
11675db71995Sopenharmony_ci                   "vkFreeMemory: Invalid device [VUID-vkFreeMemory-device-parameter]");
11685db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
11695db71995Sopenharmony_ci    }
11705db71995Sopenharmony_ci
11715db71995Sopenharmony_ci    disp->FreeMemory(device, mem, pAllocator);
11725db71995Sopenharmony_ci}
11735db71995Sopenharmony_ci
11745db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkMapMemory(VkDevice device, VkDeviceMemory mem, VkDeviceSize offset,
11755db71995Sopenharmony_ci                                                         VkDeviceSize size, VkFlags flags, void **ppData) {
11765db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
11775db71995Sopenharmony_ci    if (NULL == disp) {
11785db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
11795db71995Sopenharmony_ci                   "vkMapMemory: Invalid device [VUID-vkMapMemory-device-parameter]");
11805db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
11815db71995Sopenharmony_ci    }
11825db71995Sopenharmony_ci
11835db71995Sopenharmony_ci    return disp->MapMemory(device, mem, offset, size, flags, ppData);
11845db71995Sopenharmony_ci}
11855db71995Sopenharmony_ci
11865db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkUnmapMemory(VkDevice device, VkDeviceMemory mem) {
11875db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
11885db71995Sopenharmony_ci    if (NULL == disp) {
11895db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
11905db71995Sopenharmony_ci                   "vkUnmapMemory: Invalid device [VUID-vkUnmapMemory-device-parameter]");
11915db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
11925db71995Sopenharmony_ci    }
11935db71995Sopenharmony_ci
11945db71995Sopenharmony_ci    disp->UnmapMemory(device, mem);
11955db71995Sopenharmony_ci}
11965db71995Sopenharmony_ci
11975db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkFlushMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount,
11985db71995Sopenharmony_ci                                                                       const VkMappedMemoryRange *pMemoryRanges) {
11995db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
12005db71995Sopenharmony_ci    if (NULL == disp) {
12015db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
12025db71995Sopenharmony_ci                   "vkFlushMappedMemoryRanges: Invalid device [VUID-vkFlushMappedMemoryRanges-device-parameter]");
12035db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
12045db71995Sopenharmony_ci    }
12055db71995Sopenharmony_ci
12065db71995Sopenharmony_ci    return disp->FlushMappedMemoryRanges(device, memoryRangeCount, pMemoryRanges);
12075db71995Sopenharmony_ci}
12085db71995Sopenharmony_ci
12095db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkInvalidateMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount,
12105db71995Sopenharmony_ci                                                                            const VkMappedMemoryRange *pMemoryRanges) {
12115db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
12125db71995Sopenharmony_ci    if (NULL == disp) {
12135db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
12145db71995Sopenharmony_ci                   "vkInvalidateMappedMemoryRanges: Invalid device [VUID-vkInvalidateMappedMemoryRanges-device-parameter]");
12155db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
12165db71995Sopenharmony_ci    }
12175db71995Sopenharmony_ci
12185db71995Sopenharmony_ci    return disp->InvalidateMappedMemoryRanges(device, memoryRangeCount, pMemoryRanges);
12195db71995Sopenharmony_ci}
12205db71995Sopenharmony_ci
12215db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetDeviceMemoryCommitment(VkDevice device, VkDeviceMemory memory,
12225db71995Sopenharmony_ci                                                                     VkDeviceSize *pCommittedMemoryInBytes) {
12235db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
12245db71995Sopenharmony_ci    if (NULL == disp) {
12255db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
12265db71995Sopenharmony_ci                   "vkGetDeviceMemoryCommitment: Invalid device [VUID-vkGetDeviceMemoryCommitment-device-parameter]");
12275db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
12285db71995Sopenharmony_ci    }
12295db71995Sopenharmony_ci
12305db71995Sopenharmony_ci    disp->GetDeviceMemoryCommitment(device, memory, pCommittedMemoryInBytes);
12315db71995Sopenharmony_ci}
12325db71995Sopenharmony_ci
12335db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkBindBufferMemory(VkDevice device, VkBuffer buffer, VkDeviceMemory mem,
12345db71995Sopenharmony_ci                                                                VkDeviceSize offset) {
12355db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
12365db71995Sopenharmony_ci    if (NULL == disp) {
12375db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
12385db71995Sopenharmony_ci                   "vkBindBufferMemory: Invalid device [VUID-vkBindBufferMemory-device-parameter]");
12395db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
12405db71995Sopenharmony_ci    }
12415db71995Sopenharmony_ci
12425db71995Sopenharmony_ci    return disp->BindBufferMemory(device, buffer, mem, offset);
12435db71995Sopenharmony_ci}
12445db71995Sopenharmony_ci
12455db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkBindImageMemory(VkDevice device, VkImage image, VkDeviceMemory mem,
12465db71995Sopenharmony_ci                                                               VkDeviceSize offset) {
12475db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
12485db71995Sopenharmony_ci    if (NULL == disp) {
12495db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
12505db71995Sopenharmony_ci                   "vkBindImageMemory: Invalid device [VUID-vkBindImageMemory-device-parameter]");
12515db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
12525db71995Sopenharmony_ci    }
12535db71995Sopenharmony_ci
12545db71995Sopenharmony_ci    return disp->BindImageMemory(device, image, mem, offset);
12555db71995Sopenharmony_ci}
12565db71995Sopenharmony_ci
12575db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetBufferMemoryRequirements(VkDevice device, VkBuffer buffer,
12585db71995Sopenharmony_ci                                                                       VkMemoryRequirements *pMemoryRequirements) {
12595db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
12605db71995Sopenharmony_ci    if (NULL == disp) {
12615db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
12625db71995Sopenharmony_ci                   "vkGetBufferMemoryRequirements: Invalid device [VUID-vkGetBufferMemoryRequirements-device-parameter]");
12635db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
12645db71995Sopenharmony_ci    }
12655db71995Sopenharmony_ci
12665db71995Sopenharmony_ci    disp->GetBufferMemoryRequirements(device, buffer, pMemoryRequirements);
12675db71995Sopenharmony_ci}
12685db71995Sopenharmony_ci
12695db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetImageMemoryRequirements(VkDevice device, VkImage image,
12705db71995Sopenharmony_ci                                                                      VkMemoryRequirements *pMemoryRequirements) {
12715db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
12725db71995Sopenharmony_ci    if (NULL == disp) {
12735db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
12745db71995Sopenharmony_ci                   "vkGetImageMemoryRequirements: Invalid device [VUID-vkGetImageMemoryRequirements-device-parameter]");
12755db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
12765db71995Sopenharmony_ci    }
12775db71995Sopenharmony_ci
12785db71995Sopenharmony_ci    disp->GetImageMemoryRequirements(device, image, pMemoryRequirements);
12795db71995Sopenharmony_ci}
12805db71995Sopenharmony_ci
12815db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
12825db71995Sopenharmony_civkGetImageSparseMemoryRequirements(VkDevice device, VkImage image, uint32_t *pSparseMemoryRequirementCount,
12835db71995Sopenharmony_ci                                   VkSparseImageMemoryRequirements *pSparseMemoryRequirements) {
12845db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
12855db71995Sopenharmony_ci    if (NULL == disp) {
12865db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
12875db71995Sopenharmony_ci                   "vkGetImageSparseMemoryRequirements: Invalid device [VUID-vkGetImageSparseMemoryRequirements-device-parameter]");
12885db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
12895db71995Sopenharmony_ci    }
12905db71995Sopenharmony_ci
12915db71995Sopenharmony_ci    disp->GetImageSparseMemoryRequirements(device, image, pSparseMemoryRequirementCount, pSparseMemoryRequirements);
12925db71995Sopenharmony_ci}
12935db71995Sopenharmony_ci
12945db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceSparseImageFormatProperties(
12955db71995Sopenharmony_ci    VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkSampleCountFlagBits samples, VkImageUsageFlags usage,
12965db71995Sopenharmony_ci    VkImageTiling tiling, uint32_t *pPropertyCount, VkSparseImageFormatProperties *pProperties) {
12975db71995Sopenharmony_ci    const VkLayerInstanceDispatchTable *disp;
12985db71995Sopenharmony_ci    VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice);
12995db71995Sopenharmony_ci    if (VK_NULL_HANDLE == unwrapped_phys_dev) {
13005db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
13015db71995Sopenharmony_ci                   "vkGetPhysicalDeviceSparseImageFormatProperties: Invalid physicalDevice "
13025db71995Sopenharmony_ci                   "[VUID-vkGetPhysicalDeviceSparseImageFormatProperties-physicalDevice-parameter]");
13035db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
13045db71995Sopenharmony_ci    }
13055db71995Sopenharmony_ci
13065db71995Sopenharmony_ci    disp = loader_get_instance_layer_dispatch(physicalDevice);
13075db71995Sopenharmony_ci    disp->GetPhysicalDeviceSparseImageFormatProperties(unwrapped_phys_dev, format, type, samples, usage, tiling, pPropertyCount,
13085db71995Sopenharmony_ci                                                       pProperties);
13095db71995Sopenharmony_ci}
13105db71995Sopenharmony_ci
13115db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkQueueBindSparse(VkQueue queue, uint32_t bindInfoCount,
13125db71995Sopenharmony_ci                                                               const VkBindSparseInfo *pBindInfo, VkFence fence) {
13135db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(queue);
13145db71995Sopenharmony_ci    if (NULL == disp) {
13155db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
13165db71995Sopenharmony_ci                   "vkQueueBindSparse: Invalid queue [VUID-vkQueueBindSparse-queue-parameter]");
13175db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
13185db71995Sopenharmony_ci    }
13195db71995Sopenharmony_ci
13205db71995Sopenharmony_ci    return disp->QueueBindSparse(queue, bindInfoCount, pBindInfo, fence);
13215db71995Sopenharmony_ci}
13225db71995Sopenharmony_ci
13235db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateFence(VkDevice device, const VkFenceCreateInfo *pCreateInfo,
13245db71995Sopenharmony_ci                                                           const VkAllocationCallbacks *pAllocator, VkFence *pFence) {
13255db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
13265db71995Sopenharmony_ci    if (NULL == disp) {
13275db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
13285db71995Sopenharmony_ci                   "vkCreateFence: Invalid device [VUID-vkCreateFence-device-parameter]");
13295db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
13305db71995Sopenharmony_ci    }
13315db71995Sopenharmony_ci
13325db71995Sopenharmony_ci    return disp->CreateFence(device, pCreateInfo, pAllocator, pFence);
13335db71995Sopenharmony_ci}
13345db71995Sopenharmony_ci
13355db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyFence(VkDevice device, VkFence fence, const VkAllocationCallbacks *pAllocator) {
13365db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
13375db71995Sopenharmony_ci    if (NULL == disp) {
13385db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
13395db71995Sopenharmony_ci                   "vkDestroyFence: Invalid device [VUID-vkDestroyFence-device-parameter]");
13405db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
13415db71995Sopenharmony_ci    }
13425db71995Sopenharmony_ci
13435db71995Sopenharmony_ci    disp->DestroyFence(device, fence, pAllocator);
13445db71995Sopenharmony_ci}
13455db71995Sopenharmony_ci
13465db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkResetFences(VkDevice device, uint32_t fenceCount, const VkFence *pFences) {
13475db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
13485db71995Sopenharmony_ci    if (NULL == disp) {
13495db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
13505db71995Sopenharmony_ci                   "vkResetFences: Invalid device [VUID-vkResetFences-device-parameter]");
13515db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
13525db71995Sopenharmony_ci    }
13535db71995Sopenharmony_ci
13545db71995Sopenharmony_ci    return disp->ResetFences(device, fenceCount, pFences);
13555db71995Sopenharmony_ci}
13565db71995Sopenharmony_ci
13575db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetFenceStatus(VkDevice device, VkFence fence) {
13585db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
13595db71995Sopenharmony_ci    if (NULL == disp) {
13605db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
13615db71995Sopenharmony_ci                   "vkGetFenceStatus: Invalid device [VUID-vkGetFenceStatus-device-parameter]");
13625db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
13635db71995Sopenharmony_ci    }
13645db71995Sopenharmony_ci
13655db71995Sopenharmony_ci    return disp->GetFenceStatus(device, fence);
13665db71995Sopenharmony_ci}
13675db71995Sopenharmony_ci
13685db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkWaitForFences(VkDevice device, uint32_t fenceCount, const VkFence *pFences,
13695db71995Sopenharmony_ci                                                             VkBool32 waitAll, uint64_t timeout) {
13705db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
13715db71995Sopenharmony_ci    if (NULL == disp) {
13725db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
13735db71995Sopenharmony_ci                   "vkWaitForFences: Invalid device [VUID-vkWaitForFences-device-parameter]");
13745db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
13755db71995Sopenharmony_ci    }
13765db71995Sopenharmony_ci
13775db71995Sopenharmony_ci    return disp->WaitForFences(device, fenceCount, pFences, waitAll, timeout);
13785db71995Sopenharmony_ci}
13795db71995Sopenharmony_ci
13805db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateSemaphore(VkDevice device, const VkSemaphoreCreateInfo *pCreateInfo,
13815db71995Sopenharmony_ci                                                               const VkAllocationCallbacks *pAllocator, VkSemaphore *pSemaphore) {
13825db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
13835db71995Sopenharmony_ci    if (NULL == disp) {
13845db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
13855db71995Sopenharmony_ci                   "vkCreateSemaphore: Invalid device [VUID-vkCreateSemaphore-device-parameter]");
13865db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
13875db71995Sopenharmony_ci    }
13885db71995Sopenharmony_ci
13895db71995Sopenharmony_ci    return disp->CreateSemaphore(device, pCreateInfo, pAllocator, pSemaphore);
13905db71995Sopenharmony_ci}
13915db71995Sopenharmony_ci
13925db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroySemaphore(VkDevice device, VkSemaphore semaphore,
13935db71995Sopenharmony_ci                                                            const VkAllocationCallbacks *pAllocator) {
13945db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
13955db71995Sopenharmony_ci    if (NULL == disp) {
13965db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
13975db71995Sopenharmony_ci                   "vkDestroySemaphore: Invalid device [VUID-vkDestroySemaphore-device-parameter]");
13985db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
13995db71995Sopenharmony_ci    }
14005db71995Sopenharmony_ci
14015db71995Sopenharmony_ci    disp->DestroySemaphore(device, semaphore, pAllocator);
14025db71995Sopenharmony_ci}
14035db71995Sopenharmony_ci
14045db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateEvent(VkDevice device, const VkEventCreateInfo *pCreateInfo,
14055db71995Sopenharmony_ci                                                           const VkAllocationCallbacks *pAllocator, VkEvent *pEvent) {
14065db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
14075db71995Sopenharmony_ci    if (NULL == disp) {
14085db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
14095db71995Sopenharmony_ci                   "vkCreateEvent: Invalid device [VUID-vkCreateEvent-device-parameter]");
14105db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
14115db71995Sopenharmony_ci    }
14125db71995Sopenharmony_ci
14135db71995Sopenharmony_ci    return disp->CreateEvent(device, pCreateInfo, pAllocator, pEvent);
14145db71995Sopenharmony_ci}
14155db71995Sopenharmony_ci
14165db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyEvent(VkDevice device, VkEvent event, const VkAllocationCallbacks *pAllocator) {
14175db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
14185db71995Sopenharmony_ci    if (NULL == disp) {
14195db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
14205db71995Sopenharmony_ci                   "vkDestroyEvent: Invalid device [VUID-vkDestroyEvent-device-parameter]");
14215db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
14225db71995Sopenharmony_ci    }
14235db71995Sopenharmony_ci
14245db71995Sopenharmony_ci    disp->DestroyEvent(device, event, pAllocator);
14255db71995Sopenharmony_ci}
14265db71995Sopenharmony_ci
14275db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetEventStatus(VkDevice device, VkEvent event) {
14285db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
14295db71995Sopenharmony_ci    if (NULL == disp) {
14305db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
14315db71995Sopenharmony_ci                   "vkGetEventStatus: Invalid device [VUID-vkGetEventStatus-device-parameter]");
14325db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
14335db71995Sopenharmony_ci    }
14345db71995Sopenharmony_ci
14355db71995Sopenharmony_ci    return disp->GetEventStatus(device, event);
14365db71995Sopenharmony_ci}
14375db71995Sopenharmony_ci
14385db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkSetEvent(VkDevice device, VkEvent event) {
14395db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
14405db71995Sopenharmony_ci    if (NULL == disp) {
14415db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
14425db71995Sopenharmony_ci                   "vkSetEvent: Invalid device [VUID-vkSetEvent-device-parameter]");
14435db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
14445db71995Sopenharmony_ci    }
14455db71995Sopenharmony_ci
14465db71995Sopenharmony_ci    return disp->SetEvent(device, event);
14475db71995Sopenharmony_ci}
14485db71995Sopenharmony_ci
14495db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkResetEvent(VkDevice device, VkEvent event) {
14505db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
14515db71995Sopenharmony_ci    if (NULL == disp) {
14525db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
14535db71995Sopenharmony_ci                   "vkResetEvent: Invalid device [VUID-vkResetEvent-device-parameter]");
14545db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
14555db71995Sopenharmony_ci    }
14565db71995Sopenharmony_ci
14575db71995Sopenharmony_ci    return disp->ResetEvent(device, event);
14585db71995Sopenharmony_ci}
14595db71995Sopenharmony_ci
14605db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateQueryPool(VkDevice device, const VkQueryPoolCreateInfo *pCreateInfo,
14615db71995Sopenharmony_ci                                                               const VkAllocationCallbacks *pAllocator, VkQueryPool *pQueryPool) {
14625db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
14635db71995Sopenharmony_ci    if (NULL == disp) {
14645db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
14655db71995Sopenharmony_ci                   "vkCreateQueryPool: Invalid device [VUID-vkCreateQueryPool-device-parameter]");
14665db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
14675db71995Sopenharmony_ci    }
14685db71995Sopenharmony_ci
14695db71995Sopenharmony_ci    return disp->CreateQueryPool(device, pCreateInfo, pAllocator, pQueryPool);
14705db71995Sopenharmony_ci}
14715db71995Sopenharmony_ci
14725db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyQueryPool(VkDevice device, VkQueryPool queryPool,
14735db71995Sopenharmony_ci                                                            const VkAllocationCallbacks *pAllocator) {
14745db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
14755db71995Sopenharmony_ci    if (NULL == disp) {
14765db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
14775db71995Sopenharmony_ci                   "vkDestroyQueryPool: Invalid device [VUID-vkDestroyQueryPool-device-parameter]");
14785db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
14795db71995Sopenharmony_ci    }
14805db71995Sopenharmony_ci
14815db71995Sopenharmony_ci    disp->DestroyQueryPool(device, queryPool, pAllocator);
14825db71995Sopenharmony_ci}
14835db71995Sopenharmony_ci
14845db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetQueryPoolResults(VkDevice device, VkQueryPool queryPool, uint32_t firstQuery,
14855db71995Sopenharmony_ci                                                                   uint32_t queryCount, size_t dataSize, void *pData,
14865db71995Sopenharmony_ci                                                                   VkDeviceSize stride, VkQueryResultFlags flags) {
14875db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
14885db71995Sopenharmony_ci    if (NULL == disp) {
14895db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
14905db71995Sopenharmony_ci                   "vkGetQueryPoolResults: Invalid device [VUID-vkGetQueryPoolResults-device-parameter]");
14915db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
14925db71995Sopenharmony_ci    }
14935db71995Sopenharmony_ci
14945db71995Sopenharmony_ci    return disp->GetQueryPoolResults(device, queryPool, firstQuery, queryCount, dataSize, pData, stride, flags);
14955db71995Sopenharmony_ci}
14965db71995Sopenharmony_ci
14975db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateBuffer(VkDevice device, const VkBufferCreateInfo *pCreateInfo,
14985db71995Sopenharmony_ci                                                            const VkAllocationCallbacks *pAllocator, VkBuffer *pBuffer) {
14995db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
15005db71995Sopenharmony_ci    if (NULL == disp) {
15015db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
15025db71995Sopenharmony_ci                   "vkCreateBuffer: Invalid device [VUID-vkCreateBuffer-device-parameter]");
15035db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
15045db71995Sopenharmony_ci    }
15055db71995Sopenharmony_ci
15065db71995Sopenharmony_ci    return disp->CreateBuffer(device, pCreateInfo, pAllocator, pBuffer);
15075db71995Sopenharmony_ci}
15085db71995Sopenharmony_ci
15095db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyBuffer(VkDevice device, VkBuffer buffer,
15105db71995Sopenharmony_ci                                                         const VkAllocationCallbacks *pAllocator) {
15115db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
15125db71995Sopenharmony_ci    if (NULL == disp) {
15135db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
15145db71995Sopenharmony_ci                   "vkDestroyBuffer: Invalid device [VUID-vkDestroyBuffer-device-parameter]");
15155db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
15165db71995Sopenharmony_ci    }
15175db71995Sopenharmony_ci
15185db71995Sopenharmony_ci    disp->DestroyBuffer(device, buffer, pAllocator);
15195db71995Sopenharmony_ci}
15205db71995Sopenharmony_ci
15215db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateBufferView(VkDevice device, const VkBufferViewCreateInfo *pCreateInfo,
15225db71995Sopenharmony_ci                                                                const VkAllocationCallbacks *pAllocator, VkBufferView *pView) {
15235db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
15245db71995Sopenharmony_ci    if (NULL == disp) {
15255db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
15265db71995Sopenharmony_ci                   "vkCreateBufferView: Invalid device [VUID-vkCreateBufferView-device-parameter]");
15275db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
15285db71995Sopenharmony_ci    }
15295db71995Sopenharmony_ci
15305db71995Sopenharmony_ci    return disp->CreateBufferView(device, pCreateInfo, pAllocator, pView);
15315db71995Sopenharmony_ci}
15325db71995Sopenharmony_ci
15335db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyBufferView(VkDevice device, VkBufferView bufferView,
15345db71995Sopenharmony_ci                                                             const VkAllocationCallbacks *pAllocator) {
15355db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
15365db71995Sopenharmony_ci    if (NULL == disp) {
15375db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
15385db71995Sopenharmony_ci                   "vkDestroyBufferView: Invalid device [VUID-vkDestroyBufferView-device-parameter]");
15395db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
15405db71995Sopenharmony_ci    }
15415db71995Sopenharmony_ci
15425db71995Sopenharmony_ci    disp->DestroyBufferView(device, bufferView, pAllocator);
15435db71995Sopenharmony_ci}
15445db71995Sopenharmony_ci
15455db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateImage(VkDevice device, const VkImageCreateInfo *pCreateInfo,
15465db71995Sopenharmony_ci                                                           const VkAllocationCallbacks *pAllocator, VkImage *pImage) {
15475db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
15485db71995Sopenharmony_ci    if (NULL == disp) {
15495db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
15505db71995Sopenharmony_ci                   "vkCreateImage: Invalid device [VUID-vkCreateImage-device-parameter]");
15515db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
15525db71995Sopenharmony_ci    }
15535db71995Sopenharmony_ci
15545db71995Sopenharmony_ci    return disp->CreateImage(device, pCreateInfo, pAllocator, pImage);
15555db71995Sopenharmony_ci}
15565db71995Sopenharmony_ci
15575db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyImage(VkDevice device, VkImage image, const VkAllocationCallbacks *pAllocator) {
15585db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
15595db71995Sopenharmony_ci    if (NULL == disp) {
15605db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
15615db71995Sopenharmony_ci                   "vkDestroyImage: Invalid device [VUID-vkDestroyImage-device-parameter]");
15625db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
15635db71995Sopenharmony_ci    }
15645db71995Sopenharmony_ci
15655db71995Sopenharmony_ci    disp->DestroyImage(device, image, pAllocator);
15665db71995Sopenharmony_ci}
15675db71995Sopenharmony_ci
15685db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetImageSubresourceLayout(VkDevice device, VkImage image,
15695db71995Sopenharmony_ci                                                                     const VkImageSubresource *pSubresource,
15705db71995Sopenharmony_ci                                                                     VkSubresourceLayout *pLayout) {
15715db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
15725db71995Sopenharmony_ci    if (NULL == disp) {
15735db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
15745db71995Sopenharmony_ci                   "vkGetImageSubresourceLayout: Invalid device [VUID-vkGetImageSubresourceLayout-device-parameter]");
15755db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
15765db71995Sopenharmony_ci    }
15775db71995Sopenharmony_ci
15785db71995Sopenharmony_ci    disp->GetImageSubresourceLayout(device, image, pSubresource, pLayout);
15795db71995Sopenharmony_ci}
15805db71995Sopenharmony_ci
15815db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateImageView(VkDevice device, const VkImageViewCreateInfo *pCreateInfo,
15825db71995Sopenharmony_ci                                                               const VkAllocationCallbacks *pAllocator, VkImageView *pView) {
15835db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
15845db71995Sopenharmony_ci    if (NULL == disp) {
15855db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
15865db71995Sopenharmony_ci                   "vkCreateImageView: Invalid device [VUID-vkCreateImageView-device-parameter]");
15875db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
15885db71995Sopenharmony_ci    }
15895db71995Sopenharmony_ci
15905db71995Sopenharmony_ci    return disp->CreateImageView(device, pCreateInfo, pAllocator, pView);
15915db71995Sopenharmony_ci}
15925db71995Sopenharmony_ci
15935db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyImageView(VkDevice device, VkImageView imageView,
15945db71995Sopenharmony_ci                                                            const VkAllocationCallbacks *pAllocator) {
15955db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
15965db71995Sopenharmony_ci    if (NULL == disp) {
15975db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
15985db71995Sopenharmony_ci                   "vkDestroyImageView: Invalid device [VUID-vkDestroyImageView-device-parameter]");
15995db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
16005db71995Sopenharmony_ci    }
16015db71995Sopenharmony_ci
16025db71995Sopenharmony_ci    disp->DestroyImageView(device, imageView, pAllocator);
16035db71995Sopenharmony_ci}
16045db71995Sopenharmony_ci
16055db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateShaderModule(VkDevice device, const VkShaderModuleCreateInfo *pCreateInfo,
16065db71995Sopenharmony_ci                                                                  const VkAllocationCallbacks *pAllocator,
16075db71995Sopenharmony_ci                                                                  VkShaderModule *pShader) {
16085db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
16095db71995Sopenharmony_ci    if (NULL == disp) {
16105db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
16115db71995Sopenharmony_ci                   "vkCreateShaderModule: Invalid device [VUID-vkCreateShaderModule-device-parameter]");
16125db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
16135db71995Sopenharmony_ci    }
16145db71995Sopenharmony_ci
16155db71995Sopenharmony_ci    return disp->CreateShaderModule(device, pCreateInfo, pAllocator, pShader);
16165db71995Sopenharmony_ci}
16175db71995Sopenharmony_ci
16185db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyShaderModule(VkDevice device, VkShaderModule shaderModule,
16195db71995Sopenharmony_ci                                                               const VkAllocationCallbacks *pAllocator) {
16205db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
16215db71995Sopenharmony_ci    if (NULL == disp) {
16225db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
16235db71995Sopenharmony_ci                   "vkDestroyShaderModule: Invalid device [VUID-vkDestroyShaderModule-device-parameter]");
16245db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
16255db71995Sopenharmony_ci    }
16265db71995Sopenharmony_ci
16275db71995Sopenharmony_ci    disp->DestroyShaderModule(device, shaderModule, pAllocator);
16285db71995Sopenharmony_ci}
16295db71995Sopenharmony_ci
16305db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreatePipelineCache(VkDevice device, const VkPipelineCacheCreateInfo *pCreateInfo,
16315db71995Sopenharmony_ci                                                                   const VkAllocationCallbacks *pAllocator,
16325db71995Sopenharmony_ci                                                                   VkPipelineCache *pPipelineCache) {
16335db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
16345db71995Sopenharmony_ci    if (NULL == disp) {
16355db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
16365db71995Sopenharmony_ci                   "vkCreatePipelineCache: Invalid device [VUID-vkCreatePipelineCache-device-parameter]");
16375db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
16385db71995Sopenharmony_ci    }
16395db71995Sopenharmony_ci
16405db71995Sopenharmony_ci    return disp->CreatePipelineCache(device, pCreateInfo, pAllocator, pPipelineCache);
16415db71995Sopenharmony_ci}
16425db71995Sopenharmony_ci
16435db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyPipelineCache(VkDevice device, VkPipelineCache pipelineCache,
16445db71995Sopenharmony_ci                                                                const VkAllocationCallbacks *pAllocator) {
16455db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
16465db71995Sopenharmony_ci    if (NULL == disp) {
16475db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
16485db71995Sopenharmony_ci                   "vkDestroyPipelineCache: Invalid device [VUID-vkDestroyPipelineCache-device-parameter]");
16495db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
16505db71995Sopenharmony_ci    }
16515db71995Sopenharmony_ci
16525db71995Sopenharmony_ci    disp->DestroyPipelineCache(device, pipelineCache, pAllocator);
16535db71995Sopenharmony_ci}
16545db71995Sopenharmony_ci
16555db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetPipelineCacheData(VkDevice device, VkPipelineCache pipelineCache,
16565db71995Sopenharmony_ci                                                                    size_t *pDataSize, void *pData) {
16575db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
16585db71995Sopenharmony_ci    if (NULL == disp) {
16595db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
16605db71995Sopenharmony_ci                   "vkGetPipelineCacheData: Invalid device [VUID-vkGetPipelineCacheData-device-parameter]");
16615db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
16625db71995Sopenharmony_ci    }
16635db71995Sopenharmony_ci
16645db71995Sopenharmony_ci    return disp->GetPipelineCacheData(device, pipelineCache, pDataSize, pData);
16655db71995Sopenharmony_ci}
16665db71995Sopenharmony_ci
16675db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkMergePipelineCaches(VkDevice device, VkPipelineCache dstCache,
16685db71995Sopenharmony_ci                                                                   uint32_t srcCacheCount, const VkPipelineCache *pSrcCaches) {
16695db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
16705db71995Sopenharmony_ci    if (NULL == disp) {
16715db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
16725db71995Sopenharmony_ci                   "vkMergePipelineCaches: Invalid device [VUID-vkMergePipelineCaches-device-parameter]");
16735db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
16745db71995Sopenharmony_ci    }
16755db71995Sopenharmony_ci
16765db71995Sopenharmony_ci    return disp->MergePipelineCaches(device, dstCache, srcCacheCount, pSrcCaches);
16775db71995Sopenharmony_ci}
16785db71995Sopenharmony_ci
16795db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache,
16805db71995Sopenharmony_ci                                                                       uint32_t createInfoCount,
16815db71995Sopenharmony_ci                                                                       const VkGraphicsPipelineCreateInfo *pCreateInfos,
16825db71995Sopenharmony_ci                                                                       const VkAllocationCallbacks *pAllocator,
16835db71995Sopenharmony_ci                                                                       VkPipeline *pPipelines) {
16845db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
16855db71995Sopenharmony_ci    if (NULL == disp) {
16865db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
16875db71995Sopenharmony_ci                   "vkCreateGraphicsPipelines: Invalid device [VUID-vkCreateGraphicsPipelines-device-parameter]");
16885db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
16895db71995Sopenharmony_ci    }
16905db71995Sopenharmony_ci
16915db71995Sopenharmony_ci    return disp->CreateGraphicsPipelines(device, pipelineCache, createInfoCount, pCreateInfos, pAllocator, pPipelines);
16925db71995Sopenharmony_ci}
16935db71995Sopenharmony_ci
16945db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateComputePipelines(VkDevice device, VkPipelineCache pipelineCache,
16955db71995Sopenharmony_ci                                                                      uint32_t createInfoCount,
16965db71995Sopenharmony_ci                                                                      const VkComputePipelineCreateInfo *pCreateInfos,
16975db71995Sopenharmony_ci                                                                      const VkAllocationCallbacks *pAllocator,
16985db71995Sopenharmony_ci                                                                      VkPipeline *pPipelines) {
16995db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
17005db71995Sopenharmony_ci    if (NULL == disp) {
17015db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
17025db71995Sopenharmony_ci                   "vkCreateComputePipelines: Invalid device [VUID-vkCreateComputePipelines-device-parameter]");
17035db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
17045db71995Sopenharmony_ci    }
17055db71995Sopenharmony_ci
17065db71995Sopenharmony_ci    return disp->CreateComputePipelines(device, pipelineCache, createInfoCount, pCreateInfos, pAllocator, pPipelines);
17075db71995Sopenharmony_ci}
17085db71995Sopenharmony_ci
17095db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyPipeline(VkDevice device, VkPipeline pipeline,
17105db71995Sopenharmony_ci                                                           const VkAllocationCallbacks *pAllocator) {
17115db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
17125db71995Sopenharmony_ci    if (NULL == disp) {
17135db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
17145db71995Sopenharmony_ci                   "vkDestroyPipeline: Invalid device [VUID-vkDestroyPipeline-device-parameter]");
17155db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
17165db71995Sopenharmony_ci    }
17175db71995Sopenharmony_ci
17185db71995Sopenharmony_ci    disp->DestroyPipeline(device, pipeline, pAllocator);
17195db71995Sopenharmony_ci}
17205db71995Sopenharmony_ci
17215db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreatePipelineLayout(VkDevice device, const VkPipelineLayoutCreateInfo *pCreateInfo,
17225db71995Sopenharmony_ci                                                                    const VkAllocationCallbacks *pAllocator,
17235db71995Sopenharmony_ci                                                                    VkPipelineLayout *pPipelineLayout) {
17245db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
17255db71995Sopenharmony_ci    if (NULL == disp) {
17265db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
17275db71995Sopenharmony_ci                   "vkCreatePipelineLayout: Invalid device [VUID-vkCreatePipelineLayout-device-parameter]");
17285db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
17295db71995Sopenharmony_ci    }
17305db71995Sopenharmony_ci
17315db71995Sopenharmony_ci    return disp->CreatePipelineLayout(device, pCreateInfo, pAllocator, pPipelineLayout);
17325db71995Sopenharmony_ci}
17335db71995Sopenharmony_ci
17345db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyPipelineLayout(VkDevice device, VkPipelineLayout pipelineLayout,
17355db71995Sopenharmony_ci                                                                 const VkAllocationCallbacks *pAllocator) {
17365db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
17375db71995Sopenharmony_ci    if (NULL == disp) {
17385db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
17395db71995Sopenharmony_ci                   "vkDestroyPipelineLayout: Invalid device [VUID-vkDestroyPipelineLayout-device-parameter]");
17405db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
17415db71995Sopenharmony_ci    }
17425db71995Sopenharmony_ci
17435db71995Sopenharmony_ci    disp->DestroyPipelineLayout(device, pipelineLayout, pAllocator);
17445db71995Sopenharmony_ci}
17455db71995Sopenharmony_ci
17465db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateSampler(VkDevice device, const VkSamplerCreateInfo *pCreateInfo,
17475db71995Sopenharmony_ci                                                             const VkAllocationCallbacks *pAllocator, VkSampler *pSampler) {
17485db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
17495db71995Sopenharmony_ci    if (NULL == disp) {
17505db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
17515db71995Sopenharmony_ci                   "vkCreateSampler: Invalid device [VUID-vkCreateSampler-device-parameter]");
17525db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
17535db71995Sopenharmony_ci    }
17545db71995Sopenharmony_ci
17555db71995Sopenharmony_ci    return disp->CreateSampler(device, pCreateInfo, pAllocator, pSampler);
17565db71995Sopenharmony_ci}
17575db71995Sopenharmony_ci
17585db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroySampler(VkDevice device, VkSampler sampler,
17595db71995Sopenharmony_ci                                                          const VkAllocationCallbacks *pAllocator) {
17605db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
17615db71995Sopenharmony_ci    if (NULL == disp) {
17625db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
17635db71995Sopenharmony_ci                   "vkDestroySampler: Invalid device [VUID-vkDestroySampler-device-parameter]");
17645db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
17655db71995Sopenharmony_ci    }
17665db71995Sopenharmony_ci
17675db71995Sopenharmony_ci    disp->DestroySampler(device, sampler, pAllocator);
17685db71995Sopenharmony_ci}
17695db71995Sopenharmony_ci
17705db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateDescriptorSetLayout(VkDevice device,
17715db71995Sopenharmony_ci                                                                         const VkDescriptorSetLayoutCreateInfo *pCreateInfo,
17725db71995Sopenharmony_ci                                                                         const VkAllocationCallbacks *pAllocator,
17735db71995Sopenharmony_ci                                                                         VkDescriptorSetLayout *pSetLayout) {
17745db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
17755db71995Sopenharmony_ci    if (NULL == disp) {
17765db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
17775db71995Sopenharmony_ci                   "vkCreateDescriptorSetLayout: Invalid device [VUID-vkCreateDescriptorSetLayout-device-parameter]");
17785db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
17795db71995Sopenharmony_ci    }
17805db71995Sopenharmony_ci
17815db71995Sopenharmony_ci    return disp->CreateDescriptorSetLayout(device, pCreateInfo, pAllocator, pSetLayout);
17825db71995Sopenharmony_ci}
17835db71995Sopenharmony_ci
17845db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyDescriptorSetLayout(VkDevice device, VkDescriptorSetLayout descriptorSetLayout,
17855db71995Sopenharmony_ci                                                                      const VkAllocationCallbacks *pAllocator) {
17865db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
17875db71995Sopenharmony_ci    if (NULL == disp) {
17885db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
17895db71995Sopenharmony_ci                   "vkDestroyDescriptorSetLayout: Invalid device [VUID-vkDestroyDescriptorSetLayout-device-parameter]");
17905db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
17915db71995Sopenharmony_ci    }
17925db71995Sopenharmony_ci
17935db71995Sopenharmony_ci    disp->DestroyDescriptorSetLayout(device, descriptorSetLayout, pAllocator);
17945db71995Sopenharmony_ci}
17955db71995Sopenharmony_ci
17965db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateDescriptorPool(VkDevice device, const VkDescriptorPoolCreateInfo *pCreateInfo,
17975db71995Sopenharmony_ci                                                                    const VkAllocationCallbacks *pAllocator,
17985db71995Sopenharmony_ci                                                                    VkDescriptorPool *pDescriptorPool) {
17995db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
18005db71995Sopenharmony_ci    if (NULL == disp) {
18015db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
18025db71995Sopenharmony_ci                   "vkCreateDescriptorPool: Invalid device [VUID-vkCreateDescriptorPool-device-parameter]");
18035db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
18045db71995Sopenharmony_ci    }
18055db71995Sopenharmony_ci
18065db71995Sopenharmony_ci    return disp->CreateDescriptorPool(device, pCreateInfo, pAllocator, pDescriptorPool);
18075db71995Sopenharmony_ci}
18085db71995Sopenharmony_ci
18095db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool,
18105db71995Sopenharmony_ci                                                                 const VkAllocationCallbacks *pAllocator) {
18115db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
18125db71995Sopenharmony_ci    if (NULL == disp) {
18135db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
18145db71995Sopenharmony_ci                   "vkDestroyDescriptorPool: Invalid device [VUID-vkDestroyDescriptorPool-device-parameter]");
18155db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
18165db71995Sopenharmony_ci    }
18175db71995Sopenharmony_ci
18185db71995Sopenharmony_ci    disp->DestroyDescriptorPool(device, descriptorPool, pAllocator);
18195db71995Sopenharmony_ci}
18205db71995Sopenharmony_ci
18215db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool,
18225db71995Sopenharmony_ci                                                                   VkDescriptorPoolResetFlags flags) {
18235db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
18245db71995Sopenharmony_ci    if (NULL == disp) {
18255db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
18265db71995Sopenharmony_ci                   "vkResetDescriptorPool: Invalid device [VUID-vkResetDescriptorPool-device-parameter]");
18275db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
18285db71995Sopenharmony_ci    }
18295db71995Sopenharmony_ci
18305db71995Sopenharmony_ci    return disp->ResetDescriptorPool(device, descriptorPool, flags);
18315db71995Sopenharmony_ci}
18325db71995Sopenharmony_ci
18335db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkAllocateDescriptorSets(VkDevice device,
18345db71995Sopenharmony_ci                                                                      const VkDescriptorSetAllocateInfo *pAllocateInfo,
18355db71995Sopenharmony_ci                                                                      VkDescriptorSet *pDescriptorSets) {
18365db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
18375db71995Sopenharmony_ci    if (NULL == disp) {
18385db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
18395db71995Sopenharmony_ci                   "vkAllocateDescriptorSets: Invalid device [VUID-vkAllocateDescriptorSets-device-parameter]");
18405db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
18415db71995Sopenharmony_ci    }
18425db71995Sopenharmony_ci
18435db71995Sopenharmony_ci    return disp->AllocateDescriptorSets(device, pAllocateInfo, pDescriptorSets);
18445db71995Sopenharmony_ci}
18455db71995Sopenharmony_ci
18465db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkFreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool,
18475db71995Sopenharmony_ci                                                                  uint32_t descriptorSetCount,
18485db71995Sopenharmony_ci                                                                  const VkDescriptorSet *pDescriptorSets) {
18495db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
18505db71995Sopenharmony_ci    if (NULL == disp) {
18515db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
18525db71995Sopenharmony_ci                   "vkFreeDescriptorSets: Invalid device [VUID-vkFreeDescriptorSets-device-parameter]");
18535db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
18545db71995Sopenharmony_ci    }
18555db71995Sopenharmony_ci
18565db71995Sopenharmony_ci    return disp->FreeDescriptorSets(device, descriptorPool, descriptorSetCount, pDescriptorSets);
18575db71995Sopenharmony_ci}
18585db71995Sopenharmony_ci
18595db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkUpdateDescriptorSets(VkDevice device, uint32_t descriptorWriteCount,
18605db71995Sopenharmony_ci                                                                const VkWriteDescriptorSet *pDescriptorWrites,
18615db71995Sopenharmony_ci                                                                uint32_t descriptorCopyCount,
18625db71995Sopenharmony_ci                                                                const VkCopyDescriptorSet *pDescriptorCopies) {
18635db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
18645db71995Sopenharmony_ci    if (NULL == disp) {
18655db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
18665db71995Sopenharmony_ci                   "vkUpdateDescriptorSets: Invalid device [VUID-vkUpdateDescriptorSets-device-parameter]");
18675db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
18685db71995Sopenharmony_ci    }
18695db71995Sopenharmony_ci
18705db71995Sopenharmony_ci    disp->UpdateDescriptorSets(device, descriptorWriteCount, pDescriptorWrites, descriptorCopyCount, pDescriptorCopies);
18715db71995Sopenharmony_ci}
18725db71995Sopenharmony_ci
18735db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo *pCreateInfo,
18745db71995Sopenharmony_ci                                                                 const VkAllocationCallbacks *pAllocator,
18755db71995Sopenharmony_ci                                                                 VkFramebuffer *pFramebuffer) {
18765db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
18775db71995Sopenharmony_ci    if (NULL == disp) {
18785db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
18795db71995Sopenharmony_ci                   "vkCreateFramebuffer: Invalid device [VUID-vkCreateFramebuffer-device-parameter]");
18805db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
18815db71995Sopenharmony_ci    }
18825db71995Sopenharmony_ci
18835db71995Sopenharmony_ci    return disp->CreateFramebuffer(device, pCreateInfo, pAllocator, pFramebuffer);
18845db71995Sopenharmony_ci}
18855db71995Sopenharmony_ci
18865db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyFramebuffer(VkDevice device, VkFramebuffer framebuffer,
18875db71995Sopenharmony_ci                                                              const VkAllocationCallbacks *pAllocator) {
18885db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
18895db71995Sopenharmony_ci    if (NULL == disp) {
18905db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
18915db71995Sopenharmony_ci                   "vkDestroyFramebuffer: Invalid device [VUID-vkDestroyFramebuffer-device-parameter]");
18925db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
18935db71995Sopenharmony_ci    }
18945db71995Sopenharmony_ci
18955db71995Sopenharmony_ci    disp->DestroyFramebuffer(device, framebuffer, pAllocator);
18965db71995Sopenharmony_ci}
18975db71995Sopenharmony_ci
18985db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo *pCreateInfo,
18995db71995Sopenharmony_ci                                                                const VkAllocationCallbacks *pAllocator,
19005db71995Sopenharmony_ci                                                                VkRenderPass *pRenderPass) {
19015db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
19025db71995Sopenharmony_ci    if (NULL == disp) {
19035db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
19045db71995Sopenharmony_ci                   "vkCreateRenderPass: Invalid device [VUID-vkCreateRenderPass-device-parameter]");
19055db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
19065db71995Sopenharmony_ci    }
19075db71995Sopenharmony_ci
19085db71995Sopenharmony_ci    return disp->CreateRenderPass(device, pCreateInfo, pAllocator, pRenderPass);
19095db71995Sopenharmony_ci}
19105db71995Sopenharmony_ci
19115db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyRenderPass(VkDevice device, VkRenderPass renderPass,
19125db71995Sopenharmony_ci                                                             const VkAllocationCallbacks *pAllocator) {
19135db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
19145db71995Sopenharmony_ci    if (NULL == disp) {
19155db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
19165db71995Sopenharmony_ci                   "vkDestroyRenderPass: Invalid device [VUID-vkDestroyRenderPass-device-parameter]");
19175db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
19185db71995Sopenharmony_ci    }
19195db71995Sopenharmony_ci
19205db71995Sopenharmony_ci    disp->DestroyRenderPass(device, renderPass, pAllocator);
19215db71995Sopenharmony_ci}
19225db71995Sopenharmony_ci
19235db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetRenderAreaGranularity(VkDevice device, VkRenderPass renderPass,
19245db71995Sopenharmony_ci                                                                    VkExtent2D *pGranularity) {
19255db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
19265db71995Sopenharmony_ci    if (NULL == disp) {
19275db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
19285db71995Sopenharmony_ci                   "vkGetRenderAreaGranularity: Invalid device [VUID-vkGetRenderAreaGranularity-device-parameter]");
19295db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
19305db71995Sopenharmony_ci    }
19315db71995Sopenharmony_ci
19325db71995Sopenharmony_ci    disp->GetRenderAreaGranularity(device, renderPass, pGranularity);
19335db71995Sopenharmony_ci}
19345db71995Sopenharmony_ci
19355db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateCommandPool(VkDevice device, const VkCommandPoolCreateInfo *pCreateInfo,
19365db71995Sopenharmony_ci                                                                 const VkAllocationCallbacks *pAllocator,
19375db71995Sopenharmony_ci                                                                 VkCommandPool *pCommandPool) {
19385db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
19395db71995Sopenharmony_ci    if (NULL == disp) {
19405db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
19415db71995Sopenharmony_ci                   "vkCreateCommandPool: Invalid device [VUID-vkCreateCommandPool-device-parameter]");
19425db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
19435db71995Sopenharmony_ci    }
19445db71995Sopenharmony_ci
19455db71995Sopenharmony_ci    return disp->CreateCommandPool(device, pCreateInfo, pAllocator, pCommandPool);
19465db71995Sopenharmony_ci}
19475db71995Sopenharmony_ci
19485db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyCommandPool(VkDevice device, VkCommandPool commandPool,
19495db71995Sopenharmony_ci                                                              const VkAllocationCallbacks *pAllocator) {
19505db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
19515db71995Sopenharmony_ci    if (NULL == disp) {
19525db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
19535db71995Sopenharmony_ci                   "vkDestroyCommandPool: Invalid device [VUID-vkDestroyCommandPool-device-parameter]");
19545db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
19555db71995Sopenharmony_ci    }
19565db71995Sopenharmony_ci
19575db71995Sopenharmony_ci    disp->DestroyCommandPool(device, commandPool, pAllocator);
19585db71995Sopenharmony_ci}
19595db71995Sopenharmony_ci
19605db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkResetCommandPool(VkDevice device, VkCommandPool commandPool,
19615db71995Sopenharmony_ci                                                                VkCommandPoolResetFlags flags) {
19625db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
19635db71995Sopenharmony_ci    if (NULL == disp) {
19645db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
19655db71995Sopenharmony_ci                   "vkResetCommandPool: Invalid device [VUID-vkResetCommandPool-device-parameter]");
19665db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
19675db71995Sopenharmony_ci    }
19685db71995Sopenharmony_ci
19695db71995Sopenharmony_ci    return disp->ResetCommandPool(device, commandPool, flags);
19705db71995Sopenharmony_ci}
19715db71995Sopenharmony_ci
19725db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkAllocateCommandBuffers(VkDevice device,
19735db71995Sopenharmony_ci                                                                      const VkCommandBufferAllocateInfo *pAllocateInfo,
19745db71995Sopenharmony_ci                                                                      VkCommandBuffer *pCommandBuffers) {
19755db71995Sopenharmony_ci    VkResult res;
19765db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
19775db71995Sopenharmony_ci    if (NULL == disp) {
19785db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
19795db71995Sopenharmony_ci                   "vkAllocateCommandBuffers: Invalid device [VUID-vkAllocateCommandBuffers-device-parameter]");
19805db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
19815db71995Sopenharmony_ci    }
19825db71995Sopenharmony_ci
19835db71995Sopenharmony_ci    res = disp->AllocateCommandBuffers(device, pAllocateInfo, pCommandBuffers);
19845db71995Sopenharmony_ci    if (res == VK_SUCCESS) {
19855db71995Sopenharmony_ci        for (uint32_t i = 0; i < pAllocateInfo->commandBufferCount; i++) {
19865db71995Sopenharmony_ci            if (pCommandBuffers[i]) {
19875db71995Sopenharmony_ci                loader_set_dispatch(pCommandBuffers[i], disp);
19885db71995Sopenharmony_ci            }
19895db71995Sopenharmony_ci        }
19905db71995Sopenharmony_ci    }
19915db71995Sopenharmony_ci
19925db71995Sopenharmony_ci    return res;
19935db71995Sopenharmony_ci}
19945db71995Sopenharmony_ci
19955db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkFreeCommandBuffers(VkDevice device, VkCommandPool commandPool,
19965db71995Sopenharmony_ci                                                              uint32_t commandBufferCount, const VkCommandBuffer *pCommandBuffers) {
19975db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
19985db71995Sopenharmony_ci    if (NULL == disp) {
19995db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
20005db71995Sopenharmony_ci                   "vkFreeCommandBuffers: Invalid device [VUID-vkFreeCommandBuffers-device-parameter]");
20015db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
20025db71995Sopenharmony_ci    }
20035db71995Sopenharmony_ci
20045db71995Sopenharmony_ci    disp->FreeCommandBuffers(device, commandPool, commandBufferCount, pCommandBuffers);
20055db71995Sopenharmony_ci}
20065db71995Sopenharmony_ci
20075db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkBeginCommandBuffer(VkCommandBuffer commandBuffer,
20085db71995Sopenharmony_ci                                                                  const VkCommandBufferBeginInfo *pBeginInfo) {
20095db71995Sopenharmony_ci    const VkLayerDispatchTable *disp;
20105db71995Sopenharmony_ci
20115db71995Sopenharmony_ci    disp = loader_get_dispatch(commandBuffer);
20125db71995Sopenharmony_ci    if (NULL == disp) {
20135db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
20145db71995Sopenharmony_ci                   "vkBeginCommandBuffer: Invalid commandBuffer [VUID-vkBeginCommandBuffer-commandBuffer-parameter]");
20155db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
20165db71995Sopenharmony_ci    }
20175db71995Sopenharmony_ci
20185db71995Sopenharmony_ci    return disp->BeginCommandBuffer(commandBuffer, pBeginInfo);
20195db71995Sopenharmony_ci}
20205db71995Sopenharmony_ci
20215db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEndCommandBuffer(VkCommandBuffer commandBuffer) {
20225db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
20235db71995Sopenharmony_ci    if (NULL == disp) {
20245db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
20255db71995Sopenharmony_ci                   "vkEndCommandBuffer: Invalid commandBuffer [VUID-vkEndCommandBuffer-commandBuffer-parameter]");
20265db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
20275db71995Sopenharmony_ci    }
20285db71995Sopenharmony_ci
20295db71995Sopenharmony_ci    return disp->EndCommandBuffer(commandBuffer);
20305db71995Sopenharmony_ci}
20315db71995Sopenharmony_ci
20325db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkResetCommandBuffer(VkCommandBuffer commandBuffer, VkCommandBufferResetFlags flags) {
20335db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
20345db71995Sopenharmony_ci    if (NULL == disp) {
20355db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
20365db71995Sopenharmony_ci                   "vkResetCommandBuffer: Invalid commandBuffer [VUID-vkResetCommandBuffer-commandBuffer-parameter]");
20375db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
20385db71995Sopenharmony_ci    }
20395db71995Sopenharmony_ci
20405db71995Sopenharmony_ci    return disp->ResetCommandBuffer(commandBuffer, flags);
20415db71995Sopenharmony_ci}
20425db71995Sopenharmony_ci
20435db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdBindPipeline(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint,
20445db71995Sopenharmony_ci                                                           VkPipeline pipeline) {
20455db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
20465db71995Sopenharmony_ci    if (NULL == disp) {
20475db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
20485db71995Sopenharmony_ci                   "vkCmdBindPipeline: Invalid commandBuffer [VUID-vkCmdBindPipeline-commandBuffer-parameter]");
20495db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
20505db71995Sopenharmony_ci    }
20515db71995Sopenharmony_ci
20525db71995Sopenharmony_ci    disp->CmdBindPipeline(commandBuffer, pipelineBindPoint, pipeline);
20535db71995Sopenharmony_ci}
20545db71995Sopenharmony_ci
20555db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdSetViewport(VkCommandBuffer commandBuffer, uint32_t firstViewport,
20565db71995Sopenharmony_ci                                                          uint32_t viewportCount, const VkViewport *pViewports) {
20575db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
20585db71995Sopenharmony_ci    if (NULL == disp) {
20595db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
20605db71995Sopenharmony_ci                   "vkCmdSetViewport: Invalid commandBuffer [VUID-vkCmdSetViewport-commandBuffer-parameter]");
20615db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
20625db71995Sopenharmony_ci    }
20635db71995Sopenharmony_ci
20645db71995Sopenharmony_ci    disp->CmdSetViewport(commandBuffer, firstViewport, viewportCount, pViewports);
20655db71995Sopenharmony_ci}
20665db71995Sopenharmony_ci
20675db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdSetScissor(VkCommandBuffer commandBuffer, uint32_t firstScissor,
20685db71995Sopenharmony_ci                                                         uint32_t scissorCount, const VkRect2D *pScissors) {
20695db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
20705db71995Sopenharmony_ci    if (NULL == disp) {
20715db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
20725db71995Sopenharmony_ci                   "vkCmdSetScissor: Invalid commandBuffer [VUID-vkCmdSetScissor-commandBuffer-parameter]");
20735db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
20745db71995Sopenharmony_ci    }
20755db71995Sopenharmony_ci
20765db71995Sopenharmony_ci    disp->CmdSetScissor(commandBuffer, firstScissor, scissorCount, pScissors);
20775db71995Sopenharmony_ci}
20785db71995Sopenharmony_ci
20795db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdSetLineWidth(VkCommandBuffer commandBuffer, float lineWidth) {
20805db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
20815db71995Sopenharmony_ci    if (NULL == disp) {
20825db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
20835db71995Sopenharmony_ci                   "vkCmdSetLineWidth: Invalid commandBuffer [VUID-vkCmdSetLineWidth-commandBuffer-parameter]");
20845db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
20855db71995Sopenharmony_ci    }
20865db71995Sopenharmony_ci
20875db71995Sopenharmony_ci    disp->CmdSetLineWidth(commandBuffer, lineWidth);
20885db71995Sopenharmony_ci}
20895db71995Sopenharmony_ci
20905db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdSetDepthBias(VkCommandBuffer commandBuffer, float depthBiasConstantFactor,
20915db71995Sopenharmony_ci                                                           float depthBiasClamp, float depthBiasSlopeFactor) {
20925db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
20935db71995Sopenharmony_ci    if (NULL == disp) {
20945db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
20955db71995Sopenharmony_ci                   "vkCmdSetDepthBias: Invalid commandBuffer [VUID-vkCmdSetDepthBias-commandBuffer-parameter]");
20965db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
20975db71995Sopenharmony_ci    }
20985db71995Sopenharmony_ci
20995db71995Sopenharmony_ci    disp->CmdSetDepthBias(commandBuffer, depthBiasConstantFactor, depthBiasClamp, depthBiasSlopeFactor);
21005db71995Sopenharmony_ci}
21015db71995Sopenharmony_ci
21025db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdSetBlendConstants(VkCommandBuffer commandBuffer, const float blendConstants[4]) {
21035db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
21045db71995Sopenharmony_ci    if (NULL == disp) {
21055db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
21065db71995Sopenharmony_ci                   "vkCmdSetBlendConstants: Invalid commandBuffer [VUID-vkCmdSetBlendConstants-commandBuffer-parameter]");
21075db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
21085db71995Sopenharmony_ci    }
21095db71995Sopenharmony_ci
21105db71995Sopenharmony_ci    disp->CmdSetBlendConstants(commandBuffer, blendConstants);
21115db71995Sopenharmony_ci}
21125db71995Sopenharmony_ci
21135db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdSetDepthBounds(VkCommandBuffer commandBuffer, float minDepthBounds,
21145db71995Sopenharmony_ci                                                             float maxDepthBounds) {
21155db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
21165db71995Sopenharmony_ci    if (NULL == disp) {
21175db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
21185db71995Sopenharmony_ci                   "vkCmdSetDepthBounds: Invalid commandBuffer [VUID-vkCmdSetDepthBounds-commandBuffer-parameter]");
21195db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
21205db71995Sopenharmony_ci    }
21215db71995Sopenharmony_ci
21225db71995Sopenharmony_ci    disp->CmdSetDepthBounds(commandBuffer, minDepthBounds, maxDepthBounds);
21235db71995Sopenharmony_ci}
21245db71995Sopenharmony_ci
21255db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdSetStencilCompareMask(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask,
21265db71995Sopenharmony_ci                                                                    uint32_t compareMask) {
21275db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
21285db71995Sopenharmony_ci    if (NULL == disp) {
21295db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
21305db71995Sopenharmony_ci                   "vkCmdSetStencilCompareMask: Invalid commandBuffer [VUID-vkCmdSetStencilCompareMask-commandBuffer-parameter]");
21315db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
21325db71995Sopenharmony_ci    }
21335db71995Sopenharmony_ci
21345db71995Sopenharmony_ci    disp->CmdSetStencilCompareMask(commandBuffer, faceMask, compareMask);
21355db71995Sopenharmony_ci}
21365db71995Sopenharmony_ci
21375db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdSetStencilWriteMask(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask,
21385db71995Sopenharmony_ci                                                                  uint32_t writeMask) {
21395db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
21405db71995Sopenharmony_ci    if (NULL == disp) {
21415db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
21425db71995Sopenharmony_ci                   "vkCmdSetStencilWriteMask: Invalid commandBuffer [VUID-vkCmdSetStencilWriteMask-commandBuffer-parameter]");
21435db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
21445db71995Sopenharmony_ci    }
21455db71995Sopenharmony_ci
21465db71995Sopenharmony_ci    disp->CmdSetStencilWriteMask(commandBuffer, faceMask, writeMask);
21475db71995Sopenharmony_ci}
21485db71995Sopenharmony_ci
21495db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdSetStencilReference(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask,
21505db71995Sopenharmony_ci                                                                  uint32_t reference) {
21515db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
21525db71995Sopenharmony_ci    if (NULL == disp) {
21535db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
21545db71995Sopenharmony_ci                   "vkCmdSetStencilReference: Invalid commandBuffer [VUID-vkCmdSetStencilReference-commandBuffer-parameter]");
21555db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
21565db71995Sopenharmony_ci    }
21575db71995Sopenharmony_ci
21585db71995Sopenharmony_ci    disp->CmdSetStencilReference(commandBuffer, faceMask, reference);
21595db71995Sopenharmony_ci}
21605db71995Sopenharmony_ci
21615db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdBindDescriptorSets(VkCommandBuffer commandBuffer,
21625db71995Sopenharmony_ci                                                                 VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout,
21635db71995Sopenharmony_ci                                                                 uint32_t firstSet, uint32_t descriptorSetCount,
21645db71995Sopenharmony_ci                                                                 const VkDescriptorSet *pDescriptorSets,
21655db71995Sopenharmony_ci                                                                 uint32_t dynamicOffsetCount, const uint32_t *pDynamicOffsets) {
21665db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
21675db71995Sopenharmony_ci    if (NULL == disp) {
21685db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
21695db71995Sopenharmony_ci                   "vkCmdBindDescriptorSets: Invalid commandBuffer [VUID-vkCmdBindDescriptorSets-commandBuffer-parameter]");
21705db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
21715db71995Sopenharmony_ci    }
21725db71995Sopenharmony_ci
21735db71995Sopenharmony_ci    disp->CmdBindDescriptorSets(commandBuffer, pipelineBindPoint, layout, firstSet, descriptorSetCount, pDescriptorSets,
21745db71995Sopenharmony_ci                                dynamicOffsetCount, pDynamicOffsets);
21755db71995Sopenharmony_ci}
21765db71995Sopenharmony_ci
21775db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdBindIndexBuffer(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
21785db71995Sopenharmony_ci                                                              VkIndexType indexType) {
21795db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
21805db71995Sopenharmony_ci    if (NULL == disp) {
21815db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
21825db71995Sopenharmony_ci                   "vkCmdBindIndexBuffer: Invalid commandBuffer [VUID-vkCmdBindIndexBuffer-commandBuffer-parameter]");
21835db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
21845db71995Sopenharmony_ci    }
21855db71995Sopenharmony_ci
21865db71995Sopenharmony_ci    disp->CmdBindIndexBuffer(commandBuffer, buffer, offset, indexType);
21875db71995Sopenharmony_ci}
21885db71995Sopenharmony_ci
21895db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdBindVertexBuffers(VkCommandBuffer commandBuffer, uint32_t firstBinding,
21905db71995Sopenharmony_ci                                                                uint32_t bindingCount, const VkBuffer *pBuffers,
21915db71995Sopenharmony_ci                                                                const VkDeviceSize *pOffsets) {
21925db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
21935db71995Sopenharmony_ci    if (NULL == disp) {
21945db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
21955db71995Sopenharmony_ci                   "vkCmdBindVertexBuffers: Invalid commandBuffer [VUID-vkCmdBindVertexBuffers-commandBuffer-parameter]");
21965db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
21975db71995Sopenharmony_ci    }
21985db71995Sopenharmony_ci
21995db71995Sopenharmony_ci    disp->CmdBindVertexBuffers(commandBuffer, firstBinding, bindingCount, pBuffers, pOffsets);
22005db71995Sopenharmony_ci}
22015db71995Sopenharmony_ci
22025db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdDraw(VkCommandBuffer commandBuffer, uint32_t vertexCount, uint32_t instanceCount,
22035db71995Sopenharmony_ci                                                   uint32_t firstVertex, uint32_t firstInstance) {
22045db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
22055db71995Sopenharmony_ci    if (NULL == disp) {
22065db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
22075db71995Sopenharmony_ci                   "vkCmdDraw: Invalid commandBuffer [VUID-vkCmdDraw-commandBuffer-parameter]");
22085db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
22095db71995Sopenharmony_ci    }
22105db71995Sopenharmony_ci
22115db71995Sopenharmony_ci    disp->CmdDraw(commandBuffer, vertexCount, instanceCount, firstVertex, firstInstance);
22125db71995Sopenharmony_ci}
22135db71995Sopenharmony_ci
22145db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndexed(VkCommandBuffer commandBuffer, uint32_t indexCount,
22155db71995Sopenharmony_ci                                                          uint32_t instanceCount, uint32_t firstIndex, int32_t vertexOffset,
22165db71995Sopenharmony_ci                                                          uint32_t firstInstance) {
22175db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
22185db71995Sopenharmony_ci    if (NULL == disp) {
22195db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
22205db71995Sopenharmony_ci                   "vkCmdDrawIndexed: Invalid commandBuffer [VUID-vkCmdDrawIndexed-commandBuffer-parameter]");
22215db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
22225db71995Sopenharmony_ci    }
22235db71995Sopenharmony_ci
22245db71995Sopenharmony_ci    disp->CmdDrawIndexed(commandBuffer, indexCount, instanceCount, firstIndex, vertexOffset, firstInstance);
22255db71995Sopenharmony_ci}
22265db71995Sopenharmony_ci
22275db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
22285db71995Sopenharmony_ci                                                           uint32_t drawCount, uint32_t stride) {
22295db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
22305db71995Sopenharmony_ci    if (NULL == disp) {
22315db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
22325db71995Sopenharmony_ci                   "vkCmdDrawIndirect: Invalid commandBuffer [VUID-vkCmdDrawIndirect-commandBuffer-parameter]");
22335db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
22345db71995Sopenharmony_ci    }
22355db71995Sopenharmony_ci
22365db71995Sopenharmony_ci    disp->CmdDrawIndirect(commandBuffer, buffer, offset, drawCount, stride);
22375db71995Sopenharmony_ci}
22385db71995Sopenharmony_ci
22395db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndexedIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer,
22405db71995Sopenharmony_ci                                                                  VkDeviceSize offset, uint32_t drawCount, uint32_t stride) {
22415db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
22425db71995Sopenharmony_ci    if (NULL == disp) {
22435db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
22445db71995Sopenharmony_ci                   "vkCmdDrawIndexedIndirect: Invalid commandBuffer [VUID-vkCmdDrawIndexedIndirect-commandBuffer-parameter]");
22455db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
22465db71995Sopenharmony_ci    }
22475db71995Sopenharmony_ci
22485db71995Sopenharmony_ci    disp->CmdDrawIndexedIndirect(commandBuffer, buffer, offset, drawCount, stride);
22495db71995Sopenharmony_ci}
22505db71995Sopenharmony_ci
22515db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdDispatch(VkCommandBuffer commandBuffer, uint32_t x, uint32_t y, uint32_t z) {
22525db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
22535db71995Sopenharmony_ci    if (NULL == disp) {
22545db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
22555db71995Sopenharmony_ci                   "vkCmdDispatch: Invalid commandBuffer [VUID-vkCmdDispatch-commandBuffer-parameter]");
22565db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
22575db71995Sopenharmony_ci    }
22585db71995Sopenharmony_ci
22595db71995Sopenharmony_ci    disp->CmdDispatch(commandBuffer, x, y, z);
22605db71995Sopenharmony_ci}
22615db71995Sopenharmony_ci
22625db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdDispatchIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer,
22635db71995Sopenharmony_ci                                                               VkDeviceSize offset) {
22645db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
22655db71995Sopenharmony_ci    if (NULL == disp) {
22665db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
22675db71995Sopenharmony_ci                   "vkCmdDispatchIndirect: Invalid commandBuffer [VUID-vkCmdDispatchIndirect-commandBuffer-parameter]");
22685db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
22695db71995Sopenharmony_ci    }
22705db71995Sopenharmony_ci
22715db71995Sopenharmony_ci    disp->CmdDispatchIndirect(commandBuffer, buffer, offset);
22725db71995Sopenharmony_ci}
22735db71995Sopenharmony_ci
22745db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdCopyBuffer(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkBuffer dstBuffer,
22755db71995Sopenharmony_ci                                                         uint32_t regionCount, const VkBufferCopy *pRegions) {
22765db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
22775db71995Sopenharmony_ci    if (NULL == disp) {
22785db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
22795db71995Sopenharmony_ci                   "vkCmdCopyBuffer: Invalid commandBuffer [VUID-vkCmdCopyBuffer-commandBuffer-parameter]");
22805db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
22815db71995Sopenharmony_ci    }
22825db71995Sopenharmony_ci
22835db71995Sopenharmony_ci    disp->CmdCopyBuffer(commandBuffer, srcBuffer, dstBuffer, regionCount, pRegions);
22845db71995Sopenharmony_ci}
22855db71995Sopenharmony_ci
22865db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdCopyImage(VkCommandBuffer commandBuffer, VkImage srcImage,
22875db71995Sopenharmony_ci                                                        VkImageLayout srcImageLayout, VkImage dstImage,
22885db71995Sopenharmony_ci                                                        VkImageLayout dstImageLayout, uint32_t regionCount,
22895db71995Sopenharmony_ci                                                        const VkImageCopy *pRegions) {
22905db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
22915db71995Sopenharmony_ci    if (NULL == disp) {
22925db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
22935db71995Sopenharmony_ci                   "vkCmdCopyImage: Invalid commandBuffer [VUID-vkCmdCopyImage-commandBuffer-parameter]");
22945db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
22955db71995Sopenharmony_ci    }
22965db71995Sopenharmony_ci
22975db71995Sopenharmony_ci    disp->CmdCopyImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions);
22985db71995Sopenharmony_ci}
22995db71995Sopenharmony_ci
23005db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdBlitImage(VkCommandBuffer commandBuffer, VkImage srcImage,
23015db71995Sopenharmony_ci                                                        VkImageLayout srcImageLayout, VkImage dstImage,
23025db71995Sopenharmony_ci                                                        VkImageLayout dstImageLayout, uint32_t regionCount,
23035db71995Sopenharmony_ci                                                        const VkImageBlit *pRegions, VkFilter filter) {
23045db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
23055db71995Sopenharmony_ci    if (NULL == disp) {
23065db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
23075db71995Sopenharmony_ci                   "vkCmdBlitImage: Invalid commandBuffer [VUID-vkCmdBlitImage-commandBuffer-parameter]");
23085db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
23095db71995Sopenharmony_ci    }
23105db71995Sopenharmony_ci
23115db71995Sopenharmony_ci    disp->CmdBlitImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions, filter);
23125db71995Sopenharmony_ci}
23135db71995Sopenharmony_ci
23145db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdCopyBufferToImage(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkImage dstImage,
23155db71995Sopenharmony_ci                                                                VkImageLayout dstImageLayout, uint32_t regionCount,
23165db71995Sopenharmony_ci                                                                const VkBufferImageCopy *pRegions) {
23175db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
23185db71995Sopenharmony_ci    if (NULL == disp) {
23195db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
23205db71995Sopenharmony_ci                   "vkCmdCopyBufferToImage: Invalid commandBuffer [VUID-vkCmdCopyBufferToImage-commandBuffer-parameter]");
23215db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
23225db71995Sopenharmony_ci    }
23235db71995Sopenharmony_ci
23245db71995Sopenharmony_ci    disp->CmdCopyBufferToImage(commandBuffer, srcBuffer, dstImage, dstImageLayout, regionCount, pRegions);
23255db71995Sopenharmony_ci}
23265db71995Sopenharmony_ci
23275db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdCopyImageToBuffer(VkCommandBuffer commandBuffer, VkImage srcImage,
23285db71995Sopenharmony_ci                                                                VkImageLayout srcImageLayout, VkBuffer dstBuffer,
23295db71995Sopenharmony_ci                                                                uint32_t regionCount, const VkBufferImageCopy *pRegions) {
23305db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
23315db71995Sopenharmony_ci    if (NULL == disp) {
23325db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
23335db71995Sopenharmony_ci                   "vkCmdCopyImageToBuffer: Invalid commandBuffer [VUID-vkCmdCopyImageToBuffer-commandBuffer-parameter]");
23345db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
23355db71995Sopenharmony_ci    }
23365db71995Sopenharmony_ci
23375db71995Sopenharmony_ci    disp->CmdCopyImageToBuffer(commandBuffer, srcImage, srcImageLayout, dstBuffer, regionCount, pRegions);
23385db71995Sopenharmony_ci}
23395db71995Sopenharmony_ci
23405db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdUpdateBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer,
23415db71995Sopenharmony_ci                                                           VkDeviceSize dstOffset, VkDeviceSize dataSize, const void *pData) {
23425db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
23435db71995Sopenharmony_ci    if (NULL == disp) {
23445db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
23455db71995Sopenharmony_ci                   "vkCmdUpdateBuffer: Invalid commandBuffer [VUID-vkCmdUpdateBuffer-commandBuffer-parameter]");
23465db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
23475db71995Sopenharmony_ci    }
23485db71995Sopenharmony_ci
23495db71995Sopenharmony_ci    disp->CmdUpdateBuffer(commandBuffer, dstBuffer, dstOffset, dataSize, pData);
23505db71995Sopenharmony_ci}
23515db71995Sopenharmony_ci
23525db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdFillBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset,
23535db71995Sopenharmony_ci                                                         VkDeviceSize size, uint32_t data) {
23545db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
23555db71995Sopenharmony_ci    if (NULL == disp) {
23565db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
23575db71995Sopenharmony_ci                   "vkCmdFillBuffer: Invalid commandBuffer [VUID-vkCmdFillBuffer-commandBuffer-parameter]");
23585db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
23595db71995Sopenharmony_ci    }
23605db71995Sopenharmony_ci
23615db71995Sopenharmony_ci    disp->CmdFillBuffer(commandBuffer, dstBuffer, dstOffset, size, data);
23625db71995Sopenharmony_ci}
23635db71995Sopenharmony_ci
23645db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdClearColorImage(VkCommandBuffer commandBuffer, VkImage image,
23655db71995Sopenharmony_ci                                                              VkImageLayout imageLayout, const VkClearColorValue *pColor,
23665db71995Sopenharmony_ci                                                              uint32_t rangeCount, const VkImageSubresourceRange *pRanges) {
23675db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
23685db71995Sopenharmony_ci    if (NULL == disp) {
23695db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
23705db71995Sopenharmony_ci                   "vkCmdClearColorImage: Invalid commandBuffer [VUID-vkCmdClearColorImage-commandBuffer-parameter]");
23715db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
23725db71995Sopenharmony_ci    }
23735db71995Sopenharmony_ci
23745db71995Sopenharmony_ci    disp->CmdClearColorImage(commandBuffer, image, imageLayout, pColor, rangeCount, pRanges);
23755db71995Sopenharmony_ci}
23765db71995Sopenharmony_ci
23775db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdClearDepthStencilImage(VkCommandBuffer commandBuffer, VkImage image,
23785db71995Sopenharmony_ci                                                                     VkImageLayout imageLayout,
23795db71995Sopenharmony_ci                                                                     const VkClearDepthStencilValue *pDepthStencil,
23805db71995Sopenharmony_ci                                                                     uint32_t rangeCount, const VkImageSubresourceRange *pRanges) {
23815db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
23825db71995Sopenharmony_ci    if (NULL == disp) {
23835db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
23845db71995Sopenharmony_ci                   "vkCmdClearDepthStencilImage: Invalid commandBuffer [VUID-vkCmdClearDepthStencilImage-commandBuffer-parameter]");
23855db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
23865db71995Sopenharmony_ci    }
23875db71995Sopenharmony_ci
23885db71995Sopenharmony_ci    disp->CmdClearDepthStencilImage(commandBuffer, image, imageLayout, pDepthStencil, rangeCount, pRanges);
23895db71995Sopenharmony_ci}
23905db71995Sopenharmony_ci
23915db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdClearAttachments(VkCommandBuffer commandBuffer, uint32_t attachmentCount,
23925db71995Sopenharmony_ci                                                               const VkClearAttachment *pAttachments, uint32_t rectCount,
23935db71995Sopenharmony_ci                                                               const VkClearRect *pRects) {
23945db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
23955db71995Sopenharmony_ci    if (NULL == disp) {
23965db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
23975db71995Sopenharmony_ci                   "vkCmdClearAttachments: Invalid commandBuffer [VUID-vkCmdClearAttachments-commandBuffer-parameter]");
23985db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
23995db71995Sopenharmony_ci    }
24005db71995Sopenharmony_ci
24015db71995Sopenharmony_ci    disp->CmdClearAttachments(commandBuffer, attachmentCount, pAttachments, rectCount, pRects);
24025db71995Sopenharmony_ci}
24035db71995Sopenharmony_ci
24045db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdResolveImage(VkCommandBuffer commandBuffer, VkImage srcImage,
24055db71995Sopenharmony_ci                                                           VkImageLayout srcImageLayout, VkImage dstImage,
24065db71995Sopenharmony_ci                                                           VkImageLayout dstImageLayout, uint32_t regionCount,
24075db71995Sopenharmony_ci                                                           const VkImageResolve *pRegions) {
24085db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
24095db71995Sopenharmony_ci    if (NULL == disp) {
24105db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
24115db71995Sopenharmony_ci                   "vkCmdResolveImage: Invalid commandBuffer [VUID-vkCmdResolveImage-commandBuffer-parameter]");
24125db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
24135db71995Sopenharmony_ci    }
24145db71995Sopenharmony_ci
24155db71995Sopenharmony_ci    disp->CmdResolveImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions);
24165db71995Sopenharmony_ci}
24175db71995Sopenharmony_ci
24185db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdSetEvent(VkCommandBuffer commandBuffer, VkEvent event,
24195db71995Sopenharmony_ci                                                       VkPipelineStageFlags stageMask) {
24205db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
24215db71995Sopenharmony_ci    if (NULL == disp) {
24225db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
24235db71995Sopenharmony_ci                   "vkCmdSetEvent: Invalid commandBuffer [VUID-vkCmdSetEvent-commandBuffer-parameter]");
24245db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
24255db71995Sopenharmony_ci    }
24265db71995Sopenharmony_ci
24275db71995Sopenharmony_ci    disp->CmdSetEvent(commandBuffer, event, stageMask);
24285db71995Sopenharmony_ci}
24295db71995Sopenharmony_ci
24305db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdResetEvent(VkCommandBuffer commandBuffer, VkEvent event,
24315db71995Sopenharmony_ci                                                         VkPipelineStageFlags stageMask) {
24325db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
24335db71995Sopenharmony_ci    if (NULL == disp) {
24345db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
24355db71995Sopenharmony_ci                   "vkCmdResetEvent: Invalid commandBuffer [VUID-vkCmdResetEvent-commandBuffer-parameter]");
24365db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
24375db71995Sopenharmony_ci    }
24385db71995Sopenharmony_ci
24395db71995Sopenharmony_ci    disp->CmdResetEvent(commandBuffer, event, stageMask);
24405db71995Sopenharmony_ci}
24415db71995Sopenharmony_ci
24425db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdWaitEvents(VkCommandBuffer commandBuffer, uint32_t eventCount, const VkEvent *pEvents,
24435db71995Sopenharmony_ci                                                         VkPipelineStageFlags sourceStageMask, VkPipelineStageFlags dstStageMask,
24445db71995Sopenharmony_ci                                                         uint32_t memoryBarrierCount, const VkMemoryBarrier *pMemoryBarriers,
24455db71995Sopenharmony_ci                                                         uint32_t bufferMemoryBarrierCount,
24465db71995Sopenharmony_ci                                                         const VkBufferMemoryBarrier *pBufferMemoryBarriers,
24475db71995Sopenharmony_ci                                                         uint32_t imageMemoryBarrierCount,
24485db71995Sopenharmony_ci                                                         const VkImageMemoryBarrier *pImageMemoryBarriers) {
24495db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
24505db71995Sopenharmony_ci    if (NULL == disp) {
24515db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
24525db71995Sopenharmony_ci                   "vkCmdWaitEvents: Invalid commandBuffer [VUID-vkCmdWaitEvents-commandBuffer-parameter]");
24535db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
24545db71995Sopenharmony_ci    }
24555db71995Sopenharmony_ci
24565db71995Sopenharmony_ci    disp->CmdWaitEvents(commandBuffer, eventCount, pEvents, sourceStageMask, dstStageMask, memoryBarrierCount, pMemoryBarriers,
24575db71995Sopenharmony_ci                        bufferMemoryBarrierCount, pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers);
24585db71995Sopenharmony_ci}
24595db71995Sopenharmony_ci
24605db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdPipelineBarrier(VkCommandBuffer commandBuffer, VkPipelineStageFlags srcStageMask,
24615db71995Sopenharmony_ci                                                              VkPipelineStageFlags dstStageMask, VkDependencyFlags dependencyFlags,
24625db71995Sopenharmony_ci                                                              uint32_t memoryBarrierCount, const VkMemoryBarrier *pMemoryBarriers,
24635db71995Sopenharmony_ci                                                              uint32_t bufferMemoryBarrierCount,
24645db71995Sopenharmony_ci                                                              const VkBufferMemoryBarrier *pBufferMemoryBarriers,
24655db71995Sopenharmony_ci                                                              uint32_t imageMemoryBarrierCount,
24665db71995Sopenharmony_ci                                                              const VkImageMemoryBarrier *pImageMemoryBarriers) {
24675db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
24685db71995Sopenharmony_ci    if (NULL == disp) {
24695db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
24705db71995Sopenharmony_ci                   "vkCmdPipelineBarrier: Invalid commandBuffer [VUID-vkCmdPipelineBarrier-commandBuffer-parameter]");
24715db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
24725db71995Sopenharmony_ci    }
24735db71995Sopenharmony_ci
24745db71995Sopenharmony_ci    disp->CmdPipelineBarrier(commandBuffer, srcStageMask, dstStageMask, dependencyFlags, memoryBarrierCount, pMemoryBarriers,
24755db71995Sopenharmony_ci                             bufferMemoryBarrierCount, pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers);
24765db71995Sopenharmony_ci}
24775db71995Sopenharmony_ci
24785db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdBeginQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t slot,
24795db71995Sopenharmony_ci                                                         VkFlags flags) {
24805db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
24815db71995Sopenharmony_ci    if (NULL == disp) {
24825db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
24835db71995Sopenharmony_ci                   "vkCmdBeginQuery: Invalid commandBuffer [VUID-vkCmdBeginQuery-commandBuffer-parameter]");
24845db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
24855db71995Sopenharmony_ci    }
24865db71995Sopenharmony_ci
24875db71995Sopenharmony_ci    disp->CmdBeginQuery(commandBuffer, queryPool, slot, flags);
24885db71995Sopenharmony_ci}
24895db71995Sopenharmony_ci
24905db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdEndQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t slot) {
24915db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
24925db71995Sopenharmony_ci    if (NULL == disp) {
24935db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
24945db71995Sopenharmony_ci                   "vkCmdEndQuery: Invalid commandBuffer [VUID-vkCmdEndQuery-commandBuffer-parameter]");
24955db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
24965db71995Sopenharmony_ci    }
24975db71995Sopenharmony_ci
24985db71995Sopenharmony_ci    disp->CmdEndQuery(commandBuffer, queryPool, slot);
24995db71995Sopenharmony_ci}
25005db71995Sopenharmony_ci
25015db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdResetQueryPool(VkCommandBuffer commandBuffer, VkQueryPool queryPool,
25025db71995Sopenharmony_ci                                                             uint32_t firstQuery, uint32_t queryCount) {
25035db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
25045db71995Sopenharmony_ci    if (NULL == disp) {
25055db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
25065db71995Sopenharmony_ci                   "vkCmdResetQueryPool: Invalid commandBuffer [VUID-vkCmdResetQueryPool-commandBuffer-parameter]");
25075db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
25085db71995Sopenharmony_ci    }
25095db71995Sopenharmony_ci
25105db71995Sopenharmony_ci    disp->CmdResetQueryPool(commandBuffer, queryPool, firstQuery, queryCount);
25115db71995Sopenharmony_ci}
25125db71995Sopenharmony_ci
25135db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdWriteTimestamp(VkCommandBuffer commandBuffer, VkPipelineStageFlagBits pipelineStage,
25145db71995Sopenharmony_ci                                                             VkQueryPool queryPool, uint32_t slot) {
25155db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
25165db71995Sopenharmony_ci    if (NULL == disp) {
25175db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
25185db71995Sopenharmony_ci                   "vkCmdWriteTimestamp: Invalid commandBuffer [VUID-vkCmdWriteTimestamp-commandBuffer-parameter]");
25195db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
25205db71995Sopenharmony_ci    }
25215db71995Sopenharmony_ci
25225db71995Sopenharmony_ci    disp->CmdWriteTimestamp(commandBuffer, pipelineStage, queryPool, slot);
25235db71995Sopenharmony_ci}
25245db71995Sopenharmony_ci
25255db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdCopyQueryPoolResults(VkCommandBuffer commandBuffer, VkQueryPool queryPool,
25265db71995Sopenharmony_ci                                                                   uint32_t firstQuery, uint32_t queryCount, VkBuffer dstBuffer,
25275db71995Sopenharmony_ci                                                                   VkDeviceSize dstOffset, VkDeviceSize stride, VkFlags flags) {
25285db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
25295db71995Sopenharmony_ci    if (NULL == disp) {
25305db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
25315db71995Sopenharmony_ci                   "vkCmdCopyQueryPoolResults: Invalid commandBuffer [VUID-vkCmdCopyQueryPoolResults-commandBuffer-parameter]");
25325db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
25335db71995Sopenharmony_ci    }
25345db71995Sopenharmony_ci
25355db71995Sopenharmony_ci    disp->CmdCopyQueryPoolResults(commandBuffer, queryPool, firstQuery, queryCount, dstBuffer, dstOffset, stride, flags);
25365db71995Sopenharmony_ci}
25375db71995Sopenharmony_ci
25385db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdPushConstants(VkCommandBuffer commandBuffer, VkPipelineLayout layout,
25395db71995Sopenharmony_ci                                                            VkShaderStageFlags stageFlags, uint32_t offset, uint32_t size,
25405db71995Sopenharmony_ci                                                            const void *pValues) {
25415db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
25425db71995Sopenharmony_ci    if (NULL == disp) {
25435db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
25445db71995Sopenharmony_ci                   "vkCmdPushConstants: Invalid commandBuffer [VUID-vkCmdPushConstants-commandBuffer-parameter]");
25455db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
25465db71995Sopenharmony_ci    }
25475db71995Sopenharmony_ci
25485db71995Sopenharmony_ci    disp->CmdPushConstants(commandBuffer, layout, stageFlags, offset, size, pValues);
25495db71995Sopenharmony_ci}
25505db71995Sopenharmony_ci
25515db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdBeginRenderPass(VkCommandBuffer commandBuffer,
25525db71995Sopenharmony_ci                                                              const VkRenderPassBeginInfo *pRenderPassBegin,
25535db71995Sopenharmony_ci                                                              VkSubpassContents contents) {
25545db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
25555db71995Sopenharmony_ci    if (NULL == disp) {
25565db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
25575db71995Sopenharmony_ci                   "vkCmdBeginRenderPass: Invalid commandBuffer [VUID-vkCmdBeginRenderPass-commandBuffer-parameter]");
25585db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
25595db71995Sopenharmony_ci    }
25605db71995Sopenharmony_ci
25615db71995Sopenharmony_ci    disp->CmdBeginRenderPass(commandBuffer, pRenderPassBegin, contents);
25625db71995Sopenharmony_ci}
25635db71995Sopenharmony_ci
25645db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdNextSubpass(VkCommandBuffer commandBuffer, VkSubpassContents contents) {
25655db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
25665db71995Sopenharmony_ci    if (NULL == disp) {
25675db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
25685db71995Sopenharmony_ci                   "vkCmdNextSubpass: Invalid commandBuffer [VUID-vkCmdNextSubpass-commandBuffer-parameter]");
25695db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
25705db71995Sopenharmony_ci    }
25715db71995Sopenharmony_ci
25725db71995Sopenharmony_ci    disp->CmdNextSubpass(commandBuffer, contents);
25735db71995Sopenharmony_ci}
25745db71995Sopenharmony_ci
25755db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdEndRenderPass(VkCommandBuffer commandBuffer) {
25765db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
25775db71995Sopenharmony_ci    if (NULL == disp) {
25785db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
25795db71995Sopenharmony_ci                   "vkCmdEndRenderPass: Invalid commandBuffer [VUID-vkCmdEndRenderPass-commandBuffer-parameter]");
25805db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
25815db71995Sopenharmony_ci    }
25825db71995Sopenharmony_ci
25835db71995Sopenharmony_ci    disp->CmdEndRenderPass(commandBuffer);
25845db71995Sopenharmony_ci}
25855db71995Sopenharmony_ci
25865db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdExecuteCommands(VkCommandBuffer commandBuffer, uint32_t commandBuffersCount,
25875db71995Sopenharmony_ci                                                              const VkCommandBuffer *pCommandBuffers) {
25885db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
25895db71995Sopenharmony_ci    if (NULL == disp) {
25905db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
25915db71995Sopenharmony_ci                   "vkCmdExecuteCommands: Invalid commandBuffer [VUID-vkCmdExecuteCommands-commandBuffer-parameter]");
25925db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
25935db71995Sopenharmony_ci    }
25945db71995Sopenharmony_ci
25955db71995Sopenharmony_ci    disp->CmdExecuteCommands(commandBuffer, commandBuffersCount, pCommandBuffers);
25965db71995Sopenharmony_ci}
25975db71995Sopenharmony_ci
25985db71995Sopenharmony_ci// ---- Vulkan core 1.1 trampolines
25995db71995Sopenharmony_ci
26005db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumeratePhysicalDeviceGroups(
26015db71995Sopenharmony_ci    VkInstance instance, uint32_t *pPhysicalDeviceGroupCount, VkPhysicalDeviceGroupProperties *pPhysicalDeviceGroupProperties) {
26025db71995Sopenharmony_ci    VkResult res = VK_SUCCESS;
26035db71995Sopenharmony_ci    struct loader_instance *inst = NULL;
26045db71995Sopenharmony_ci
26055db71995Sopenharmony_ci    loader_platform_thread_lock_mutex(&loader_lock);
26065db71995Sopenharmony_ci
26075db71995Sopenharmony_ci    inst = loader_get_instance(instance);
26085db71995Sopenharmony_ci    if (NULL == inst) {
26095db71995Sopenharmony_ci        loader_log(
26105db71995Sopenharmony_ci            NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
26115db71995Sopenharmony_ci            "vkEnumeratePhysicalDeviceGroupsKHR: Invalid instance [VUID-vkEnumeratePhysicalDeviceGroups-instance-parameter]");
26125db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
26135db71995Sopenharmony_ci    }
26145db71995Sopenharmony_ci
26155db71995Sopenharmony_ci    if (NULL == pPhysicalDeviceGroupCount) {
26165db71995Sopenharmony_ci        loader_log(inst, VULKAN_LOADER_ERROR_BIT, 0,
26175db71995Sopenharmony_ci                   "vkEnumeratePhysicalDeviceGroupsKHR: Received NULL pointer for physical "
26185db71995Sopenharmony_ci                   "device group count return value.");
26195db71995Sopenharmony_ci        res = VK_ERROR_INITIALIZATION_FAILED;
26205db71995Sopenharmony_ci        goto out;
26215db71995Sopenharmony_ci    }
26225db71995Sopenharmony_ci
26235db71995Sopenharmony_ci    // Call down the chain to get the physical device group info.
26245db71995Sopenharmony_ci    res = inst->disp->layer_inst_disp.EnumeratePhysicalDeviceGroups(inst->instance, pPhysicalDeviceGroupCount,
26255db71995Sopenharmony_ci                                                                    pPhysicalDeviceGroupProperties);
26265db71995Sopenharmony_ci    if (NULL != pPhysicalDeviceGroupProperties && (VK_SUCCESS == res || VK_INCOMPLETE == res)) {
26275db71995Sopenharmony_ci        // Wrap the PhysDev object for loader usage, return wrapped objects
26285db71995Sopenharmony_ci        VkResult update_res = setup_loader_tramp_phys_dev_groups(inst, *pPhysicalDeviceGroupCount, pPhysicalDeviceGroupProperties);
26295db71995Sopenharmony_ci        if (VK_SUCCESS != update_res) {
26305db71995Sopenharmony_ci            res = update_res;
26315db71995Sopenharmony_ci        }
26325db71995Sopenharmony_ci    }
26335db71995Sopenharmony_ci
26345db71995Sopenharmony_ciout:
26355db71995Sopenharmony_ci
26365db71995Sopenharmony_ci    loader_platform_thread_unlock_mutex(&loader_lock);
26375db71995Sopenharmony_ci    return res;
26385db71995Sopenharmony_ci}
26395db71995Sopenharmony_ci
26405db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice,
26415db71995Sopenharmony_ci                                                                      VkPhysicalDeviceFeatures2 *pFeatures) {
26425db71995Sopenharmony_ci    VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice);
26435db71995Sopenharmony_ci    if (VK_NULL_HANDLE == unwrapped_phys_dev) {
26445db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
26455db71995Sopenharmony_ci                   "vkGetPhysicalDeviceFeatures2: Invalid physicalDevice "
26465db71995Sopenharmony_ci                   "[VUID-vkGetPhysicalDeviceFeatures2-physicalDevice-parameter]");
26475db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
26485db71995Sopenharmony_ci    }
26495db71995Sopenharmony_ci    const VkLayerInstanceDispatchTable *disp = loader_get_instance_layer_dispatch(physicalDevice);
26505db71995Sopenharmony_ci    const struct loader_instance *inst = ((struct loader_physical_device_tramp *)physicalDevice)->this_instance;
26515db71995Sopenharmony_ci
26525db71995Sopenharmony_ci    if (inst != NULL && inst->enabled_known_extensions.khr_get_physical_device_properties2) {
26535db71995Sopenharmony_ci        disp->GetPhysicalDeviceFeatures2KHR(unwrapped_phys_dev, pFeatures);
26545db71995Sopenharmony_ci    } else {
26555db71995Sopenharmony_ci        disp->GetPhysicalDeviceFeatures2(unwrapped_phys_dev, pFeatures);
26565db71995Sopenharmony_ci    }
26575db71995Sopenharmony_ci}
26585db71995Sopenharmony_ci
26595db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceProperties2(VkPhysicalDevice physicalDevice,
26605db71995Sopenharmony_ci                                                                        VkPhysicalDeviceProperties2 *pProperties) {
26615db71995Sopenharmony_ci    VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice);
26625db71995Sopenharmony_ci    if (VK_NULL_HANDLE == unwrapped_phys_dev) {
26635db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
26645db71995Sopenharmony_ci                   "vkGetPhysicalDeviceProperties2: Invalid physicalDevice "
26655db71995Sopenharmony_ci                   "[VUID-vkGetPhysicalDeviceProperties2-physicalDevice-parameter]");
26665db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
26675db71995Sopenharmony_ci    }
26685db71995Sopenharmony_ci    const VkLayerInstanceDispatchTable *disp = loader_get_instance_layer_dispatch(physicalDevice);
26695db71995Sopenharmony_ci    const struct loader_instance *inst = ((struct loader_physical_device_tramp *)physicalDevice)->this_instance;
26705db71995Sopenharmony_ci
26715db71995Sopenharmony_ci    if (inst != NULL && inst->enabled_known_extensions.khr_get_physical_device_properties2) {
26725db71995Sopenharmony_ci        disp->GetPhysicalDeviceProperties2KHR(unwrapped_phys_dev, pProperties);
26735db71995Sopenharmony_ci    } else {
26745db71995Sopenharmony_ci        disp->GetPhysicalDeviceProperties2(unwrapped_phys_dev, pProperties);
26755db71995Sopenharmony_ci    }
26765db71995Sopenharmony_ci}
26775db71995Sopenharmony_ci
26785db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFormatProperties2(VkPhysicalDevice physicalDevice, VkFormat format,
26795db71995Sopenharmony_ci                                                                              VkFormatProperties2 *pFormatProperties) {
26805db71995Sopenharmony_ci    VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice);
26815db71995Sopenharmony_ci    if (VK_NULL_HANDLE == unwrapped_phys_dev) {
26825db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
26835db71995Sopenharmony_ci                   "vkGetPhysicalDeviceFormatProperties2: Invalid physicalDevice "
26845db71995Sopenharmony_ci                   "[VUID-vkGetPhysicalDeviceFormatProperties2-physicalDevice-parameter]");
26855db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
26865db71995Sopenharmony_ci    }
26875db71995Sopenharmony_ci    const VkLayerInstanceDispatchTable *disp = loader_get_instance_layer_dispatch(physicalDevice);
26885db71995Sopenharmony_ci    const struct loader_instance *inst = ((struct loader_physical_device_tramp *)physicalDevice)->this_instance;
26895db71995Sopenharmony_ci
26905db71995Sopenharmony_ci    if (inst != NULL && inst->enabled_known_extensions.khr_get_physical_device_properties2) {
26915db71995Sopenharmony_ci        disp->GetPhysicalDeviceFormatProperties2KHR(unwrapped_phys_dev, format, pFormatProperties);
26925db71995Sopenharmony_ci    } else {
26935db71995Sopenharmony_ci        disp->GetPhysicalDeviceFormatProperties2(unwrapped_phys_dev, format, pFormatProperties);
26945db71995Sopenharmony_ci    }
26955db71995Sopenharmony_ci}
26965db71995Sopenharmony_ci
26975db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
26985db71995Sopenharmony_civkGetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo,
26995db71995Sopenharmony_ci                                          VkImageFormatProperties2 *pImageFormatProperties) {
27005db71995Sopenharmony_ci    VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice);
27015db71995Sopenharmony_ci    if (VK_NULL_HANDLE == unwrapped_phys_dev) {
27025db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
27035db71995Sopenharmony_ci                   "vkGetPhysicalDeviceImageFormatProperties2: Invalid physicalDevice "
27045db71995Sopenharmony_ci                   "[VUID-vkGetPhysicalDeviceImageFormatProperties2-physicalDevice-parameter]");
27055db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
27065db71995Sopenharmony_ci    }
27075db71995Sopenharmony_ci    const VkLayerInstanceDispatchTable *disp = loader_get_instance_layer_dispatch(physicalDevice);
27085db71995Sopenharmony_ci    const struct loader_instance *inst = ((struct loader_physical_device_tramp *)physicalDevice)->this_instance;
27095db71995Sopenharmony_ci
27105db71995Sopenharmony_ci    if (inst != NULL && inst->enabled_known_extensions.khr_get_physical_device_properties2) {
27115db71995Sopenharmony_ci        return disp->GetPhysicalDeviceImageFormatProperties2KHR(unwrapped_phys_dev, pImageFormatInfo, pImageFormatProperties);
27125db71995Sopenharmony_ci    } else {
27135db71995Sopenharmony_ci        return disp->GetPhysicalDeviceImageFormatProperties2(unwrapped_phys_dev, pImageFormatInfo, pImageFormatProperties);
27145db71995Sopenharmony_ci    }
27155db71995Sopenharmony_ci}
27165db71995Sopenharmony_ci
27175db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceQueueFamilyProperties2(
27185db71995Sopenharmony_ci    VkPhysicalDevice physicalDevice, uint32_t *pQueueFamilyPropertyCount, VkQueueFamilyProperties2 *pQueueFamilyProperties) {
27195db71995Sopenharmony_ci    VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice);
27205db71995Sopenharmony_ci    if (VK_NULL_HANDLE == unwrapped_phys_dev) {
27215db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
27225db71995Sopenharmony_ci                   "vkGetPhysicalDeviceQueueFamilyProperties2: Invalid physicalDevice "
27235db71995Sopenharmony_ci                   "[VUID-vkGetPhysicalDeviceQueueFamilyProperties2-physicalDevice-parameter]");
27245db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
27255db71995Sopenharmony_ci    }
27265db71995Sopenharmony_ci    const VkLayerInstanceDispatchTable *disp = loader_get_instance_layer_dispatch(physicalDevice);
27275db71995Sopenharmony_ci    const struct loader_instance *inst = ((struct loader_physical_device_tramp *)physicalDevice)->this_instance;
27285db71995Sopenharmony_ci
27295db71995Sopenharmony_ci    if (inst != NULL && inst->enabled_known_extensions.khr_get_physical_device_properties2) {
27305db71995Sopenharmony_ci        disp->GetPhysicalDeviceQueueFamilyProperties2KHR(unwrapped_phys_dev, pQueueFamilyPropertyCount, pQueueFamilyProperties);
27315db71995Sopenharmony_ci    } else {
27325db71995Sopenharmony_ci        disp->GetPhysicalDeviceQueueFamilyProperties2(unwrapped_phys_dev, pQueueFamilyPropertyCount, pQueueFamilyProperties);
27335db71995Sopenharmony_ci    }
27345db71995Sopenharmony_ci}
27355db71995Sopenharmony_ci
27365db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
27375db71995Sopenharmony_civkGetPhysicalDeviceMemoryProperties2(VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties2 *pMemoryProperties) {
27385db71995Sopenharmony_ci    VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice);
27395db71995Sopenharmony_ci    if (VK_NULL_HANDLE == unwrapped_phys_dev) {
27405db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
27415db71995Sopenharmony_ci                   "vkGetPhysicalDeviceMemoryProperties2: Invalid physicalDevice "
27425db71995Sopenharmony_ci                   "[VUID-vkGetPhysicalDeviceMemoryProperties2-physicalDevice-parameter]");
27435db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
27445db71995Sopenharmony_ci    }
27455db71995Sopenharmony_ci    const VkLayerInstanceDispatchTable *disp = loader_get_instance_layer_dispatch(physicalDevice);
27465db71995Sopenharmony_ci    const struct loader_instance *inst = ((struct loader_physical_device_tramp *)physicalDevice)->this_instance;
27475db71995Sopenharmony_ci
27485db71995Sopenharmony_ci    if (inst != NULL && inst->enabled_known_extensions.khr_get_physical_device_properties2) {
27495db71995Sopenharmony_ci        disp->GetPhysicalDeviceMemoryProperties2KHR(unwrapped_phys_dev, pMemoryProperties);
27505db71995Sopenharmony_ci    } else {
27515db71995Sopenharmony_ci        disp->GetPhysicalDeviceMemoryProperties2(unwrapped_phys_dev, pMemoryProperties);
27525db71995Sopenharmony_ci    }
27535db71995Sopenharmony_ci}
27545db71995Sopenharmony_ci
27555db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceSparseImageFormatProperties2(
27565db71995Sopenharmony_ci    VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSparseImageFormatInfo2 *pFormatInfo, uint32_t *pPropertyCount,
27575db71995Sopenharmony_ci    VkSparseImageFormatProperties2 *pProperties) {
27585db71995Sopenharmony_ci    VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice);
27595db71995Sopenharmony_ci    if (VK_NULL_HANDLE == unwrapped_phys_dev) {
27605db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
27615db71995Sopenharmony_ci                   "vkGetPhysicalDeviceSparseImageFormatProperties2: Invalid physicalDevice "
27625db71995Sopenharmony_ci                   "[VUID-vkGetPhysicalDeviceSparseImageFormatProperties2-physicalDevice-parameter]");
27635db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
27645db71995Sopenharmony_ci    }
27655db71995Sopenharmony_ci    const VkLayerInstanceDispatchTable *disp = loader_get_instance_layer_dispatch(physicalDevice);
27665db71995Sopenharmony_ci    const struct loader_instance *inst = ((struct loader_physical_device_tramp *)physicalDevice)->this_instance;
27675db71995Sopenharmony_ci
27685db71995Sopenharmony_ci    if (inst != NULL && inst->enabled_known_extensions.khr_get_physical_device_properties2) {
27695db71995Sopenharmony_ci        disp->GetPhysicalDeviceSparseImageFormatProperties2KHR(unwrapped_phys_dev, pFormatInfo, pPropertyCount, pProperties);
27705db71995Sopenharmony_ci    } else {
27715db71995Sopenharmony_ci        disp->GetPhysicalDeviceSparseImageFormatProperties2(unwrapped_phys_dev, pFormatInfo, pPropertyCount, pProperties);
27725db71995Sopenharmony_ci    }
27735db71995Sopenharmony_ci}
27745db71995Sopenharmony_ci
27755db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceExternalBufferProperties(
27765db71995Sopenharmony_ci    VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalBufferInfo *pExternalBufferInfo,
27775db71995Sopenharmony_ci    VkExternalBufferProperties *pExternalBufferProperties) {
27785db71995Sopenharmony_ci    VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice);
27795db71995Sopenharmony_ci    if (VK_NULL_HANDLE == unwrapped_phys_dev) {
27805db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
27815db71995Sopenharmony_ci                   "vkGetPhysicalDeviceExternalBufferProperties: Invalid physicalDevice "
27825db71995Sopenharmony_ci                   "[VUID-vkGetPhysicalDeviceExternalBufferProperties-physicalDevice-parameter]");
27835db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
27845db71995Sopenharmony_ci    }
27855db71995Sopenharmony_ci    const VkLayerInstanceDispatchTable *disp = loader_get_instance_layer_dispatch(physicalDevice);
27865db71995Sopenharmony_ci    const struct loader_instance *inst = ((struct loader_physical_device_tramp *)physicalDevice)->this_instance;
27875db71995Sopenharmony_ci
27885db71995Sopenharmony_ci    if (inst != NULL && inst->enabled_known_extensions.khr_external_memory_capabilities) {
27895db71995Sopenharmony_ci        disp->GetPhysicalDeviceExternalBufferPropertiesKHR(unwrapped_phys_dev, pExternalBufferInfo, pExternalBufferProperties);
27905db71995Sopenharmony_ci    } else {
27915db71995Sopenharmony_ci        disp->GetPhysicalDeviceExternalBufferProperties(unwrapped_phys_dev, pExternalBufferInfo, pExternalBufferProperties);
27925db71995Sopenharmony_ci    }
27935db71995Sopenharmony_ci}
27945db71995Sopenharmony_ci
27955db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceExternalSemaphoreProperties(
27965db71995Sopenharmony_ci    VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalSemaphoreInfo *pExternalSemaphoreInfo,
27975db71995Sopenharmony_ci    VkExternalSemaphoreProperties *pExternalSemaphoreProperties) {
27985db71995Sopenharmony_ci    VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice);
27995db71995Sopenharmony_ci    if (VK_NULL_HANDLE == unwrapped_phys_dev) {
28005db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
28015db71995Sopenharmony_ci                   "vkGetPhysicalDeviceExternalSemaphoreProperties: Invalid physicalDevice "
28025db71995Sopenharmony_ci                   "[VUID-vkGetPhysicalDeviceExternalSemaphoreProperties-physicalDevice-parameter]");
28035db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
28045db71995Sopenharmony_ci    }
28055db71995Sopenharmony_ci    const VkLayerInstanceDispatchTable *disp = loader_get_instance_layer_dispatch(physicalDevice);
28065db71995Sopenharmony_ci    const struct loader_instance *inst = ((struct loader_physical_device_tramp *)physicalDevice)->this_instance;
28075db71995Sopenharmony_ci
28085db71995Sopenharmony_ci    if (inst != NULL && inst->enabled_known_extensions.khr_external_semaphore_capabilities) {
28095db71995Sopenharmony_ci        disp->GetPhysicalDeviceExternalSemaphorePropertiesKHR(unwrapped_phys_dev, pExternalSemaphoreInfo,
28105db71995Sopenharmony_ci                                                              pExternalSemaphoreProperties);
28115db71995Sopenharmony_ci    } else {
28125db71995Sopenharmony_ci        disp->GetPhysicalDeviceExternalSemaphoreProperties(unwrapped_phys_dev, pExternalSemaphoreInfo,
28135db71995Sopenharmony_ci                                                           pExternalSemaphoreProperties);
28145db71995Sopenharmony_ci    }
28155db71995Sopenharmony_ci}
28165db71995Sopenharmony_ci
28175db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceExternalFenceProperties(
28185db71995Sopenharmony_ci    VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalFenceInfo *pExternalFenceInfo,
28195db71995Sopenharmony_ci    VkExternalFenceProperties *pExternalFenceProperties) {
28205db71995Sopenharmony_ci    VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice);
28215db71995Sopenharmony_ci    if (VK_NULL_HANDLE == unwrapped_phys_dev) {
28225db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
28235db71995Sopenharmony_ci                   "vkGetPhysicalDeviceExternalFenceProperties: Invalid physicalDevice "
28245db71995Sopenharmony_ci                   "[VUID-vkGetPhysicalDeviceExternalFenceProperties-physicalDevice-parameter]");
28255db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
28265db71995Sopenharmony_ci    }
28275db71995Sopenharmony_ci    const VkLayerInstanceDispatchTable *disp = loader_get_instance_layer_dispatch(physicalDevice);
28285db71995Sopenharmony_ci    const struct loader_instance *inst = ((struct loader_physical_device_tramp *)physicalDevice)->this_instance;
28295db71995Sopenharmony_ci
28305db71995Sopenharmony_ci    if (inst != NULL && inst->enabled_known_extensions.khr_external_fence_capabilities) {
28315db71995Sopenharmony_ci        disp->GetPhysicalDeviceExternalFencePropertiesKHR(unwrapped_phys_dev, pExternalFenceInfo, pExternalFenceProperties);
28325db71995Sopenharmony_ci    } else {
28335db71995Sopenharmony_ci        disp->GetPhysicalDeviceExternalFenceProperties(unwrapped_phys_dev, pExternalFenceInfo, pExternalFenceProperties);
28345db71995Sopenharmony_ci    }
28355db71995Sopenharmony_ci}
28365db71995Sopenharmony_ci
28375db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkBindBufferMemory2(VkDevice device, uint32_t bindInfoCount,
28385db71995Sopenharmony_ci                                                                 const VkBindBufferMemoryInfo *pBindInfos) {
28395db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
28405db71995Sopenharmony_ci    if (NULL == disp) {
28415db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
28425db71995Sopenharmony_ci                   "vkBindBufferMemory2: Invalid device [VUID-vkBindBufferMemory2-device-parameter]");
28435db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
28445db71995Sopenharmony_ci    }
28455db71995Sopenharmony_ci    return disp->BindBufferMemory2(device, bindInfoCount, pBindInfos);
28465db71995Sopenharmony_ci}
28475db71995Sopenharmony_ci
28485db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkBindImageMemory2(VkDevice device, uint32_t bindInfoCount,
28495db71995Sopenharmony_ci                                                                const VkBindImageMemoryInfo *pBindInfos) {
28505db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
28515db71995Sopenharmony_ci    if (NULL == disp) {
28525db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
28535db71995Sopenharmony_ci                   "vkBindImageMemory2: Invalid device [VUID-vkBindImageMemory2-device-parameter]");
28545db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
28555db71995Sopenharmony_ci    }
28565db71995Sopenharmony_ci    return disp->BindImageMemory2(device, bindInfoCount, pBindInfos);
28575db71995Sopenharmony_ci}
28585db71995Sopenharmony_ci
28595db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetDeviceGroupPeerMemoryFeatures(VkDevice device, uint32_t heapIndex,
28605db71995Sopenharmony_ci                                                                            uint32_t localDeviceIndex, uint32_t remoteDeviceIndex,
28615db71995Sopenharmony_ci                                                                            VkPeerMemoryFeatureFlags *pPeerMemoryFeatures) {
28625db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
28635db71995Sopenharmony_ci    if (NULL == disp) {
28645db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
28655db71995Sopenharmony_ci                   "vkGetDeviceGroupPeerMemoryFeatures: Invalid device [VUID-vkGetDeviceGroupPeerMemoryFeatures-device-parameter]");
28665db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
28675db71995Sopenharmony_ci    }
28685db71995Sopenharmony_ci    disp->GetDeviceGroupPeerMemoryFeatures(device, heapIndex, localDeviceIndex, remoteDeviceIndex, pPeerMemoryFeatures);
28695db71995Sopenharmony_ci}
28705db71995Sopenharmony_ci
28715db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdSetDeviceMask(VkCommandBuffer commandBuffer, uint32_t deviceMask) {
28725db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
28735db71995Sopenharmony_ci    if (NULL == disp) {
28745db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
28755db71995Sopenharmony_ci                   "vkCmdSetDeviceMask: Invalid commandBuffer [VUID-vkCmdSetDeviceMask-commandBuffer-parameter]");
28765db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
28775db71995Sopenharmony_ci    }
28785db71995Sopenharmony_ci    disp->CmdSetDeviceMask(commandBuffer, deviceMask);
28795db71995Sopenharmony_ci}
28805db71995Sopenharmony_ci
28815db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdDispatchBase(VkCommandBuffer commandBuffer, uint32_t baseGroupX, uint32_t baseGroupY,
28825db71995Sopenharmony_ci                                                           uint32_t baseGroupZ, uint32_t groupCountX, uint32_t groupCountY,
28835db71995Sopenharmony_ci                                                           uint32_t groupCountZ) {
28845db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
28855db71995Sopenharmony_ci    if (NULL == disp) {
28865db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
28875db71995Sopenharmony_ci                   "vkCmdDispatchBase: Invalid commandBuffer [VUID-vkCmdDispatchBase-commandBuffer-parameter]");
28885db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
28895db71995Sopenharmony_ci    }
28905db71995Sopenharmony_ci    disp->CmdDispatchBase(commandBuffer, baseGroupX, baseGroupY, baseGroupZ, groupCountX, groupCountY, groupCountZ);
28915db71995Sopenharmony_ci}
28925db71995Sopenharmony_ci
28935db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetImageMemoryRequirements2(VkDevice device, const VkImageMemoryRequirementsInfo2 *pInfo,
28945db71995Sopenharmony_ci                                                                       VkMemoryRequirements2 *pMemoryRequirements) {
28955db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
28965db71995Sopenharmony_ci    if (NULL == disp) {
28975db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
28985db71995Sopenharmony_ci                   "vkGetImageMemoryRequirements2: Invalid device [VUID-vkGetImageMemoryRequirements2-device-parameter]");
28995db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
29005db71995Sopenharmony_ci    }
29015db71995Sopenharmony_ci    disp->GetImageMemoryRequirements2(device, pInfo, pMemoryRequirements);
29025db71995Sopenharmony_ci}
29035db71995Sopenharmony_ci
29045db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetBufferMemoryRequirements2(VkDevice device,
29055db71995Sopenharmony_ci                                                                        const VkBufferMemoryRequirementsInfo2 *pInfo,
29065db71995Sopenharmony_ci                                                                        VkMemoryRequirements2 *pMemoryRequirements) {
29075db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
29085db71995Sopenharmony_ci    if (NULL == disp) {
29095db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
29105db71995Sopenharmony_ci                   "vkGetBufferMemoryRequirements2: Invalid device [VUID-vkGetBufferMemoryRequirements2-device-parameter]");
29115db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
29125db71995Sopenharmony_ci    }
29135db71995Sopenharmony_ci    disp->GetBufferMemoryRequirements2(device, pInfo, pMemoryRequirements);
29145db71995Sopenharmony_ci}
29155db71995Sopenharmony_ci
29165db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetImageSparseMemoryRequirements2(
29175db71995Sopenharmony_ci    VkDevice device, const VkImageSparseMemoryRequirementsInfo2 *pInfo, uint32_t *pSparseMemoryRequirementCount,
29185db71995Sopenharmony_ci    VkSparseImageMemoryRequirements2 *pSparseMemoryRequirements) {
29195db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
29205db71995Sopenharmony_ci    if (NULL == disp) {
29215db71995Sopenharmony_ci        loader_log(
29225db71995Sopenharmony_ci            NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
29235db71995Sopenharmony_ci            "vkGetImageSparseMemoryRequirements2: Invalid device [VUID-vkGetImageSparseMemoryRequirements2-device-parameter]");
29245db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
29255db71995Sopenharmony_ci    }
29265db71995Sopenharmony_ci    disp->GetImageSparseMemoryRequirements2(device, pInfo, pSparseMemoryRequirementCount, pSparseMemoryRequirements);
29275db71995Sopenharmony_ci}
29285db71995Sopenharmony_ci
29295db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkTrimCommandPool(VkDevice device, VkCommandPool commandPool,
29305db71995Sopenharmony_ci                                                           VkCommandPoolTrimFlags flags) {
29315db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
29325db71995Sopenharmony_ci    if (NULL == disp) {
29335db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
29345db71995Sopenharmony_ci                   "vkTrimCommandPool: Invalid device [VUID-vkTrimCommandPool-device-parameter]");
29355db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
29365db71995Sopenharmony_ci    }
29375db71995Sopenharmony_ci    disp->TrimCommandPool(device, commandPool, flags);
29385db71995Sopenharmony_ci}
29395db71995Sopenharmony_ci
29405db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetDeviceQueue2(VkDevice device, const VkDeviceQueueInfo2 *pQueueInfo, VkQueue *pQueue) {
29415db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
29425db71995Sopenharmony_ci    if (NULL == disp) {
29435db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
29445db71995Sopenharmony_ci                   "vkGetDeviceQueue2: Invalid device [VUID-vkGetDeviceQueue2-device-parameter]");
29455db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
29465db71995Sopenharmony_ci    }
29475db71995Sopenharmony_ci    disp->GetDeviceQueue2(device, pQueueInfo, pQueue);
29485db71995Sopenharmony_ci    if (pQueue != NULL && *pQueue != NULL) {
29495db71995Sopenharmony_ci        loader_set_dispatch(*pQueue, disp);
29505db71995Sopenharmony_ci    }
29515db71995Sopenharmony_ci}
29525db71995Sopenharmony_ci
29535db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateSamplerYcbcrConversion(VkDevice device,
29545db71995Sopenharmony_ci                                                                            const VkSamplerYcbcrConversionCreateInfo *pCreateInfo,
29555db71995Sopenharmony_ci                                                                            const VkAllocationCallbacks *pAllocator,
29565db71995Sopenharmony_ci                                                                            VkSamplerYcbcrConversion *pYcbcrConversion) {
29575db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
29585db71995Sopenharmony_ci    if (NULL == disp) {
29595db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
29605db71995Sopenharmony_ci                   "vkCreateSamplerYcbcrConversion: Invalid device [VUID-vkCreateSamplerYcbcrConversion-device-parameter]");
29615db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
29625db71995Sopenharmony_ci    }
29635db71995Sopenharmony_ci    return disp->CreateSamplerYcbcrConversion(device, pCreateInfo, pAllocator, pYcbcrConversion);
29645db71995Sopenharmony_ci}
29655db71995Sopenharmony_ci
29665db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroySamplerYcbcrConversion(VkDevice device, VkSamplerYcbcrConversion ycbcrConversion,
29675db71995Sopenharmony_ci                                                                         const VkAllocationCallbacks *pAllocator) {
29685db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
29695db71995Sopenharmony_ci    if (NULL == disp) {
29705db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
29715db71995Sopenharmony_ci                   "vkDestroySamplerYcbcrConversion: Invalid device [VUID-vkDestroySamplerYcbcrConversion-device-parameter]");
29725db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
29735db71995Sopenharmony_ci    }
29745db71995Sopenharmony_ci    disp->DestroySamplerYcbcrConversion(device, ycbcrConversion, pAllocator);
29755db71995Sopenharmony_ci}
29765db71995Sopenharmony_ci
29775db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetDescriptorSetLayoutSupport(VkDevice device,
29785db71995Sopenharmony_ci                                                                         const VkDescriptorSetLayoutCreateInfo *pCreateInfo,
29795db71995Sopenharmony_ci                                                                         VkDescriptorSetLayoutSupport *pSupport) {
29805db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
29815db71995Sopenharmony_ci    if (NULL == disp) {
29825db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
29835db71995Sopenharmony_ci                   "vkGetDescriptorSetLayoutSupport: Invalid device [VUID-vkGetDescriptorSetLayoutSupport-device-parameter]");
29845db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
29855db71995Sopenharmony_ci    }
29865db71995Sopenharmony_ci    disp->GetDescriptorSetLayoutSupport(device, pCreateInfo, pSupport);
29875db71995Sopenharmony_ci}
29885db71995Sopenharmony_ci
29895db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
29905db71995Sopenharmony_civkCreateDescriptorUpdateTemplate(VkDevice device, const VkDescriptorUpdateTemplateCreateInfo *pCreateInfo,
29915db71995Sopenharmony_ci                                 const VkAllocationCallbacks *pAllocator, VkDescriptorUpdateTemplate *pDescriptorUpdateTemplate) {
29925db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
29935db71995Sopenharmony_ci    if (NULL == disp) {
29945db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
29955db71995Sopenharmony_ci                   "vkCreateDescriptorUpdateTemplate: Invalid device [VUID-vkCreateDescriptorUpdateTemplate-device-parameter]");
29965db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
29975db71995Sopenharmony_ci    }
29985db71995Sopenharmony_ci    return disp->CreateDescriptorUpdateTemplate(device, pCreateInfo, pAllocator, pDescriptorUpdateTemplate);
29995db71995Sopenharmony_ci}
30005db71995Sopenharmony_ci
30015db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyDescriptorUpdateTemplate(VkDevice device,
30025db71995Sopenharmony_ci                                                                           VkDescriptorUpdateTemplate descriptorUpdateTemplate,
30035db71995Sopenharmony_ci                                                                           const VkAllocationCallbacks *pAllocator) {
30045db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
30055db71995Sopenharmony_ci    if (NULL == disp) {
30065db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
30075db71995Sopenharmony_ci                   "vkDestroyDescriptorUpdateTemplate: Invalid device [VUID-vkDestroyDescriptorUpdateTemplate-device-parameter]");
30085db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
30095db71995Sopenharmony_ci    }
30105db71995Sopenharmony_ci    disp->DestroyDescriptorUpdateTemplate(device, descriptorUpdateTemplate, pAllocator);
30115db71995Sopenharmony_ci}
30125db71995Sopenharmony_ci
30135db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkUpdateDescriptorSetWithTemplate(VkDevice device, VkDescriptorSet descriptorSet,
30145db71995Sopenharmony_ci                                                                           VkDescriptorUpdateTemplate descriptorUpdateTemplate,
30155db71995Sopenharmony_ci                                                                           const void *pData) {
30165db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
30175db71995Sopenharmony_ci    if (NULL == disp) {
30185db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
30195db71995Sopenharmony_ci                   "vkUpdateDescriptorSetWithTemplate: Invalid device [VUID-vkUpdateDescriptorSetWithTemplate-device-parameter]");
30205db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
30215db71995Sopenharmony_ci    }
30225db71995Sopenharmony_ci    disp->UpdateDescriptorSetWithTemplate(device, descriptorSet, descriptorUpdateTemplate, pData);
30235db71995Sopenharmony_ci}
30245db71995Sopenharmony_ci
30255db71995Sopenharmony_ci// ---- Vulkan core 1.2 trampolines
30265db71995Sopenharmony_ci
30275db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateRenderPass2(VkDevice device, const VkRenderPassCreateInfo2 *pCreateInfo,
30285db71995Sopenharmony_ci                                                                 const VkAllocationCallbacks *pAllocator,
30295db71995Sopenharmony_ci                                                                 VkRenderPass *pRenderPass) {
30305db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
30315db71995Sopenharmony_ci    if (NULL == disp) {
30325db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
30335db71995Sopenharmony_ci                   "vkCreateRenderPass2: Invalid device [VUID-vkCreateRenderPass2-device-parameter]");
30345db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
30355db71995Sopenharmony_ci    }
30365db71995Sopenharmony_ci    return disp->CreateRenderPass2(device, pCreateInfo, pAllocator, pRenderPass);
30375db71995Sopenharmony_ci}
30385db71995Sopenharmony_ci
30395db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdBeginRenderPass2(VkCommandBuffer commandBuffer,
30405db71995Sopenharmony_ci                                                               const VkRenderPassBeginInfo *pRenderPassBegin,
30415db71995Sopenharmony_ci                                                               const VkSubpassBeginInfo *pSubpassBeginInfo) {
30425db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
30435db71995Sopenharmony_ci    if (NULL == disp) {
30445db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
30455db71995Sopenharmony_ci                   "vkCmdBeginRenderPass2: Invalid commandBuffer [VUID-vkCmdBeginRenderPass2-commandBuffer-parameter]");
30465db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
30475db71995Sopenharmony_ci    }
30485db71995Sopenharmony_ci    disp->CmdBeginRenderPass2(commandBuffer, pRenderPassBegin, pSubpassBeginInfo);
30495db71995Sopenharmony_ci}
30505db71995Sopenharmony_ci
30515db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdNextSubpass2(VkCommandBuffer commandBuffer,
30525db71995Sopenharmony_ci                                                           const VkSubpassBeginInfo *pSubpassBeginInfo,
30535db71995Sopenharmony_ci                                                           const VkSubpassEndInfo *pSubpassEndInfo) {
30545db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
30555db71995Sopenharmony_ci    if (NULL == disp) {
30565db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
30575db71995Sopenharmony_ci                   "vkCmdNextSubpass2: Invalid commandBuffer [VUID-vkCmdNextSubpass2-commandBuffer-parameter]");
30585db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
30595db71995Sopenharmony_ci    }
30605db71995Sopenharmony_ci    disp->CmdNextSubpass2(commandBuffer, pSubpassBeginInfo, pSubpassEndInfo);
30615db71995Sopenharmony_ci}
30625db71995Sopenharmony_ci
30635db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdEndRenderPass2(VkCommandBuffer commandBuffer,
30645db71995Sopenharmony_ci                                                             const VkSubpassEndInfo *pSubpassEndInfo) {
30655db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
30665db71995Sopenharmony_ci    if (NULL == disp) {
30675db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
30685db71995Sopenharmony_ci                   "vkCmdEndRenderPass2: Invalid commandBuffer [VUID-vkCmdEndRenderPass2-commandBuffer-parameter]");
30695db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
30705db71995Sopenharmony_ci    }
30715db71995Sopenharmony_ci    disp->CmdEndRenderPass2(commandBuffer, pSubpassEndInfo);
30725db71995Sopenharmony_ci}
30735db71995Sopenharmony_ci
30745db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndirectCount(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
30755db71995Sopenharmony_ci                                                                VkBuffer countBuffer, VkDeviceSize countBufferOffset,
30765db71995Sopenharmony_ci                                                                uint32_t maxDrawCount, uint32_t stride) {
30775db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
30785db71995Sopenharmony_ci    if (NULL == disp) {
30795db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
30805db71995Sopenharmony_ci                   "vkCmdDrawIndirectCount: Invalid commandBuffer [VUID-vkCmdDrawIndirectCount-commandBuffer-parameter]");
30815db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
30825db71995Sopenharmony_ci    }
30835db71995Sopenharmony_ci    disp->CmdDrawIndirectCount(commandBuffer, buffer, offset, countBuffer, countBufferOffset, maxDrawCount, stride);
30845db71995Sopenharmony_ci}
30855db71995Sopenharmony_ci
30865db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndexedIndirectCount(VkCommandBuffer commandBuffer, VkBuffer buffer,
30875db71995Sopenharmony_ci                                                                       VkDeviceSize offset, VkBuffer countBuffer,
30885db71995Sopenharmony_ci                                                                       VkDeviceSize countBufferOffset, uint32_t maxDrawCount,
30895db71995Sopenharmony_ci                                                                       uint32_t stride) {
30905db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
30915db71995Sopenharmony_ci    if (NULL == disp) {
30925db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
30935db71995Sopenharmony_ci                   "vkCmdDrawIndexedIndirectCount: Invalid commandBuffer "
30945db71995Sopenharmony_ci                   "[VUID-vkCmdDrawIndexedIndirectCount-commandBuffer-parameter]");
30955db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
30965db71995Sopenharmony_ci    }
30975db71995Sopenharmony_ci    disp->CmdDrawIndexedIndirectCount(commandBuffer, buffer, offset, countBuffer, countBufferOffset, maxDrawCount, stride);
30985db71995Sopenharmony_ci}
30995db71995Sopenharmony_ci
31005db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetSemaphoreCounterValue(VkDevice device, VkSemaphore semaphore, uint64_t *pValue) {
31015db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
31025db71995Sopenharmony_ci    if (NULL == disp) {
31035db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
31045db71995Sopenharmony_ci                   "vkGetSemaphoreCounterValue: Invalid device [VUID-vkGetSemaphoreCounterValue-device-parameter]");
31055db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
31065db71995Sopenharmony_ci    }
31075db71995Sopenharmony_ci    return disp->GetSemaphoreCounterValue(device, semaphore, pValue);
31085db71995Sopenharmony_ci}
31095db71995Sopenharmony_ci
31105db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkWaitSemaphores(VkDevice device, const VkSemaphoreWaitInfo *pWaitInfo,
31115db71995Sopenharmony_ci                                                              uint64_t timeout) {
31125db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
31135db71995Sopenharmony_ci    if (NULL == disp) {
31145db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
31155db71995Sopenharmony_ci                   "vkWaitSemaphores: Invalid device [VUID-vkWaitSemaphores-device-parameter]");
31165db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
31175db71995Sopenharmony_ci    }
31185db71995Sopenharmony_ci    return disp->WaitSemaphores(device, pWaitInfo, timeout);
31195db71995Sopenharmony_ci}
31205db71995Sopenharmony_ci
31215db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkSignalSemaphore(VkDevice device, const VkSemaphoreSignalInfo *pSignalInfo) {
31225db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
31235db71995Sopenharmony_ci    if (NULL == disp) {
31245db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
31255db71995Sopenharmony_ci                   "vkSignalSemaphore: Invalid device [VUID-vkSignalSemaphore-device-parameter]");
31265db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
31275db71995Sopenharmony_ci    }
31285db71995Sopenharmony_ci    return disp->SignalSemaphore(device, pSignalInfo);
31295db71995Sopenharmony_ci}
31305db71995Sopenharmony_ci
31315db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkDeviceAddress VKAPI_CALL vkGetBufferDeviceAddress(VkDevice device,
31325db71995Sopenharmony_ci                                                                             const VkBufferDeviceAddressInfo *pInfo) {
31335db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
31345db71995Sopenharmony_ci    if (NULL == disp) {
31355db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
31365db71995Sopenharmony_ci                   "vkGetBufferDeviceAddress: Invalid device [VUID-vkGetBufferDeviceAddress-device-parameter]");
31375db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
31385db71995Sopenharmony_ci    }
31395db71995Sopenharmony_ci    return disp->GetBufferDeviceAddress(device, pInfo);
31405db71995Sopenharmony_ci}
31415db71995Sopenharmony_ci
31425db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR uint64_t VKAPI_CALL vkGetBufferOpaqueCaptureAddress(VkDevice device,
31435db71995Sopenharmony_ci                                                                             const VkBufferDeviceAddressInfo *pInfo) {
31445db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
31455db71995Sopenharmony_ci    if (NULL == disp) {
31465db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
31475db71995Sopenharmony_ci                   "vkGetBufferOpaqueCaptureAddress: Invalid device [VUID-vkGetBufferOpaqueCaptureAddress-device-parameter]");
31485db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
31495db71995Sopenharmony_ci    }
31505db71995Sopenharmony_ci    return disp->GetBufferOpaqueCaptureAddress(device, pInfo);
31515db71995Sopenharmony_ci}
31525db71995Sopenharmony_ci
31535db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR uint64_t VKAPI_CALL
31545db71995Sopenharmony_civkGetDeviceMemoryOpaqueCaptureAddress(VkDevice device, const VkDeviceMemoryOpaqueCaptureAddressInfo *pInfo) {
31555db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
31565db71995Sopenharmony_ci    if (NULL == disp) {
31575db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
31585db71995Sopenharmony_ci                   "vkGetDeviceMemoryOpaqueCaptureAddress: Invalid device "
31595db71995Sopenharmony_ci                   "[VUID-vkGetDeviceMemoryOpaqueCaptureAddress-device-parameter]");
31605db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
31615db71995Sopenharmony_ci    }
31625db71995Sopenharmony_ci    return disp->GetDeviceMemoryOpaqueCaptureAddress(device, pInfo);
31635db71995Sopenharmony_ci}
31645db71995Sopenharmony_ci
31655db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkResetQueryPool(VkDevice device, VkQueryPool queryPool, uint32_t firstQuery,
31665db71995Sopenharmony_ci                                                          uint32_t queryCount) {
31675db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
31685db71995Sopenharmony_ci    if (NULL == disp) {
31695db71995Sopenharmony_ci        loader_log(NULL, VULKAN_LOADER_FATAL_ERROR_BIT | VULKAN_LOADER_ERROR_BIT | VULKAN_LOADER_VALIDATION_BIT, 0,
31705db71995Sopenharmony_ci                   "vkResetQueryPool: Invalid device [VUID-vkResetQueryPool-device-parameter]");
31715db71995Sopenharmony_ci        abort(); /* Intentionally fail so user can correct issue. */
31725db71995Sopenharmony_ci    }
31735db71995Sopenharmony_ci    disp->ResetQueryPool(device, queryPool, firstQuery, queryCount);
31745db71995Sopenharmony_ci}
31755db71995Sopenharmony_ci
31765db71995Sopenharmony_ci// ---- Vulkan core 1.3 trampolines
31775db71995Sopenharmony_ci
31785db71995Sopenharmony_ci// Instance
31795db71995Sopenharmony_ci
31805db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceToolProperties(VkPhysicalDevice physicalDevice,
31815db71995Sopenharmony_ci                                                                               uint32_t *pToolCount,
31825db71995Sopenharmony_ci                                                                               VkPhysicalDeviceToolProperties *pToolProperties) {
31835db71995Sopenharmony_ci    VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice);
31845db71995Sopenharmony_ci    const VkLayerInstanceDispatchTable *disp = loader_get_instance_layer_dispatch(physicalDevice);
31855db71995Sopenharmony_ci
31865db71995Sopenharmony_ci    return disp->GetPhysicalDeviceToolProperties(unwrapped_phys_dev, pToolCount, pToolProperties);
31875db71995Sopenharmony_ci}
31885db71995Sopenharmony_ci
31895db71995Sopenharmony_ci// Device
31905db71995Sopenharmony_ci
31915db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdBeginRendering(VkCommandBuffer commandBuffer, const VkRenderingInfo *pRenderingInfo) {
31925db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
31935db71995Sopenharmony_ci    disp->CmdBeginRendering(commandBuffer, pRenderingInfo);
31945db71995Sopenharmony_ci}
31955db71995Sopenharmony_ci
31965db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdBindVertexBuffers2(VkCommandBuffer commandBuffer, uint32_t firstBinding,
31975db71995Sopenharmony_ci                                                                 uint32_t bindingCount, const VkBuffer *pBuffers,
31985db71995Sopenharmony_ci                                                                 const VkDeviceSize *pOffsets, const VkDeviceSize *pSizes,
31995db71995Sopenharmony_ci                                                                 const VkDeviceSize *pStrides) {
32005db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
32015db71995Sopenharmony_ci    disp->CmdBindVertexBuffers2(commandBuffer, firstBinding, bindingCount, pBuffers, pOffsets, pSizes, pStrides);
32025db71995Sopenharmony_ci}
32035db71995Sopenharmony_ci
32045db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdBlitImage2(VkCommandBuffer commandBuffer, const VkBlitImageInfo2 *pBlitImageInfo) {
32055db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
32065db71995Sopenharmony_ci    disp->CmdBlitImage2(commandBuffer, pBlitImageInfo);
32075db71995Sopenharmony_ci}
32085db71995Sopenharmony_ci
32095db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdCopyBuffer2(VkCommandBuffer commandBuffer, const VkCopyBufferInfo2 *pCopyBufferInfo) {
32105db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
32115db71995Sopenharmony_ci    disp->CmdCopyBuffer2(commandBuffer, pCopyBufferInfo);
32125db71995Sopenharmony_ci}
32135db71995Sopenharmony_ci
32145db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdCopyBufferToImage2(VkCommandBuffer commandBuffer,
32155db71995Sopenharmony_ci                                                                 const VkCopyBufferToImageInfo2 *pCopyBufferToImageInfo) {
32165db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
32175db71995Sopenharmony_ci    disp->CmdCopyBufferToImage2(commandBuffer, pCopyBufferToImageInfo);
32185db71995Sopenharmony_ci}
32195db71995Sopenharmony_ci
32205db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdCopyImage2(VkCommandBuffer commandBuffer, const VkCopyImageInfo2 *pCopyImageInfo) {
32215db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
32225db71995Sopenharmony_ci    disp->CmdCopyImage2(commandBuffer, pCopyImageInfo);
32235db71995Sopenharmony_ci}
32245db71995Sopenharmony_ci
32255db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdCopyImageToBuffer2(VkCommandBuffer commandBuffer,
32265db71995Sopenharmony_ci                                                                 const VkCopyImageToBufferInfo2 *pCopyImageToBufferInfo) {
32275db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
32285db71995Sopenharmony_ci    disp->CmdCopyImageToBuffer2(commandBuffer, pCopyImageToBufferInfo);
32295db71995Sopenharmony_ci}
32305db71995Sopenharmony_ci
32315db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdEndRendering(VkCommandBuffer commandBuffer) {
32325db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
32335db71995Sopenharmony_ci    disp->CmdEndRendering(commandBuffer);
32345db71995Sopenharmony_ci}
32355db71995Sopenharmony_ci
32365db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdPipelineBarrier2(VkCommandBuffer commandBuffer,
32375db71995Sopenharmony_ci                                                               const VkDependencyInfo *pDependencyInfo) {
32385db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
32395db71995Sopenharmony_ci    disp->CmdPipelineBarrier2(commandBuffer, pDependencyInfo);
32405db71995Sopenharmony_ci}
32415db71995Sopenharmony_ci
32425db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdResetEvent2(VkCommandBuffer commandBuffer, VkEvent event,
32435db71995Sopenharmony_ci                                                          VkPipelineStageFlags2 stageMask) {
32445db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
32455db71995Sopenharmony_ci    disp->CmdResetEvent2(commandBuffer, event, stageMask);
32465db71995Sopenharmony_ci}
32475db71995Sopenharmony_ci
32485db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdResolveImage2(VkCommandBuffer commandBuffer,
32495db71995Sopenharmony_ci                                                            const VkResolveImageInfo2 *pResolveImageInfo) {
32505db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
32515db71995Sopenharmony_ci    disp->CmdResolveImage2(commandBuffer, pResolveImageInfo);
32525db71995Sopenharmony_ci}
32535db71995Sopenharmony_ci
32545db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdSetCullMode(VkCommandBuffer commandBuffer, VkCullModeFlags cullMode) {
32555db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
32565db71995Sopenharmony_ci    disp->CmdSetCullMode(commandBuffer, cullMode);
32575db71995Sopenharmony_ci}
32585db71995Sopenharmony_ci
32595db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdSetDepthBiasEnable(VkCommandBuffer commandBuffer, VkBool32 depthBiasEnable) {
32605db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
32615db71995Sopenharmony_ci    disp->CmdSetDepthBiasEnable(commandBuffer, depthBiasEnable);
32625db71995Sopenharmony_ci}
32635db71995Sopenharmony_ci
32645db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdSetDepthBoundsTestEnable(VkCommandBuffer commandBuffer,
32655db71995Sopenharmony_ci                                                                       VkBool32 depthBoundsTestEnable) {
32665db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
32675db71995Sopenharmony_ci    disp->CmdSetDepthBoundsTestEnable(commandBuffer, depthBoundsTestEnable);
32685db71995Sopenharmony_ci}
32695db71995Sopenharmony_ci
32705db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdSetDepthCompareOp(VkCommandBuffer commandBuffer, VkCompareOp depthCompareOp) {
32715db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
32725db71995Sopenharmony_ci    disp->CmdSetDepthCompareOp(commandBuffer, depthCompareOp);
32735db71995Sopenharmony_ci}
32745db71995Sopenharmony_ci
32755db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdSetDepthTestEnable(VkCommandBuffer commandBuffer, VkBool32 depthTestEnable) {
32765db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
32775db71995Sopenharmony_ci    disp->CmdSetDepthTestEnable(commandBuffer, depthTestEnable);
32785db71995Sopenharmony_ci}
32795db71995Sopenharmony_ci
32805db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdSetDepthWriteEnable(VkCommandBuffer commandBuffer, VkBool32 depthWriteEnable) {
32815db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
32825db71995Sopenharmony_ci    disp->CmdSetDepthWriteEnable(commandBuffer, depthWriteEnable);
32835db71995Sopenharmony_ci}
32845db71995Sopenharmony_ci
32855db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdSetEvent2(VkCommandBuffer commandBuffer, VkEvent event,
32865db71995Sopenharmony_ci                                                        const VkDependencyInfo *pDependencyInfo) {
32875db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
32885db71995Sopenharmony_ci    disp->CmdSetEvent2(commandBuffer, event, pDependencyInfo);
32895db71995Sopenharmony_ci}
32905db71995Sopenharmony_ci
32915db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdSetFrontFace(VkCommandBuffer commandBuffer, VkFrontFace frontFace) {
32925db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
32935db71995Sopenharmony_ci    disp->CmdSetFrontFace(commandBuffer, frontFace);
32945db71995Sopenharmony_ci}
32955db71995Sopenharmony_ci
32965db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdSetPrimitiveRestartEnable(VkCommandBuffer commandBuffer,
32975db71995Sopenharmony_ci                                                                        VkBool32 primitiveRestartEnable) {
32985db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
32995db71995Sopenharmony_ci    disp->CmdSetPrimitiveRestartEnable(commandBuffer, primitiveRestartEnable);
33005db71995Sopenharmony_ci}
33015db71995Sopenharmony_ci
33025db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdSetPrimitiveTopology(VkCommandBuffer commandBuffer,
33035db71995Sopenharmony_ci                                                                   VkPrimitiveTopology primitiveTopology) {
33045db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
33055db71995Sopenharmony_ci    disp->CmdSetPrimitiveTopology(commandBuffer, primitiveTopology);
33065db71995Sopenharmony_ci}
33075db71995Sopenharmony_ci
33085db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdSetRasterizerDiscardEnable(VkCommandBuffer commandBuffer,
33095db71995Sopenharmony_ci                                                                         VkBool32 rasterizerDiscardEnable) {
33105db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
33115db71995Sopenharmony_ci    disp->CmdSetRasterizerDiscardEnable(commandBuffer, rasterizerDiscardEnable);
33125db71995Sopenharmony_ci}
33135db71995Sopenharmony_ci
33145db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdSetScissorWithCount(VkCommandBuffer commandBuffer, uint32_t scissorCount,
33155db71995Sopenharmony_ci                                                                  const VkRect2D *pScissors) {
33165db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
33175db71995Sopenharmony_ci    disp->CmdSetScissorWithCount(commandBuffer, scissorCount, pScissors);
33185db71995Sopenharmony_ci}
33195db71995Sopenharmony_ci
33205db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdSetStencilOp(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask,
33215db71995Sopenharmony_ci                                                           VkStencilOp failOp, VkStencilOp passOp, VkStencilOp depthFailOp,
33225db71995Sopenharmony_ci                                                           VkCompareOp compareOp) {
33235db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
33245db71995Sopenharmony_ci    disp->CmdSetStencilOp(commandBuffer, faceMask, failOp, passOp, depthFailOp, compareOp);
33255db71995Sopenharmony_ci}
33265db71995Sopenharmony_ci
33275db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdSetStencilTestEnable(VkCommandBuffer commandBuffer, VkBool32 stencilTestEnable) {
33285db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
33295db71995Sopenharmony_ci    disp->CmdSetStencilTestEnable(commandBuffer, stencilTestEnable);
33305db71995Sopenharmony_ci}
33315db71995Sopenharmony_ci
33325db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdSetViewportWithCount(VkCommandBuffer commandBuffer, uint32_t viewportCount,
33335db71995Sopenharmony_ci                                                                   const VkViewport *pViewports) {
33345db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
33355db71995Sopenharmony_ci    disp->CmdSetViewportWithCount(commandBuffer, viewportCount, pViewports);
33365db71995Sopenharmony_ci}
33375db71995Sopenharmony_ci
33385db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdWaitEvents2(VkCommandBuffer commandBuffer, uint32_t eventCount,
33395db71995Sopenharmony_ci                                                          const VkEvent *pEvents, const VkDependencyInfo *pDependencyInfos) {
33405db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
33415db71995Sopenharmony_ci    disp->CmdWaitEvents2(commandBuffer, eventCount, pEvents, pDependencyInfos);
33425db71995Sopenharmony_ci}
33435db71995Sopenharmony_ci
33445db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdWriteTimestamp2(VkCommandBuffer commandBuffer, VkPipelineStageFlags2 stage,
33455db71995Sopenharmony_ci                                                              VkQueryPool queryPool, uint32_t query) {
33465db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
33475db71995Sopenharmony_ci    disp->CmdWriteTimestamp2(commandBuffer, stage, queryPool, query);
33485db71995Sopenharmony_ci}
33495db71995Sopenharmony_ci
33505db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreatePrivateDataSlot(VkDevice device,
33515db71995Sopenharmony_ci                                                                     const VkPrivateDataSlotCreateInfo *pCreateInfo,
33525db71995Sopenharmony_ci                                                                     const VkAllocationCallbacks *pAllocator,
33535db71995Sopenharmony_ci                                                                     VkPrivateDataSlot *pPrivateDataSlot) {
33545db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
33555db71995Sopenharmony_ci    return disp->CreatePrivateDataSlot(device, pCreateInfo, pAllocator, pPrivateDataSlot);
33565db71995Sopenharmony_ci}
33575db71995Sopenharmony_ci
33585db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyPrivateDataSlot(VkDevice device, VkPrivateDataSlot privateDataSlot,
33595db71995Sopenharmony_ci                                                                  const VkAllocationCallbacks *pAllocator) {
33605db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
33615db71995Sopenharmony_ci    disp->DestroyPrivateDataSlot(device, privateDataSlot, pAllocator);
33625db71995Sopenharmony_ci}
33635db71995Sopenharmony_ci
33645db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetDeviceBufferMemoryRequirements(VkDevice device,
33655db71995Sopenharmony_ci                                                                             const VkDeviceBufferMemoryRequirements *pInfo,
33665db71995Sopenharmony_ci                                                                             VkMemoryRequirements2 *pMemoryRequirements) {
33675db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
33685db71995Sopenharmony_ci    disp->GetDeviceBufferMemoryRequirements(device, pInfo, pMemoryRequirements);
33695db71995Sopenharmony_ci}
33705db71995Sopenharmony_ci
33715db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetDeviceImageMemoryRequirements(VkDevice device,
33725db71995Sopenharmony_ci                                                                            const VkDeviceImageMemoryRequirements *pInfo,
33735db71995Sopenharmony_ci                                                                            VkMemoryRequirements2 *pMemoryRequirements) {
33745db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
33755db71995Sopenharmony_ci    disp->GetDeviceImageMemoryRequirements(device, pInfo, pMemoryRequirements);
33765db71995Sopenharmony_ci}
33775db71995Sopenharmony_ci
33785db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetDeviceImageSparseMemoryRequirements(
33795db71995Sopenharmony_ci    VkDevice device, const VkDeviceImageMemoryRequirements *pInfo, uint32_t *pSparseMemoryRequirementCount,
33805db71995Sopenharmony_ci    VkSparseImageMemoryRequirements2 *pSparseMemoryRequirements) {
33815db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
33825db71995Sopenharmony_ci    disp->GetDeviceImageSparseMemoryRequirements(device, pInfo, pSparseMemoryRequirementCount, pSparseMemoryRequirements);
33835db71995Sopenharmony_ci}
33845db71995Sopenharmony_ci
33855db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPrivateData(VkDevice device, VkObjectType objectType, uint64_t objectHandle,
33865db71995Sopenharmony_ci                                                          VkPrivateDataSlot privateDataSlot, uint64_t *pData) {
33875db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
33885db71995Sopenharmony_ci    disp->GetPrivateData(device, objectType, objectHandle, privateDataSlot, pData);
33895db71995Sopenharmony_ci}
33905db71995Sopenharmony_ci
33915db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkSetPrivateData(VkDevice device, VkObjectType objectType, uint64_t objectHandle,
33925db71995Sopenharmony_ci                                                              VkPrivateDataSlot privateDataSlot, uint64_t data) {
33935db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(device);
33945db71995Sopenharmony_ci    return disp->SetPrivateData(device, objectType, objectHandle, privateDataSlot, data);
33955db71995Sopenharmony_ci}
33965db71995Sopenharmony_ci
33975db71995Sopenharmony_ciLOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkQueueSubmit2(VkQueue queue, uint32_t submitCount, const VkSubmitInfo2 *pSubmits,
33985db71995Sopenharmony_ci                                                            VkFence fence) {
33995db71995Sopenharmony_ci    const VkLayerDispatchTable *disp = loader_get_dispatch(queue);
34005db71995Sopenharmony_ci    return disp->QueueSubmit2(queue, submitCount, pSubmits, fence);
34015db71995Sopenharmony_ci}
3402