diff options
author | Mark Lobodzinski <mark@lunarg.com> | 2017-01-26 12:16:30 -0700 |
---|---|---|
committer | Mark Lobodzinski <mark@lunarg.com> | 2017-01-26 13:42:36 -0700 |
commit | bc9caa57c5583dfdf05198e78b78a7cb361da16c (patch) | |
tree | ad617ba03fe14eb47da5e30fe719377abb3abf2f /loader | |
parent | 19895b894b16c64b9a05e63b25be8d562a6c9fb3 (diff) |
repo: Clang-format c/cpp/h LVL files using LLVM
Bring all source files in the repo up to date with consistent
coding style/standard.
Change-Id: Iceedbc17109974d3a0437fc4995441c9ad7e0c23
Diffstat (limited to 'loader')
-rw-r--r-- | loader/cJSON.c | 82 | ||||
-rw-r--r-- | loader/cJSON.h | 56 | ||||
-rw-r--r-- | loader/debug_report.c | 218 | ||||
-rw-r--r-- | loader/debug_report.h | 69 | ||||
-rw-r--r-- | loader/dirent_on_windows.c | 6 | ||||
-rw-r--r-- | loader/extensions.c | 522 | ||||
-rw-r--r-- | loader/extensions.h | 83 | ||||
-rw-r--r-- | loader/gpa_helper.h | 6 | ||||
-rw-r--r-- | loader/loader.c | 2611 | ||||
-rw-r--r-- | loader/loader.h | 426 | ||||
-rw-r--r-- | loader/phys_dev_ext.c | 36 | ||||
-rw-r--r-- | loader/table_ops.h | 526 | ||||
-rw-r--r-- | loader/trampoline.c | 1241 | ||||
-rw-r--r-- | loader/vk_loader_layer.h | 1 | ||||
-rw-r--r-- | loader/vk_loader_platform.h | 193 | ||||
-rw-r--r-- | loader/wsi.c | 1189 | ||||
-rw-r--r-- | loader/wsi.h | 176 |
17 files changed, 2661 insertions, 4780 deletions
diff --git a/loader/cJSON.c b/loader/cJSON.c index e7266c38..9c800e18 100644 --- a/loader/cJSON.c +++ b/loader/cJSON.c @@ -88,9 +88,7 @@ void cJSON_Delete(cJSON *c) { } } -void cJSON_Free(void *p) { - cJSON_free(p); -} +void cJSON_Free(void *p) { cJSON_free(p); } /* Parse the input text to generate a number, and populate the result into item. */ @@ -123,10 +121,9 @@ static const char *parse_number(cJSON *item, const char *num) { subscale = (subscale * 10) + (*num++ - '0'); /* Number? */ } - n = sign * n * - pow(10.0, (scale + subscale * signsubscale)); /* number = +/- - number.fraction * - 10^+/- exponent */ + n = sign * n * pow(10.0, (scale + subscale * signsubscale)); /* number = +/- + number.fraction * + 10^+/- exponent */ item->valuedouble = n; item->valueint = (int)n; @@ -193,13 +190,11 @@ static char *print_number(cJSON *item, printbuffer *p) { str = (char *)cJSON_malloc(2); /* special case for 0. */ if (str) strcpy(str, "0"); - } else if (fabs(((double)item->valueint) - d) <= DBL_EPSILON && - d <= INT_MAX && d >= INT_MIN) { + } else if (fabs(((double)item->valueint) - d) <= DBL_EPSILON && d <= INT_MAX && d >= INT_MIN) { if (p) str = ensure(p, 21); else - str = (char *)cJSON_malloc( - 21); /* 2^64+1 can be represented in 21 chars. */ + str = (char *)cJSON_malloc(21); /* 2^64+1 can be represented in 21 chars. */ if (str) sprintf(str, "%d", item->valueint); } else { @@ -263,8 +258,7 @@ static unsigned parse_hex4(const char *str) { } /* Parse the input text into an unescaped cstring, and populate item. */ -static const unsigned char firstByteMark[7] = {0x00, 0x00, 0xC0, 0xE0, - 0xF0, 0xF8, 0xFC}; +static const unsigned char firstByteMark[7] = {0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC}; static const char *parse_string(cJSON *item, const char *str) { const char *ptr = str + 1; char *ptr2; @@ -280,8 +274,7 @@ static const char *parse_string(cJSON *item, const char *str) { if (*ptr++ == '\\') ptr++; /* Skip escaped quotes. */ - out = (char *)cJSON_malloc( - len + 1); /* This is how long we need for the string, roughly. */ + out = (char *)cJSON_malloc(len + 1); /* This is how long we need for the string, roughly. */ if (!out) return 0; @@ -315,8 +308,7 @@ static const char *parse_string(cJSON *item, const char *str) { if ((uc >= 0xDC00 && uc <= 0xDFFF) || uc == 0) break; /* check for invalid. */ - if (uc >= 0xD800 && - uc <= 0xDBFF) /* UTF16 surrogate pairs. */ + if (uc >= 0xD800 && uc <= 0xDBFF) /* UTF16 surrogate pairs. */ { if (ptr[1] != '\\' || ptr[2] != 'u') break; /* missing second-half of surrogate. */ @@ -375,9 +367,7 @@ static char *print_string_ptr(const char *str, printbuffer *p) { unsigned char token; for (ptr = str; *ptr; ptr++) - flag |= ((*ptr > 0 && *ptr < 32) || (*ptr == '\"') || (*ptr == '\\')) - ? 1 - : 0; + flag |= ((*ptr > 0 && *ptr < 32) || (*ptr == '\"') || (*ptr == '\\')) ? 1 : 0; if (!flag) { len = ptr - str; if (p) @@ -461,9 +451,7 @@ static char *print_string_ptr(const char *str, printbuffer *p) { return out; } /* Invote print_string_ptr (which is useful) on an item. */ -static char *print_string(cJSON *item, printbuffer *p) { - return print_string_ptr(item->valuestring, p); -} +static char *print_string(cJSON *item, printbuffer *p) { return print_string_ptr(item->valuestring, p); } /* Predeclare these prototypes. */ static const char *parse_value(cJSON *item, const char *value); @@ -481,8 +469,7 @@ static const char *skip(const char *in) { } /* Parse an object - create a new root, and populate. */ -cJSON *cJSON_ParseWithOpts(const char *value, const char **return_parse_end, - int require_null_terminated) { +cJSON *cJSON_ParseWithOpts(const char *value, const char **return_parse_end, int require_null_terminated) { const char *end = 0; cJSON *c = cJSON_New_Item(); ep = 0; @@ -510,9 +497,7 @@ cJSON *cJSON_ParseWithOpts(const char *value, const char **return_parse_end, return c; } /* Default options for cJSON_Parse */ -cJSON *cJSON_Parse(const char *value) { - return cJSON_ParseWithOpts(value, 0, 0); -} +cJSON *cJSON_Parse(const char *value) { return cJSON_ParseWithOpts(value, 0, 0); } /* Render a cJSON item/entity/structure to text. */ char *cJSON_Print(cJSON *item) { return print_value(item, 0, 1, 0); } @@ -641,9 +626,8 @@ static const char *parse_array(cJSON *item, const char *value) { item->child = child = cJSON_New_Item(); if (!item->child) - return 0; /* memory fail */ - value = skip( - parse_value(child, skip(value))); /* skip any spacing, get the value. */ + return 0; /* memory fail */ + value = skip(parse_value(child, skip(value))); /* skip any spacing, get the value. */ if (!value) return 0; @@ -800,9 +784,8 @@ static const char *parse_object(cJSON *item, const char *value) { if (*value != ':') { ep = value; return 0; - } /* fail! */ - value = skip(parse_value( - child, skip(value + 1))); /* skip any spacing, get the value. */ + } /* fail! */ + value = skip(parse_value(child, skip(value + 1))); /* skip any spacing, get the value. */ if (!value) return 0; @@ -821,9 +804,8 @@ static const char *parse_object(cJSON *item, const char *value) { if (*value != ':') { ep = value; return 0; - } /* fail! */ - value = skip(parse_value( - child, skip(value + 1))); /* skip any spacing, get the value. */ + } /* fail! */ + value = skip(parse_value(child, skip(value + 1))); /* skip any spacing, get the value. */ if (!value) return 0; } @@ -1076,11 +1058,8 @@ void cJSON_AddItemToObjectCS(cJSON *object, const char *string, cJSON *item) { item->type |= cJSON_StringIsConst; cJSON_AddItemToArray(object, item); } -void cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item) { - cJSON_AddItemToArray(array, create_reference(item)); -} -void cJSON_AddItemReferenceToObject(cJSON *object, const char *string, - cJSON *item) { +void cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item) { cJSON_AddItemToArray(array, create_reference(item)); } +void cJSON_AddItemReferenceToObject(cJSON *object, const char *string, cJSON *item) { cJSON_AddItemToObject(object, string, create_reference(item)); } @@ -1099,9 +1078,7 @@ cJSON *cJSON_DetachItemFromArray(cJSON *array, int which) { c->prev = c->next = 0; return c; } -void cJSON_DeleteItemFromArray(cJSON *array, int which) { - cJSON_Delete(cJSON_DetachItemFromArray(array, which)); -} +void cJSON_DeleteItemFromArray(cJSON *array, int which) { cJSON_Delete(cJSON_DetachItemFromArray(array, which)); } cJSON *cJSON_DetachItemFromObject(cJSON *object, const char *string) { int i = 0; cJSON *c = object->child; @@ -1111,9 +1088,7 @@ cJSON *cJSON_DetachItemFromObject(cJSON *object, const char *string) { return cJSON_DetachItemFromArray(object, i); return 0; } -void cJSON_DeleteItemFromObject(cJSON *object, const char *string) { - cJSON_Delete(cJSON_DetachItemFromObject(object, string)); -} +void cJSON_DeleteItemFromObject(cJSON *object, const char *string) { cJSON_Delete(cJSON_DetachItemFromObject(object, string)); } /* Replace array/object items with new ones. */ void cJSON_InsertItemInArray(cJSON *array, int which, cJSON *newitem) { @@ -1149,8 +1124,7 @@ void cJSON_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem) { c->next = c->prev = 0; cJSON_Delete(c); } -void cJSON_ReplaceItemInObject(cJSON *object, const char *string, - cJSON *newitem) { +void cJSON_ReplaceItemInObject(cJSON *object, const char *string, cJSON *newitem) { int i = 0; cJSON *c = object->child; while (c && strcmp(c->string, string)) @@ -1281,9 +1255,7 @@ cJSON *cJSON_Duplicate(cJSON *item, int recurse) { if (!newitem) return 0; /* Copy over all vars */ - newitem->type = item->type & (~cJSON_IsReference), - newitem->valueint = item->valueint, - newitem->valuedouble = item->valuedouble; + newitem->type = item->type & (~cJSON_IsReference), newitem->valueint = item->valueint, newitem->valuedouble = item->valuedouble; if (item->valuestring) { newitem->valuestring = cJSON_strdup(item->valuestring); if (!newitem->valuestring) { @@ -1304,9 +1276,7 @@ cJSON *cJSON_Duplicate(cJSON *item, int recurse) { /* Walk the ->next chain for the child. */ cptr = item->child; while (cptr) { - newchild = cJSON_Duplicate( - cptr, - 1); /* Duplicate (with recurse) each item in the ->next chain */ + newchild = cJSON_Duplicate(cptr, 1); /* Duplicate (with recurse) each item in the ->next chain */ if (!newchild) { cJSON_Delete(newitem); return 0; diff --git a/loader/cJSON.h b/loader/cJSON.h index cab30515..f0059abd 100644 --- a/loader/cJSON.h +++ b/loader/cJSON.h @@ -47,9 +47,9 @@ typedef struct cJSON { struct cJSON *next, *prev; /* next/prev allow you to walk array/object chains. Alternatively, use GetArraySize/GetArrayItem/GetObjectItem */ - struct cJSON *child; /* An array or object item will have a child pointer - pointing to a chain of the items in the - array/object. */ + struct cJSON *child; /* An array or object item will have a child pointer + pointing to a chain of the items in the + array/object. */ int type; /* The type of the item, as above. */ @@ -118,19 +118,16 @@ extern cJSON *cJSON_CreateStringArray(const char **strings, int count); /* Append item to the specified array/object. */ extern void cJSON_AddItemToArray(cJSON *array, cJSON *item); -extern void cJSON_AddItemToObject(cJSON *object, const char *string, - cJSON *item); -extern void cJSON_AddItemToObjectCS( - cJSON *object, const char *string, - cJSON *item); /* Use this when string is definitely const (i.e. a literal, - or as good as), and will definitely survive the cJSON - object */ +extern void cJSON_AddItemToObject(cJSON *object, const char *string, cJSON *item); +extern void cJSON_AddItemToObjectCS(cJSON *object, const char *string, + cJSON *item); /* Use this when string is definitely const (i.e. a literal, + or as good as), and will definitely survive the cJSON + object */ /* Append reference to item to the specified array/object. Use this when you * want to add an existing cJSON to a new cJSON, but don't want to corrupt your * existing cJSON. */ extern void cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item); -extern void cJSON_AddItemReferenceToObject(cJSON *object, const char *string, - cJSON *item); +extern void cJSON_AddItemReferenceToObject(cJSON *object, const char *string, cJSON *item); /* Remove/Detatch items from Arrays/Objects. */ extern cJSON *cJSON_DetachItemFromArray(cJSON *array, int which); @@ -139,12 +136,9 @@ extern cJSON *cJSON_DetachItemFromObject(cJSON *object, const char *string); extern void cJSON_DeleteItemFromObject(cJSON *object, const char *string); /* Update array items. */ -extern void cJSON_InsertItemInArray( - cJSON *array, int which, - cJSON *newitem); /* Shifts pre-existing items to the right. */ +extern void cJSON_InsertItemInArray(cJSON *array, int which, cJSON *newitem); /* Shifts pre-existing items to the right. */ extern void cJSON_ReplaceItemInArray(cJSON *array, int which, cJSON *newitem); -extern void cJSON_ReplaceItemInObject(cJSON *object, const char *string, - cJSON *newitem); +extern void cJSON_ReplaceItemInObject(cJSON *object, const char *string, cJSON *newitem); /* Duplicate a cJSON item */ extern cJSON *cJSON_Duplicate(cJSON *item, int recurse); @@ -156,32 +150,22 @@ The item->next and ->prev pointers are always zero on return from Duplicate. */ /* ParseWithOpts allows you to require (and check) that the JSON is null * terminated, and to retrieve the pointer to the final byte parsed. */ -extern cJSON *cJSON_ParseWithOpts(const char *value, - const char **return_parse_end, - int require_null_terminated); +extern cJSON *cJSON_ParseWithOpts(const char *value, const char **return_parse_end, int require_null_terminated); extern void cJSON_Minify(char *json); /* Macros for creating things quickly. */ -#define cJSON_AddNullToObject(object, name) \ - cJSON_AddItemToObject(object, name, cJSON_CreateNull()) -#define cJSON_AddTrueToObject(object, name) \ - cJSON_AddItemToObject(object, name, cJSON_CreateTrue()) -#define cJSON_AddFalseToObject(object, name) \ - cJSON_AddItemToObject(object, name, cJSON_CreateFalse()) -#define cJSON_AddBoolToObject(object, name, b) \ - cJSON_AddItemToObject(object, name, cJSON_CreateBool(b)) -#define cJSON_AddNumberToObject(object, name, n) \ - cJSON_AddItemToObject(object, name, cJSON_CreateNumber(n)) -#define cJSON_AddStringToObject(object, name, s) \ - cJSON_AddItemToObject(object, name, cJSON_CreateString(s)) +#define cJSON_AddNullToObject(object, name) cJSON_AddItemToObject(object, name, cJSON_CreateNull()) +#define cJSON_AddTrueToObject(object, name) cJSON_AddItemToObject(object, name, cJSON_CreateTrue()) +#define cJSON_AddFalseToObject(object, name) cJSON_AddItemToObject(object, name, cJSON_CreateFalse()) +#define cJSON_AddBoolToObject(object, name, b) cJSON_AddItemToObject(object, name, cJSON_CreateBool(b)) +#define cJSON_AddNumberToObject(object, name, n) cJSON_AddItemToObject(object, name, cJSON_CreateNumber(n)) +#define cJSON_AddStringToObject(object, name, s) cJSON_AddItemToObject(object, name, cJSON_CreateString(s)) /* When assigning an integer value, it needs to be propagated to valuedouble * too. */ -#define cJSON_SetIntValue(object, val) \ - ((object) ? (object)->valueint = (object)->valuedouble = (val) : (val)) -#define cJSON_SetNumberValue(object, val) \ - ((object) ? (object)->valueint = (object)->valuedouble = (val) : (val)) +#define cJSON_SetIntValue(object, val) ((object) ? (object)->valueint = (object)->valuedouble = (val) : (val)) +#define cJSON_SetNumberValue(object, val) ((object) ? (object)->valueint = (object)->valuedouble = (val) : (val)) #ifdef __cplusplus } diff --git a/loader/debug_report.c b/loader/debug_report.c index bf9ff411..84b85492 100644 --- a/loader/debug_report.c +++ b/loader/debug_report.c @@ -37,50 +37,38 @@ typedef void(VKAPI_PTR *PFN_stringCallback)(char *message); static const VkExtensionProperties debug_report_extension_info = { - .extensionName = VK_EXT_DEBUG_REPORT_EXTENSION_NAME, - .specVersion = VK_EXT_DEBUG_REPORT_SPEC_VERSION, + .extensionName = VK_EXT_DEBUG_REPORT_EXTENSION_NAME, .specVersion = VK_EXT_DEBUG_REPORT_SPEC_VERSION, }; -void debug_report_add_instance_extensions( - const struct loader_instance *inst, - struct loader_extension_list *ext_list) { +void debug_report_add_instance_extensions(const struct loader_instance *inst, struct loader_extension_list *ext_list) { loader_add_to_ext_list(inst, ext_list, 1, &debug_report_extension_info); } -void debug_report_create_instance(struct loader_instance *ptr_instance, - const VkInstanceCreateInfo *pCreateInfo) { +void debug_report_create_instance(struct loader_instance *ptr_instance, const VkInstanceCreateInfo *pCreateInfo) { ptr_instance->enabled_known_extensions.ext_debug_report = 0; for (uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; i++) { - if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], - VK_EXT_DEBUG_REPORT_EXTENSION_NAME) == 0) { + if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_EXT_DEBUG_REPORT_EXTENSION_NAME) == 0) { ptr_instance->enabled_known_extensions.ext_debug_report = 1; return; } } } -VkResult -util_CreateDebugReportCallback(struct loader_instance *inst, - VkDebugReportCallbackCreateInfoEXT *pCreateInfo, - const VkAllocationCallbacks *pAllocator, - VkDebugReportCallbackEXT callback) { +VkResult util_CreateDebugReportCallback(struct loader_instance *inst, VkDebugReportCallbackCreateInfoEXT *pCreateInfo, + const VkAllocationCallbacks *pAllocator, VkDebugReportCallbackEXT callback) { VkLayerDbgFunctionNode *pNewDbgFuncNode = NULL; #if (DEBUG_DISABLE_APP_ALLOCATORS == 1) { #else if (pAllocator != NULL) { - pNewDbgFuncNode = - (VkLayerDbgFunctionNode *)pAllocator->pfnAllocation( - pAllocator->pUserData, sizeof(VkLayerDbgFunctionNode), - sizeof(int *), VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); + pNewDbgFuncNode = (VkLayerDbgFunctionNode *)pAllocator->pfnAllocation(pAllocator->pUserData, sizeof(VkLayerDbgFunctionNode), + sizeof(int *), VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); } else { #endif - pNewDbgFuncNode = - (VkLayerDbgFunctionNode *)loader_instance_heap_alloc( - inst, sizeof(VkLayerDbgFunctionNode), - VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); + pNewDbgFuncNode = (VkLayerDbgFunctionNode *)loader_instance_heap_alloc(inst, sizeof(VkLayerDbgFunctionNode), + VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); } if (!pNewDbgFuncNode) { return VK_ERROR_OUT_OF_HOST_MEMORY; @@ -97,32 +85,24 @@ util_CreateDebugReportCallback(struct loader_instance *inst, return VK_SUCCESS; } -static VKAPI_ATTR VkResult VKAPI_CALL debug_report_CreateDebugReportCallbackEXT( - VkInstance instance, const VkDebugReportCallbackCreateInfoEXT *pCreateInfo, - const VkAllocationCallbacks *pAllocator, - VkDebugReportCallbackEXT *pCallback) { +static VKAPI_ATTR VkResult VKAPI_CALL +debug_report_CreateDebugReportCallbackEXT(VkInstance instance, const VkDebugReportCallbackCreateInfoEXT *pCreateInfo, + const VkAllocationCallbacks *pAllocator, VkDebugReportCallbackEXT *pCallback) { struct loader_instance *inst = loader_get_instance(instance); loader_platform_thread_lock_mutex(&loader_lock); - VkResult result = inst->disp->layer_inst_disp.CreateDebugReportCallbackEXT( - instance, pCreateInfo, pAllocator, pCallback); + VkResult result = inst->disp->layer_inst_disp.CreateDebugReportCallbackEXT(instance, pCreateInfo, pAllocator, pCallback); loader_platform_thread_unlock_mutex(&loader_lock); return result; } // Utility function to handle reporting -VkBool32 util_DebugReportMessage(const struct loader_instance *inst, - VkFlags msgFlags, - VkDebugReportObjectTypeEXT objectType, - uint64_t srcObject, size_t location, - int32_t msgCode, const char *pLayerPrefix, - const char *pMsg) { +VkBool32 util_DebugReportMessage(const struct loader_instance *inst, VkFlags msgFlags, VkDebugReportObjectTypeEXT objectType, + uint64_t srcObject, size_t location, int32_t msgCode, const char *pLayerPrefix, const char *pMsg) { VkBool32 bail = false; VkLayerDbgFunctionNode *pTrav = inst->DbgFunctionHead; while (pTrav) { if (pTrav->msgFlags & msgFlags) { - if (pTrav->pfnMsgCallback(msgFlags, objectType, srcObject, location, - msgCode, pLayerPrefix, pMsg, - pTrav->pUserData)) { + if (pTrav->pfnMsgCallback(msgFlags, objectType, srcObject, location, msgCode, pLayerPrefix, pMsg, pTrav->pUserData)) { bail = true; } } @@ -132,8 +112,7 @@ VkBool32 util_DebugReportMessage(const struct loader_instance *inst, return bail; } -void util_DestroyDebugReportCallback(struct loader_instance *inst, - VkDebugReportCallbackEXT callback, +void util_DestroyDebugReportCallback(struct loader_instance *inst, VkDebugReportCallbackEXT callback, const VkAllocationCallbacks *pAllocator) { VkLayerDbgFunctionNode *pTrav = inst->DbgFunctionHead; VkLayerDbgFunctionNode *pPrev = pTrav; @@ -164,10 +143,8 @@ void util_DestroyDebugReportCallback(struct loader_instance *inst, // then allocates array that can hold that many structs, as well as that many // VkDebugReportCallbackEXT handles. It then copies each // VkDebugReportCallbackCreateInfoEXT, and initializes each handle. -VkResult util_CopyDebugReportCreateInfos( - const void *pChain, const VkAllocationCallbacks *pAllocator, - uint32_t *num_callbacks, VkDebugReportCallbackCreateInfoEXT **infos, - VkDebugReportCallbackEXT **callbacks) { +VkResult util_CopyDebugReportCreateInfos(const void *pChain, const VkAllocationCallbacks *pAllocator, uint32_t *num_callbacks, + VkDebugReportCallbackCreateInfoEXT **infos, VkDebugReportCallbackEXT **callbacks) { uint32_t n = *num_callbacks = 0; VkDebugReportCallbackCreateInfoEXT *pInfos = NULL; VkDebugReportCallbackEXT *pCallbacks = NULL; @@ -178,8 +155,7 @@ VkResult util_CopyDebugReportCreateInfos( const void *pNext = pChain; while (pNext) { // 1st, count the number VkDebugReportCallbackCreateInfoEXT: - if (((VkDebugReportCallbackCreateInfoEXT *)pNext)->sType == - VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT) { + if (((VkDebugReportCallbackCreateInfoEXT *)pNext)->sType == VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT) { n++; } pNext = (void *)((VkDebugReportCallbackCreateInfoEXT *)pNext)->pNext; @@ -193,15 +169,12 @@ VkResult util_CopyDebugReportCreateInfos( { #else if (pAllocator != NULL) { - pInfos = *infos = - ((VkDebugReportCallbackCreateInfoEXT *)pAllocator->pfnAllocation( - pAllocator->pUserData, - n * sizeof(VkDebugReportCallbackCreateInfoEXT), sizeof(void *), - VK_SYSTEM_ALLOCATION_SCOPE_OBJECT)); + pInfos = *infos = ((VkDebugReportCallbackCreateInfoEXT *)pAllocator->pfnAllocation( + pAllocator->pUserData, n * sizeof(VkDebugReportCallbackCreateInfoEXT), sizeof(void *), + VK_SYSTEM_ALLOCATION_SCOPE_OBJECT)); } else { #endif - pInfos = *infos = ((VkDebugReportCallbackCreateInfoEXT *)malloc( - n * sizeof(VkDebugReportCallbackCreateInfoEXT))); + pInfos = *infos = ((VkDebugReportCallbackCreateInfoEXT *)malloc(n * sizeof(VkDebugReportCallbackCreateInfoEXT))); } if (!pInfos) { return VK_ERROR_OUT_OF_HOST_MEMORY; @@ -211,18 +184,15 @@ VkResult util_CopyDebugReportCreateInfos( { #else if (pAllocator != NULL) { - pCallbacks = *callbacks = - ((VkDebugReportCallbackEXT *)pAllocator->pfnAllocation( - pAllocator->pUserData, n * sizeof(VkDebugReportCallbackEXT), - sizeof(void *), VK_SYSTEM_ALLOCATION_SCOPE_OBJECT)); + pCallbacks = *callbacks = ((VkDebugReportCallbackEXT *)pAllocator->pfnAllocation( + pAllocator->pUserData, n * sizeof(VkDebugReportCallbackEXT), sizeof(void *), VK_SYSTEM_ALLOCATION_SCOPE_OBJECT)); if (!pCallbacks) { pAllocator->pfnFree(pAllocator->pUserData, pInfos); return VK_ERROR_OUT_OF_HOST_MEMORY; } } else { #endif - pCallbacks = *callbacks = ((VkDebugReportCallbackEXT *)malloc( - n * sizeof(VkDebugReportCallbackEXT))); + pCallbacks = *callbacks = ((VkDebugReportCallbackEXT *)malloc(n * sizeof(VkDebugReportCallbackEXT))); if (!pCallbacks) { free(pInfos); return VK_ERROR_OUT_OF_HOST_MEMORY; @@ -233,8 +203,7 @@ VkResult util_CopyDebugReportCreateInfos( // use the address of the copied VkDebugReportCallbackCreateInfoEXT): pNext = pChain; while (pNext) { - if (((VkInstanceCreateInfo *)pNext)->sType == - VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT) { + if (((VkInstanceCreateInfo *)pNext)->sType == VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT) { memcpy(pInfos, pNext, sizeof(VkDebugReportCallbackCreateInfoEXT)); *pCallbacks++ = (VkDebugReportCallbackEXT)(uintptr_t)pInfos++; } @@ -245,15 +214,14 @@ VkResult util_CopyDebugReportCreateInfos( return VK_SUCCESS; } -void util_FreeDebugReportCreateInfos(const VkAllocationCallbacks *pAllocator, - VkDebugReportCallbackCreateInfoEXT *infos, +void util_FreeDebugReportCreateInfos(const VkAllocationCallbacks *pAllocator, VkDebugReportCallbackCreateInfoEXT *infos, VkDebugReportCallbackEXT *callbacks) { #if (DEBUG_DISABLE_APP_ALLOCATORS == 1) - { + { #else if (pAllocator != NULL) { - pAllocator->pfnFree(pAllocator->pUserData, infos); - pAllocator->pfnFree(pAllocator->pUserData, callbacks); + pAllocator->pfnFree(pAllocator->pUserData, infos); + pAllocator->pfnFree(pAllocator->pUserData, callbacks); } else { #endif free(infos); @@ -261,14 +229,12 @@ void util_FreeDebugReportCreateInfos(const VkAllocationCallbacks *pAllocator, } } -VkResult util_CreateDebugReportCallbacks( - struct loader_instance *inst, const VkAllocationCallbacks *pAllocator, - uint32_t num_callbacks, VkDebugReportCallbackCreateInfoEXT *infos, - VkDebugReportCallbackEXT *callbacks) { +VkResult util_CreateDebugReportCallbacks(struct loader_instance *inst, const VkAllocationCallbacks *pAllocator, + uint32_t num_callbacks, VkDebugReportCallbackCreateInfoEXT *infos, + VkDebugReportCallbackEXT *callbacks) { VkResult rtn = VK_SUCCESS; for (uint32_t i = 0; i < num_callbacks; i++) { - rtn = util_CreateDebugReportCallback(inst, &infos[i], pAllocator, - callbacks[i]); + rtn = util_CreateDebugReportCallback(inst, &infos[i], pAllocator, callbacks[i]); if (rtn != VK_SUCCESS) { for (uint32_t j = 0; j < i; j++) { util_DestroyDebugReportCallback(inst, callbacks[j], pAllocator); @@ -279,39 +245,32 @@ VkResult util_CreateDebugReportCallbacks( return rtn; } -void util_DestroyDebugReportCallbacks(struct loader_instance *inst, - const VkAllocationCallbacks *pAllocator, - uint32_t num_callbacks, +void util_DestroyDebugReportCallbacks(struct loader_instance *inst, const VkAllocationCallbacks *pAllocator, uint32_t num_callbacks, VkDebugReportCallbackEXT *callbacks) { for (uint32_t i = 0; i < num_callbacks; i++) { util_DestroyDebugReportCallback(inst, callbacks[i], pAllocator); } } -static VKAPI_ATTR void VKAPI_CALL -debug_report_DestroyDebugReportCallbackEXT( - VkInstance instance, VkDebugReportCallbackEXT callback, - const VkAllocationCallbacks *pAllocator) { +static VKAPI_ATTR void VKAPI_CALL debug_report_DestroyDebugReportCallbackEXT(VkInstance instance, VkDebugReportCallbackEXT callback, + const VkAllocationCallbacks *pAllocator) { struct loader_instance *inst = loader_get_instance(instance); loader_platform_thread_lock_mutex(&loader_lock); - inst->disp->layer_inst_disp.DestroyDebugReportCallbackEXT( - instance, callback, pAllocator); + inst->disp->layer_inst_disp.DestroyDebugReportCallbackEXT(instance, callback, pAllocator); util_DestroyDebugReportCallback(inst, callback, pAllocator); loader_platform_thread_unlock_mutex(&loader_lock); } -static VKAPI_ATTR void VKAPI_CALL debug_report_DebugReportMessageEXT( - VkInstance instance, VkDebugReportFlagsEXT flags, - VkDebugReportObjectTypeEXT objType, uint64_t object, size_t location, - int32_t msgCode, const char *pLayerPrefix, const char *pMsg) { +static VKAPI_ATTR void VKAPI_CALL debug_report_DebugReportMessageEXT(VkInstance instance, VkDebugReportFlagsEXT flags, + VkDebugReportObjectTypeEXT objType, uint64_t object, + size_t location, int32_t msgCode, const char *pLayerPrefix, + const char *pMsg) { struct loader_instance *inst = loader_get_instance(instance); - inst->disp->layer_inst_disp.DebugReportMessageEXT( - instance, flags, objType, object, location, msgCode, pLayerPrefix, - pMsg); + inst->disp->layer_inst_disp.DebugReportMessageEXT(instance, flags, objType, object, location, msgCode, pLayerPrefix, pMsg); } /* @@ -319,10 +278,10 @@ static VKAPI_ATTR void VKAPI_CALL debug_report_DebugReportMessageEXT( * for CreateDebugReportCallback */ -VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDebugReportCallback( - VkInstance instance, const VkDebugReportCallbackCreateInfoEXT *pCreateInfo, - const VkAllocationCallbacks *pAllocator, - VkDebugReportCallbackEXT *pCallback) { +VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDebugReportCallback(VkInstance instance, + const VkDebugReportCallbackCreateInfoEXT *pCreateInfo, + const VkAllocationCallbacks *pAllocator, + VkDebugReportCallbackEXT *pCallback) { VkDebugReportCallbackEXT *icd_info = NULL; const struct loader_icd_term *icd_term; struct loader_instance *inst = (struct loader_instance *)instance; @@ -334,18 +293,15 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDebugReportCallback( { #else if (pAllocator != NULL) { - icd_info = ((VkDebugReportCallbackEXT *)pAllocator->pfnAllocation( - pAllocator->pUserData, - inst->total_icd_count * sizeof(VkDebugReportCallbackEXT), - sizeof(void *), VK_SYSTEM_ALLOCATION_SCOPE_OBJECT)); + icd_info = ((VkDebugReportCallbackEXT *)pAllocator->pfnAllocation(pAllocator->pUserData, + inst->total_icd_count * sizeof(VkDebugReportCallbackEXT), + sizeof(void *), VK_SYSTEM_ALLOCATION_SCOPE_OBJECT)); if (icd_info) { - memset(icd_info, 0, - inst->total_icd_count * sizeof(VkDebugReportCallbackEXT)); + memset(icd_info, 0, inst->total_icd_count * sizeof(VkDebugReportCallbackEXT)); } } else { #endif - icd_info = - calloc(sizeof(VkDebugReportCallbackEXT), inst->total_icd_count); + icd_info = calloc(sizeof(VkDebugReportCallbackEXT), inst->total_icd_count); } if (!icd_info) { res = VK_ERROR_OUT_OF_HOST_MEMORY; @@ -358,9 +314,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDebugReportCallback( continue; } - res = icd_term->CreateDebugReportCallbackEXT(icd_term->instance, - pCreateInfo, pAllocator, - &icd_info[storage_idx]); + res = icd_term->CreateDebugReportCallbackEXT(icd_term->instance, pCreateInfo, pAllocator, &icd_info[storage_idx]); if (res != VK_SUCCESS) { goto out; @@ -368,23 +322,19 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDebugReportCallback( storage_idx++; } - // Setup the debug report callback in the terminator since a layer may want - // to grab the information itself (RenderDoc) and then return back to the - // user callback a sub-set of the messages. +// Setup the debug report callback in the terminator since a layer may want +// to grab the information itself (RenderDoc) and then return back to the +// user callback a sub-set of the messages. #if (DEBUG_DISABLE_APP_ALLOCATORS == 0) if (pAllocator != NULL) { - pNewDbgFuncNode = - (VkLayerDbgFunctionNode *)pAllocator->pfnAllocation( - pAllocator->pUserData, sizeof(VkLayerDbgFunctionNode), - sizeof(int *), VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); + pNewDbgFuncNode = (VkLayerDbgFunctionNode *)pAllocator->pfnAllocation(pAllocator->pUserData, sizeof(VkLayerDbgFunctionNode), + sizeof(int *), VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); } else { #else { #endif - pNewDbgFuncNode = - (VkLayerDbgFunctionNode *)loader_instance_heap_alloc( - inst, sizeof(VkLayerDbgFunctionNode), - VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); + pNewDbgFuncNode = (VkLayerDbgFunctionNode *)loader_instance_heap_alloc(inst, sizeof(VkLayerDbgFunctionNode), + VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); } if (!pNewDbgFuncNode) { res = VK_ERROR_OUT_OF_HOST_MEMORY; @@ -412,8 +362,7 @@ out: } if (icd_info && icd_info[storage_idx]) { - icd_term->DestroyDebugReportCallbackEXT( - icd_term->instance, icd_info[storage_idx], pAllocator); + icd_term->DestroyDebugReportCallbackEXT(icd_term->instance, icd_info[storage_idx], pAllocator); } storage_idx++; } @@ -446,9 +395,8 @@ out: * This is the instance chain terminator function * for DestroyDebugReportCallback */ -VKAPI_ATTR void VKAPI_CALL terminator_DestroyDebugReportCallback( - VkInstance instance, VkDebugReportCallbackEXT callback, - const VkAllocationCallbacks *pAllocator) { +VKAPI_ATTR void VKAPI_CALL terminator_DestroyDebugReportCallback(VkInstance instance, VkDebugReportCallbackEXT callback, + const VkAllocationCallbacks *pAllocator) { uint32_t storage_idx; VkDebugReportCallbackEXT *icd_info; const struct loader_icd_term *icd_term; @@ -462,8 +410,7 @@ VKAPI_ATTR void VKAPI_CALL terminator_DestroyDebugReportCallback( } if (icd_info[storage_idx]) { - icd_term->DestroyDebugReportCallbackEXT( - icd_term->instance, icd_info[storage_idx], pAllocator); + icd_term->DestroyDebugReportCallbackEXT(icd_term->instance, icd_info[storage_idx], pAllocator); } storage_idx++; } @@ -483,10 +430,9 @@ VKAPI_ATTR void VKAPI_CALL terminator_DestroyDebugReportCallback( * This is the instance chain terminator function * for DebugReportMessage */ -VKAPI_ATTR void VKAPI_CALL terminator_DebugReportMessage( - VkInstance instance, VkDebugReportFlagsEXT flags, - VkDebugReportObjectTypeEXT objType, uint64_t object, size_t location, - int32_t msgCode, const char *pLayerPrefix, const char *pMsg) { +VKAPI_ATTR void VKAPI_CALL terminator_DebugReportMessage(VkInstance instance, VkDebugReportFlagsEXT flags, + VkDebugReportObjectTypeEXT objType, uint64_t object, size_t location, + int32_t msgCode, const char *pLayerPrefix, const char *pMsg) { const struct loader_icd_term *icd_term; struct loader_instance *inst = (struct loader_instance *)instance; @@ -494,9 +440,7 @@ VKAPI_ATTR void VKAPI_CALL terminator_DebugReportMessage( loader_platform_thread_lock_mutex(&loader_lock); for (icd_term = inst->icd_terms; icd_term; icd_term = icd_term->next) { if (icd_term->DebugReportMessageEXT != NULL) { - icd_term->DebugReportMessageEXT(icd_term->instance, flags, objType, - object, location, msgCode, - pLayerPrefix, pMsg); + icd_term->DebugReportMessageEXT(icd_term->instance, flags, objType, object, location, msgCode, pLayerPrefix, pMsg); } } @@ -506,34 +450,28 @@ VKAPI_ATTR void VKAPI_CALL terminator_DebugReportMessage( * point. */ - util_DebugReportMessage(inst, flags, objType, object, location, msgCode, - pLayerPrefix, pMsg); + util_DebugReportMessage(inst, flags, objType, object, location, msgCode, pLayerPrefix, pMsg); loader_platform_thread_unlock_mutex(&loader_lock); } -bool debug_report_instance_gpa(struct loader_instance *ptr_instance, - const char *name, void **addr) { +bool debug_report_instance_gpa(struct loader_instance *ptr_instance, const char *name, void **addr) { // debug_report is currently advertised to be supported by the loader, // so always return the entry points if name matches and it's enabled *addr = NULL; if (!strcmp("vkCreateDebugReportCallbackEXT", name)) { - *addr = (ptr_instance->enabled_known_extensions.ext_debug_report == 1) - ? (void *)debug_report_CreateDebugReportCallbackEXT - : NULL; + *addr = (ptr_instance->enabled_known_extensions.ext_debug_report == 1) ? (void *)debug_report_CreateDebugReportCallbackEXT + : NULL; return true; } if (!strcmp("vkDestroyDebugReportCallbackEXT", name)) { - *addr = (ptr_instance->enabled_known_extensions.ext_debug_report == 1) - ? (void *)debug_report_DestroyDebugReportCallbackEXT - : NULL; + *addr = (ptr_instance->enabled_known_extensions.ext_debug_report == 1) ? (void *)debug_report_DestroyDebugReportCallbackEXT + : NULL; return true; } if (!strcmp("vkDebugReportMessageEXT", name)) { - *addr = (ptr_instance->enabled_known_extensions.ext_debug_report == 1) - ? (void *)debug_report_DebugReportMessageEXT - : NULL; + *addr = (ptr_instance->enabled_known_extensions.ext_debug_report == 1) ? (void *)debug_report_DebugReportMessageEXT : NULL; return true; } return false; diff --git a/loader/debug_report.h b/loader/debug_report.h index 7a659d03..425811f2 100644 --- a/loader/debug_report.h +++ b/loader/debug_report.h @@ -100,61 +100,40 @@ * Any reports generated after this will only have MsgCallbackObject2 available. */ -void debug_report_add_instance_extensions( - const struct loader_instance *inst, struct loader_extension_list *ext_list); +void debug_report_add_instance_extensions(const struct loader_instance *inst, struct loader_extension_list *ext_list); -void debug_report_create_instance(struct loader_instance *ptr_instance, - const VkInstanceCreateInfo *pCreateInfo); +void debug_report_create_instance(struct loader_instance *ptr_instance, const VkInstanceCreateInfo *pCreateInfo); -bool debug_report_instance_gpa(struct loader_instance *ptr_instance, - const char *name, void **addr); +bool debug_report_instance_gpa(struct loader_instance *ptr_instance, const char *name, void **addr); -VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDebugReportCallback( - VkInstance instance, const VkDebugReportCallbackCreateInfoEXT *pCreateInfo, - const VkAllocationCallbacks *pAllocator, - VkDebugReportCallbackEXT *pCallback); +VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDebugReportCallback(VkInstance instance, + const VkDebugReportCallbackCreateInfoEXT *pCreateInfo, + const VkAllocationCallbacks *pAllocator, + VkDebugReportCallbackEXT *pCallback); -VKAPI_ATTR void VKAPI_CALL -terminator_DestroyDebugReportCallback(VkInstance instance, - VkDebugReportCallbackEXT callback, - const VkAllocationCallbacks *pAllocator); +VKAPI_ATTR void VKAPI_CALL terminator_DestroyDebugReportCallback(VkInstance instance, VkDebugReportCallbackEXT callback, + const VkAllocationCallbacks *pAllocator); -VKAPI_ATTR void VKAPI_CALL -terminator_DebugReportMessage(VkInstance instance, VkDebugReportFlagsEXT flags, - VkDebugReportObjectTypeEXT objType, - uint64_t object, size_t location, int32_t msgCode, - const char *pLayerPrefix, const char *pMsg); +VKAPI_ATTR void VKAPI_CALL terminator_DebugReportMessage(VkInstance instance, VkDebugReportFlagsEXT flags, + VkDebugReportObjectTypeEXT objType, uint64_t object, size_t location, + int32_t msgCode, const char *pLayerPrefix, const char *pMsg); -VkResult -util_CreateDebugReportCallback(struct loader_instance *inst, - VkDebugReportCallbackCreateInfoEXT *pCreateInfo, - const VkAllocationCallbacks *pAllocator, - VkDebugReportCallbackEXT callback); +VkResult util_CreateDebugReportCallback(struct loader_instance *inst, VkDebugReportCallbackCreateInfoEXT *pCreateInfo, + const VkAllocationCallbacks *pAllocator, VkDebugReportCallbackEXT callback); -void util_DestroyDebugReportCallback(struct loader_instance *inst, - VkDebugReportCallbackEXT callback, +void util_DestroyDebugReportCallback(struct loader_instance *inst, VkDebugReportCallbackEXT callback, const VkAllocationCallbacks *pAllocator); -VkResult util_CopyDebugReportCreateInfos( - const void *pChain, const VkAllocationCallbacks *pAllocator, - uint32_t *num_callbacks, VkDebugReportCallbackCreateInfoEXT **infos, - VkDebugReportCallbackEXT **callbacks); -void util_FreeDebugReportCreateInfos(const VkAllocationCallbacks *pAllocator, - VkDebugReportCallbackCreateInfoEXT *infos, +VkResult util_CopyDebugReportCreateInfos(const void *pChain, const VkAllocationCallbacks *pAllocator, uint32_t *num_callbacks, + VkDebugReportCallbackCreateInfoEXT **infos, VkDebugReportCallbackEXT **callbacks); +void util_FreeDebugReportCreateInfos(const VkAllocationCallbacks *pAllocator, VkDebugReportCallbackCreateInfoEXT *infos, VkDebugReportCallbackEXT *callbacks); -VkResult util_CreateDebugReportCallbacks( - struct loader_instance *inst, const VkAllocationCallbacks *pAllocator, - uint32_t num_callbacks, VkDebugReportCallbackCreateInfoEXT *infos, - VkDebugReportCallbackEXT *callbacks); +VkResult util_CreateDebugReportCallbacks(struct loader_instance *inst, const VkAllocationCallbacks *pAllocator, + uint32_t num_callbacks, VkDebugReportCallbackCreateInfoEXT *infos, + VkDebugReportCallbackEXT *callbacks); -void util_DestroyDebugReportCallbacks(struct loader_instance *inst, - const VkAllocationCallbacks *pAllocator, - uint32_t num_callbacks, +void util_DestroyDebugReportCallbacks(struct loader_instance *inst, const VkAllocationCallbacks *pAllocator, uint32_t num_callbacks, VkDebugReportCallbackEXT *callbacks); -VkBool32 util_DebugReportMessage(const struct loader_instance *inst, - VkFlags msgFlags, - VkDebugReportObjectTypeEXT objectType, - uint64_t srcObject, size_t location, - int32_t msgCode, const char *pLayerPrefix, - const char *pMsg); +VkBool32 util_DebugReportMessage(const struct loader_instance *inst, VkFlags msgFlags, VkDebugReportObjectTypeEXT objectType, + uint64_t srcObject, size_t location, int32_t msgCode, const char *pLayerPrefix, const char *pMsg); diff --git a/loader/dirent_on_windows.c b/loader/dirent_on_windows.c index 6f78cf93..16318cc7 100644 --- a/loader/dirent_on_windows.c +++ b/loader/dirent_on_windows.c @@ -37,12 +37,10 @@ DIR *opendir(const char *name) { strchr("/\\", name[base_length - 1]) ? "*" : "/*"; if ((dir = (DIR *)loader_instance_tls_heap_alloc(sizeof *dir)) != 0 && - (dir->name = (char *)loader_instance_tls_heap_alloc( - base_length + strlen(all) + 1)) != 0) { + (dir->name = (char *)loader_instance_tls_heap_alloc(base_length + strlen(all) + 1)) != 0) { strcat(strcpy(dir->name, name), all); - if ((dir->handle = - (handle_type)_findfirst(dir->name, &dir->info)) != -1) { + if ((dir->handle = (handle_type)_findfirst(dir->name, &dir->info)) != -1) { dir->result.d_name = 0; } else /* rollback */ { diff --git a/loader/extensions.c b/loader/extensions.c index 221924a9..0b5c0002 100644 --- a/loader/extensions.c +++ b/loader/extensions.c @@ -31,19 +31,17 @@ // Definitions for the VK_KHR_get_physical_device_properties2 extension -VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFeatures2KHR( - VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures2KHR *pFeatures) { +VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFeatures2KHR(VkPhysicalDevice physicalDevice, + VkPhysicalDeviceFeatures2KHR *pFeatures) { const VkLayerInstanceDispatchTable *disp; - VkPhysicalDevice unwrapped_phys_dev = - loader_unwrap_physical_device(physicalDevice); + VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); disp = loader_get_instance_layer_dispatch(physicalDevice); disp->GetPhysicalDeviceFeatures2KHR(unwrapped_phys_dev, pFeatures); } -VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceFeatures2KHR( - VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures2KHR *pFeatures) { - struct loader_physical_device_term *phys_dev_term = - (struct loader_physical_device_term *)physicalDevice; +VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceFeatures2KHR(VkPhysicalDevice physicalDevice, + VkPhysicalDeviceFeatures2KHR *pFeatures) { + struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; if (NULL == icd_term->GetPhysicalDeviceFeatures2KHR) { loader_log(icd_term->this_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, @@ -53,173 +51,134 @@ VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceFeatures2KHR( icd_term->GetPhysicalDeviceFeatures2KHR(phys_dev_term->phys_dev, pFeatures); } -VKAPI_ATTR void VKAPI_CALL -vkGetPhysicalDeviceProperties2KHR(VkPhysicalDevice physicalDevice, - VkPhysicalDeviceProperties2KHR *pProperties) { +VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceProperties2KHR(VkPhysicalDevice physicalDevice, + VkPhysicalDeviceProperties2KHR *pProperties) { const VkLayerInstanceDispatchTable *disp; - VkPhysicalDevice unwrapped_phys_dev = - loader_unwrap_physical_device(physicalDevice); + VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); disp = loader_get_instance_layer_dispatch(physicalDevice); disp->GetPhysicalDeviceProperties2KHR(unwrapped_phys_dev, pProperties); } -VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceProperties2KHR( - VkPhysicalDevice physicalDevice, - VkPhysicalDeviceProperties2KHR *pProperties) { - struct loader_physical_device_term *phys_dev_term = - (struct loader_physical_device_term *)physicalDevice; +VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceProperties2KHR(VkPhysicalDevice physicalDevice, + VkPhysicalDeviceProperties2KHR *pProperties) { + struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; if (NULL == icd_term->GetPhysicalDeviceProperties2KHR) { loader_log(icd_term->this_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "ICD associated with VkPhysicalDevice does not support " "vkGetPhysicalDeviceProperties2KHR"); } - icd_term->GetPhysicalDeviceProperties2KHR(phys_dev_term->phys_dev, - pProperties); + icd_term->GetPhysicalDeviceProperties2KHR(phys_dev_term->phys_dev, pProperties); } -VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFormatProperties2KHR( - VkPhysicalDevice physicalDevice, VkFormat format, - VkFormatProperties2KHR *pFormatProperties) { +VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFormatProperties2KHR(VkPhysicalDevice physicalDevice, VkFormat format, + VkFormatProperties2KHR *pFormatProperties) { const VkLayerInstanceDispatchTable *disp; - VkPhysicalDevice unwrapped_phys_dev = - loader_unwrap_physical_device(physicalDevice); + VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); disp = loader_get_instance_layer_dispatch(physicalDevice); - disp->GetPhysicalDeviceFormatProperties2KHR(unwrapped_phys_dev, format, - pFormatProperties); + disp->GetPhysicalDeviceFormatProperties2KHR(unwrapped_phys_dev, format, pFormatProperties); } -VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceFormatProperties2KHR( - VkPhysicalDevice physicalDevice, VkFormat format, - VkFormatProperties2KHR *pFormatProperties) { - struct loader_physical_device_term *phys_dev_term = - (struct loader_physical_device_term *)physicalDevice; +VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceFormatProperties2KHR(VkPhysicalDevice physicalDevice, VkFormat format, + VkFormatProperties2KHR *pFormatProperties) { + struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; if (NULL == icd_term->GetPhysicalDeviceFormatProperties2KHR) { loader_log(icd_term->this_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "ICD associated with VkPhysicalDevice does not support " "vkGetPhysicalDeviceFormatProperties2KHR"); } - icd_term->GetPhysicalDeviceFormatProperties2KHR(phys_dev_term->phys_dev, - format, pFormatProperties); + icd_term->GetPhysicalDeviceFormatProperties2KHR(phys_dev_term->phys_dev, format, pFormatProperties); } VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceImageFormatProperties2KHR( - VkPhysicalDevice physicalDevice, - const VkPhysicalDeviceImageFormatInfo2KHR *pImageFormatInfo, + VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2KHR *pImageFormatInfo, VkImageFormatProperties2KHR *pImageFormatProperties) { const VkLayerInstanceDispatchTable *disp; - VkPhysicalDevice unwrapped_phys_dev = - loader_unwrap_physical_device(physicalDevice); + VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); disp = loader_get_instance_layer_dispatch(physicalDevice); - return disp->GetPhysicalDeviceImageFormatProperties2KHR( - unwrapped_phys_dev, pImageFormatInfo, pImageFormatProperties); + return disp->GetPhysicalDeviceImageFormatProperties2KHR(unwrapped_phys_dev, pImageFormatInfo, pImageFormatProperties); } -VKAPI_ATTR VkResult VKAPI_CALL -terminator_GetPhysicalDeviceImageFormatProperties2KHR( - VkPhysicalDevice physicalDevice, - const VkPhysicalDeviceImageFormatInfo2KHR *pImageFormatInfo, +VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceImageFormatProperties2KHR( + VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2KHR *pImageFormatInfo, VkImageFormatProperties2KHR *pImageFormatProperties) { - struct loader_physical_device_term *phys_dev_term = - (struct loader_physical_device_term *)physicalDevice; + struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; if (NULL == icd_term->GetPhysicalDeviceImageFormatProperties2KHR) { loader_log(icd_term->this_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "ICD associated with VkPhysicalDevice does not support " "vkGetPhysicalDeviceImageFormatProperties2KHR"); } - return icd_term->GetPhysicalDeviceImageFormatProperties2KHR( - phys_dev_term->phys_dev, pImageFormatInfo, pImageFormatProperties); + return icd_term->GetPhysicalDeviceImageFormatProperties2KHR(phys_dev_term->phys_dev, pImageFormatInfo, pImageFormatProperties); } -VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceQueueFamilyProperties2KHR( - VkPhysicalDevice physicalDevice, uint32_t *pQueueFamilyPropertyCount, - VkQueueFamilyProperties2KHR *pQueueFamilyProperties) { +VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceQueueFamilyProperties2KHR(VkPhysicalDevice physicalDevice, + uint32_t *pQueueFamilyPropertyCount, + VkQueueFamilyProperties2KHR *pQueueFamilyProperties) { const VkLayerInstanceDispatchTable *disp; - VkPhysicalDevice unwrapped_phys_dev = - loader_unwrap_physical_device(physicalDevice); + VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); disp = loader_get_instance_layer_dispatch(physicalDevice); - disp->GetPhysicalDeviceQueueFamilyProperties2KHR( - unwrapped_phys_dev, pQueueFamilyPropertyCount, pQueueFamilyProperties); + disp->GetPhysicalDeviceQueueFamilyProperties2KHR(unwrapped_phys_dev, pQueueFamilyPropertyCount, pQueueFamilyProperties); } -VKAPI_ATTR void VKAPI_CALL -terminator_GetPhysicalDeviceQueueFamilyProperties2KHR( - VkPhysicalDevice physicalDevice, uint32_t *pQueueFamilyPropertyCount, - VkQueueFamilyProperties2KHR *pQueueFamilyProperties) { - struct loader_physical_device_term *phys_dev_term = - (struct loader_physical_device_term *)physicalDevice; +VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceQueueFamilyProperties2KHR( + VkPhysicalDevice physicalDevice, uint32_t *pQueueFamilyPropertyCount, VkQueueFamilyProperties2KHR *pQueueFamilyProperties) { + struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; if (NULL == icd_term->GetPhysicalDeviceQueueFamilyProperties2KHR) { loader_log(icd_term->this_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "ICD associated with VkPhysicalDevice does not support " "vkGetPhysicalDeviceQueueFamilyProperties2KHR"); } - icd_term->GetPhysicalDeviceQueueFamilyProperties2KHR( - phys_dev_term->phys_dev, pQueueFamilyPropertyCount, - pQueueFamilyProperties); + icd_term->GetPhysicalDeviceQueueFamilyProperties2KHR(phys_dev_term->phys_dev, pQueueFamilyPropertyCount, + pQueueFamilyProperties); } -VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceMemoryProperties2KHR( - VkPhysicalDevice physicalDevice, - VkPhysicalDeviceMemoryProperties2KHR *pMemoryProperties) { +VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceMemoryProperties2KHR(VkPhysicalDevice physicalDevice, + VkPhysicalDeviceMemoryProperties2KHR *pMemoryProperties) { const VkLayerInstanceDispatchTable *disp; - VkPhysicalDevice unwrapped_phys_dev = - loader_unwrap_physical_device(physicalDevice); + VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); disp = loader_get_instance_layer_dispatch(physicalDevice); - disp->GetPhysicalDeviceMemoryProperties2KHR(unwrapped_phys_dev, - pMemoryProperties); + disp->GetPhysicalDeviceMemoryProperties2KHR(unwrapped_phys_dev, pMemoryProperties); } VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceMemoryProperties2KHR( - VkPhysicalDevice physicalDevice, - VkPhysicalDeviceMemoryProperties2KHR *pMemoryProperties) { - struct loader_physical_device_term *phys_dev_term = - (struct loader_physical_device_term *)physicalDevice; + VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties2KHR *pMemoryProperties) { + struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; if (NULL == icd_term->GetPhysicalDeviceMemoryProperties2KHR) { loader_log(icd_term->this_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "ICD associated with VkPhysicalDevice does not support " "vkGetPhysicalDeviceMemoryProperties2KHR"); } - icd_term->GetPhysicalDeviceMemoryProperties2KHR(phys_dev_term->phys_dev, - pMemoryProperties); + icd_term->GetPhysicalDeviceMemoryProperties2KHR(phys_dev_term->phys_dev, pMemoryProperties); } VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceSparseImageFormatProperties2KHR( - VkPhysicalDevice physicalDevice, - const VkPhysicalDeviceSparseImageFormatInfo2KHR *pFormatInfo, - uint32_t *pPropertyCount, VkSparseImageFormatProperties2KHR *pProperties) { + VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSparseImageFormatInfo2KHR *pFormatInfo, uint32_t *pPropertyCount, + VkSparseImageFormatProperties2KHR *pProperties) { const VkLayerInstanceDispatchTable *disp; - VkPhysicalDevice unwrapped_phys_dev = - loader_unwrap_physical_device(physicalDevice); + VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); disp = loader_get_instance_layer_dispatch(physicalDevice); - disp->GetPhysicalDeviceSparseImageFormatProperties2KHR( - unwrapped_phys_dev, pFormatInfo, pPropertyCount, pProperties); + disp->GetPhysicalDeviceSparseImageFormatProperties2KHR(unwrapped_phys_dev, pFormatInfo, pPropertyCount, pProperties); } -VKAPI_ATTR void VKAPI_CALL -terminator_GetPhysicalDeviceSparseImageFormatProperties2KHR( - VkPhysicalDevice physicalDevice, - const VkPhysicalDeviceSparseImageFormatInfo2KHR *pFormatInfo, - uint32_t *pPropertyCount, VkSparseImageFormatProperties2KHR *pProperties) { - struct loader_physical_device_term *phys_dev_term = - (struct loader_physical_device_term *)physicalDevice; +VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceSparseImageFormatProperties2KHR( + VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSparseImageFormatInfo2KHR *pFormatInfo, uint32_t *pPropertyCount, + VkSparseImageFormatProperties2KHR *pProperties) { + struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; if (NULL == icd_term->GetPhysicalDeviceSparseImageFormatProperties2KHR) { loader_log(icd_term->this_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "ICD associated with VkPhysicalDevice does not support " "vkGetPhysicalDeviceSparseImageFormatProperties2KHR"); } - icd_term->GetPhysicalDeviceSparseImageFormatProperties2KHR( - phys_dev_term->phys_dev, pFormatInfo, pPropertyCount, pProperties); + icd_term->GetPhysicalDeviceSparseImageFormatProperties2KHR(phys_dev_term->phys_dev, pFormatInfo, pPropertyCount, pProperties); } // Definitions for the VK_KHR_maintenance1 extension -VKAPI_ATTR void VKAPI_CALL -vkTrimCommandPoolKHR(VkDevice device, VkCommandPool commandPool, - VkCommandPoolTrimFlagsKHR flags) { +VKAPI_ATTR void VKAPI_CALL vkTrimCommandPoolKHR(VkDevice device, VkCommandPool commandPool, VkCommandPoolTrimFlagsKHR flags) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); disp->TrimCommandPoolKHR(device, commandPool, flags); } @@ -227,99 +186,78 @@ vkTrimCommandPoolKHR(VkDevice device, VkCommandPool commandPool, // Definitions for the VK_EXT_acquire_xlib_display extension #ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT -VKAPI_ATTR VkResult VKAPI_CALL vkAcquireXlibDisplayEXT( - VkPhysicalDevice physicalDevice, Display *dpy, VkDisplayKHR display) { +VKAPI_ATTR VkResult VKAPI_CALL vkAcquireXlibDisplayEXT(VkPhysicalDevice physicalDevice, Display *dpy, VkDisplayKHR display) { const VkLayerInstanceDispatchTable *disp; - VkPhysicalDevice unwrapped_phys_dev = - loader_unwrap_physical_device(physicalDevice); + VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); disp = loader_get_instance_layer_dispatch(physicalDevice); return disp->AcquireXlibDisplayEXT(unwrapped_phys_dev, dpy, display); } -VKAPI_ATTR VkResult VKAPI_CALL terminator_AcquireXlibDisplayEXT( - VkPhysicalDevice physicalDevice, Display *dpy, VkDisplayKHR display) { - struct loader_physical_device_term *phys_dev_term = - (struct loader_physical_device_term *)physicalDevice; +VKAPI_ATTR VkResult VKAPI_CALL terminator_AcquireXlibDisplayEXT(VkPhysicalDevice physicalDevice, Display *dpy, + VkDisplayKHR display) { + struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; if (NULL == icd_term->AcquireXlibDisplayEXT) { loader_log(icd_term->this_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "ICD associated with VkPhysicalDevice does not support " "vkAcquireXlibDisplayEXT"); } - return icd_term->AcquireXlibDisplayEXT(phys_dev_term->phys_dev, dpy, - display); + return icd_term->AcquireXlibDisplayEXT(phys_dev_term->phys_dev, dpy, display); } -VKAPI_ATTR VkResult VKAPI_CALL -vkGetRandROutputDisplayEXT(VkPhysicalDevice physicalDevice, Display *dpy, - RROutput rrOutput, VkDisplayKHR *pDisplay) { +VKAPI_ATTR VkResult VKAPI_CALL vkGetRandROutputDisplayEXT(VkPhysicalDevice physicalDevice, Display *dpy, RROutput rrOutput, + VkDisplayKHR *pDisplay) { const VkLayerInstanceDispatchTable *disp; - VkPhysicalDevice unwrapped_phys_dev = - loader_unwrap_physical_device(physicalDevice); + VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); disp = loader_get_instance_layer_dispatch(physicalDevice); - return disp->GetRandROutputDisplayEXT(unwrapped_phys_dev, dpy, rrOutput, - pDisplay); + return disp->GetRandROutputDisplayEXT(unwrapped_phys_dev, dpy, rrOutput, pDisplay); } -VKAPI_ATTR VkResult VKAPI_CALL terminator_GetRandROutputDisplayEXT( - VkPhysicalDevice physicalDevice, Display *dpy, RROutput rrOutput, - VkDisplayKHR *pDisplay) { - struct loader_physical_device_term *phys_dev_term = - (struct loader_physical_device_term *)physicalDevice; +VKAPI_ATTR VkResult VKAPI_CALL terminator_GetRandROutputDisplayEXT(VkPhysicalDevice physicalDevice, Display *dpy, RROutput rrOutput, + VkDisplayKHR *pDisplay) { + struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; if (NULL == icd_term->GetRandROutputDisplayEXT) { loader_log(icd_term->this_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "ICD associated with VkPhysicalDevice does not support " "vkGetRandROutputDisplayEXT"); } - return icd_term->GetRandROutputDisplayEXT(phys_dev_term->phys_dev, dpy, - rrOutput, pDisplay); + return icd_term->GetRandROutputDisplayEXT(phys_dev_term->phys_dev, dpy, rrOutput, pDisplay); } #endif /* VK_USE_PLATFORM_XLIB_XRANDR_EXT */ // Definitions for the VK_EXT_debug_marker extension commands which // need to have a terminator function -VKAPI_ATTR VkResult VKAPI_CALL vkDebugMarkerSetObjectTagEXT( - VkDevice device, VkDebugMarkerObjectTagInfoEXT *pTagInfo) { +VKAPI_ATTR VkResult VKAPI_CALL vkDebugMarkerSetObjectTagEXT(VkDevice device, VkDebugMarkerObjectTagInfoEXT *pTagInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); // If this is a physical device, we have to replace it with the proper one // for the next call. - if (pTagInfo->objectType == - VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT) { - struct loader_physical_device_tramp *phys_dev_tramp = - (struct loader_physical_device_tramp *)(uintptr_t)pTagInfo->object; + if (pTagInfo->objectType == VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT) { + struct loader_physical_device_tramp *phys_dev_tramp = (struct loader_physical_device_tramp *)(uintptr_t)pTagInfo->object; pTagInfo->object = (uint64_t)(uintptr_t)phys_dev_tramp->phys_dev; } return disp->DebugMarkerSetObjectTagEXT(device, pTagInfo); } -VKAPI_ATTR VkResult VKAPI_CALL terminator_DebugMarkerSetObjectTagEXT( - VkDevice device, VkDebugMarkerObjectTagInfoEXT *pTagInfo) { +VKAPI_ATTR VkResult VKAPI_CALL terminator_DebugMarkerSetObjectTagEXT(VkDevice device, VkDebugMarkerObjectTagInfoEXT *pTagInfo) { uint32_t icd_index = 0; struct loader_device *dev; - struct loader_icd_term *icd_term = - loader_get_icd_and_device(device, &dev, &icd_index); + struct loader_icd_term *icd_term = loader_get_icd_and_device(device, &dev, &icd_index); if (NULL != icd_term && NULL != icd_term->DebugMarkerSetObjectTagEXT) { // If this is a physical device, we have to replace it with the proper // one for the next call. - if (pTagInfo->objectType == - VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT) { - struct loader_physical_device_term *phys_dev_term = - (struct loader_physical_device_term *)(uintptr_t) - pTagInfo->object; + if (pTagInfo->objectType == VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT) { + struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)(uintptr_t)pTagInfo->object; pTagInfo->object = (uint64_t)(uintptr_t)phys_dev_term->phys_dev; // If this is a KHR_surface, and the ICD has created its own, we // have to replace it with the proper one for the next call. - } else if (pTagInfo->objectType == - VK_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT) { + } else if (pTagInfo->objectType == VK_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT) { if (NULL != icd_term && NULL != icd_term->CreateSwapchainKHR) { - VkIcdSurface *icd_surface = - (VkIcdSurface *)(uintptr_t)pTagInfo->object; + VkIcdSurface *icd_surface = (VkIcdSurface *)(uintptr_t)pTagInfo->object; if (NULL != icd_surface->real_icd_surfaces) { - pTagInfo->object = - (uint64_t)icd_surface->real_icd_surfaces[icd_index]; + pTagInfo->object = (uint64_t)icd_surface->real_icd_surfaces[icd_index]; } } } @@ -329,47 +267,35 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_DebugMarkerSetObjectTagEXT( } } -VKAPI_ATTR VkResult VKAPI_CALL vkDebugMarkerSetObjectNameEXT( - VkDevice device, VkDebugMarkerObjectNameInfoEXT *pNameInfo) { +VKAPI_ATTR VkResult VKAPI_CALL vkDebugMarkerSetObjectNameEXT(VkDevice device, VkDebugMarkerObjectNameInfoEXT *pNameInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); // If this is a physical device, we have to replace it with the proper one // for the next call. - if (pNameInfo->objectType == - VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT) { - struct loader_physical_device_tramp *phys_dev_tramp = - (struct loader_physical_device_tramp *)(uintptr_t)pNameInfo->object; + if (pNameInfo->objectType == VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT) { + struct loader_physical_device_tramp *phys_dev_tramp = (struct loader_physical_device_tramp *)(uintptr_t)pNameInfo->object; pNameInfo->object = (uint64_t)(uintptr_t)phys_dev_tramp->phys_dev; } return disp->DebugMarkerSetObjectNameEXT(device, pNameInfo); } -VKAPI_ATTR VkResult VKAPI_CALL terminator_DebugMarkerSetObjectNameEXT( - VkDevice device, VkDebugMarkerObjectNameInfoEXT *pNameInfo) { +VKAPI_ATTR VkResult VKAPI_CALL terminator_DebugMarkerSetObjectNameEXT(VkDevice device, VkDebugMarkerObjectNameInfoEXT *pNameInfo) { uint32_t icd_index = 0; struct loader_device *dev; - struct loader_icd_term *icd_term = - loader_get_icd_and_device(device, &dev, &icd_index); + struct loader_icd_term *icd_term = loader_get_icd_and_device(device, &dev, &icd_index); if (NULL != icd_term && NULL != icd_term->DebugMarkerSetObjectNameEXT) { // If this is a physical device, we have to replace it with the proper // one for the next call. - if (pNameInfo->objectType == - VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT) { - struct loader_physical_device_term *phys_dev_term = - (struct loader_physical_device_term *)(uintptr_t) - pNameInfo->object; + if (pNameInfo->objectType == VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT) { + struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)(uintptr_t)pNameInfo->object; pNameInfo->object = (uint64_t)(uintptr_t)phys_dev_term->phys_dev; // If this is a KHR_surface, and the ICD has created its own, we // have to replace it with the proper one for the next call. - } else if (pNameInfo->objectType == - VK_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT) { + } else if (pNameInfo->objectType == VK_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT) { if (NULL != icd_term && NULL != icd_term->CreateSwapchainKHR) { - VkIcdSurface *icd_surface = - (VkIcdSurface *)(uintptr_t)pNameInfo->object; + VkIcdSurface *icd_surface = (VkIcdSurface *)(uintptr_t)pNameInfo->object; if (NULL != icd_surface->real_icd_surfaces) { - pNameInfo->object = - (uint64_t)( - uintptr_t)icd_surface->real_icd_surfaces[icd_index]; + pNameInfo->object = (uint64_t)(uintptr_t)icd_surface->real_icd_surfaces[icd_index]; } } } @@ -381,19 +307,15 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_DebugMarkerSetObjectNameEXT( // Definitions for the VK_EXT_direct_mode_display extension -VKAPI_ATTR VkResult VKAPI_CALL -vkReleaseDisplayEXT(VkPhysicalDevice physicalDevice, VkDisplayKHR display) { +VKAPI_ATTR VkResult VKAPI_CALL vkReleaseDisplayEXT(VkPhysicalDevice physicalDevice, VkDisplayKHR display) { const VkLayerInstanceDispatchTable *disp; - VkPhysicalDevice unwrapped_phys_dev = - loader_unwrap_physical_device(physicalDevice); + VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); disp = loader_get_instance_layer_dispatch(physicalDevice); return disp->ReleaseDisplayEXT(unwrapped_phys_dev, display); } -VKAPI_ATTR VkResult VKAPI_CALL terminator_ReleaseDisplayEXT( - VkPhysicalDevice physicalDevice, VkDisplayKHR display) { - struct loader_physical_device_term *phys_dev_term = - (struct loader_physical_device_term *)physicalDevice; +VKAPI_ATTR VkResult VKAPI_CALL terminator_ReleaseDisplayEXT(VkPhysicalDevice physicalDevice, VkDisplayKHR display) { + struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; if (NULL == icd_term->ReleaseDisplayEXT) { loader_log(icd_term->this_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, @@ -405,28 +327,21 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_ReleaseDisplayEXT( // Definitions for the VK_EXT_display_surface_counter extension -VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceCapabilities2EXT( - VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, - VkSurfaceCapabilities2EXT *pSurfaceCapabilities) { +VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceCapabilities2EXT(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, + VkSurfaceCapabilities2EXT *pSurfaceCapabilities) { const VkLayerInstanceDispatchTable *disp; - VkPhysicalDevice unwrapped_phys_dev = - loader_unwrap_physical_device(physicalDevice); + VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); disp = loader_get_instance_layer_dispatch(physicalDevice); - return disp->GetPhysicalDeviceSurfaceCapabilities2EXT( - unwrapped_phys_dev, surface, pSurfaceCapabilities); + return disp->GetPhysicalDeviceSurfaceCapabilities2EXT(unwrapped_phys_dev, surface, pSurfaceCapabilities); } -VKAPI_ATTR VkResult VKAPI_CALL -terminator_GetPhysicalDeviceSurfaceCapabilities2EXT( - VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, - VkSurfaceCapabilities2EXT *pSurfaceCapabilities) { - struct loader_physical_device_term *phys_dev_term = - (struct loader_physical_device_term *)physicalDevice; +VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSurfaceCapabilities2EXT( + VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, VkSurfaceCapabilities2EXT *pSurfaceCapabilities) { + struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; if (NULL != icd_term) { if (NULL == icd_term->GetPhysicalDeviceSurfaceCapabilities2EXT) { - loader_log(icd_term->this_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, - 0, + loader_log(icd_term->this_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "ICD associated with VkPhysicalDevice does not support " "vkGetPhysicalDeviceSurfaceCapabilities2EXT"); } @@ -435,63 +350,48 @@ terminator_GetPhysicalDeviceSurfaceCapabilities2EXT( if (NULL != icd_surface->real_icd_surfaces) { if (NULL != (void *)icd_surface->real_icd_surfaces[icd_index]) { return icd_term->GetPhysicalDeviceSurfaceCapabilities2EXT( - phys_dev_term->phys_dev, - icd_surface->real_icd_surfaces[icd_index], - pSurfaceCapabilities); + phys_dev_term->phys_dev, icd_surface->real_icd_surfaces[icd_index], pSurfaceCapabilities); } } } - return icd_term->GetPhysicalDeviceSurfaceCapabilities2EXT( - phys_dev_term->phys_dev, surface, pSurfaceCapabilities); + return icd_term->GetPhysicalDeviceSurfaceCapabilities2EXT(phys_dev_term->phys_dev, surface, pSurfaceCapabilities); } // Definitions for the VK_AMD_draw_indirect_count extension -VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndirectCountAMD( - VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, - VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, - uint32_t stride) { +VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndirectCountAMD(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, + VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, + uint32_t stride) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); - disp->CmdDrawIndirectCountAMD(commandBuffer, buffer, offset, countBuffer, - countBufferOffset, maxDrawCount, stride); + disp->CmdDrawIndirectCountAMD(commandBuffer, buffer, offset, countBuffer, countBufferOffset, maxDrawCount, stride); } -VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndexedIndirectCountAMD( - VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, - VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, - uint32_t stride) { +VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndexedIndirectCountAMD(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, + VkBuffer countBuffer, VkDeviceSize countBufferOffset, + uint32_t maxDrawCount, uint32_t stride) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); - disp->CmdDrawIndexedIndirectCountAMD(commandBuffer, buffer, offset, - countBuffer, countBufferOffset, - maxDrawCount, stride); + disp->CmdDrawIndexedIndirectCountAMD(commandBuffer, buffer, offset, countBuffer, countBufferOffset, maxDrawCount, stride); } // Definitions for the VK_NV_external_memory_capabilities extension -VKAPI_ATTR VkResult VKAPI_CALL -vkGetPhysicalDeviceExternalImageFormatPropertiesNV( - VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, - VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, - VkExternalMemoryHandleTypeFlagsNV externalHandleType, +VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceExternalImageFormatPropertiesNV( + VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, + VkImageCreateFlags flags, VkExternalMemoryHandleTypeFlagsNV externalHandleType, VkExternalImageFormatPropertiesNV *pExternalImageFormatProperties) { const VkLayerInstanceDispatchTable *disp; - VkPhysicalDevice unwrapped_phys_dev = - loader_unwrap_physical_device(physicalDevice); + VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); disp = loader_get_instance_layer_dispatch(physicalDevice); - return disp->GetPhysicalDeviceExternalImageFormatPropertiesNV( - unwrapped_phys_dev, format, type, tiling, usage, flags, - externalHandleType, pExternalImageFormatProperties); + return disp->GetPhysicalDeviceExternalImageFormatPropertiesNV(unwrapped_phys_dev, format, type, tiling, usage, flags, + externalHandleType, pExternalImageFormatProperties); } -VKAPI_ATTR VkResult VKAPI_CALL -terminator_GetPhysicalDeviceExternalImageFormatPropertiesNV( - VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, - VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, - VkExternalMemoryHandleTypeFlagsNV externalHandleType, +VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceExternalImageFormatPropertiesNV( + VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, + VkImageCreateFlags flags, VkExternalMemoryHandleTypeFlagsNV externalHandleType, VkExternalImageFormatPropertiesNV *pExternalImageFormatProperties) { - struct loader_physical_device_term *phys_dev_term = - (struct loader_physical_device_term *)physicalDevice; + struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; if (!icd_term->GetPhysicalDeviceExternalImageFormatPropertiesNV) { @@ -507,23 +407,20 @@ terminator_GetPhysicalDeviceExternalImageFormatPropertiesNV( pExternalImageFormatProperties->exportFromImportedHandleTypes = 0; pExternalImageFormatProperties->compatibleHandleTypes = 0; - return icd_term->GetPhysicalDeviceImageFormatProperties( - phys_dev_term->phys_dev, format, type, tiling, usage, flags, - &pExternalImageFormatProperties->imageFormatProperties); + return icd_term->GetPhysicalDeviceImageFormatProperties(phys_dev_term->phys_dev, format, type, tiling, usage, flags, + &pExternalImageFormatProperties->imageFormatProperties); } - return icd_term->GetPhysicalDeviceExternalImageFormatPropertiesNV( - phys_dev_term->phys_dev, format, type, tiling, usage, flags, - externalHandleType, pExternalImageFormatProperties); + return icd_term->GetPhysicalDeviceExternalImageFormatPropertiesNV(phys_dev_term->phys_dev, format, type, tiling, usage, flags, + externalHandleType, pExternalImageFormatProperties); } #ifdef VK_USE_PLATFORM_WIN32_KHR // Definitions for the VK_NV_external_memory_win32 extension -VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryWin32HandleNV( - VkDevice device, VkDeviceMemory memory, - VkExternalMemoryHandleTypeFlagsNV handleType, HANDLE *pHandle) { +VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryWin32HandleNV(VkDevice device, VkDeviceMemory memory, + VkExternalMemoryHandleTypeFlagsNV handleType, HANDLE *pHandle) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); return disp->GetMemoryWin32HandleNV(device, memory, handleType, pHandle); } @@ -532,153 +429,125 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryWin32HandleNV( // Definitions for the VK_NVX_device_generated_commands -VKAPI_ATTR void VKAPI_CALL vkCmdProcessCommandsNVX( - VkCommandBuffer commandBuffer, - const VkCmdProcessCommandsInfoNVX *pProcessCommandsInfo) { +VKAPI_ATTR void VKAPI_CALL vkCmdProcessCommandsNVX(VkCommandBuffer commandBuffer, + const VkCmdProcessCommandsInfoNVX *pProcessCommandsInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); disp->CmdProcessCommandsNVX(commandBuffer, pProcessCommandsInfo); } -VKAPI_ATTR void VKAPI_CALL vkCmdReserveSpaceForCommandsNVX( - VkCommandBuffer commandBuffer, - const VkCmdReserveSpaceForCommandsInfoNVX *pReserveSpaceInfo) { +VKAPI_ATTR void VKAPI_CALL vkCmdReserveSpaceForCommandsNVX(VkCommandBuffer commandBuffer, + const VkCmdReserveSpaceForCommandsInfoNVX *pReserveSpaceInfo) { const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer); disp->CmdReserveSpaceForCommandsNVX(commandBuffer, pReserveSpaceInfo); } -VKAPI_ATTR VkResult VKAPI_CALL vkCreateIndirectCommandsLayoutNVX( - VkDevice device, const VkIndirectCommandsLayoutCreateInfoNVX *pCreateInfo, - const VkAllocationCallbacks *pAllocator, - VkIndirectCommandsLayoutNVX *pIndirectCommandsLayout) { +VKAPI_ATTR VkResult VKAPI_CALL vkCreateIndirectCommandsLayoutNVX(VkDevice device, + const VkIndirectCommandsLayoutCreateInfoNVX *pCreateInfo, + const VkAllocationCallbacks *pAllocator, + VkIndirectCommandsLayoutNVX *pIndirectCommandsLayout) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); - return disp->CreateIndirectCommandsLayoutNVX( - device, pCreateInfo, pAllocator, pIndirectCommandsLayout); + return disp->CreateIndirectCommandsLayoutNVX(device, pCreateInfo, pAllocator, pIndirectCommandsLayout); } -VKAPI_ATTR void VKAPI_CALL vkDestroyIndirectCommandsLayoutNVX( - VkDevice device, VkIndirectCommandsLayoutNVX indirectCommandsLayout, - const VkAllocationCallbacks *pAllocator) { +VKAPI_ATTR void VKAPI_CALL vkDestroyIndirectCommandsLayoutNVX(VkDevice device, VkIndirectCommandsLayoutNVX indirectCommandsLayout, + const VkAllocationCallbacks *pAllocator) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); - disp->DestroyIndirectCommandsLayoutNVX(device, indirectCommandsLayout, - pAllocator); + disp->DestroyIndirectCommandsLayoutNVX(device, indirectCommandsLayout, pAllocator); } -VKAPI_ATTR VkResult VKAPI_CALL vkCreateObjectTableNVX( - VkDevice device, const VkObjectTableCreateInfoNVX *pCreateInfo, - const VkAllocationCallbacks *pAllocator, VkObjectTableNVX *pObjectTable) { +VKAPI_ATTR VkResult VKAPI_CALL vkCreateObjectTableNVX(VkDevice device, const VkObjectTableCreateInfoNVX *pCreateInfo, + const VkAllocationCallbacks *pAllocator, VkObjectTableNVX *pObjectTable) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); - return disp->CreateObjectTableNVX(device, pCreateInfo, pAllocator, - pObjectTable); + return disp->CreateObjectTableNVX(device, pCreateInfo, pAllocator, pObjectTable); } -VKAPI_ATTR void VKAPI_CALL -vkDestroyObjectTableNVX(VkDevice device, VkObjectTableNVX objectTable, - const VkAllocationCallbacks *pAllocator) { +VKAPI_ATTR void VKAPI_CALL vkDestroyObjectTableNVX(VkDevice device, VkObjectTableNVX objectTable, + const VkAllocationCallbacks *pAllocator) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); disp->DestroyObjectTableNVX(device, objectTable, pAllocator); } -VKAPI_ATTR VkResult VKAPI_CALL vkRegisterObjectsNVX( - VkDevice device, VkObjectTableNVX objectTable, uint32_t objectCount, - const VkObjectTableEntryNVX *const *ppObjectTableEntries, - const uint32_t *pObjectIndices) { +VKAPI_ATTR VkResult VKAPI_CALL vkRegisterObjectsNVX(VkDevice device, VkObjectTableNVX objectTable, uint32_t objectCount, + const VkObjectTableEntryNVX *const *ppObjectTableEntries, + const uint32_t *pObjectIndices) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); - return disp->RegisterObjectsNVX(device, objectTable, objectCount, - ppObjectTableEntries, pObjectIndices); + return disp->RegisterObjectsNVX(device, objectTable, objectCount, ppObjectTableEntries, pObjectIndices); } -VKAPI_ATTR VkResult VKAPI_CALL vkUnregisterObjectsNVX( - VkDevice device, VkObjectTableNVX objectTable, uint32_t objectCount, - const VkObjectEntryTypeNVX *pObjectEntryTypes, - const uint32_t *pObjectIndices) { +VKAPI_ATTR VkResult VKAPI_CALL vkUnregisterObjectsNVX(VkDevice device, VkObjectTableNVX objectTable, uint32_t objectCount, + const VkObjectEntryTypeNVX *pObjectEntryTypes, + const uint32_t *pObjectIndices) { const VkLayerDispatchTable *disp = loader_get_dispatch(device); - return disp->UnregisterObjectsNVX(device, objectTable, objectCount, - pObjectEntryTypes, pObjectIndices); + return disp->UnregisterObjectsNVX(device, objectTable, objectCount, pObjectEntryTypes, pObjectIndices); } -VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceGeneratedCommandsPropertiesNVX( - VkPhysicalDevice physicalDevice, - VkDeviceGeneratedCommandsFeaturesNVX *pFeatures, - VkDeviceGeneratedCommandsLimitsNVX *pLimits) { +VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceGeneratedCommandsPropertiesNVX(VkPhysicalDevice physicalDevice, + VkDeviceGeneratedCommandsFeaturesNVX *pFeatures, + VkDeviceGeneratedCommandsLimitsNVX *pLimits) { const VkLayerInstanceDispatchTable *disp; - VkPhysicalDevice unwrapped_phys_dev = - loader_unwrap_physical_device(physicalDevice); + VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); disp = loader_get_instance_layer_dispatch(physicalDevice); - disp->GetPhysicalDeviceGeneratedCommandsPropertiesNVX(unwrapped_phys_dev, - pFeatures, pLimits); + disp->GetPhysicalDeviceGeneratedCommandsPropertiesNVX(unwrapped_phys_dev, pFeatures, pLimits); } -VKAPI_ATTR void VKAPI_CALL -terminator_GetPhysicalDeviceGeneratedCommandsPropertiesNVX( - VkPhysicalDevice physicalDevice, - VkDeviceGeneratedCommandsFeaturesNVX *pFeatures, - VkDeviceGeneratedCommandsLimitsNVX *pLimits) { - struct loader_physical_device_term *phys_dev_term = - (struct loader_physical_device_term *)physicalDevice; +VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceGeneratedCommandsPropertiesNVX( + VkPhysicalDevice physicalDevice, VkDeviceGeneratedCommandsFeaturesNVX *pFeatures, VkDeviceGeneratedCommandsLimitsNVX *pLimits) { + struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; if (NULL == icd_term->GetPhysicalDeviceGeneratedCommandsPropertiesNVX) { loader_log(icd_term->this_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "ICD associated with VkPhysicalDevice does not support " "vkGetPhysicalDeviceGeneratedCommandsPropertiesNVX"); } else { - icd_term->GetPhysicalDeviceGeneratedCommandsPropertiesNVX( - phys_dev_term->phys_dev, pFeatures, pLimits); + icd_term->GetPhysicalDeviceGeneratedCommandsPropertiesNVX(phys_dev_term->phys_dev, pFeatures, pLimits); } } // GPA helpers for extensions -bool extension_instance_gpa(struct loader_instance *ptr_instance, - const char *name, void **addr) { +bool extension_instance_gpa(struct loader_instance *ptr_instance, const char *name, void **addr) { *addr = NULL; // Functions for the VK_KHR_get_physical_device_properties2 extension if (!strcmp("vkGetPhysicalDeviceFeatures2KHR", name)) { - *addr = (ptr_instance->enabled_known_extensions - .khr_get_physical_device_properties2 == 1) + *addr = (ptr_instance->enabled_known_extensions.khr_get_physical_device_properties2 == 1) ? (void *)vkGetPhysicalDeviceFeatures2KHR : NULL; return true; } if (!strcmp("vkGetPhysicalDeviceProperties2KHR", name)) { - *addr = (ptr_instance->enabled_known_extensions - .khr_get_physical_device_properties2 == 1) + *addr = (ptr_instance->enabled_known_extensions.khr_get_physical_device_properties2 == 1) ? (void *)vkGetPhysicalDeviceProperties2KHR : NULL; return true; } if (!strcmp("vkGetPhysicalDeviceFormatProperties2KHR", name)) { - *addr = (ptr_instance->enabled_known_extensions - .khr_get_physical_device_properties2 == 1) + *addr = (ptr_instance->enabled_known_extensions.khr_get_physical_device_properties2 == 1) ? (void *)vkGetPhysicalDeviceFormatProperties2KHR : NULL; return true; } if (!strcmp("vkGetPhysicalDeviceImageFormatProperties2KHR", name)) { - *addr = (ptr_instance->enabled_known_extensions - .khr_get_physical_device_properties2 == 1) + *addr = (ptr_instance->enabled_known_extensions.khr_get_physical_device_properties2 == 1) ? (void *)vkGetPhysicalDeviceImageFormatProperties2KHR : NULL; return true; } if (!strcmp("vkGetPhysicalDeviceQueueFamilyProperties2KHR", name)) { - *addr = (ptr_instance->enabled_known_extensions - .khr_get_physical_device_properties2 == 1) + *addr = (ptr_instance->enabled_known_extensions.khr_get_physical_device_properties2 == 1) ? (void *)vkGetPhysicalDeviceQueueFamilyProperties2KHR : NULL; return true; } if (!strcmp("vkGetPhysicalDeviceMemoryProperties2KHR", name)) { - *addr = (ptr_instance->enabled_known_extensions - .khr_get_physical_device_properties2 == 1) + *addr = (ptr_instance->enabled_known_extensions.khr_get_physical_device_properties2 == 1) ? (void *)vkGetPhysicalDeviceMemoryProperties2KHR : NULL; return true; } if (!strcmp("vkGetPhysicalDeviceSparseImageFormatProperties2KHR", name)) { - *addr = (ptr_instance->enabled_known_extensions - .khr_get_physical_device_properties2 == 1) + *addr = (ptr_instance->enabled_known_extensions.khr_get_physical_device_properties2 == 1) ? (void *)vkGetPhysicalDeviceSparseImageFormatProperties2KHR : NULL; return true; @@ -695,20 +564,12 @@ bool extension_instance_gpa(struct loader_instance *ptr_instance, #ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT if (!strcmp("vkAcquireXlibDisplayEXT", name)) { - *addr = - (ptr_instance->enabled_known_extensions.ext_acquire_xlib_display == - 1) - ? (void *)vkAcquireXlibDisplayEXT - : NULL; + *addr = (ptr_instance->enabled_known_extensions.ext_acquire_xlib_display == 1) ? (void *)vkAcquireXlibDisplayEXT : NULL; return true; } if (!strcmp("vkGetRandROutputDisplayEXT", name)) { - *addr = - (ptr_instance->enabled_known_extensions.ext_acquire_xlib_display == - 1) - ? (void *)vkGetRandROutputDisplayEXT - : NULL; + *addr = (ptr_instance->enabled_known_extensions.ext_acquire_xlib_display == 1) ? (void *)vkGetRandROutputDisplayEXT : NULL; return true; } @@ -730,19 +591,14 @@ bool extension_instance_gpa(struct loader_instance *ptr_instance, // Functions for the VK_EXT_direct_mode_display extension if (!strcmp("vkReleaseDisplayEXT", name)) { - *addr = - (ptr_instance->enabled_known_extensions.ext_direct_mode_display == - 1) - ? (void *)vkReleaseDisplayEXT - : NULL; + *addr = (ptr_instance->enabled_known_extensions.ext_direct_mode_display == 1) ? (void *)vkReleaseDisplayEXT : NULL; return true; } // Functions for the VK_EXT_display_surface_counter extension if (!strcmp("vkGetPhysicalDeviceSurfaceCapabilities2EXT", name)) { - *addr = (ptr_instance->enabled_known_extensions - .ext_display_surface_counter == 1) + *addr = (ptr_instance->enabled_known_extensions.ext_display_surface_counter == 1) ? (void *)vkGetPhysicalDeviceSurfaceCapabilities2EXT : NULL; return true; @@ -761,8 +617,7 @@ bool extension_instance_gpa(struct loader_instance *ptr_instance, // Functions for the VK_NV_external_memory_capabilities extension if (!strcmp("vkGetPhysicalDeviceExternalImageFormatPropertiesNV", name)) { - *addr = (ptr_instance->enabled_known_extensions - .nv_external_memory_capabilities == 1) + *addr = (ptr_instance->enabled_known_extensions.nv_external_memory_capabilities == 1) ? (void *)vkGetPhysicalDeviceExternalImageFormatPropertiesNV : NULL; return true; @@ -820,31 +675,20 @@ bool extension_instance_gpa(struct loader_instance *ptr_instance, return false; } -void extensions_create_instance(struct loader_instance *ptr_instance, - const VkInstanceCreateInfo *pCreateInfo) { +void extensions_create_instance(struct loader_instance *ptr_instance, const VkInstanceCreateInfo *pCreateInfo) { for (uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; i++) { - if (0 == - strcmp(pCreateInfo->ppEnabledExtensionNames[i], - VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME)) { - ptr_instance->enabled_known_extensions - .khr_get_physical_device_properties2 = 1; + if (0 == strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME)) { + ptr_instance->enabled_known_extensions.khr_get_physical_device_properties2 = 1; #ifdef VK_USE_PLATFORM_XLIB_KHR - } else if (0 == strcmp(pCreateInfo->ppEnabledExtensionNames[i], - VK_EXT_ACQUIRE_XLIB_DISPLAY_EXTENSION_NAME)) { + } else if (0 == strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_EXT_ACQUIRE_XLIB_DISPLAY_EXTENSION_NAME)) { ptr_instance->enabled_known_extensions.ext_acquire_xlib_display = 1; #endif - } else if (0 == strcmp(pCreateInfo->ppEnabledExtensionNames[i], - VK_EXT_DIRECT_MODE_DISPLAY_EXTENSION_NAME)) { + } else if (0 == strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_EXT_DIRECT_MODE_DISPLAY_EXTENSION_NAME)) { ptr_instance->enabled_known_extensions.ext_direct_mode_display = 1; - } else if (0 == strcmp(pCreateInfo->ppEnabledExtensionNames[i], - VK_EXT_DISPLAY_SURFACE_COUNTER_EXTENSION_NAME)) { - ptr_instance->enabled_known_extensions.ext_display_surface_counter = - 1; - } else if (0 == - strcmp(pCreateInfo->ppEnabledExtensionNames[i], - VK_NV_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME)) { - ptr_instance->enabled_known_extensions - .nv_external_memory_capabilities = 1; + } else if (0 == strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_EXT_DISPLAY_SURFACE_COUNTER_EXTENSION_NAME)) { + ptr_instance->enabled_known_extensions.ext_display_surface_counter = 1; + } else if (0 == strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_NV_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME)) { + ptr_instance->enabled_known_extensions.nv_external_memory_capabilities = 1; } } } diff --git a/loader/extensions.h b/loader/extensions.h index b94aaf90..5736f3ba 100644 --- a/loader/extensions.h +++ b/loader/extensions.h @@ -22,96 +22,75 @@ #include "vk_loader_platform.h" #include "loader.h" -bool extension_instance_gpa(struct loader_instance *ptr_instance, - const char *name, void **addr); +bool extension_instance_gpa(struct loader_instance *ptr_instance, const char *name, void **addr); -void extensions_create_instance(struct loader_instance *ptr_instance, - const VkInstanceCreateInfo *pCreateInfo); +void extensions_create_instance(struct loader_instance *ptr_instance, const VkInstanceCreateInfo *pCreateInfo); // Instance extension terminators for the VK_KHR_get_physical_device_properties2 // extension -VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceFeatures2KHR( - VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures2KHR *pFeatures); +VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceFeatures2KHR(VkPhysicalDevice physicalDevice, + VkPhysicalDeviceFeatures2KHR *pFeatures); -VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceProperties2KHR( - VkPhysicalDevice physicalDevice, - VkPhysicalDeviceProperties2KHR *pProperties); +VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceProperties2KHR(VkPhysicalDevice physicalDevice, + VkPhysicalDeviceProperties2KHR *pProperties); -VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceFormatProperties2KHR( - VkPhysicalDevice physicalDevice, VkFormat format, - VkFormatProperties2KHR *pFormatProperties); +VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceFormatProperties2KHR(VkPhysicalDevice physicalDevice, VkFormat format, + VkFormatProperties2KHR *pFormatProperties); -VKAPI_ATTR VkResult VKAPI_CALL -terminator_GetPhysicalDeviceImageFormatProperties2KHR( - VkPhysicalDevice physicalDevice, - const VkPhysicalDeviceImageFormatInfo2KHR *pImageFormatInfo, +VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceImageFormatProperties2KHR( + VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2KHR *pImageFormatInfo, VkImageFormatProperties2KHR *pImageFormatProperties); -VKAPI_ATTR void VKAPI_CALL -terminator_GetPhysicalDeviceQueueFamilyProperties2KHR( - VkPhysicalDevice physicalDevice, uint32_t *pQueueFamilyPropertyCount, - VkQueueFamilyProperties2KHR *pQueueFamilyProperties); +VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceQueueFamilyProperties2KHR( + VkPhysicalDevice physicalDevice, uint32_t *pQueueFamilyPropertyCount, VkQueueFamilyProperties2KHR *pQueueFamilyProperties); VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceMemoryProperties2KHR( - VkPhysicalDevice physicalDevice, - VkPhysicalDeviceMemoryProperties2KHR *pMemoryProperties); + VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties2KHR *pMemoryProperties); -VKAPI_ATTR void VKAPI_CALL -terminator_GetPhysicalDeviceSparseImageFormatProperties2KHR( - VkPhysicalDevice physicalDevice, - const VkPhysicalDeviceSparseImageFormatInfo2KHR *pFormatInfo, - uint32_t *pPropertyCount, VkSparseImageFormatProperties2KHR *pProperties); +VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceSparseImageFormatProperties2KHR( + VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSparseImageFormatInfo2KHR *pFormatInfo, uint32_t *pPropertyCount, + VkSparseImageFormatProperties2KHR *pProperties); // Instance extension terminators for the VK_EXT_acquire_xlib_display // extension #ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT -VKAPI_ATTR VkResult VKAPI_CALL terminator_AcquireXlibDisplayEXT( - VkPhysicalDevice physicalDevice, Display *dpy, VkDisplayKHR display); +VKAPI_ATTR VkResult VKAPI_CALL terminator_AcquireXlibDisplayEXT(VkPhysicalDevice physicalDevice, Display *dpy, + VkDisplayKHR display); -VKAPI_ATTR VkResult VKAPI_CALL terminator_GetRandROutputDisplayEXT( - VkPhysicalDevice physicalDevice, Display *dpy, RROutput rrOutput, - VkDisplayKHR *pDisplay); +VKAPI_ATTR VkResult VKAPI_CALL terminator_GetRandROutputDisplayEXT(VkPhysicalDevice physicalDevice, Display *dpy, RROutput rrOutput, + VkDisplayKHR *pDisplay); #endif /* VK_USE_PLATFORM_XLIB_XRANDR_EXT */ // Instance extension terminators for the VK_EXT_direct_mode_display // extension -VKAPI_ATTR VkResult VKAPI_CALL terminator_ReleaseDisplayEXT( - VkPhysicalDevice physicalDevice, VkDisplayKHR display); +VKAPI_ATTR VkResult VKAPI_CALL terminator_ReleaseDisplayEXT(VkPhysicalDevice physicalDevice, VkDisplayKHR display); // Instance extension terminators for the VK_EXT_display_surface_counter // extension -VKAPI_ATTR VkResult VKAPI_CALL -terminator_GetPhysicalDeviceSurfaceCapabilities2EXT( - VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, - VkSurfaceCapabilities2EXT *pSurfaceCapabilities); +VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSurfaceCapabilities2EXT(VkPhysicalDevice physicalDevice, + VkSurfaceKHR surface, + VkSurfaceCapabilities2EXT *pSurfaceCapabilities); // Device extension terminators for the VK_NV_external_memory_capabilities // extension -VKAPI_ATTR VkResult VKAPI_CALL terminator_DebugMarkerSetObjectTagEXT( - VkDevice device, VkDebugMarkerObjectTagInfoEXT *pTagInfo); +VKAPI_ATTR VkResult VKAPI_CALL terminator_DebugMarkerSetObjectTagEXT(VkDevice device, VkDebugMarkerObjectTagInfoEXT *pTagInfo); -VKAPI_ATTR VkResult VKAPI_CALL terminator_DebugMarkerSetObjectNameEXT( - VkDevice device, VkDebugMarkerObjectNameInfoEXT *pNameInfo); +VKAPI_ATTR VkResult VKAPI_CALL terminator_DebugMarkerSetObjectNameEXT(VkDevice device, VkDebugMarkerObjectNameInfoEXT *pNameInfo); // Instance extension terminators for the VK_NV_external_memory_capabilities // extension -VKAPI_ATTR VkResult VKAPI_CALL -terminator_GetPhysicalDeviceExternalImageFormatPropertiesNV( - VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, - VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, - VkExternalMemoryHandleTypeFlagsNV externalHandleType, +VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceExternalImageFormatPropertiesNV( + VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, + VkImageCreateFlags flags, VkExternalMemoryHandleTypeFlagsNV externalHandleType, VkExternalImageFormatPropertiesNV *pExternalImageFormatProperties); // Instance extension terminators for the VK_NVX_device_generated_commands // extension -VKAPI_ATTR void VKAPI_CALL -terminator_GetPhysicalDeviceGeneratedCommandsPropertiesNVX( - VkPhysicalDevice physicalDevice, - VkDeviceGeneratedCommandsFeaturesNVX *pFeatures, - VkDeviceGeneratedCommandsLimitsNVX *pLimits); +VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceGeneratedCommandsPropertiesNVX( + VkPhysicalDevice physicalDevice, VkDeviceGeneratedCommandsFeaturesNVX *pFeatures, VkDeviceGeneratedCommandsLimitsNVX *pLimits); diff --git a/loader/gpa_helper.h b/loader/gpa_helper.h index c7e7ba2d..e3e41ba1 100644 --- a/loader/gpa_helper.h +++ b/loader/gpa_helper.h @@ -24,8 +24,7 @@ #include "wsi.h" #include "extensions.h" -static inline void *trampolineGetProcAddr(struct loader_instance *inst, - const char *funcName) { +static inline void *trampolineGetProcAddr(struct loader_instance *inst, const char *funcName) { // Don't include or check global functions if (!strcmp(funcName, "vkGetInstanceProcAddr")) return (PFN_vkVoidFunction)vkGetInstanceProcAddr; @@ -40,8 +39,7 @@ static inline void *trampolineGetProcAddr(struct loader_instance *inst, if (!strcmp(funcName, "vkGetPhysicalDeviceImageFormatProperties")) return (PFN_vkVoidFunction)vkGetPhysicalDeviceImageFormatProperties; if (!strcmp(funcName, "vkGetPhysicalDeviceSparseImageFormatProperties")) - return ( - PFN_vkVoidFunction)vkGetPhysicalDeviceSparseImageFormatProperties; + return (PFN_vkVoidFunction)vkGetPhysicalDeviceSparseImageFormatProperties; if (!strcmp(funcName, "vkGetPhysicalDeviceProperties")) return (PFN_vkVoidFunction)vkGetPhysicalDeviceProperties; if (!strcmp(funcName, "vkGetPhysicalDeviceQueueFamilyProperties")) diff --git a/loader/loader.c b/loader/loader.c index 24758f4a..b002d43d 100644 --- a/loader/loader.c +++ b/loader/loader.c @@ -93,63 +93,45 @@ const VkLayerInstanceDispatchTable instance_disp = { .DestroyInstance = terminator_DestroyInstance, .EnumeratePhysicalDevices = terminator_EnumeratePhysicalDevices, .GetPhysicalDeviceFeatures = terminator_GetPhysicalDeviceFeatures, - .GetPhysicalDeviceFormatProperties = - terminator_GetPhysicalDeviceFormatProperties, - .GetPhysicalDeviceImageFormatProperties = - terminator_GetPhysicalDeviceImageFormatProperties, + .GetPhysicalDeviceFormatProperties = terminator_GetPhysicalDeviceFormatProperties, + .GetPhysicalDeviceImageFormatProperties = terminator_GetPhysicalDeviceImageFormatProperties, .GetPhysicalDeviceProperties = terminator_GetPhysicalDeviceProperties, - .GetPhysicalDeviceQueueFamilyProperties = - terminator_GetPhysicalDeviceQueueFamilyProperties, - .GetPhysicalDeviceMemoryProperties = - terminator_GetPhysicalDeviceMemoryProperties, - .EnumerateDeviceExtensionProperties = - terminator_EnumerateDeviceExtensionProperties, + .GetPhysicalDeviceQueueFamilyProperties = terminator_GetPhysicalDeviceQueueFamilyProperties, + .GetPhysicalDeviceMemoryProperties = terminator_GetPhysicalDeviceMemoryProperties, + .EnumerateDeviceExtensionProperties = terminator_EnumerateDeviceExtensionProperties, .EnumerateDeviceLayerProperties = terminator_EnumerateDeviceLayerProperties, - .GetPhysicalDeviceSparseImageFormatProperties = - terminator_GetPhysicalDeviceSparseImageFormatProperties, + .GetPhysicalDeviceSparseImageFormatProperties = terminator_GetPhysicalDeviceSparseImageFormatProperties, .DestroySurfaceKHR = terminator_DestroySurfaceKHR, - .GetPhysicalDeviceSurfaceSupportKHR = - terminator_GetPhysicalDeviceSurfaceSupportKHR, - .GetPhysicalDeviceSurfaceCapabilitiesKHR = - terminator_GetPhysicalDeviceSurfaceCapabilitiesKHR, - .GetPhysicalDeviceSurfaceFormatsKHR = - terminator_GetPhysicalDeviceSurfaceFormatsKHR, - .GetPhysicalDeviceSurfacePresentModesKHR = - terminator_GetPhysicalDeviceSurfacePresentModesKHR, + .GetPhysicalDeviceSurfaceSupportKHR = terminator_GetPhysicalDeviceSurfaceSupportKHR, + .GetPhysicalDeviceSurfaceCapabilitiesKHR = terminator_GetPhysicalDeviceSurfaceCapabilitiesKHR, + .GetPhysicalDeviceSurfaceFormatsKHR = terminator_GetPhysicalDeviceSurfaceFormatsKHR, + .GetPhysicalDeviceSurfacePresentModesKHR = terminator_GetPhysicalDeviceSurfacePresentModesKHR, #ifdef VK_USE_PLATFORM_MIR_KHR .CreateMirSurfaceKHR = terminator_CreateMirSurfaceKHR, - .GetPhysicalDeviceMirPresentationSupportKHR = - terminator_GetPhysicalDeviceMirPresentationSupportKHR, + .GetPhysicalDeviceMirPresentationSupportKHR = terminator_GetPhysicalDeviceMirPresentationSupportKHR, #endif #ifdef VK_USE_PLATFORM_WAYLAND_KHR .CreateWaylandSurfaceKHR = terminator_CreateWaylandSurfaceKHR, - .GetPhysicalDeviceWaylandPresentationSupportKHR = - terminator_GetPhysicalDeviceWaylandPresentationSupportKHR, + .GetPhysicalDeviceWaylandPresentationSupportKHR = terminator_GetPhysicalDeviceWaylandPresentationSupportKHR, #endif #ifdef VK_USE_PLATFORM_WIN32_KHR .CreateWin32SurfaceKHR = terminator_CreateWin32SurfaceKHR, - .GetPhysicalDeviceWin32PresentationSupportKHR = - terminator_GetPhysicalDeviceWin32PresentationSupportKHR, + .GetPhysicalDeviceWin32PresentationSupportKHR = terminator_GetPhysicalDeviceWin32PresentationSupportKHR, #endif #ifdef VK_USE_PLATFORM_XCB_KHR .CreateXcbSurfaceKHR = terminator_CreateXcbSurfaceKHR, - .GetPhysicalDeviceXcbPresentationSupportKHR = - terminator_GetPhysicalDeviceXcbPresentationSupportKHR, + .GetPhysicalDeviceXcbPresentationSupportKHR = terminator_GetPhysicalDeviceXcbPresentationSupportKHR, #endif #ifdef VK_USE_PLATFORM_XLIB_KHR .CreateXlibSurfaceKHR = terminator_CreateXlibSurfaceKHR, - .GetPhysicalDeviceXlibPresentationSupportKHR = - terminator_GetPhysicalDeviceXlibPresentationSupportKHR, + .GetPhysicalDeviceXlibPresentationSupportKHR = terminator_GetPhysicalDeviceXlibPresentationSupportKHR, #endif #ifdef VK_USE_PLATFORM_ANDROID_KHR .CreateAndroidSurfaceKHR = terminator_CreateAndroidSurfaceKHR, #endif - .GetPhysicalDeviceDisplayPropertiesKHR = - terminator_GetPhysicalDeviceDisplayPropertiesKHR, - .GetPhysicalDeviceDisplayPlanePropertiesKHR = - terminator_GetPhysicalDeviceDisplayPlanePropertiesKHR, - .GetDisplayPlaneSupportedDisplaysKHR = - terminator_GetDisplayPlaneSupportedDisplaysKHR, + .GetPhysicalDeviceDisplayPropertiesKHR = terminator_GetPhysicalDeviceDisplayPropertiesKHR, + .GetPhysicalDeviceDisplayPlanePropertiesKHR = terminator_GetPhysicalDeviceDisplayPlanePropertiesKHR, + .GetDisplayPlaneSupportedDisplaysKHR = terminator_GetDisplayPlaneSupportedDisplaysKHR, .GetDisplayModePropertiesKHR = terminator_GetDisplayModePropertiesKHR, .CreateDisplayModeKHR = terminator_CreateDisplayModeKHR, .GetDisplayPlaneCapabilitiesKHR = terminator_GetDisplayPlaneCapabilitiesKHR, @@ -157,18 +139,12 @@ const VkLayerInstanceDispatchTable instance_disp = { // KHR_get_physical_device_properties2 .GetPhysicalDeviceFeatures2KHR = terminator_GetPhysicalDeviceFeatures2KHR, - .GetPhysicalDeviceProperties2KHR = - terminator_GetPhysicalDeviceProperties2KHR, - .GetPhysicalDeviceFormatProperties2KHR = - terminator_GetPhysicalDeviceFormatProperties2KHR, - .GetPhysicalDeviceImageFormatProperties2KHR = - terminator_GetPhysicalDeviceImageFormatProperties2KHR, - .GetPhysicalDeviceQueueFamilyProperties2KHR = - terminator_GetPhysicalDeviceQueueFamilyProperties2KHR, - .GetPhysicalDeviceMemoryProperties2KHR = - terminator_GetPhysicalDeviceMemoryProperties2KHR, - .GetPhysicalDeviceSparseImageFormatProperties2KHR = - terminator_GetPhysicalDeviceSparseImageFormatProperties2KHR, + .GetPhysicalDeviceProperties2KHR = terminator_GetPhysicalDeviceProperties2KHR, + .GetPhysicalDeviceFormatProperties2KHR = terminator_GetPhysicalDeviceFormatProperties2KHR, + .GetPhysicalDeviceImageFormatProperties2KHR = terminator_GetPhysicalDeviceImageFormatProperties2KHR, + .GetPhysicalDeviceQueueFamilyProperties2KHR = terminator_GetPhysicalDeviceQueueFamilyProperties2KHR, + .GetPhysicalDeviceMemoryProperties2KHR = terminator_GetPhysicalDeviceMemoryProperties2KHR, + .GetPhysicalDeviceSparseImageFormatProperties2KHR = terminator_GetPhysicalDeviceSparseImageFormatProperties2KHR, #ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT // EXT_acquire_xlib_display @@ -185,60 +161,54 @@ const VkLayerInstanceDispatchTable instance_disp = { .ReleaseDisplayEXT = terminator_ReleaseDisplayEXT, // EXT_display_surface_counter - .GetPhysicalDeviceSurfaceCapabilities2EXT = - terminator_GetPhysicalDeviceSurfaceCapabilities2EXT, + .GetPhysicalDeviceSurfaceCapabilities2EXT = terminator_GetPhysicalDeviceSurfaceCapabilities2EXT, // NV_external_memory_capabilities - .GetPhysicalDeviceExternalImageFormatPropertiesNV = - terminator_GetPhysicalDeviceExternalImageFormatPropertiesNV, + .GetPhysicalDeviceExternalImageFormatPropertiesNV = terminator_GetPhysicalDeviceExternalImageFormatPropertiesNV, // NVX_device_generated_commands - .GetPhysicalDeviceGeneratedCommandsPropertiesNVX = - terminator_GetPhysicalDeviceGeneratedCommandsPropertiesNVX, + .GetPhysicalDeviceGeneratedCommandsPropertiesNVX = terminator_GetPhysicalDeviceGeneratedCommandsPropertiesNVX, }; // A null-terminated list of all of the instance extensions supported by the // loader -static const char *const LOADER_INSTANCE_EXTENSIONS[] = { - VK_KHR_SURFACE_EXTENSION_NAME, - VK_KHR_DISPLAY_EXTENSION_NAME, +static const char *const LOADER_INSTANCE_EXTENSIONS[] = {VK_KHR_SURFACE_EXTENSION_NAME, + VK_KHR_DISPLAY_EXTENSION_NAME, #ifdef VK_USE_PLATFORM_XLIB_KHR - VK_KHR_XLIB_SURFACE_EXTENSION_NAME, + VK_KHR_XLIB_SURFACE_EXTENSION_NAME, #endif #ifdef VK_USE_PLATFORM_XCB_KHR - VK_KHR_XCB_SURFACE_EXTENSION_NAME, + VK_KHR_XCB_SURFACE_EXTENSION_NAME, #endif #ifdef VK_USE_PLATFORM_WAYLAND_KHR - VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME, + VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME, #endif #ifdef VK_USE_PLATFORM_MIR_KHR - VK_KHR_MIR_SURFACE_EXTENSION_NAME, + VK_KHR_MIR_SURFACE_EXTENSION_NAME, #endif #ifdef VK_USE_PLATFORM_ANDROID_KHR - VK_KHR_ANDROID_SURFACE_EXTENSION_NAME, + VK_KHR_ANDROID_SURFACE_EXTENSION_NAME, #endif #ifdef VK_USE_PLATFORM_WIN32_KHR - VK_KHR_WIN32_SURFACE_EXTENSION_NAME, + VK_KHR_WIN32_SURFACE_EXTENSION_NAME, #endif - VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME, + VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME, #ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT - VK_EXT_ACQUIRE_XLIB_DISPLAY_EXTENSION_NAME, + VK_EXT_ACQUIRE_XLIB_DISPLAY_EXTENSION_NAME, #endif - VK_EXT_DEBUG_REPORT_EXTENSION_NAME, - VK_EXT_DIRECT_MODE_DISPLAY_EXTENSION_NAME, - VK_EXT_DISPLAY_SURFACE_COUNTER_EXTENSION_NAME, - VK_EXT_VALIDATION_FLAGS_EXTENSION_NAME, + VK_EXT_DEBUG_REPORT_EXTENSION_NAME, + VK_EXT_DIRECT_MODE_DISPLAY_EXTENSION_NAME, + VK_EXT_DISPLAY_SURFACE_COUNTER_EXTENSION_NAME, + VK_EXT_VALIDATION_FLAGS_EXTENSION_NAME, #ifdef VK_USE_PLATFORM_VI_NN - VK_NN_VI_SURFACE_EXTENSION_NAME, + VK_NN_VI_SURFACE_EXTENSION_NAME, #endif - VK_NV_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME, - NULL}; + VK_NV_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME, + NULL}; LOADER_PLATFORM_THREAD_ONCE_DECLARATION(once_init); -void *loader_instance_heap_alloc(const struct loader_instance *instance, - size_t size, - VkSystemAllocationScope alloc_scope) { +void *loader_instance_heap_alloc(const struct loader_instance *instance, size_t size, VkSystemAllocationScope alloc_scope) { void *pMemory = NULL; #if (DEBUG_DISABLE_APP_ALLOCATORS == 1) { @@ -247,9 +217,7 @@ void *loader_instance_heap_alloc(const struct loader_instance *instance, /* These are internal structures, so it's best to align everything to * the largest unit size which is the size of a uint64_t. */ - pMemory = instance->alloc_callbacks.pfnAllocation( - instance->alloc_callbacks.pUserData, size, sizeof(uint64_t), - alloc_scope); + pMemory = instance->alloc_callbacks.pfnAllocation(instance->alloc_callbacks.pUserData, size, sizeof(uint64_t), alloc_scope); } else { #endif pMemory = malloc(size); @@ -257,15 +225,13 @@ void *loader_instance_heap_alloc(const struct loader_instance *instance, return pMemory; } -void loader_instance_heap_free(const struct loader_instance *instance, - void *pMemory) { +void loader_instance_heap_free(const struct loader_instance *instance, void *pMemory) { if (pMemory != NULL) { #if (DEBUG_DISABLE_APP_ALLOCATORS == 1) { #else if (instance && instance->alloc_callbacks.pfnFree) { - instance->alloc_callbacks.pfnFree( - instance->alloc_callbacks.pUserData, pMemory); + instance->alloc_callbacks.pfnFree(instance->alloc_callbacks.pUserData, pMemory); } else { #endif free(pMemory); @@ -273,8 +239,7 @@ void loader_instance_heap_free(const struct loader_instance *instance, } } -void *loader_instance_heap_realloc(const struct loader_instance *instance, - void *pMemory, size_t orig_size, size_t size, +void *loader_instance_heap_realloc(const struct loader_instance *instance, void *pMemory, size_t orig_size, size_t size, VkSystemAllocationScope alloc_scope) { void *pNewMem = NULL; if (pMemory == NULL || orig_size == 0) { @@ -287,9 +252,8 @@ void *loader_instance_heap_realloc(const struct loader_instance *instance, /* These are internal structures, so it's best to align everything to * the largest unit size which is the size of a uint64_t. */ - pNewMem = instance->alloc_callbacks.pfnReallocation( - instance->alloc_callbacks.pUserData, pMemory, size, - sizeof(uint64_t), alloc_scope); + pNewMem = instance->alloc_callbacks.pfnReallocation(instance->alloc_callbacks.pUserData, pMemory, size, sizeof(uint64_t), + alloc_scope); #endif } else { pNewMem = realloc(pMemory, size); @@ -298,16 +262,12 @@ void *loader_instance_heap_realloc(const struct loader_instance *instance, } void *loader_instance_tls_heap_alloc(size_t size) { - return loader_instance_heap_alloc(tls_instance, size, - VK_SYSTEM_ALLOCATION_SCOPE_COMMAND); + return loader_instance_heap_alloc(tls_instance, size, VK_SYSTEM_ALLOCATION_SCOPE_COMMAND); } -void loader_instance_tls_heap_free(void *pMemory) { - loader_instance_heap_free(tls_instance, pMemory); -} +void loader_instance_tls_heap_free(void *pMemory) { loader_instance_heap_free(tls_instance, pMemory); } -void *loader_device_heap_alloc(const struct loader_device *device, size_t size, - VkSystemAllocationScope alloc_scope) { +void *loader_device_heap_alloc(const struct loader_device *device, size_t size, VkSystemAllocationScope alloc_scope) { void *pMemory = NULL; #if (DEBUG_DISABLE_APP_ALLOCATORS == 1) { @@ -316,9 +276,7 @@ void *loader_device_heap_alloc(const struct loader_device *device, size_t size, /* These are internal structures, so it's best to align everything to * the largest unit size which is the size of a uint64_t. */ - pMemory = device->alloc_callbacks.pfnAllocation( - device->alloc_callbacks.pUserData, size, sizeof(uint64_t), - alloc_scope); + pMemory = device->alloc_callbacks.pfnAllocation(device->alloc_callbacks.pUserData, size, sizeof(uint64_t), alloc_scope); } else { #endif pMemory = malloc(size); @@ -326,15 +284,13 @@ void *loader_device_heap_alloc(const struct loader_device *device, size_t size, return pMemory; } -void loader_device_heap_free(const struct loader_device *device, - void *pMemory) { +void loader_device_heap_free(const struct loader_device *device, void *pMemory) { if (pMemory != NULL) { #if (DEBUG_DISABLE_APP_ALLOCATORS == 1) { #else if (device && device->alloc_callbacks.pfnFree) { - device->alloc_callbacks.pfnFree(device->alloc_callbacks.pUserData, - pMemory); + device->alloc_callbacks.pfnFree(device->alloc_callbacks.pUserData, pMemory); } else { #endif free(pMemory); @@ -342,8 +298,7 @@ void loader_device_heap_free(const struct loader_device *device, } } -void *loader_device_heap_realloc(const struct loader_device *device, - void *pMemory, size_t orig_size, size_t size, +void *loader_device_heap_realloc(const struct loader_device *device, void *pMemory, size_t orig_size, size_t size, VkSystemAllocationScope alloc_scope) { void *pNewMem = NULL; if (pMemory == NULL || orig_size == 0) { @@ -356,9 +311,8 @@ void *loader_device_heap_realloc(const struct loader_device *device, /* These are internal structures, so it's best to align everything to * the largest unit size which is the size of a uint64_t. */ - pNewMem = device->alloc_callbacks.pfnReallocation( - device->alloc_callbacks.pUserData, pMemory, size, sizeof(uint64_t), - alloc_scope); + pNewMem = device->alloc_callbacks.pfnReallocation(device->alloc_callbacks.pUserData, pMemory, size, sizeof(uint64_t), + alloc_scope); #endif } else { pNewMem = realloc(pMemory, size); @@ -369,15 +323,13 @@ void *loader_device_heap_realloc(const struct loader_device *device, // Environment variables #if defined(__linux__) -static inline char *loader_getenv(const char *name, - const struct loader_instance *inst) { +static inline char *loader_getenv(const char *name, const struct loader_instance *inst) { // No allocation of memory necessary for Linux, but we should at least touch // the inst pointer to get rid of compiler warnings. (void)inst; return getenv(name); } -static inline void loader_free_getenv(char *val, - const struct loader_instance *inst) { +static inline void loader_free_getenv(char *val, const struct loader_instance *inst) { // No freeing of memory necessary for Linux, but we should at least touch // the val and inst pointers to get rid of compiler warnings. (void)val; @@ -386,8 +338,7 @@ static inline void loader_free_getenv(char *val, #elif defined(WIN32) -static inline char *loader_getenv(const char *name, - const struct loader_instance *inst) { +static inline char *loader_getenv(const char *name, const struct loader_instance *inst) { char *retVal; DWORD valSize; @@ -400,9 +351,8 @@ static inline char *loader_getenv(const char *name, // Allocate the space necessary for the registry entry if (NULL != inst && NULL != inst->alloc_callbacks.pfnAllocation) { - retVal = (char *)inst->alloc_callbacks.pfnAllocation( - inst->alloc_callbacks.pUserData, valSize, sizeof(char *), - VK_SYSTEM_ALLOCATION_SCOPE_COMMAND); + retVal = (char *)inst->alloc_callbacks.pfnAllocation(inst->alloc_callbacks.pUserData, valSize, sizeof(char *), + VK_SYSTEM_ALLOCATION_SCOPE_COMMAND); } else { retVal = (char *)malloc(valSize); } @@ -414,8 +364,7 @@ static inline char *loader_getenv(const char *name, return retVal; } -static inline void loader_free_getenv(char *val, - const struct loader_instance *inst) { +static inline void loader_free_getenv(char *val, const struct loader_instance *inst) { if (NULL != inst && NULL != inst->alloc_callbacks.pfnFree) { inst->alloc_callbacks.pfnFree(inst->alloc_callbacks.pUserData, val); } else { @@ -425,15 +374,13 @@ static inline void loader_free_getenv(char *val, #else -static inline char *loader_getenv(const char *name, - const struct loader_instance *inst) { +static inline char *loader_getenv(const char *name, const struct loader_instance *inst) { // stub func (void)inst; (void)name; return NULL; } -static inline void loader_free_getenv(char *val, - const struct loader_instance *inst) { +static inline void loader_free_getenv(char *val, const struct loader_instance *inst) { // stub func (void)val; (void)inst; @@ -441,8 +388,7 @@ static inline void loader_free_getenv(char *val, #endif -void loader_log(const struct loader_instance *inst, VkFlags msg_type, - int32_t msg_code, const char *format, ...) { +void loader_log(const struct loader_instance *inst, VkFlags msg_type, int32_t msg_code, const char *format, ...) { char msg[512]; char cmd_line_msg[512]; uint16_t cmd_line_size = sizeof(cmd_line_msg); @@ -457,9 +403,8 @@ void loader_log(const struct loader_instance *inst, VkFlags msg_type, va_end(ap); if (inst) { - util_DebugReportMessage( - inst, msg_type, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, - (uint64_t)(uintptr_t)inst, 0, msg_code, "loader", msg); + util_DebugReportMessage(inst, msg_type, VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT, (uint64_t)(uintptr_t)inst, 0, msg_code, + "loader", msg); } if (!(msg_type & g_loader_log_msgs)) { @@ -519,25 +464,21 @@ void loader_log(const struct loader_instance *inst, VkFlags msg_type, fputc('\n', stderr); } -VKAPI_ATTR VkResult VKAPI_CALL vkSetInstanceDispatch(VkInstance instance, - void *object) { +VKAPI_ATTR VkResult VKAPI_CALL vkSetInstanceDispatch(VkInstance instance, void *object) { struct loader_instance *inst = loader_get_instance(instance); if (!inst) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "vkSetInstanceDispatch: Can not retrieve Instance " - "dispatch table."); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "vkSetInstanceDispatch: Can not retrieve Instance " + "dispatch table."); return VK_ERROR_INITIALIZATION_FAILED; } loader_set_dispatch(object, inst->disp); return VK_SUCCESS; } -VKAPI_ATTR VkResult VKAPI_CALL vkSetDeviceDispatch(VkDevice device, - void *object) { +VKAPI_ATTR VkResult VKAPI_CALL vkSetDeviceDispatch(VkDevice device, void *object) { struct loader_device *dev; - struct loader_icd_term *icd_term = - loader_get_icd_and_device(device, &dev, NULL); + struct loader_icd_term *icd_term = loader_get_icd_and_device(device, &dev, NULL); if (NULL == icd_term) { return VK_ERROR_INITIALIZATION_FAILED; @@ -562,8 +503,7 @@ static char *loader_get_next_path(char *path); // // *reg_data contains a string list of filenames as pointer. // When done using the returned string list, the caller should free the pointer. -VkResult loaderGetRegistryFiles(const struct loader_instance *inst, - char *location, char **reg_data) { +VkResult loaderGetRegistryFiles(const struct loader_instance *inst, char *location, char **reg_data) { LONG rtn_value; HKEY hive, key; DWORD access_flags; @@ -594,32 +534,25 @@ VkResult loaderGetRegistryFiles(const struct loader_instance *inst, continue; } - while ((rtn_value = RegEnumValue(key, idx++, name, &name_size, NULL, - NULL, (LPBYTE)&value, &value_size)) == - ERROR_SUCCESS) { + while ((rtn_value = RegEnumValue(key, idx++, name, &name_size, NULL, NULL, (LPBYTE)&value, &value_size)) == ERROR_SUCCESS) { if (value_size == sizeof(value) && value == 0) { if (NULL == *reg_data) { - *reg_data = loader_instance_heap_alloc( - inst, total_size, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); + *reg_data = loader_instance_heap_alloc(inst, total_size, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (NULL == *reg_data) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loaderGetRegistryFiles: Failed to allocate " - "space for registry data for key %s", - name); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loaderGetRegistryFiles: Failed to allocate " + "space for registry data for key %s", + name); result = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; } *reg_data[0] = '\0'; } else if (strlen(*reg_data) + name_size + 1 > total_size) { - *reg_data = loader_instance_heap_realloc( - inst, *reg_data, total_size, total_size * 2, - VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); + *reg_data = loader_instance_heap_realloc(inst, *reg_data, total_size, total_size * 2, + VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (NULL == *reg_data) { - loader_log( - inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loaderGetRegistryFiles: Failed to reallocate " - "space for registry value of size %d for key %s", - total_size * 2, name); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loaderGetRegistryFiles: Failed to reallocate " + "space for registry value of size %d for key %s", + total_size * 2, name); result = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; } @@ -628,8 +561,7 @@ VkResult loaderGetRegistryFiles(const struct loader_instance *inst, if (strlen(*reg_data) == 0) { (void)snprintf(*reg_data, name_size + 1, "%s", name); } else { - (void)snprintf(*reg_data + strlen(*reg_data), name_size + 2, - "%c%s", PATH_SEPARATOR, name); + (void)snprintf(*reg_data + strlen(*reg_data), name_size + 2, "%c%s", PATH_SEPARATOR, name); } found = true; } @@ -675,8 +607,7 @@ static size_t loader_platform_combine_path(char *dest, size_t len, ...) { // This path element is not the first non-empty element; prepend // a directory separator if space allows if (dest && required_len + 1 < len) { - (void)snprintf(dest + required_len, len - required_len, "%c", - DIRECTORY_SYMBOL); + (void)snprintf(dest + required_len, len - required_len, "%c", DIRECTORY_SYMBOL); } required_len++; } @@ -725,8 +656,7 @@ static uint32_t loader_make_version(char *vers_str) { return VK_MAKE_VERSION(major, minor, patch); } -bool compare_vk_extension_properties(const VkExtensionProperties *op1, - const VkExtensionProperties *op2) { +bool compare_vk_extension_properties(const VkExtensionProperties *op1, const VkExtensionProperties *op2) { return strcmp(op1->extensionName, op2->extensionName) == 0 ? true : false; } @@ -734,8 +664,7 @@ bool compare_vk_extension_properties(const VkExtensionProperties *op1, * Search the given ext_array for an extension * matching the given vk_ext_prop */ -bool has_vk_extension_property_array(const VkExtensionProperties *vk_ext_prop, - const uint32_t count, +bool has_vk_extension_property_array(const VkExtensionProperties *vk_ext_prop, const uint32_t count, const VkExtensionProperties *ext_array) { for (uint32_t i = 0; i < count; i++) { if (compare_vk_extension_properties(vk_ext_prop, &ext_array[i])) @@ -748,8 +677,7 @@ bool has_vk_extension_property_array(const VkExtensionProperties *vk_ext_prop, * Search the given ext_list for an extension * matching the given vk_ext_prop */ -bool has_vk_extension_property(const VkExtensionProperties *vk_ext_prop, - const struct loader_extension_list *ext_list) { +bool has_vk_extension_property(const VkExtensionProperties *vk_ext_prop, const struct loader_extension_list *ext_list) { for (uint32_t i = 0; i < ext_list->count; i++) { if (compare_vk_extension_properties(&ext_list->list[i], vk_ext_prop)) return true; @@ -760,9 +688,7 @@ bool has_vk_extension_property(const VkExtensionProperties *vk_ext_prop, /** * Search the given ext_list for a device extension matching the given ext_prop */ -bool has_vk_dev_ext_property( - const VkExtensionProperties *ext_prop, - const struct loader_device_extension_list *ext_list) { +bool has_vk_dev_ext_property(const VkExtensionProperties *ext_prop, const struct loader_device_extension_list *ext_list) { for (uint32_t i = 0; i < ext_list->count; i++) { if (compare_vk_extension_properties(&ext_list->list[i].props, ext_prop)) return true; @@ -773,9 +699,7 @@ bool has_vk_dev_ext_property( /* * Search the given layer list for a layer matching the given layer name */ -static struct loader_layer_properties * -loader_get_layer_property(const char *name, - const struct loader_layer_list *layer_list) { +static struct loader_layer_properties *loader_get_layer_property(const char *name, const struct loader_layer_list *layer_list) { for (uint32_t i = 0; i < layer_list->count; i++) { const VkLayerProperties *item = &layer_list->list[i].info; if (strcmp(name, item->layerName) == 0) @@ -787,34 +711,27 @@ loader_get_layer_property(const char *name, /** * Get the next unused layer property in the list. Init the property to zero. */ -static struct loader_layer_properties * -loader_get_next_layer_property(const struct loader_instance *inst, - struct loader_layer_list *layer_list) { +static struct loader_layer_properties *loader_get_next_layer_property(const struct loader_instance *inst, + struct loader_layer_list *layer_list) { if (layer_list->capacity == 0) { - layer_list->list = loader_instance_heap_alloc( - inst, sizeof(struct loader_layer_properties) * 64, - VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); + layer_list->list = + loader_instance_heap_alloc(inst, sizeof(struct loader_layer_properties) * 64, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (layer_list->list == NULL) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_get_next_layer_property: Out of memory can " - "not add any layer properties to list"); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_get_next_layer_property: Out of memory can " + "not add any layer properties to list"); return NULL; } - memset(layer_list->list, 0, - sizeof(struct loader_layer_properties) * 64); + memset(layer_list->list, 0, sizeof(struct loader_layer_properties) * 64); layer_list->capacity = sizeof(struct loader_layer_properties) * 64; } // ensure enough room to add an entry - if ((layer_list->count + 1) * sizeof(struct loader_layer_properties) > - layer_list->capacity) { - layer_list->list = loader_instance_heap_realloc( - inst, layer_list->list, layer_list->capacity, - layer_list->capacity * 2, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); + if ((layer_list->count + 1) * sizeof(struct loader_layer_properties) > layer_list->capacity) { + layer_list->list = loader_instance_heap_realloc(inst, layer_list->list, layer_list->capacity, layer_list->capacity * 2, + VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (layer_list->list == NULL) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_get_next_layer_property: realloc failed for " - "layer list"); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_get_next_layer_property: realloc failed for " + "layer list"); return NULL; } layer_list->capacity *= 2; @@ -827,28 +744,22 @@ loader_get_next_layer_property(const struct loader_instance *inst, /** * Remove all layer properties entrys from the list */ -void loader_delete_layer_properties(const struct loader_instance *inst, - struct loader_layer_list *layer_list) { +void loader_delete_layer_properties(const struct loader_instance *inst, struct loader_layer_list *layer_list) { uint32_t i, j; struct loader_device_extension_list *dev_ext_list; if (!layer_list) return; for (i = 0; i < layer_list->count; i++) { - loader_destroy_generic_list( - inst, (struct loader_generic_list *)&layer_list->list[i] - .instance_extension_list); + loader_destroy_generic_list(inst, (struct loader_generic_list *)&layer_list->list[i].instance_extension_list); dev_ext_list = &layer_list->list[i].device_extension_list; - if (dev_ext_list->capacity > 0 && NULL != dev_ext_list->list && - dev_ext_list->list->entrypoint_count > 0) { + if (dev_ext_list->capacity > 0 && NULL != dev_ext_list->list && dev_ext_list->list->entrypoint_count > 0) { for (j = 0; j < dev_ext_list->list->entrypoint_count; j++) { - loader_instance_heap_free(inst, - dev_ext_list->list->entrypoints[j]); + loader_instance_heap_free(inst, dev_ext_list->list->entrypoints[j]); } loader_instance_heap_free(inst, dev_ext_list->list->entrypoints); } - loader_destroy_generic_list(inst, - (struct loader_generic_list *)dev_ext_list); + loader_destroy_generic_list(inst, (struct loader_generic_list *)dev_ext_list); } layer_list->count = 0; @@ -858,10 +769,9 @@ void loader_delete_layer_properties(const struct loader_instance *inst, } } -static VkResult loader_add_instance_extensions( - const struct loader_instance *inst, - const PFN_vkEnumerateInstanceExtensionProperties fp_get_props, - const char *lib_name, struct loader_extension_list *ext_list) { +static VkResult loader_add_instance_extensions(const struct loader_instance *inst, + const PFN_vkEnumerateInstanceExtensionProperties fp_get_props, const char *lib_name, + struct loader_extension_list *ext_list) { uint32_t i, count = 0; VkExtensionProperties *ext_props; VkResult res = VK_SUCCESS; @@ -873,9 +783,8 @@ static VkResult loader_add_instance_extensions( res = fp_get_props(NULL, &count, NULL); if (res != VK_SUCCESS) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_add_instance_extensions: Error getting Instance " - "extension count from %s", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_add_instance_extensions: Error getting Instance " + "extension count from %s", lib_name); goto out; } @@ -893,9 +802,8 @@ static VkResult loader_add_instance_extensions( res = fp_get_props(NULL, &count, ext_props); if (res != VK_SUCCESS) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_add_instance_extensions: Error getting Instance " - "extensions from %s", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_add_instance_extensions: Error getting Instance " + "extensions from %s", lib_name); goto out; } @@ -903,22 +811,17 @@ static VkResult loader_add_instance_extensions( for (i = 0; i < count; i++) { char spec_version[64]; - bool ext_unsupported = - wsi_unsupported_instance_extension(&ext_props[i]); + bool ext_unsupported = wsi_unsupported_instance_extension(&ext_props[i]); if (!ext_unsupported) { - (void)snprintf(spec_version, sizeof(spec_version), "%d.%d.%d", - VK_MAJOR(ext_props[i].specVersion), - VK_MINOR(ext_props[i].specVersion), - VK_PATCH(ext_props[i].specVersion)); - loader_log(inst, VK_DEBUG_REPORT_DEBUG_BIT_EXT, 0, - "Instance Extension: %s (%s) version %s", - ext_props[i].extensionName, lib_name, spec_version); + (void)snprintf(spec_version, sizeof(spec_version), "%d.%d.%d", VK_MAJOR(ext_props[i].specVersion), + VK_MINOR(ext_props[i].specVersion), VK_PATCH(ext_props[i].specVersion)); + loader_log(inst, VK_DEBUG_REPORT_DEBUG_BIT_EXT, 0, "Instance Extension: %s (%s) version %s", ext_props[i].extensionName, + lib_name, spec_version); res = loader_add_to_ext_list(inst, ext_list, 1, &ext_props[i]); if (res != VK_SUCCESS) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_add_instance_extensions: Failed to add %s " - "to Instance extension list", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_add_instance_extensions: Failed to add %s " + "to Instance extension list", lib_name); goto out; } @@ -933,16 +836,13 @@ out: * Initialize ext_list with the physical device extensions. * The extension properties are passed as inputs in count and ext_props. */ -static VkResult -loader_init_device_extensions(const struct loader_instance *inst, - struct loader_physical_device_term *phys_dev_term, - uint32_t count, VkExtensionProperties *ext_props, - struct loader_extension_list *ext_list) { +static VkResult loader_init_device_extensions(const struct loader_instance *inst, struct loader_physical_device_term *phys_dev_term, + uint32_t count, VkExtensionProperties *ext_props, + struct loader_extension_list *ext_list) { VkResult res; uint32_t i; - res = loader_init_generic_list(inst, (struct loader_generic_list *)ext_list, - sizeof(VkExtensionProperties)); + res = loader_init_generic_list(inst, (struct loader_generic_list *)ext_list, sizeof(VkExtensionProperties)); if (VK_SUCCESS != res) { return res; } @@ -950,14 +850,10 @@ loader_init_device_extensions(const struct loader_instance *inst, for (i = 0; i < count; i++) { char spec_version[64]; - (void)snprintf(spec_version, sizeof(spec_version), "%d.%d.%d", - VK_MAJOR(ext_props[i].specVersion), - VK_MINOR(ext_props[i].specVersion), - VK_PATCH(ext_props[i].specVersion)); - loader_log( - inst, VK_DEBUG_REPORT_DEBUG_BIT_EXT, 0, - "Device Extension: %s (%s) version %s", ext_props[i].extensionName, - phys_dev_term->this_icd_term->scanned_icd->lib_name, spec_version); + (void)snprintf(spec_version, sizeof(spec_version), "%d.%d.%d", VK_MAJOR(ext_props[i].specVersion), + VK_MINOR(ext_props[i].specVersion), VK_PATCH(ext_props[i].specVersion)); + loader_log(inst, VK_DEBUG_REPORT_DEBUG_BIT_EXT, 0, "Device Extension: %s (%s) version %s", ext_props[i].extensionName, + phys_dev_term->this_icd_term->scanned_icd->lib_name, spec_version); res = loader_add_to_ext_list(inst, ext_list, 1, &ext_props[i]); if (res != VK_SUCCESS) return res; @@ -967,49 +863,40 @@ loader_init_device_extensions(const struct loader_instance *inst, } VkResult loader_add_device_extensions(const struct loader_instance *inst, - PFN_vkEnumerateDeviceExtensionProperties - fpEnumerateDeviceExtensionProperties, - VkPhysicalDevice physical_device, - const char *lib_name, + PFN_vkEnumerateDeviceExtensionProperties fpEnumerateDeviceExtensionProperties, + VkPhysicalDevice physical_device, const char *lib_name, struct loader_extension_list *ext_list) { uint32_t i, count; VkResult res; VkExtensionProperties *ext_props; - res = fpEnumerateDeviceExtensionProperties(physical_device, NULL, &count, - NULL); + res = fpEnumerateDeviceExtensionProperties(physical_device, NULL, &count, NULL); if (res == VK_SUCCESS && count > 0) { ext_props = loader_stack_alloc(count * sizeof(VkExtensionProperties)); if (!ext_props) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_add_device_extensions: Failed to allocate space" - " for device extension properties."); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_add_device_extensions: Failed to allocate space" + " for device extension properties."); return VK_ERROR_OUT_OF_HOST_MEMORY; } - res = fpEnumerateDeviceExtensionProperties(physical_device, NULL, - &count, ext_props); + res = fpEnumerateDeviceExtensionProperties(physical_device, NULL, &count, ext_props); if (res != VK_SUCCESS) { return res; } for (i = 0; i < count; i++) { char spec_version[64]; - (void)snprintf(spec_version, sizeof(spec_version), "%d.%d.%d", - VK_MAJOR(ext_props[i].specVersion), - VK_MINOR(ext_props[i].specVersion), - VK_PATCH(ext_props[i].specVersion)); - loader_log(inst, VK_DEBUG_REPORT_DEBUG_BIT_EXT, 0, - "Device Extension: %s (%s) version %s", - ext_props[i].extensionName, lib_name, spec_version); + (void)snprintf(spec_version, sizeof(spec_version), "%d.%d.%d", VK_MAJOR(ext_props[i].specVersion), + VK_MINOR(ext_props[i].specVersion), VK_PATCH(ext_props[i].specVersion)); + loader_log(inst, VK_DEBUG_REPORT_DEBUG_BIT_EXT, 0, "Device Extension: %s (%s) version %s", ext_props[i].extensionName, + lib_name, spec_version); res = loader_add_to_ext_list(inst, ext_list, 1, &ext_props[i]); if (res != VK_SUCCESS) { return res; } } } else { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_add_device_extensions: Error getting physical " - "device extension info count from library %s", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_add_device_extensions: Error getting physical " + "device extension info count from library %s", lib_name); return res; } @@ -1017,18 +904,14 @@ VkResult loader_add_device_extensions(const struct loader_instance *inst, return VK_SUCCESS; } -VkResult loader_init_generic_list(const struct loader_instance *inst, - struct loader_generic_list *list_info, - size_t element_size) { +VkResult loader_init_generic_list(const struct loader_instance *inst, struct loader_generic_list *list_info, size_t element_size) { size_t capacity = 32 * element_size; list_info->count = 0; list_info->capacity = 0; - list_info->list = loader_instance_heap_alloc( - inst, capacity, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); + list_info->list = loader_instance_heap_alloc(inst, capacity, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (list_info->list == NULL) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_init_generic_list: Failed to allocate space " - "for generic list"); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_init_generic_list: Failed to allocate space " + "for generic list"); return VK_ERROR_OUT_OF_HOST_MEMORY; } memset(list_info->list, 0, capacity); @@ -1036,8 +919,7 @@ VkResult loader_init_generic_list(const struct loader_instance *inst, return VK_SUCCESS; } -void loader_destroy_generic_list(const struct loader_instance *inst, - struct loader_generic_list *list) { +void loader_destroy_generic_list(const struct loader_instance *inst, struct loader_generic_list *list) { loader_instance_heap_free(inst, list->list); list->count = 0; list->capacity = 0; @@ -1049,17 +931,13 @@ void loader_destroy_generic_list(const struct loader_instance *inst, * Return * Vk_SUCCESS on success */ -VkResult loader_add_to_ext_list(const struct loader_instance *inst, - struct loader_extension_list *ext_list, - uint32_t prop_list_count, - const VkExtensionProperties *props) { +VkResult loader_add_to_ext_list(const struct loader_instance *inst, struct loader_extension_list *ext_list, + uint32_t prop_list_count, const VkExtensionProperties *props) { uint32_t i; const VkExtensionProperties *cur_ext; if (ext_list->list == NULL || ext_list->capacity == 0) { - VkResult res = loader_init_generic_list( - inst, (struct loader_generic_list *)ext_list, - sizeof(VkExtensionProperties)); + VkResult res = loader_init_generic_list(inst, (struct loader_generic_list *)ext_list, sizeof(VkExtensionProperties)); if (VK_SUCCESS != res) { return res; } @@ -1075,17 +953,14 @@ VkResult loader_add_to_ext_list(const struct loader_instance *inst, // add to list at end // check for enough capacity - if (ext_list->count * sizeof(VkExtensionProperties) >= - ext_list->capacity) { + if (ext_list->count * sizeof(VkExtensionProperties) >= ext_list->capacity) { - ext_list->list = loader_instance_heap_realloc( - inst, ext_list->list, ext_list->capacity, - ext_list->capacity * 2, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); + ext_list->list = loader_instance_heap_realloc(inst, ext_list->list, ext_list->capacity, ext_list->capacity * 2, + VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (ext_list->list == NULL) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_add_to_ext_list: Failed to reallocate " - "space for extension list"); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_add_to_ext_list: Failed to reallocate " + "space for extension list"); return VK_ERROR_OUT_OF_HOST_MEMORY; } @@ -1093,8 +968,7 @@ VkResult loader_add_to_ext_list(const struct loader_instance *inst, ext_list->capacity *= 2; } - memcpy(&ext_list->list[ext_list->count], cur_ext, - sizeof(VkExtensionProperties)); + memcpy(&ext_list->list[ext_list->count], cur_ext, sizeof(VkExtensionProperties)); ext_list->count++; } return VK_SUCCESS; @@ -1106,16 +980,11 @@ VkResult loader_add_to_ext_list(const struct loader_instance *inst, * Return * Vk_SUCCESS on success */ -VkResult -loader_add_to_dev_ext_list(const struct loader_instance *inst, - struct loader_device_extension_list *ext_list, - const VkExtensionProperties *props, - uint32_t entry_count, char **entrys) { +VkResult loader_add_to_dev_ext_list(const struct loader_instance *inst, struct loader_device_extension_list *ext_list, + const VkExtensionProperties *props, uint32_t entry_count, char **entrys) { uint32_t idx; if (ext_list->list == NULL || ext_list->capacity == 0) { - VkResult res = loader_init_generic_list( - inst, (struct loader_generic_list *)ext_list, - sizeof(struct loader_dev_ext_props)); + VkResult res = loader_init_generic_list(inst, (struct loader_generic_list *)ext_list, sizeof(struct loader_dev_ext_props)); if (VK_SUCCESS != res) { return res; } @@ -1131,14 +1000,12 @@ loader_add_to_dev_ext_list(const struct loader_instance *inst, // check for enough capacity if (idx * sizeof(struct loader_dev_ext_props) >= ext_list->capacity) { - ext_list->list = loader_instance_heap_realloc( - inst, ext_list->list, ext_list->capacity, ext_list->capacity * 2, - VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); + ext_list->list = loader_instance_heap_realloc(inst, ext_list->list, ext_list->capacity, ext_list->capacity * 2, + VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (ext_list->list == NULL) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_add_to_dev_ext_list: Failed to reallocate " - "space for device extension list"); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_add_to_dev_ext_list: Failed to reallocate " + "space for device extension list"); return VK_ERROR_OUT_OF_HOST_MEMORY; } @@ -1146,34 +1013,29 @@ loader_add_to_dev_ext_list(const struct loader_instance *inst, ext_list->capacity *= 2; } - memcpy(&ext_list->list[idx].props, props, - sizeof(struct loader_dev_ext_props)); + memcpy(&ext_list->list[idx].props, props, sizeof(struct loader_dev_ext_props)); ext_list->list[idx].entrypoint_count = entry_count; ext_list->list[idx].entrypoints = - loader_instance_heap_alloc(inst, sizeof(char *) * entry_count, - VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); + loader_instance_heap_alloc(inst, sizeof(char *) * entry_count, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (ext_list->list[idx].entrypoints == NULL) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_add_to_dev_ext_list: Failed to allocate space " - "for device extension entrypoint list in list %d", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_add_to_dev_ext_list: Failed to allocate space " + "for device extension entrypoint list in list %d", idx); ext_list->list[idx].entrypoint_count = 0; return VK_ERROR_OUT_OF_HOST_MEMORY; } for (uint32_t i = 0; i < entry_count; i++) { - ext_list->list[idx].entrypoints[i] = loader_instance_heap_alloc( - inst, strlen(entrys[i]) + 1, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); + ext_list->list[idx].entrypoints[i] = + loader_instance_heap_alloc(inst, strlen(entrys[i]) + 1, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (ext_list->list[idx].entrypoints[i] == NULL) { for (uint32_t j = 0; j < i; j++) { - loader_instance_heap_free(inst, - ext_list->list[idx].entrypoints[j]); + loader_instance_heap_free(inst, ext_list->list[idx].entrypoints[j]); } loader_instance_heap_free(inst, ext_list->list[idx].entrypoints); ext_list->list[idx].entrypoint_count = 0; ext_list->list[idx].entrypoints = NULL; - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_add_to_dev_ext_list: Failed to allocate space " - "for device extension entrypoint %d name", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_add_to_dev_ext_list: Failed to allocate space " + "for device extension entrypoint %d name", i); return VK_ERROR_OUT_OF_HOST_MEMORY; } @@ -1189,11 +1051,9 @@ loader_add_to_dev_ext_list(const struct loader_instance *inst, * Add these to the output layer_list. Don't add duplicates to the output * layer_list. */ -static VkResult -loader_add_layer_names_to_list(const struct loader_instance *inst, - struct loader_layer_list *output_list, - uint32_t name_count, const char *const *names, - const struct loader_layer_list *search_list) { +static VkResult loader_add_layer_names_to_list(const struct loader_instance *inst, struct loader_layer_list *output_list, + uint32_t name_count, const char *const *names, + const struct loader_layer_list *search_list) { struct loader_layer_properties *layer_prop; VkResult err = VK_SUCCESS; @@ -1201,9 +1061,8 @@ loader_add_layer_names_to_list(const struct loader_instance *inst, const char *search_target = names[i]; layer_prop = loader_get_layer_property(search_target, search_list); if (!layer_prop) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_add_layer_names_to_list: Unable to find layer" - " %s", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_add_layer_names_to_list: Unable to find layer" + " %s", search_target); err = VK_ERROR_LAYER_NOT_PRESENT; continue; @@ -1218,11 +1077,9 @@ loader_add_layer_names_to_list(const struct loader_instance *inst, /* * Manage lists of VkLayerProperties */ -static bool loader_init_layer_list(const struct loader_instance *inst, - struct loader_layer_list *list) { +static bool loader_init_layer_list(const struct loader_instance *inst, struct loader_layer_list *list) { list->capacity = 32 * sizeof(struct loader_layer_properties); - list->list = loader_instance_heap_alloc( - inst, list->capacity, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); + list->list = loader_instance_heap_alloc(inst, list->capacity, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (list->list == NULL) { return false; } @@ -1231,8 +1088,7 @@ static bool loader_init_layer_list(const struct loader_instance *inst, return true; } -void loader_destroy_layer_list(const struct loader_instance *inst, - struct loader_device *device, +void loader_destroy_layer_list(const struct loader_instance *inst, struct loader_device *device, struct loader_layer_list *layer_list) { if (device) { loader_device_heap_free(device, layer_list->list); @@ -1247,8 +1103,7 @@ void loader_destroy_layer_list(const struct loader_instance *inst, * Search the given layer list for a list * matching the given VkLayerProperties */ -bool has_vk_layer_property(const VkLayerProperties *vk_layer_prop, - const struct loader_layer_list *list) { +bool has_vk_layer_property(const VkLayerProperties *vk_layer_prop, const struct loader_layer_list *list) { for (uint32_t i = 0; i < list->count; i++) { if (strcmp(vk_layer_prop->layerName, list->list[i].info.layerName) == 0) return true; @@ -1272,9 +1127,7 @@ bool has_layer_name(const char *name, const struct loader_layer_list *list) { * Append non-duplicate layer properties defined in prop_list * to the given layer_info list */ -VkResult loader_add_to_layer_list(const struct loader_instance *inst, - struct loader_layer_list *list, - uint32_t prop_list_count, +VkResult loader_add_to_layer_list(const struct loader_instance *inst, struct loader_layer_list *list, uint32_t prop_list_count, const struct loader_layer_properties *props) { uint32_t i; struct loader_layer_properties *layer; @@ -1296,24 +1149,20 @@ VkResult loader_add_to_layer_list(const struct loader_instance *inst, // add to list at end // check for enough capacity - if (list->count * sizeof(struct loader_layer_properties) >= - list->capacity) { + if (list->count * sizeof(struct loader_layer_properties) >= list->capacity) { - list->list = loader_instance_heap_realloc( - inst, list->list, list->capacity, list->capacity * 2, - VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); + list->list = loader_instance_heap_realloc(inst, list->list, list->capacity, list->capacity * 2, + VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (NULL == list->list) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_add_to_layer_list: Realloc failed for " - "when attempting to add new layer"); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_add_to_layer_list: Realloc failed for " + "when attempting to add new layer"); return VK_ERROR_OUT_OF_HOST_MEMORY; } // double capacity list->capacity *= 2; } - memcpy(&list->list[list->count], layer, - sizeof(struct loader_layer_properties)); + memcpy(&list->list[list->count], layer, sizeof(struct loader_layer_properties)); list->count++; } @@ -1327,33 +1176,26 @@ VkResult loader_add_to_layer_list(const struct loader_instance *inst, * Do not add if found loader_layer_properties is already * on the found_list. */ -void loader_find_layer_name_add_list( - const struct loader_instance *inst, const char *name, - const enum layer_type type, const struct loader_layer_list *search_list, - struct loader_layer_list *found_list) { +void loader_find_layer_name_add_list(const struct loader_instance *inst, const char *name, const enum layer_type type, + const struct loader_layer_list *search_list, struct loader_layer_list *found_list) { bool found = false; for (uint32_t i = 0; i < search_list->count; i++) { struct loader_layer_properties *layer_prop = &search_list->list[i]; - if (0 == strcmp(layer_prop->info.layerName, name) && - (layer_prop->type & type)) { + if (0 == strcmp(layer_prop->info.layerName, name) && (layer_prop->type & type)) { /* Found a layer with the same name, add to found_list */ - if (VK_SUCCESS == - loader_add_to_layer_list(inst, found_list, 1, layer_prop)) { + if (VK_SUCCESS == loader_add_to_layer_list(inst, found_list, 1, layer_prop)) { found = true; } } } if (!found) { - loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, - "loader_find_layer_name_add_list: Failed to find layer name " - "%s to activate", + loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, "loader_find_layer_name_add_list: Failed to find layer name " + "%s to activate", name); } } -static VkExtensionProperties * -get_extension_property(const char *name, - const struct loader_extension_list *list) { +static VkExtensionProperties *get_extension_property(const char *name, const struct loader_extension_list *list) { for (uint32_t i = 0; i < list->count; i++) { if (strcmp(name, list->list[i].extensionName) == 0) return &list->list[i]; @@ -1361,9 +1203,7 @@ get_extension_property(const char *name, return NULL; } -static VkExtensionProperties * -get_dev_extension_property(const char *name, - const struct loader_device_extension_list *list) { +static VkExtensionProperties *get_dev_extension_property(const char *name, const struct loader_device_extension_list *list) { for (uint32_t i = 0; i < list->count; i++) { if (strcmp(name, list->list[i].props.extensionName) == 0) return &list->list[i].props; @@ -1391,38 +1231,29 @@ get_dev_extension_property(const char *name, * linked directly with the loader. */ -VkResult loader_get_icd_loader_instance_extensions( - const struct loader_instance *inst, - struct loader_icd_tramp_list *icd_tramp_list, - struct loader_extension_list *inst_exts) { +VkResult loader_get_icd_loader_instance_extensions(const struct loader_instance *inst, struct loader_icd_tramp_list *icd_tramp_list, + struct loader_extension_list *inst_exts) { struct loader_extension_list icd_exts; VkResult res = VK_SUCCESS; - loader_log(inst, VK_DEBUG_REPORT_DEBUG_BIT_EXT, 0, - "Build ICD instance extension list"); + loader_log(inst, VK_DEBUG_REPORT_DEBUG_BIT_EXT, 0, "Build ICD instance extension list"); // traverse scanned icd list adding non-duplicate extensions to the list for (uint32_t i = 0; i < icd_tramp_list->count; i++) { - res = loader_init_generic_list(inst, - (struct loader_generic_list *)&icd_exts, - sizeof(VkExtensionProperties)); + res = loader_init_generic_list(inst, (struct loader_generic_list *)&icd_exts, sizeof(VkExtensionProperties)); if (VK_SUCCESS != res) { goto out; } - res = loader_add_instance_extensions( - inst, icd_tramp_list->scanned_list[i] - .EnumerateInstanceExtensionProperties, - icd_tramp_list->scanned_list[i].lib_name, &icd_exts); + res = loader_add_instance_extensions(inst, icd_tramp_list->scanned_list[i].EnumerateInstanceExtensionProperties, + icd_tramp_list->scanned_list[i].lib_name, &icd_exts); if (VK_SUCCESS == res) { // Remove any extensions not recognized by the loader for (int32_t j = 0; j < (int32_t)icd_exts.count; j++) { // See if the extension is in the list of supported extensions bool found = false; - for (uint32_t k = 0; LOADER_INSTANCE_EXTENSIONS[k] != NULL; - k++) { - if (strcmp(icd_exts.list[j].extensionName, - LOADER_INSTANCE_EXTENSIONS[k]) == 0) { + for (uint32_t k = 0; LOADER_INSTANCE_EXTENSIONS[k] != NULL; k++) { + if (strcmp(icd_exts.list[j].extensionName, LOADER_INSTANCE_EXTENSIONS[k]) == 0) { found = true; break; } @@ -1438,17 +1269,14 @@ VkResult loader_get_icd_loader_instance_extensions( } } - res = loader_add_to_ext_list(inst, inst_exts, icd_exts.count, - icd_exts.list); + res = loader_add_to_ext_list(inst, inst_exts, icd_exts.count, icd_exts.list); } - loader_destroy_generic_list(inst, - (struct loader_generic_list *)&icd_exts); + loader_destroy_generic_list(inst, (struct loader_generic_list *)&icd_exts); if (VK_SUCCESS != res) { goto out; } }; - // Traverse loader's extensions, adding non-duplicate extensions to the list debug_report_add_instance_extensions(inst, inst_exts); @@ -1456,23 +1284,15 @@ out: return res; } -struct loader_icd_term * -loader_get_icd_and_device(const VkDevice device, - struct loader_device **found_dev, - uint32_t *icd_index) { +struct loader_icd_term *loader_get_icd_and_device(const VkDevice device, struct loader_device **found_dev, uint32_t *icd_index) { *found_dev = NULL; uint32_t index = 0; - for (struct loader_instance *inst = loader.instances; inst; - inst = inst->next) { - for (struct loader_icd_term *icd_term = inst->icd_terms; icd_term; - icd_term = icd_term->next) { - for (struct loader_device *dev = icd_term->logical_device_list; dev; - dev = dev->next) + for (struct loader_instance *inst = loader.instances; inst; inst = inst->next) { + for (struct loader_icd_term *icd_term = inst->icd_terms; icd_term; icd_term = icd_term->next) { + for (struct loader_device *dev = icd_term->logical_device_list; dev; dev = dev->next) // Value comparison of device prevents object wrapping by layers - if (loader_get_dispatch(dev->icd_device) == - loader_get_dispatch(device) || - loader_get_dispatch(dev->chain_device) == - loader_get_dispatch(device)) { + if (loader_get_dispatch(dev->icd_device) == loader_get_dispatch(device) || + loader_get_dispatch(dev->chain_device) == loader_get_dispatch(device)) { *found_dev = dev; if (NULL != icd_index) { *icd_index = index; @@ -1485,8 +1305,7 @@ loader_get_icd_and_device(const VkDevice device, return NULL; } -void loader_destroy_logical_device(const struct loader_instance *inst, - struct loader_device *dev, +void loader_destroy_logical_device(const struct loader_instance *inst, struct loader_device *dev, const VkAllocationCallbacks *pAllocator) { if (pAllocator) { dev->alloc_callbacks = *pAllocator; @@ -1497,26 +1316,22 @@ void loader_destroy_logical_device(const struct loader_instance *inst, loader_device_heap_free(dev, dev); } -struct loader_device * -loader_create_logical_device(const struct loader_instance *inst, - const VkAllocationCallbacks *pAllocator) { +struct loader_device *loader_create_logical_device(const struct loader_instance *inst, const VkAllocationCallbacks *pAllocator) { struct loader_device *new_dev; #if (DEBUG_DISABLE_APP_ALLOCATORS == 1) { #else if (pAllocator) { - new_dev = (struct loader_device *)pAllocator->pfnAllocation( - pAllocator->pUserData, sizeof(struct loader_device), sizeof(int *), - VK_SYSTEM_ALLOCATION_SCOPE_DEVICE); + new_dev = (struct loader_device *)pAllocator->pfnAllocation(pAllocator->pUserData, sizeof(struct loader_device), + sizeof(int *), VK_SYSTEM_ALLOCATION_SCOPE_DEVICE); } else { #endif new_dev = (struct loader_device *)malloc(sizeof(struct loader_device)); } if (!new_dev) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_create_logical_device: Failed to alloc struct " - "loader_device"); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_create_logical_device: Failed to alloc struct " + "loader_device"); return NULL; } @@ -1528,17 +1343,13 @@ loader_create_logical_device(const struct loader_instance *inst, return new_dev; } -void loader_add_logical_device(const struct loader_instance *inst, - struct loader_icd_term *icd_term, - struct loader_device *dev) { +void loader_add_logical_device(const struct loader_instance *inst, struct loader_icd_term *icd_term, struct loader_device *dev) { dev->next = icd_term->logical_device_list; icd_term->logical_device_list = dev; } -void loader_remove_logical_device(const struct loader_instance *inst, - struct loader_icd_term *icd_term, - struct loader_device *found_dev, - const VkAllocationCallbacks *pAllocator) { +void loader_remove_logical_device(const struct loader_instance *inst, struct loader_icd_term *icd_term, + struct loader_device *found_dev, const VkAllocationCallbacks *pAllocator) { struct loader_device *dev, *prev_dev; if (!icd_term || !found_dev) @@ -1558,8 +1369,7 @@ void loader_remove_logical_device(const struct loader_instance *inst, loader_destroy_logical_device(inst, found_dev, pAllocator); } -static void loader_icd_destroy(struct loader_instance *ptr_inst, - struct loader_icd_term *icd_term, +static void loader_icd_destroy(struct loader_instance *ptr_inst, struct loader_icd_term *icd_term, const VkAllocationCallbacks *pAllocator) { ptr_inst->total_icd_count--; for (struct loader_device *dev = icd_term->logical_device_list; dev;) { @@ -1571,12 +1381,10 @@ static void loader_icd_destroy(struct loader_instance *ptr_inst, loader_instance_heap_free(ptr_inst, icd_term); } -static struct loader_icd_term * -loader_icd_create(const struct loader_instance *inst) { +static struct loader_icd_term *loader_icd_create(const struct loader_instance *inst) { struct loader_icd_term *icd_term; - icd_term = loader_instance_heap_alloc(inst, sizeof(struct loader_icd_term), - VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); + icd_term = loader_instance_heap_alloc(inst, sizeof(struct loader_icd_term), VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (!icd_term) { return NULL; } @@ -1586,9 +1394,7 @@ loader_icd_create(const struct loader_instance *inst) { return icd_term; } -static struct loader_icd_term * -loader_icd_add(struct loader_instance *ptr_inst, - const struct loader_scanned_icd *scanned_icd) { +static struct loader_icd_term *loader_icd_add(struct loader_instance *ptr_inst, const struct loader_scanned_icd *scanned_icd) { struct loader_icd_term *icd_term; icd_term = loader_icd_create(ptr_inst); @@ -1615,9 +1421,7 @@ loader_icd_add(struct loader_instance *ptr_inst, * @return bool indicating true if the selected interface version is supported * by the loader, false indicates the version is not supported */ -bool loader_get_icd_interface_version( - PFN_vkNegotiateLoaderICDInterfaceVersion fp_negotiate_icd_version, - uint32_t *pVersion) { +bool loader_get_icd_interface_version(PFN_vkNegotiateLoaderICDInterfaceVersion fp_negotiate_icd_version, uint32_t *pVersion) { if (fp_negotiate_icd_version == NULL) { // ICD does not support the negotiation API, it supports version 0 or 1 @@ -1646,14 +1450,12 @@ bool loader_get_icd_interface_version( return true; } -void loader_scanned_icd_clear(const struct loader_instance *inst, - struct loader_icd_tramp_list *icd_tramp_list) { +void loader_scanned_icd_clear(const struct loader_instance *inst, struct loader_icd_tramp_list *icd_tramp_list) { if (icd_tramp_list->capacity == 0) return; for (uint32_t i = 0; i < icd_tramp_list->count; i++) { loader_platform_close_library(icd_tramp_list->scanned_list[i].handle); - loader_instance_heap_free(inst, - icd_tramp_list->scanned_list[i].lib_name); + loader_instance_heap_free(inst, icd_tramp_list->scanned_list[i].lib_name); } loader_instance_heap_free(inst, icd_tramp_list->scanned_list); icd_tramp_list->capacity = 0; @@ -1661,28 +1463,21 @@ void loader_scanned_icd_clear(const struct loader_instance *inst, icd_tramp_list->scanned_list = NULL; } -static VkResult -loader_scanned_icd_init(const struct loader_instance *inst, - struct loader_icd_tramp_list *icd_tramp_list) { +static VkResult loader_scanned_icd_init(const struct loader_instance *inst, struct loader_icd_tramp_list *icd_tramp_list) { VkResult err = VK_SUCCESS; loader_scanned_icd_clear(inst, icd_tramp_list); icd_tramp_list->capacity = 8 * sizeof(struct loader_scanned_icd); - icd_tramp_list->scanned_list = loader_instance_heap_alloc( - inst, icd_tramp_list->capacity, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); + icd_tramp_list->scanned_list = loader_instance_heap_alloc(inst, icd_tramp_list->capacity, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (NULL == icd_tramp_list->scanned_list) { - loader_log( - inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_scanned_icd_init: Realloc failed for layer list when " - "attempting to add new layer"); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_scanned_icd_init: Realloc failed for layer list when " + "attempting to add new layer"); err = VK_ERROR_OUT_OF_HOST_MEMORY; } return err; } -static VkResult -loader_scanned_icd_add(const struct loader_instance *inst, - struct loader_icd_tramp_list *icd_tramp_list, - const char *filename, uint32_t api_version) { +static VkResult loader_scanned_icd_add(const struct loader_instance *inst, struct loader_icd_tramp_list *icd_tramp_list, + const char *filename, uint32_t api_version) { loader_platform_dl_handle handle; PFN_vkCreateInstance fp_create_inst; PFN_vkEnumerateInstanceExtensionProperties fp_get_inst_ext_props; @@ -1697,62 +1492,50 @@ loader_scanned_icd_add(const struct loader_instance *inst, * function leaves libraries open and the scanned_icd_clear closes them */ handle = loader_platform_open_library(filename); if (NULL == handle) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - loader_platform_open_library_error(filename)); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, loader_platform_open_library_error(filename)); goto out; } // Get and settle on an ICD interface version - fp_negotiate_icd_version = loader_platform_get_proc_address( - handle, "vk_icdNegotiateLoaderICDInterfaceVersion"); - - if (!loader_get_icd_interface_version(fp_negotiate_icd_version, - &interface_vers)) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_scanned_icd_add: ICD %s doesn't support interface" - " version compatible with loader, skip this ICD.", + fp_negotiate_icd_version = loader_platform_get_proc_address(handle, "vk_icdNegotiateLoaderICDInterfaceVersion"); + + if (!loader_get_icd_interface_version(fp_negotiate_icd_version, &interface_vers)) { + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_scanned_icd_add: ICD %s doesn't support interface" + " version compatible with loader, skip this ICD.", filename); goto out; } - fp_get_proc_addr = - loader_platform_get_proc_address(handle, "vk_icdGetInstanceProcAddr"); + fp_get_proc_addr = loader_platform_get_proc_address(handle, "vk_icdGetInstanceProcAddr"); if (NULL == fp_get_proc_addr) { assert(interface_vers == 0); // Use deprecated interface from version 0 - fp_get_proc_addr = - loader_platform_get_proc_address(handle, "vkGetInstanceProcAddr"); + fp_get_proc_addr = loader_platform_get_proc_address(handle, "vkGetInstanceProcAddr"); if (NULL == fp_get_proc_addr) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_scanned_icd_add: Attempt to retreive either " - "\'vkGetInstanceProcAddr\' or " - "\'vk_icdGetInstanceProcAddr\' from ICD %s failed.", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_scanned_icd_add: Attempt to retreive either " + "\'vkGetInstanceProcAddr\' or " + "\'vk_icdGetInstanceProcAddr\' from ICD %s failed.", filename); goto out; } else { - loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, - "loader_scanned_icd_add: Using deprecated ICD " - "interface of \'vkGetInstanceProcAddr\' instead of " - "\'vk_icdGetInstanceProcAddr\' for ICD %s", + loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, "loader_scanned_icd_add: Using deprecated ICD " + "interface of \'vkGetInstanceProcAddr\' instead of " + "\'vk_icdGetInstanceProcAddr\' for ICD %s", filename); } - fp_create_inst = - loader_platform_get_proc_address(handle, "vkCreateInstance"); + fp_create_inst = loader_platform_get_proc_address(handle, "vkCreateInstance"); if (NULL == fp_create_inst) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_scanned_icd_add: Failed querying " - "\'vkCreateInstance\' via dlsym/loadlibrary for " - "ICD %s", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_scanned_icd_add: Failed querying " + "\'vkCreateInstance\' via dlsym/loadlibrary for " + "ICD %s", filename); goto out; } - fp_get_inst_ext_props = loader_platform_get_proc_address( - handle, "vkEnumerateInstanceExtensionProperties"); + fp_get_inst_ext_props = loader_platform_get_proc_address(handle, "vkEnumerateInstanceExtensionProperties"); if (NULL == fp_get_inst_ext_props) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_scanned_icd_add: Could not get \'vkEnumerate" - "InstanceExtensionProperties\' via dlsym/loadlibrary " - "for ICD %s", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_scanned_icd_add: Could not get \'vkEnumerate" + "InstanceExtensionProperties\' via dlsym/loadlibrary " + "for ICD %s", filename); goto out; } @@ -1762,43 +1545,36 @@ loader_scanned_icd_add(const struct loader_instance *inst, interface_vers = 1; } - fp_create_inst = - (PFN_vkCreateInstance)fp_get_proc_addr(NULL, "vkCreateInstance"); + fp_create_inst = (PFN_vkCreateInstance)fp_get_proc_addr(NULL, "vkCreateInstance"); if (NULL == fp_create_inst) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_scanned_icd_add: Could not get " - "\'vkCreateInstance\' via \'vk_icdGetInstanceProcAddr\'" - " for ICD %s", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_scanned_icd_add: Could not get " + "\'vkCreateInstance\' via \'vk_icdGetInstanceProcAddr\'" + " for ICD %s", filename); goto out; } fp_get_inst_ext_props = - (PFN_vkEnumerateInstanceExtensionProperties)fp_get_proc_addr( - NULL, "vkEnumerateInstanceExtensionProperties"); + (PFN_vkEnumerateInstanceExtensionProperties)fp_get_proc_addr(NULL, "vkEnumerateInstanceExtensionProperties"); if (NULL == fp_get_inst_ext_props) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_scanned_icd_add: Could not get \'vkEnumerate" - "InstanceExtensionProperties\' via " - "\'vk_icdGetInstanceProcAddr\' for ICD %s", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_scanned_icd_add: Could not get \'vkEnumerate" + "InstanceExtensionProperties\' via " + "\'vk_icdGetInstanceProcAddr\' for ICD %s", filename); goto out; } - fp_get_phys_dev_proc_addr = - loader_platform_get_proc_address(handle, "vk_icdGetPhysicalDeviceProcAddr"); + fp_get_phys_dev_proc_addr = loader_platform_get_proc_address(handle, "vk_icdGetPhysicalDeviceProcAddr"); } // check for enough capacity - if ((icd_tramp_list->count * sizeof(struct loader_scanned_icd)) >= - icd_tramp_list->capacity) { + if ((icd_tramp_list->count * sizeof(struct loader_scanned_icd)) >= icd_tramp_list->capacity) { - icd_tramp_list->scanned_list = loader_instance_heap_realloc( - inst, icd_tramp_list->scanned_list, icd_tramp_list->capacity, - icd_tramp_list->capacity * 2, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); + icd_tramp_list->scanned_list = + loader_instance_heap_realloc(inst, icd_tramp_list->scanned_list, icd_tramp_list->capacity, icd_tramp_list->capacity * 2, + VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (NULL == icd_tramp_list->scanned_list) { res = VK_ERROR_OUT_OF_HOST_MEMORY; - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_scanned_icd_add: Realloc failed on icd library" - " list for ICD %s", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_scanned_icd_add: Realloc failed on icd library" + " list for ICD %s", filename); goto out; } @@ -1811,17 +1587,13 @@ loader_scanned_icd_add(const struct loader_instance *inst, new_scanned_icd->api_version = api_version; new_scanned_icd->GetInstanceProcAddr = fp_get_proc_addr; new_scanned_icd->GetPhysicalDeviceProcAddr = fp_get_phys_dev_proc_addr; - new_scanned_icd->EnumerateInstanceExtensionProperties = - fp_get_inst_ext_props; + new_scanned_icd->EnumerateInstanceExtensionProperties = fp_get_inst_ext_props; new_scanned_icd->CreateInstance = fp_create_inst; new_scanned_icd->interface_version = interface_vers; - new_scanned_icd->lib_name = (char *)loader_instance_heap_alloc( - inst, strlen(filename) + 1, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); + new_scanned_icd->lib_name = (char *)loader_instance_heap_alloc(inst, strlen(filename) + 1, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (NULL == new_scanned_icd->lib_name) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_scanned_icd_add: Out of memory can't add ICD %s", - filename); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_scanned_icd_add: Out of memory can't add ICD %s", filename); res = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; } @@ -1833,20 +1605,17 @@ out: return res; } -static bool loader_icd_init_entrys(struct loader_icd_term *icd_term, - VkInstance inst, - const PFN_vkGetInstanceProcAddr fp_gipa) { +static bool loader_icd_init_entrys(struct loader_icd_term *icd_term, VkInstance inst, const PFN_vkGetInstanceProcAddr fp_gipa) { /* initialize entrypoint function pointers */ -#define LOOKUP_GIPA(func, required) \ - do { \ - icd_term->func = (PFN_vk##func)fp_gipa(inst, "vk" #func); \ - if (!icd_term->func && required) { \ - loader_log((struct loader_instance *)inst, \ - VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, \ - loader_platform_get_proc_address_error("vk" #func)); \ - return false; \ - } \ +#define LOOKUP_GIPA(func, required) \ + do { \ + icd_term->func = (PFN_vk##func)fp_gipa(inst, "vk" #func); \ + if (!icd_term->func && required) { \ + loader_log((struct loader_instance *)inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, \ + loader_platform_get_proc_address_error("vk" #func)); \ + return false; \ + } \ } while (0) LOOKUP_GIPA(GetDeviceProcAddr, true); @@ -1966,8 +1735,7 @@ static void loader_debug_init(void) { g_loader_log_msgs |= VK_DEBUG_REPORT_INFORMATION_BIT_EXT; } else if (strncmp(env, "perf", len) == 0) { g_loader_debug |= LOADER_PERF_BIT; - g_loader_log_msgs |= - VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT; + g_loader_log_msgs |= VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT; } else if (strncmp(env, "error", len) == 0) { g_loader_debug |= LOADER_ERROR_BIT; g_loader_log_msgs |= VK_DEBUG_REPORT_ERROR_BIT_EXT; @@ -1996,8 +1764,7 @@ void loader_initialize(void) { // initial cJSON to use alloc callbacks cJSON_Hooks alloc_fns = { - .malloc_fn = loader_instance_tls_heap_alloc, - .free_fn = loader_instance_tls_heap_free, + .malloc_fn = loader_instance_tls_heap_alloc, .free_fn = loader_instance_tls_heap_free, }; cJSON_InitHooks(&alloc_fns); } @@ -2041,8 +1808,7 @@ static char *loader_get_next_path(char *path) { * \returns * A string in out_fullpath of the full absolute path */ -static void loader_expand_path(const char *path, const char *rel_base, - size_t out_size, char *out_fullpath) { +static void loader_expand_path(const char *path, const char *rel_base, size_t out_size, char *out_fullpath) { if (loader_platform_is_path_absolute(path)) { // do not prepend a base to an absolute path rel_base = ""; @@ -2059,8 +1825,7 @@ static void loader_expand_path(const char *path, const char *rel_base, * \returns * A string in out_fullpath of either the full path or file. */ -static void loader_get_fullpath(const char *file, const char *dirs, - size_t out_size, char *out_fullpath) { +static void loader_get_fullpath(const char *file, const char *dirs, size_t out_size, char *out_fullpath) { if (!loader_platform_is_path(file) && *dirs) { char *dirs_copy, *dir, *next_dir; @@ -2068,10 +1833,8 @@ static void loader_get_fullpath(const char *file, const char *dirs, strcpy(dirs_copy, dirs); // find if file exists after prepending paths in given list - for (dir = dirs_copy; *dir && (next_dir = loader_get_next_path(dir)); - dir = next_dir) { - loader_platform_combine_path(out_fullpath, out_size, dir, file, - NULL); + for (dir = dirs_copy; *dir && (next_dir = loader_get_next_path(dir)); dir = next_dir) { + loader_platform_combine_path(out_fullpath, out_size, dir, file, NULL); if (loader_platform_file_exists(out_fullpath)) { return; } @@ -2088,16 +1851,14 @@ static void loader_get_fullpath(const char *file, const char *dirs, * A pointer to a cJSON object representing the JSON parse tree. * This returned buffer should be freed by caller. */ -static VkResult loader_get_json(const struct loader_instance *inst, - const char *filename, cJSON **json) { +static VkResult loader_get_json(const struct loader_instance *inst, const char *filename, cJSON **json) { FILE *file = NULL; char *json_buf; size_t len; VkResult res = VK_SUCCESS; if (NULL == json) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_get_json: Received invalid JSON file"); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_get_json: Received invalid JSON file"); res = VK_ERROR_INITIALIZATION_FAILED; goto out; } @@ -2106,8 +1867,7 @@ static VkResult loader_get_json(const struct loader_instance *inst, file = fopen(filename, "rb"); if (!file) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_get_json: Failed to open JSON file %s", filename); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_get_json: Failed to open JSON file %s", filename); res = VK_ERROR_INITIALIZATION_FAILED; goto out; } @@ -2116,16 +1876,14 @@ static VkResult loader_get_json(const struct loader_instance *inst, fseek(file, 0, SEEK_SET); json_buf = (char *)loader_stack_alloc(len + 1); if (json_buf == NULL) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_get_json: Failed to allocate space for " - "JSON file %s buffer of length %d", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_get_json: Failed to allocate space for " + "JSON file %s buffer of length %d", filename, len); res = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; } if (fread(json_buf, sizeof(char), len, file) != len) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_get_json: Failed to read JSON file %s.", filename); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_get_json: Failed to read JSON file %s.", filename); res = VK_ERROR_INITIALIZATION_FAILED; goto out; } @@ -2134,10 +1892,9 @@ static VkResult loader_get_json(const struct loader_instance *inst, // parse text from file *json = cJSON_Parse(json_buf); if (*json == NULL) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_get_json: Failed to parse JSON file %s, " - "this is usually because something ran out of " - "memory.", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_get_json: Failed to parse JSON file %s, " + "this is usually because something ran out of " + "memory.", filename); res = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; @@ -2154,86 +1911,62 @@ out: /** * Do a deep copy of the loader_layer_properties structure. */ -VkResult loader_copy_layer_properties(const struct loader_instance *inst, - struct loader_layer_properties *dst, +VkResult loader_copy_layer_properties(const struct loader_instance *inst, struct loader_layer_properties *dst, struct loader_layer_properties *src) { uint32_t cnt, i; memcpy(dst, src, sizeof(*src)); dst->instance_extension_list.list = loader_instance_heap_alloc( - inst, - sizeof(VkExtensionProperties) * src->instance_extension_list.count, - VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); + inst, sizeof(VkExtensionProperties) * src->instance_extension_list.count, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (NULL == dst->instance_extension_list.list) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_copy_layer_properties: Failed to allocate space " - "for instance extension list of size %d.", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_copy_layer_properties: Failed to allocate space " + "for instance extension list of size %d.", src->instance_extension_list.count); return VK_ERROR_OUT_OF_HOST_MEMORY; } - dst->instance_extension_list.capacity = - sizeof(VkExtensionProperties) * src->instance_extension_list.count; - memcpy(dst->instance_extension_list.list, src->instance_extension_list.list, - dst->instance_extension_list.capacity); + dst->instance_extension_list.capacity = sizeof(VkExtensionProperties) * src->instance_extension_list.count; + memcpy(dst->instance_extension_list.list, src->instance_extension_list.list, dst->instance_extension_list.capacity); dst->device_extension_list.list = loader_instance_heap_alloc( - inst, - sizeof(struct loader_dev_ext_props) * src->device_extension_list.count, - VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); + inst, sizeof(struct loader_dev_ext_props) * src->device_extension_list.count, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (NULL == dst->device_extension_list.list) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_copy_layer_properties: Failed to allocate space " - "for device extension list of size %d.", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_copy_layer_properties: Failed to allocate space " + "for device extension list of size %d.", src->device_extension_list.count); return VK_ERROR_OUT_OF_HOST_MEMORY; } - memset(dst->device_extension_list.list, 0, - sizeof(struct loader_dev_ext_props) * - src->device_extension_list.count); + memset(dst->device_extension_list.list, 0, sizeof(struct loader_dev_ext_props) * src->device_extension_list.count); - dst->device_extension_list.capacity = - sizeof(struct loader_dev_ext_props) * src->device_extension_list.count; - memcpy(dst->device_extension_list.list, src->device_extension_list.list, - dst->device_extension_list.capacity); - if (src->device_extension_list.count > 0 && - src->device_extension_list.list->entrypoint_count > 0) { + dst->device_extension_list.capacity = sizeof(struct loader_dev_ext_props) * src->device_extension_list.count; + memcpy(dst->device_extension_list.list, src->device_extension_list.list, dst->device_extension_list.capacity); + if (src->device_extension_list.count > 0 && src->device_extension_list.list->entrypoint_count > 0) { cnt = src->device_extension_list.list->entrypoint_count; dst->device_extension_list.list->entrypoints = - loader_instance_heap_alloc(inst, sizeof(char *) * cnt, - VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); + loader_instance_heap_alloc(inst, sizeof(char *) * cnt, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (NULL == dst->device_extension_list.list->entrypoints) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_copy_layer_properties: Failed to allocate space " - "for device extension entrypoint list of size %d.", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_copy_layer_properties: Failed to allocate space " + "for device extension entrypoint list of size %d.", cnt); return VK_ERROR_OUT_OF_HOST_MEMORY; } - memset(dst->device_extension_list.list->entrypoints, 0, - sizeof(char *) * cnt); + memset(dst->device_extension_list.list->entrypoints, 0, sizeof(char *) * cnt); for (i = 0; i < cnt; i++) { - dst->device_extension_list.list->entrypoints[i] = - loader_instance_heap_alloc( - inst, - strlen(src->device_extension_list.list->entrypoints[i]) + 1, - VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); + dst->device_extension_list.list->entrypoints[i] = loader_instance_heap_alloc( + inst, strlen(src->device_extension_list.list->entrypoints[i]) + 1, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (NULL == dst->device_extension_list.list->entrypoints[i]) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_copy_layer_properties: Failed to " - "allocate space for device extension entrypoint " - "%d name of length", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_copy_layer_properties: Failed to " + "allocate space for device extension entrypoint " + "%d name of length", i); return VK_ERROR_OUT_OF_HOST_MEMORY; } - strcpy(dst->device_extension_list.list->entrypoints[i], - src->device_extension_list.list->entrypoints[i]); + strcpy(dst->device_extension_list.list->entrypoints[i], src->device_extension_list.list->entrypoints[i]); } } return VK_SUCCESS; } -static bool -loader_find_layer_name_list(const char *name, - const struct loader_layer_list *layer_list) { +static bool loader_find_layer_name_list(const char *name, const struct loader_layer_list *layer_list) { if (!layer_list) return false; for (uint32_t j = 0; j < layer_list->count; j++) @@ -2242,8 +1975,7 @@ loader_find_layer_name_list(const char *name, return false; } -static bool loader_find_layer_name(const char *name, uint32_t layer_count, - const char **layer_list) { +static bool loader_find_layer_name(const char *name, uint32_t layer_count, const char **layer_list) { if (!layer_list) return false; for (uint32_t j = 0; j < layer_count; j++) @@ -2252,9 +1984,7 @@ static bool loader_find_layer_name(const char *name, uint32_t layer_count, return false; } -bool loader_find_layer_name_array( - const char *name, uint32_t layer_count, - const char layer_list[][VK_MAX_EXTENSION_NAME_SIZE]) { +bool loader_find_layer_name_array(const char *name, uint32_t layer_count, const char layer_list[][VK_MAX_EXTENSION_NAME_SIZE]) { if (!layer_list) return false; for (uint32_t j = 0; j < layer_count; j++) @@ -2275,31 +2005,25 @@ bool loader_find_layer_name_array( * @param layer_count * @param ppp_layer_names */ -VkResult loader_expand_layer_names( - struct loader_instance *inst, const char *key_name, uint32_t expand_count, - const char expand_names[][VK_MAX_EXTENSION_NAME_SIZE], - uint32_t *layer_count, char const *const **ppp_layer_names) { +VkResult loader_expand_layer_names(struct loader_instance *inst, const char *key_name, uint32_t expand_count, + const char expand_names[][VK_MAX_EXTENSION_NAME_SIZE], uint32_t *layer_count, + char const *const **ppp_layer_names) { char const *const *pp_src_layers = *ppp_layer_names; - if (!loader_find_layer_name(key_name, *layer_count, - (char const **)pp_src_layers)) { + if (!loader_find_layer_name(key_name, *layer_count, (char const **)pp_src_layers)) { inst->activated_layers_are_std_val = false; return VK_SUCCESS; // didn't find the key_name in the list. } - loader_log(inst, VK_DEBUG_REPORT_INFORMATION_BIT_EXT, 0, - "Found meta layer %s, replacing with actual layer group", - key_name); + loader_log(inst, VK_DEBUG_REPORT_INFORMATION_BIT_EXT, 0, "Found meta layer %s, replacing with actual layer group", key_name); inst->activated_layers_are_std_val = true; - char const **pp_dst_layers = loader_instance_heap_alloc( - inst, (expand_count + *layer_count - 1) * sizeof(char const *), - VK_SYSTEM_ALLOCATION_SCOPE_COMMAND); + char const **pp_dst_layers = loader_instance_heap_alloc(inst, (expand_count + *layer_count - 1) * sizeof(char const *), + VK_SYSTEM_ALLOCATION_SCOPE_COMMAND); if (NULL == pp_dst_layers) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_expand_layer_names:: Failed to allocate space for " - "std_validation layer names in pp_dst_layers."); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_expand_layer_names:: Failed to allocate space for " + "std_validation layer names in pp_dst_layers."); return VK_ERROR_OUT_OF_HOST_MEMORY; } @@ -2307,16 +2031,14 @@ VkResult loader_expand_layer_names( // expand_names. uint32_t src_index, dst_index = 0; for (src_index = 0; src_index < *layer_count; src_index++) { - if (loader_find_layer_name_array(pp_src_layers[src_index], expand_count, - expand_names)) { + if (loader_find_layer_name_array(pp_src_layers[src_index], expand_count, expand_names)) { continue; } if (!strcmp(pp_src_layers[src_index], key_name)) { // insert all expand_names in place of key_name uint32_t expand_index; - for (expand_index = 0; expand_index < expand_count; - expand_index++) { + for (expand_index = 0; expand_index < expand_count; expand_index++) { pp_dst_layers[dst_index++] = expand_names[expand_index]; } continue; @@ -2331,8 +2053,7 @@ VkResult loader_expand_layer_names( return VK_SUCCESS; } -void loader_delete_shadow_inst_layer_names(const struct loader_instance *inst, - const VkInstanceCreateInfo *orig, +void loader_delete_shadow_inst_layer_names(const struct loader_instance *inst, const VkInstanceCreateInfo *orig, VkInstanceCreateInfo *ours) { /* Free the layer names array iff we had to reallocate it */ if (orig->ppEnabledLayerNames != ours->ppEnabledLayerNames) { @@ -2343,11 +2064,9 @@ void loader_delete_shadow_inst_layer_names(const struct loader_instance *inst, void loader_init_std_validation_props(struct loader_layer_properties *props) { memset(props, 0, sizeof(struct loader_layer_properties)); props->type = VK_LAYER_TYPE_META_EXPLICT; - strncpy(props->info.description, "LunarG Standard Validation Layer", - sizeof(props->info.description)); + strncpy(props->info.description, "LunarG Standard Validation Layer", sizeof(props->info.description)); props->info.implementationVersion = 1; - strncpy(props->info.layerName, std_validation_str, - sizeof(props->info.layerName)); + strncpy(props->info.layerName, std_validation_str, sizeof(props->info.layerName)); // TODO what about specVersion? for now insert loader's built version props->info.specVersion = VK_MAKE_VERSION(1, 0, VK_HEADER_VERSION); } @@ -2362,10 +2081,9 @@ void loader_init_std_validation_props(struct loader_layer_properties *props) { * @param layer_names array of required layer names * @param layer_instance_list */ -static void loader_add_layer_property_meta( - const struct loader_instance *inst, uint32_t layer_count, - const char layer_names[][VK_MAX_EXTENSION_NAME_SIZE], - struct loader_layer_list *layer_instance_list) { +static void loader_add_layer_property_meta(const struct loader_instance *inst, uint32_t layer_count, + const char layer_names[][VK_MAX_EXTENSION_NAME_SIZE], + struct loader_layer_list *layer_instance_list) { uint32_t i; bool found; struct loader_layer_list *layer_list; @@ -2406,12 +2124,9 @@ typedef struct { uint16_t patch; } layer_json_version; -static void -loader_read_json_layer(const struct loader_instance *inst, - struct loader_layer_list *layer_instance_list, - cJSON *layer_node, layer_json_version version, - cJSON *item, cJSON *disable_environment, - bool is_implicit, char *filename) { +static void loader_read_json_layer(const struct loader_instance *inst, struct loader_layer_list *layer_instance_list, + cJSON *layer_node, layer_json_version version, cJSON *item, cJSON *disable_environment, + bool is_implicit, char *filename) { char *temp; char *name, *type, *library_path, *api_version; char *implementation_version, *description; @@ -2429,42 +2144,39 @@ loader_read_json_layer(const struct loader_instance *inst, * (required for implicit layers) “disable_environment” */ -#define GET_JSON_OBJECT(node, var) \ - { \ - var = cJSON_GetObjectItem(node, #var); \ - if (var == NULL) { \ - layer_node = layer_node->next; \ - loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, \ - "Didn't find required layer object %s in manifest " \ - "JSON file, skipping this layer", \ - #var); \ - return; \ - } \ - } -#define GET_JSON_ITEM(node, var) \ - { \ - item = cJSON_GetObjectItem(node, #var); \ - if (item == NULL) { \ - layer_node = layer_node->next; \ - loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, \ - "Didn't find required layer value %s in manifest JSON " \ - "file, skipping this layer", \ - #var); \ - return; \ - } \ - temp = cJSON_Print(item); \ - if (temp == NULL) { \ - layer_node = layer_node->next; \ - loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, \ - "Problem accessing layer value %s in manifest JSON " \ - "file, skipping this layer", \ - #var); \ - return; \ - } \ - temp[strlen(temp) - 1] = '\0'; \ - var = loader_stack_alloc(strlen(temp) + 1); \ - strcpy(var, &temp[1]); \ - cJSON_Free(temp); \ +#define GET_JSON_OBJECT(node, var) \ + { \ + var = cJSON_GetObjectItem(node, #var); \ + if (var == NULL) { \ + layer_node = layer_node->next; \ + loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, "Didn't find required layer object %s in manifest " \ + "JSON file, skipping this layer", \ + #var); \ + return; \ + } \ + } +#define GET_JSON_ITEM(node, var) \ + { \ + item = cJSON_GetObjectItem(node, #var); \ + if (item == NULL) { \ + layer_node = layer_node->next; \ + loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, "Didn't find required layer value %s in manifest JSON " \ + "file, skipping this layer", \ + #var); \ + return; \ + } \ + temp = cJSON_Print(item); \ + if (temp == NULL) { \ + layer_node = layer_node->next; \ + loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, "Problem accessing layer value %s in manifest JSON " \ + "file, skipping this layer", \ + #var); \ + return; \ + } \ + temp[strlen(temp) - 1] = '\0'; \ + var = loader_stack_alloc(strlen(temp) + 1); \ + strcpy(var, &temp[1]); \ + cJSON_Free(temp); \ } GET_JSON_ITEM(layer_node, name) GET_JSON_ITEM(layer_node, type) @@ -2481,8 +2193,7 @@ loader_read_json_layer(const struct loader_instance *inst, // Add list entry struct loader_layer_properties *props = NULL; if (!strcmp(type, "DEVICE")) { - loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, - "Device layers are deprecated skipping this layer"); + loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, "Device layers are deprecated skipping this layer"); layer_node = layer_node->next; return; } @@ -2498,8 +2209,7 @@ loader_read_json_layer(const struct loader_instance *inst, // Error already triggered in loader_get_next_layer_property. return; } - props->type = (is_implicit) ? VK_LAYER_TYPE_INSTANCE_IMPLICIT - : VK_LAYER_TYPE_INSTANCE_EXPLICIT; + props->type = (is_implicit) ? VK_LAYER_TYPE_INSTANCE_IMPLICIT : VK_LAYER_TYPE_INSTANCE_EXPLICIT; } if (props == NULL) { @@ -2520,32 +2230,23 @@ loader_read_json_layer(const struct loader_instance *inst, loader_expand_path(library_path, rel_base, MAX_STRING_SIZE, fullpath); } else { // A filename which is assumed in a system directory - loader_get_fullpath(library_path, DEFAULT_VK_LAYERS_PATH, - MAX_STRING_SIZE, fullpath); + loader_get_fullpath(library_path, DEFAULT_VK_LAYERS_PATH, MAX_STRING_SIZE, fullpath); } props->info.specVersion = loader_make_version(api_version); props->info.implementationVersion = atoi(implementation_version); - strncpy((char *)props->info.description, description, - sizeof(props->info.description)); + strncpy((char *)props->info.description, description, sizeof(props->info.description)); props->info.description[sizeof(props->info.description) - 1] = '\0'; if (is_implicit) { if (!disable_environment || !disable_environment->child) { - loader_log( - inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, - "Didn't find required layer child value disable_environment" - "in manifest JSON file, skipping this layer"); + loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, "Didn't find required layer child value disable_environment" + "in manifest JSON file, skipping this layer"); layer_node = layer_node->next; return; } - strncpy(props->disable_env_var.name, disable_environment->child->string, - sizeof(props->disable_env_var.name)); - props->disable_env_var.name[sizeof(props->disable_env_var.name) - 1] = - '\0'; - strncpy(props->disable_env_var.value, - disable_environment->child->valuestring, - sizeof(props->disable_env_var.value)); - props->disable_env_var.value[sizeof(props->disable_env_var.value) - 1] = - '\0'; + strncpy(props->disable_env_var.name, disable_environment->child->string, sizeof(props->disable_env_var.name)); + props->disable_env_var.name[sizeof(props->disable_env_var.name) - 1] = '\0'; + strncpy(props->disable_env_var.value, disable_environment->child->valuestring, sizeof(props->disable_env_var.value)); + props->disable_env_var.value[sizeof(props->disable_env_var.value) - 1] = '\0'; } /** @@ -2555,24 +2256,23 @@ loader_read_json_layer(const struct loader_instance *inst, * device_extensions * enable_environment (implicit layers only) */ -#define GET_JSON_OBJECT(node, var) \ +#define GET_JSON_OBJECT(node, var) \ { var = cJSON_GetObjectItem(node, #var); } -#define GET_JSON_ITEM(node, var) \ - { \ - item = cJSON_GetObjectItem(node, #var); \ - if (item != NULL) { \ - temp = cJSON_Print(item); \ - if (temp != NULL) { \ - temp[strlen(temp) - 1] = '\0'; \ - var = loader_stack_alloc(strlen(temp) + 1); \ - strcpy(var, &temp[1]); \ - cJSON_Free(temp); \ - } \ - } \ - } - - cJSON *instance_extensions, *device_extensions, *functions, - *enable_environment; +#define GET_JSON_ITEM(node, var) \ + { \ + item = cJSON_GetObjectItem(node, #var); \ + if (item != NULL) { \ + temp = cJSON_Print(item); \ + if (temp != NULL) { \ + temp[strlen(temp) - 1] = '\0'; \ + var = loader_stack_alloc(strlen(temp) + 1); \ + strcpy(var, &temp[1]); \ + cJSON_Free(temp); \ + } \ + } \ + } + + cJSON *instance_extensions, *device_extensions, *functions, *enable_environment; cJSON *entrypoints = NULL; char *vkGetInstanceProcAddr = NULL; char *vkGetDeviceProcAddr = NULL; @@ -2591,41 +2291,35 @@ loader_read_json_layer(const struct loader_instance *inst, if (version.major > 1 || version.minor >= 1) { GET_JSON_ITEM(functions, vkNegotiateLoaderLayerInterfaceVersion) if (vkNegotiateLoaderLayerInterfaceVersion != NULL) - strncpy(props->functions.str_negotiate_interface, - vkNegotiateLoaderLayerInterfaceVersion, + strncpy(props->functions.str_negotiate_interface, vkNegotiateLoaderLayerInterfaceVersion, sizeof(props->functions.str_negotiate_interface)); - props->functions.str_negotiate_interface - [sizeof(props->functions.str_negotiate_interface) - 1] = '\0'; + props->functions.str_negotiate_interface[sizeof(props->functions.str_negotiate_interface) - 1] = '\0'; } else { props->functions.str_negotiate_interface[0] = '\0'; } GET_JSON_ITEM(functions, vkGetInstanceProcAddr) GET_JSON_ITEM(functions, vkGetDeviceProcAddr) if (vkGetInstanceProcAddr != NULL) { - strncpy(props->functions.str_gipa, vkGetInstanceProcAddr, - sizeof(props->functions.str_gipa)); + strncpy(props->functions.str_gipa, vkGetInstanceProcAddr, sizeof(props->functions.str_gipa)); if (version.major > 1 || version.minor >= 1) { - loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, - "Indicating layer-specific vkGetInstanceProcAddr " - "function is deprecated starting with JSON file " - "version 1.1.0. Instead, use the new " - "vkNegotiateLayerInterfaceVersion function to " - "return the GetInstanceProcAddr function for this" - "layer"); + loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, "Indicating layer-specific vkGetInstanceProcAddr " + "function is deprecated starting with JSON file " + "version 1.1.0. Instead, use the new " + "vkNegotiateLayerInterfaceVersion function to " + "return the GetInstanceProcAddr function for this" + "layer"); } } props->functions.str_gipa[sizeof(props->functions.str_gipa) - 1] = '\0'; if (vkGetDeviceProcAddr != NULL) { - strncpy(props->functions.str_gdpa, vkGetDeviceProcAddr, - sizeof(props->functions.str_gdpa)); + strncpy(props->functions.str_gdpa, vkGetDeviceProcAddr, sizeof(props->functions.str_gdpa)); if (version.major > 1 || version.minor >= 1) { - loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, - "Indicating layer-specific vkGetDeviceProcAddr " - "function is deprecated starting with JSON file " - "version 1.1.0. Instead, use the new " - "vkNegotiateLayerInterfaceVersion function to " - "return the GetDeviceProcAddr function for this" - "layer"); + loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, "Indicating layer-specific vkGetDeviceProcAddr " + "function is deprecated starting with JSON file " + "version 1.1.0. Instead, use the new " + "vkNegotiateLayerInterfaceVersion function to " + "return the GetDeviceProcAddr function for this" + "layer"); } } props->functions.str_gdpa[sizeof(props->functions.str_gdpa) - 1] = '\0'; @@ -2643,10 +2337,8 @@ loader_read_json_layer(const struct loader_instance *inst, ext_item = cJSON_GetArrayItem(instance_extensions, i); GET_JSON_ITEM(ext_item, name) if (name != NULL) { - strncpy(ext_prop.extensionName, name, - sizeof(ext_prop.extensionName)); - ext_prop.extensionName[sizeof(ext_prop.extensionName) - 1] = - '\0'; + strncpy(ext_prop.extensionName, name, sizeof(ext_prop.extensionName)); + ext_prop.extensionName[sizeof(ext_prop.extensionName) - 1] = '\0'; } GET_JSON_ITEM(ext_item, spec_version) if (NULL != spec_version) { @@ -2654,11 +2346,9 @@ loader_read_json_layer(const struct loader_instance *inst, } else { ext_prop.specVersion = 0; } - bool ext_unsupported = - wsi_unsupported_instance_extension(&ext_prop); + bool ext_unsupported = wsi_unsupported_instance_extension(&ext_prop); if (!ext_unsupported) { - loader_add_to_ext_list(inst, &props->instance_extension_list, 1, - &ext_prop); + loader_add_to_ext_list(inst, &props->instance_extension_list, 1, &ext_prop); } } } @@ -2677,10 +2367,8 @@ loader_read_json_layer(const struct loader_instance *inst, GET_JSON_ITEM(ext_item, name) GET_JSON_ITEM(ext_item, spec_version) if (name != NULL) { - strncpy(ext_prop.extensionName, name, - sizeof(ext_prop.extensionName)); - ext_prop.extensionName[sizeof(ext_prop.extensionName) - 1] = - '\0'; + strncpy(ext_prop.extensionName, name, sizeof(ext_prop.extensionName)); + ext_prop.extensionName[sizeof(ext_prop.extensionName) - 1] = '\0'; } if (NULL != spec_version) { ext_prop.specVersion = atoi(spec_version); @@ -2691,14 +2379,12 @@ loader_read_json_layer(const struct loader_instance *inst, GET_JSON_OBJECT(ext_item, entrypoints) int entry_count; if (entrypoints == NULL) { - loader_add_to_dev_ext_list(inst, &props->device_extension_list, - &ext_prop, 0, NULL); + loader_add_to_dev_ext_list(inst, &props->device_extension_list, &ext_prop, 0, NULL); continue; } entry_count = cJSON_GetArraySize(entrypoints); if (entry_count) { - entry_array = - (char **)loader_stack_alloc(sizeof(char *) * entry_count); + entry_array = (char **)loader_stack_alloc(sizeof(char *) * entry_count); } for (j = 0; j < entry_count; j++) { ext_item = cJSON_GetArrayItem(entrypoints, j); @@ -2714,8 +2400,7 @@ loader_read_json_layer(const struct loader_instance *inst, cJSON_Free(temp); } } - loader_add_to_dev_ext_list(inst, &props->device_extension_list, - &ext_prop, entry_count, entry_array); + loader_add_to_dev_ext_list(inst, &props->device_extension_list, &ext_prop, entry_count, entry_array); } } if (is_implicit) { @@ -2723,16 +2408,10 @@ loader_read_json_layer(const struct loader_instance *inst, // enable_environment is optional if (enable_environment) { - strncpy(props->enable_env_var.name, - enable_environment->child->string, - sizeof(props->enable_env_var.name)); - props->enable_env_var.name[sizeof(props->enable_env_var.name) - 1] = - '\0'; - strncpy(props->enable_env_var.value, - enable_environment->child->valuestring, - sizeof(props->enable_env_var.value)); - props->enable_env_var - .value[sizeof(props->enable_env_var.value) - 1] = '\0'; + strncpy(props->enable_env_var.name, enable_environment->child->string, sizeof(props->enable_env_var.name)); + props->enable_env_var.name[sizeof(props->enable_env_var.name) - 1] = '\0'; + strncpy(props->enable_env_var.value, enable_environment->child->valuestring, sizeof(props->enable_env_var.value)); + props->enable_env_var.value[sizeof(props->enable_env_var.value) - 1] = '\0'; } } #undef GET_JSON_ITEM @@ -2767,10 +2446,8 @@ static inline bool layer_json_supports_layers_tag(const layer_json_version *laye * If the json input object does not have all the required fields no entry * is added to the list. */ -static void -loader_add_layer_properties(const struct loader_instance *inst, - struct loader_layer_list *layer_instance_list, - cJSON *json, bool is_implicit, char *filename) { +static void loader_add_layer_properties(const struct loader_instance *inst, struct loader_layer_list *layer_instance_list, + cJSON *json, bool is_implicit, char *filename) { // The following Fields in layer manifest file that are required: // - “file_format_version” // - If more than one "layer" object are used, then the "layers" array is @@ -2788,8 +2465,7 @@ loader_add_layer_properties(const struct loader_instance *inst, if (NULL == file_vers) { return; } - loader_log(inst, VK_DEBUG_REPORT_INFORMATION_BIT_EXT, 0, - "Found manifest file %s, version %s", filename, file_vers); + loader_log(inst, VK_DEBUG_REPORT_INFORMATION_BIT_EXT, 0, "Found manifest file %s, version %s", filename, file_vers); // Get the major/minor/and patch as integers for easier comparison vers_tok = strtok(file_vers, ".\"\n\r"); if (NULL != vers_tok) { @@ -2805,11 +2481,9 @@ loader_add_layer_properties(const struct loader_instance *inst, } if (!is_valid_layer_json_version(&json_version)) { - loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, - "loader_add_layer_properties: %s invalid layer " - " manifest file version %d.%d.%d. May cause errors.", - filename, json_version.major, json_version.minor, - json_version.patch); + loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, "loader_add_layer_properties: %s invalid layer " + " manifest file version %d.%d.%d. May cause errors.", + filename, json_version.major, json_version.minor, json_version.patch); } cJSON_Free(file_vers); @@ -2818,33 +2492,29 @@ loader_add_layer_properties(const struct loader_instance *inst, if (layers_node != NULL) { int numItems = cJSON_GetArraySize(layers_node); if (!layer_json_supports_layers_tag(&json_version)) { - loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, - "loader_add_layer_properties: \'layers\' tag not " - "supported until file version 1.0.1, but %s is " - "reporting version %s", + loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, "loader_add_layer_properties: \'layers\' tag not " + "supported until file version 1.0.1, but %s is " + "reporting version %s", filename, file_vers); } for (int curLayer = 0; curLayer < numItems; curLayer++) { layer_node = cJSON_GetArrayItem(layers_node, curLayer); if (layer_node == NULL) { - loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, - "loader_add_layer_properties: Can not find " - "\'layers\' array element %d object in manifest " - "JSON file %s. Skipping this file", + loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, "loader_add_layer_properties: Can not find " + "\'layers\' array element %d object in manifest " + "JSON file %s. Skipping this file", curLayer, filename); return; } - loader_read_json_layer(inst, layer_instance_list, layer_node, - json_version, item, disable_environment, - is_implicit, filename); + loader_read_json_layer(inst, layer_instance_list, layer_node, json_version, item, disable_environment, is_implicit, + filename); } } else { // Otherwise, try to read in individual layers layer_node = cJSON_GetObjectItem(json, "layer"); if (layer_node == NULL) { - loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, - "loader_add_layer_properties: Can not find \'layer\' " - "object in manifest JSON file %s. Skipping this file.", + loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, "loader_add_layer_properties: Can not find \'layer\' " + "object in manifest JSON file %s. Skipping this file.", filename); return; } @@ -2861,16 +2531,14 @@ loader_add_layer_properties(const struct loader_instance *inst, // versions newer than 1.0.0. Having multiple objects with the same // name at the same level is actually a JSON standard violation. if (layer_count > 1 && layer_json_supports_layers_tag(&json_version)) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_add_layer_properties: Multiple \'layer\' nodes" - " are deprecated starting in file version \"1.0.1\". " - "Please use \'layers\' : [] array instead in %s.", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_add_layer_properties: Multiple \'layer\' nodes" + " are deprecated starting in file version \"1.0.1\". " + "Please use \'layers\' : [] array instead in %s.", filename); } else { do { - loader_read_json_layer(inst, layer_instance_list, layer_node, - json_version, item, disable_environment, - is_implicit, filename); + loader_read_json_layer(inst, layer_instance_list, layer_node, json_version, item, disable_environment, is_implicit, + filename); layer_node = layer_node->next; } while (layer_node != NULL); } @@ -2905,12 +2573,9 @@ loader_add_layer_properties(const struct loader_instance *inst, * Linux ICD | dirs | files * Linux Layer| dirs | dirs */ -static VkResult -loader_get_manifest_files(const struct loader_instance *inst, - const char *env_override, const char *source_override, - bool is_layer, bool warn_if_not_present, - const char *location, const char *home_location, - struct loader_manifest_files *out_files) { +static VkResult loader_get_manifest_files(const struct loader_instance *inst, const char *env_override, const char *source_override, + bool is_layer, bool warn_if_not_present, const char *location, const char *home_location, + struct loader_manifest_files *out_files) { const char * override = NULL; char *override_getenv = NULL; char *loc, *orig_loc = NULL; @@ -2946,9 +2611,8 @@ loader_get_manifest_files(const struct loader_instance *inst, home_location = NULL; if (location == NULL) { #endif - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_get_manifest_files: Can not get manifest files with " - "NULL location, env_override=%s", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_get_manifest_files: Can not get manifest files with " + "NULL location, env_override=%s", (env_override != NULL) ? env_override : ""); res = VK_ERROR_INITIALIZATION_FAILED; goto out; @@ -2964,9 +2628,8 @@ loader_get_manifest_files(const struct loader_instance *inst, if (override == NULL) { loc = loader_stack_alloc(strlen(location) + 1); if (loc == NULL) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_get_manifest_files: Failed to allocate " - "%d bytes for manifest file location.", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_get_manifest_files: Failed to allocate " + "%d bytes for manifest file location.", strlen(location)); res = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; @@ -2976,12 +2639,10 @@ loader_get_manifest_files(const struct loader_instance *inst, VkResult reg_result = loaderGetRegistryFiles(inst, loc, ®); if (VK_SUCCESS != reg_result || NULL == reg) { if (!is_layer) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_get_manifest_files: Registry lookup failed " - "to get ICD manifest files. Possibly missing Vulkan" - " driver?"); - if (VK_SUCCESS == reg_result || - VK_ERROR_OUT_OF_HOST_MEMORY == reg_result) { + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_get_manifest_files: Registry lookup failed " + "to get ICD manifest files. Possibly missing Vulkan" + " driver?"); + if (VK_SUCCESS == reg_result || VK_ERROR_OUT_OF_HOST_MEMORY == reg_result) { res = reg_result; } else { res = VK_ERROR_INCOMPATIBLE_DRIVER; @@ -2989,10 +2650,8 @@ loader_get_manifest_files(const struct loader_instance *inst, } else { if (warn_if_not_present) { // This is only a warning for layers - loader_log( - inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, - "loader_get_manifest_files: Registry lookup failed " - "to get layer manifest files."); + loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, "loader_get_manifest_files: Registry lookup failed " + "to get layer manifest files."); } if (reg_result == VK_ERROR_OUT_OF_HOST_MEMORY) { res = reg_result; @@ -3009,11 +2668,9 @@ loader_get_manifest_files(const struct loader_instance *inst, } else { loc = loader_stack_alloc(strlen(override) + 1); if (loc == NULL) { - loader_log( - inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_get_manifest_files: Failed to allocate space for " - "override environment variable of length %d", - strlen(override) + 1); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_get_manifest_files: Failed to allocate space for " + "override environment variable of length %d", + strlen(override) + 1); res = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; } @@ -3021,8 +2678,7 @@ loader_get_manifest_files(const struct loader_instance *inst, } // Print out the paths being searched if debugging is enabled - loader_log(inst, VK_DEBUG_REPORT_DEBUG_BIT_EXT, 0, - "Searching the following paths for manifest files: %s\n", loc); + loader_log(inst, VK_DEBUG_REPORT_DEBUG_BIT_EXT, 0, "Searching the following paths for manifest files: %s\n", loc); file = loc; while (*file) { @@ -3047,9 +2703,8 @@ loader_get_manifest_files(const struct loader_instance *inst, // make a copy of location so it isn't modified dir = loader_stack_alloc(strlen(loc) + 1); if (dir == NULL) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_get_manifest_files: Failed to allocate " - "space for relative location path length %d", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_get_manifest_files: Failed to allocate " + "space for relative location path length %d", strlen(loc) + 1); goto out; } @@ -3066,32 +2721,25 @@ loader_get_manifest_files(const struct loader_instance *inst, const char *suf = name + nlen - 5; if ((nlen > 5) && !strncmp(suf, ".json", 5)) { if (out_files->count == 0) { - out_files->filename_list = loader_instance_heap_alloc( - inst, alloced_count * sizeof(char *), - VK_SYSTEM_ALLOCATION_SCOPE_COMMAND); + out_files->filename_list = + loader_instance_heap_alloc(inst, alloced_count * sizeof(char *), VK_SYSTEM_ALLOCATION_SCOPE_COMMAND); } else if (out_files->count == alloced_count) { - out_files->filename_list = loader_instance_heap_realloc( - inst, out_files->filename_list, - alloced_count * sizeof(char *), - alloced_count * sizeof(char *) * 2, - VK_SYSTEM_ALLOCATION_SCOPE_COMMAND); + out_files->filename_list = + loader_instance_heap_realloc(inst, out_files->filename_list, alloced_count * sizeof(char *), + alloced_count * sizeof(char *) * 2, VK_SYSTEM_ALLOCATION_SCOPE_COMMAND); alloced_count *= 2; } if (out_files->filename_list == NULL) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_get_manifest_files: Failed to allocate " - "space for manifest file name list"); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_get_manifest_files: Failed to allocate " + "space for manifest file name list"); res = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; } out_files->filename_list[out_files->count] = - loader_instance_heap_alloc( - inst, strlen(name) + 1, - VK_SYSTEM_ALLOCATION_SCOPE_COMMAND); + loader_instance_heap_alloc(inst, strlen(name) + 1, VK_SYSTEM_ALLOCATION_SCOPE_COMMAND); if (out_files->filename_list[out_files->count] == NULL) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_get_manifest_files: Failed to allocate " - "space for manifest file %d list", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_get_manifest_files: Failed to allocate " + "space for manifest file %d list", out_files->count); res = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; @@ -3099,10 +2747,8 @@ loader_get_manifest_files(const struct loader_instance *inst, strcpy(out_files->filename_list[out_files->count], name); out_files->count++; } else if (!list_is_dirs) { - loader_log( - inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, - "Skipping manifest file %s, file name must end in .json", - name); + loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, "Skipping manifest file %s, file name must end in .json", + name); } if (list_is_dirs) { dent = readdir(sysdir); @@ -3122,18 +2768,15 @@ loader_get_manifest_files(const struct loader_instance *inst, } file = next_file; #if !defined(_WIN32) - if (home_location != NULL && - (next_file == NULL || *next_file == '\0') && override == NULL) { + if (home_location != NULL && (next_file == NULL || *next_file == '\0') && override == NULL) { char *xdgdatahome = secure_getenv("XDG_DATA_HOME"); size_t len; if (xdgdatahome != NULL) { - char *home_loc = loader_stack_alloc(strlen(xdgdatahome) + 2 + - strlen(home_location)); + char *home_loc = loader_stack_alloc(strlen(xdgdatahome) + 2 + strlen(home_location)); if (home_loc == NULL) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_get_manifest_files: Failed to allocate " - "space for manifest file XDG Home location"); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_get_manifest_files: Failed to allocate " + "space for manifest file XDG Home location"); res = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; } @@ -3149,23 +2792,18 @@ loader_get_manifest_files(const struct loader_instance *inst, next_file = loader_get_next_path(file); home_location = NULL; - loader_log( - inst, VK_DEBUG_REPORT_DEBUG_BIT_EXT, 0, - "Searching the following path for manifest files: %s\n", - home_loc); + loader_log(inst, VK_DEBUG_REPORT_DEBUG_BIT_EXT, 0, "Searching the following path for manifest files: %s\n", + home_loc); list_is_dirs = true; } else { char *home = secure_getenv("HOME"); if (home != NULL) { - char *home_loc = loader_stack_alloc(strlen(home) + 16 + - strlen(home_location)); + char *home_loc = loader_stack_alloc(strlen(home) + 16 + strlen(home_location)); if (home_loc == NULL) { - loader_log( - inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_get_manifest_files: Failed to allocate " - "space for manifest file Home location"); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_get_manifest_files: Failed to allocate " + "space for manifest file Home location"); res = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; } @@ -3188,10 +2826,8 @@ loader_get_manifest_files(const struct loader_instance *inst, next_file = loader_get_next_path(file); home_location = NULL; - loader_log( - inst, VK_DEBUG_REPORT_DEBUG_BIT_EXT, 0, - "Searching the following path for manifest files: %s\n", - home_loc); + loader_log(inst, VK_DEBUG_REPORT_DEBUG_BIT_EXT, 0, "Searching the following path for manifest files: %s\n", + home_loc); list_is_dirs = true; } else { // without knowing HOME, we just.. give up @@ -3240,8 +2876,7 @@ void loader_destroy_icd_lib_list() {} * Vulkan result * (on result == VK_SUCCESS) a list of icds that were discovered */ -VkResult loader_icd_scan(const struct loader_instance *inst, - struct loader_icd_tramp_list *icd_tramp_list) { +VkResult loader_icd_scan(const struct loader_instance *inst, struct loader_icd_tramp_list *icd_tramp_list) { char *file_str; uint16_t file_major_vers = 0; uint16_t file_minor_vers = 0; @@ -3261,9 +2896,8 @@ VkResult loader_icd_scan(const struct loader_instance *inst, } // Get a list of manifest files for ICDs - res = loader_get_manifest_files(inst, "VK_ICD_FILENAMES", NULL, false, true, - DEFAULT_VK_DRIVERS_INFO, - HOME_VK_DRIVERS_INFO, &manifest_files); + res = loader_get_manifest_files(inst, "VK_ICD_FILENAMES", NULL, false, true, DEFAULT_VK_DRIVERS_INFO, HOME_VK_DRIVERS_INFO, + &manifest_files); if (VK_SUCCESS != res || manifest_files.count == 0) { goto out; } @@ -3288,9 +2922,8 @@ VkResult loader_icd_scan(const struct loader_instance *inst, if (num_good_icds == 0) { res = VK_ERROR_INITIALIZATION_FAILED; } - loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, - "loader_icd_scan: ICD JSON %s does not have a" - " \'file_format_version\' field. Skipping ICD JSON.", + loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, "loader_icd_scan: ICD JSON %s does not have a" + " \'file_format_version\' field. Skipping ICD JSON.", file_str); cJSON_Delete(json); json = NULL; @@ -3303,17 +2936,14 @@ VkResult loader_icd_scan(const struct loader_instance *inst, if (num_good_icds == 0) { res = VK_ERROR_OUT_OF_HOST_MEMORY; } - loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, - "loader_icd_scan: Failed retrieving ICD JSON %s" - " \'file_format_version\' field. Skipping ICD JSON", + loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, "loader_icd_scan: Failed retrieving ICD JSON %s" + " \'file_format_version\' field. Skipping ICD JSON", file_str); cJSON_Delete(json); json = NULL; continue; } - loader_log(inst, VK_DEBUG_REPORT_INFORMATION_BIT_EXT, 0, - "Found ICD manifest file %s, version %s", file_str, - file_vers); + loader_log(inst, VK_DEBUG_REPORT_INFORMATION_BIT_EXT, 0, "Found ICD manifest file %s, version %s", file_str, file_vers); // Get the major/minor/and patch as integers for easier comparison vers_tok = strtok(file_vers, ".\"\n\r"); if (NULL != vers_tok) { @@ -3328,9 +2958,8 @@ VkResult loader_icd_scan(const struct loader_instance *inst, } } if (file_major_vers != 1 || file_minor_vers != 0 || file_patch_vers > 1) - loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, - "loader_icd_scan: Unexpected manifest file version " - "(expected 1.0.0 or 1.0.1), may cause errors"); + loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, "loader_icd_scan: Unexpected manifest file version " + "(expected 1.0.0 or 1.0.1), may cause errors"); cJSON_Free(file_vers); itemICD = cJSON_GetObjectItem(json, "ICD"); if (itemICD != NULL) { @@ -3341,9 +2970,8 @@ VkResult loader_icd_scan(const struct loader_instance *inst, if (num_good_icds == 0) { res = VK_ERROR_OUT_OF_HOST_MEMORY; } - loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, - "loader_icd_scan: Failed retrieving ICD JSON %s" - " \'library_path\' field. Skipping ICD JSON.", + loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, "loader_icd_scan: Failed retrieving ICD JSON %s" + " \'library_path\' field. Skipping ICD JSON.", file_str); cJSON_Free(temp); cJSON_Delete(json); @@ -3354,10 +2982,9 @@ VkResult loader_icd_scan(const struct loader_instance *inst, temp[strlen(temp) - 1] = '\0'; char *library_path = loader_stack_alloc(strlen(temp) + 1); if (NULL == library_path) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_icd_scan: Failed to allocate space for " - "ICD JSON %s \'library_path\' value. Skipping " - "ICD JSON.", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_icd_scan: Failed to allocate space for " + "ICD JSON %s \'library_path\' value. Skipping " + "ICD JSON.", file_str); res = VK_ERROR_OUT_OF_HOST_MEMORY; cJSON_Free(temp); @@ -3368,9 +2995,8 @@ VkResult loader_icd_scan(const struct loader_instance *inst, strcpy(library_path, &temp[1]); cJSON_Free(temp); if (strlen(library_path) == 0) { - loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, - "loader_icd_scan: ICD JSON %s \'library_path\'" - " field is empty. Skipping ICD JSON.", + loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, "loader_icd_scan: ICD JSON %s \'library_path\'" + " field is empty. Skipping ICD JSON.", file_str); cJSON_Delete(json); json = NULL; @@ -3378,22 +3004,18 @@ VkResult loader_icd_scan(const struct loader_instance *inst, } char fullpath[MAX_STRING_SIZE]; // Print out the paths being searched if debugging is enabled - loader_log( - inst, VK_DEBUG_REPORT_DEBUG_BIT_EXT, 0, - "Searching for ICD drivers named %s, using default dir %s", - library_path, DEFAULT_VK_DRIVERS_PATH); + loader_log(inst, VK_DEBUG_REPORT_DEBUG_BIT_EXT, 0, "Searching for ICD drivers named %s, using default dir %s", + library_path, DEFAULT_VK_DRIVERS_PATH); if (loader_platform_is_path(library_path)) { // a relative or absolute path char *name_copy = loader_stack_alloc(strlen(file_str) + 1); char *rel_base; strcpy(name_copy, file_str); rel_base = loader_platform_dirname(name_copy); - loader_expand_path(library_path, rel_base, sizeof(fullpath), - fullpath); + loader_expand_path(library_path, rel_base, sizeof(fullpath), fullpath); } else { // a filename which is assumed in a system directory - loader_get_fullpath(library_path, DEFAULT_VK_DRIVERS_PATH, - sizeof(fullpath), fullpath); + loader_get_fullpath(library_path, DEFAULT_VK_DRIVERS_PATH, sizeof(fullpath), fullpath); } uint32_t vers = 0; @@ -3401,11 +3023,9 @@ VkResult loader_icd_scan(const struct loader_instance *inst, if (item != NULL) { temp = cJSON_Print(item); if (NULL == temp) { - loader_log( - inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, - "loader_icd_scan: Failed retrieving ICD JSON %s" - " \'api_version\' field. Skipping ICD JSON.", - file_str); + loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, "loader_icd_scan: Failed retrieving ICD JSON %s" + " \'api_version\' field. Skipping ICD JSON.", + file_str); // Only reason the print can fail is if there was an // allocation issue @@ -3421,34 +3041,28 @@ VkResult loader_icd_scan(const struct loader_instance *inst, vers = loader_make_version(temp); cJSON_Free(temp); } else { - loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, - "loader_icd_scan: ICD JSON %s does not have an" - " \'api_version\' field.", + loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, "loader_icd_scan: ICD JSON %s does not have an" + " \'api_version\' field.", file_str); } - res = loader_scanned_icd_add(inst, icd_tramp_list, fullpath, - vers); + res = loader_scanned_icd_add(inst, icd_tramp_list, fullpath, vers); if (VK_SUCCESS != res) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_icd_scan: Failed to add ICD JSON %s. " - " Skipping ICD JSON.", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_icd_scan: Failed to add ICD JSON %s. " + " Skipping ICD JSON.", fullpath); continue; } num_good_icds++; } else { - loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, - "loader_icd_scan: Failed to find \'library_path\' " - "object in ICD JSON file %s. Skipping ICD JSON.", + loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, "loader_icd_scan: Failed to find \'library_path\' " + "object in ICD JSON file %s. Skipping ICD JSON.", file_str); } } else { - loader_log( - inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, - "loader_icd_scan: Can not find \'ICD\' object in ICD JSON " - "file %s. Skipping ICD JSON", - file_str); + loader_log(inst, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, "loader_icd_scan: Can not find \'ICD\' object in ICD JSON " + "file %s. Skipping ICD JSON", + file_str); } cJSON_Delete(json); @@ -3463,8 +3077,7 @@ out: if (NULL != manifest_files.filename_list) { for (uint32_t i = 0; i < manifest_files.count; i++) { if (NULL != manifest_files.filename_list[i]) { - loader_instance_heap_free(inst, - manifest_files.filename_list[i]); + loader_instance_heap_free(inst, manifest_files.filename_list[i]); } } loader_instance_heap_free(inst, manifest_files.filename_list); @@ -3475,11 +3088,9 @@ out: return res; } -void loader_layer_scan(const struct loader_instance *inst, - struct loader_layer_list *instance_layers) { +void loader_layer_scan(const struct loader_instance *inst, struct loader_layer_list *instance_layers) { char *file_str; - struct loader_manifest_files - manifest_files[2]; // [0] = explicit, [1] = implicit + struct loader_manifest_files manifest_files[2]; // [0] = explicit, [1] = implicit cJSON *json; uint32_t implicit; bool lockedMutex = false; @@ -3487,19 +3098,15 @@ void loader_layer_scan(const struct loader_instance *inst, memset(manifest_files, 0, sizeof(struct loader_manifest_files) * 2); // Get a list of manifest files for explicit layers - if (VK_SUCCESS != - loader_get_manifest_files(inst, LAYERS_PATH_ENV, LAYERS_SOURCE_PATH, - true, true, DEFAULT_VK_ELAYERS_INFO, - HOME_VK_ELAYERS_INFO, &manifest_files[0])) { + if (VK_SUCCESS != loader_get_manifest_files(inst, LAYERS_PATH_ENV, LAYERS_SOURCE_PATH, true, true, DEFAULT_VK_ELAYERS_INFO, + HOME_VK_ELAYERS_INFO, &manifest_files[0])) { goto out; } // Get a list of manifest files for any implicit layers // Pass NULL for environment variable override - implicit layers are not // overridden by LAYERS_PATH_ENV - if (VK_SUCCESS != loader_get_manifest_files(inst, NULL, NULL, true, false, - DEFAULT_VK_ILAYERS_INFO, - HOME_VK_ILAYERS_INFO, + if (VK_SUCCESS != loader_get_manifest_files(inst, NULL, NULL, true, false, DEFAULT_VK_ILAYERS_INFO, HOME_VK_ILAYERS_INFO, &manifest_files[1])) { goto out; } @@ -3528,16 +3135,14 @@ void loader_layer_scan(const struct loader_instance *inst, continue; } - loader_add_layer_properties(inst, instance_layers, json, - (implicit == 1), file_str); + loader_add_layer_properties(inst, instance_layers, json, (implicit == 1), file_str); cJSON_Delete(json); } } // add a meta layer for validation if the validation layers are all present - loader_add_layer_property_meta(inst, sizeof(std_validation_names) / - sizeof(std_validation_names[0]), - std_validation_names, instance_layers); + loader_add_layer_property_meta(inst, sizeof(std_validation_names) / sizeof(std_validation_names[0]), std_validation_names, + instance_layers); out: @@ -3545,12 +3150,10 @@ out: if (NULL != manifest_files[manFile].filename_list) { for (uint32_t i = 0; i < manifest_files[manFile].count; i++) { if (NULL != manifest_files[manFile].filename_list[i]) { - loader_instance_heap_free( - inst, manifest_files[manFile].filename_list[i]); + loader_instance_heap_free(inst, manifest_files[manFile].filename_list[i]); } } - loader_instance_heap_free(inst, - manifest_files[manFile].filename_list); + loader_instance_heap_free(inst, manifest_files[manFile].filename_list); } } if (lockedMutex) { @@ -3558,8 +3161,7 @@ out: } } -void loader_implicit_layer_scan(const struct loader_instance *inst, - struct loader_layer_list *instance_layers) { +void loader_implicit_layer_scan(const struct loader_instance *inst, struct loader_layer_list *instance_layers) { char *file_str; struct loader_manifest_files manifest_files; cJSON *json; @@ -3567,9 +3169,8 @@ void loader_implicit_layer_scan(const struct loader_instance *inst, // Pass NULL for environment variable override - implicit layers are not // overridden by LAYERS_PATH_ENV - VkResult res = loader_get_manifest_files( - inst, NULL, NULL, true, false, DEFAULT_VK_ILAYERS_INFO, - HOME_VK_ILAYERS_INFO, &manifest_files); + VkResult res = + loader_get_manifest_files(inst, NULL, NULL, true, false, DEFAULT_VK_ILAYERS_INFO, HOME_VK_ILAYERS_INFO, &manifest_files); if (VK_SUCCESS != res || manifest_files.count == 0) { return; } @@ -3593,8 +3194,7 @@ void loader_implicit_layer_scan(const struct loader_instance *inst, continue; } - loader_add_layer_properties(inst, instance_layers, json, true, - file_str); + loader_add_layer_properties(inst, instance_layers, json, true, file_str); loader_instance_heap_free(inst, file_str); cJSON_Delete(json); @@ -3602,29 +3202,25 @@ void loader_implicit_layer_scan(const struct loader_instance *inst, loader_instance_heap_free(inst, manifest_files.filename_list); // add a meta layer for validation if the validation layers are all present - loader_add_layer_property_meta(inst, sizeof(std_validation_names) / - sizeof(std_validation_names[0]), - std_validation_names, instance_layers); + loader_add_layer_property_meta(inst, sizeof(std_validation_names) / sizeof(std_validation_names[0]), std_validation_names, + instance_layers); loader_platform_thread_unlock_mutex(&loader_json_lock); } -static VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL -loader_gpdpa_instance_internal(VkInstance inst, const char *pName) { +static VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL loader_gpdpa_instance_internal(VkInstance inst, const char *pName) { // inst is not wrapped if (inst == VK_NULL_HANDLE) { return NULL; } - VkLayerInstanceDispatchTable *disp_table = - *(VkLayerInstanceDispatchTable **)inst; + VkLayerInstanceDispatchTable *disp_table = *(VkLayerInstanceDispatchTable **)inst; void *addr; if (disp_table == NULL) return NULL; bool found_name; - addr = - loader_lookup_instance_dispatch_table(disp_table, pName, &found_name); + addr = loader_lookup_instance_dispatch_table(disp_table, pName, &found_name); if (found_name) { return addr; } @@ -3633,47 +3229,39 @@ loader_gpdpa_instance_internal(VkInstance inst, const char *pName) { return addr; // Don't call down the chain, this would be an infinite loop - loader_log(NULL, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, - "loader_gpdpa_instance_internal() unrecognized name %s", pName); + loader_log(NULL, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, "loader_gpdpa_instance_internal() unrecognized name %s", pName); return NULL; } -static VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL -loader_gpdpa_instance_terminator(VkInstance inst, const char *pName) { +static VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL loader_gpdpa_instance_terminator(VkInstance inst, const char *pName) { // inst is not wrapped if (inst == VK_NULL_HANDLE) { return NULL; } - VkLayerInstanceDispatchTable *disp_table = - *(VkLayerInstanceDispatchTable **)inst; + VkLayerInstanceDispatchTable *disp_table = *(VkLayerInstanceDispatchTable **)inst; void *addr; if (disp_table == NULL) return NULL; bool found_name; - addr = - loader_lookup_instance_dispatch_table(disp_table, pName, &found_name); + addr = loader_lookup_instance_dispatch_table(disp_table, pName, &found_name); if (found_name) { return addr; } // Get the terminator, but don't perform checking since it should already // have been setup if we get here. - if (loader_phys_dev_ext_gpa(loader_get_instance(inst), pName, false, NULL, - &addr)) { + if (loader_phys_dev_ext_gpa(loader_get_instance(inst), pName, false, NULL, &addr)) { return addr; } // Don't call down the chain, this would be an infinite loop - loader_log(NULL, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, - "loader_gpdpa_instance_terminator() unrecognized name %s", - pName); + loader_log(NULL, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, "loader_gpdpa_instance_terminator() unrecognized name %s", pName); return NULL; } -static VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL -loader_gpa_instance_internal(VkInstance inst, const char *pName) { +static VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL loader_gpa_instance_internal(VkInstance inst, const char *pName) { if (!strcmp(pName, "vkGetInstanceProcAddr")) { return (PFN_vkVoidFunction)loader_gpa_instance_internal; } @@ -3691,31 +3279,26 @@ loader_gpa_instance_internal(VkInstance inst, const char *pName) { if (inst == VK_NULL_HANDLE) { return NULL; } - VkLayerInstanceDispatchTable *disp_table = - *(VkLayerInstanceDispatchTable **)inst; + VkLayerInstanceDispatchTable *disp_table = *(VkLayerInstanceDispatchTable **)inst; void *addr; if (disp_table == NULL) return NULL; bool found_name; - addr = - loader_lookup_instance_dispatch_table(disp_table, pName, &found_name); + addr = loader_lookup_instance_dispatch_table(disp_table, pName, &found_name); if (found_name) { return addr; } // Don't call down the chain, this would be an infinite loop - loader_log(NULL, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, - "loader_gpa_instance_internal() unrecognized name %s", pName); + loader_log(NULL, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, "loader_gpa_instance_internal() unrecognized name %s", pName); return NULL; } -VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL -loader_gpa_device_internal(VkDevice device, const char *pName) { +VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL loader_gpa_device_internal(VkDevice device, const char *pName) { struct loader_device *dev; - struct loader_icd_term *icd_term = - loader_get_icd_and_device(device, &dev, NULL); + struct loader_icd_term *icd_term = loader_get_icd_and_device(device, &dev, NULL); // NOTE: Device Funcs needing Trampoline/Terminator. // Overrides for device functions needing a trampoline and @@ -3749,30 +3332,22 @@ loader_gpa_device_internal(VkDevice device, const char *pName) { * GDPA. * If GDPA returns NULL then don't initialize the dispatch table entry. */ -static void loader_init_dispatch_dev_ext_entry(struct loader_instance *inst, - struct loader_device *dev, - uint32_t idx, +static void loader_init_dispatch_dev_ext_entry(struct loader_instance *inst, struct loader_device *dev, uint32_t idx, const char *funcName) { void *gdpa_value; if (dev != NULL) { - gdpa_value = dev->loader_dispatch.core_dispatch.GetDeviceProcAddr( - dev->chain_device, funcName); + gdpa_value = dev->loader_dispatch.core_dispatch.GetDeviceProcAddr(dev->chain_device, funcName); if (gdpa_value != NULL) - dev->loader_dispatch.ext_dispatch.dev_ext[idx] = - (PFN_vkDevExt)gdpa_value; + dev->loader_dispatch.ext_dispatch.dev_ext[idx] = (PFN_vkDevExt)gdpa_value; } else { - for (struct loader_icd_term *icd_term = inst->icd_terms; - icd_term != NULL; icd_term = icd_term->next) { + for (struct loader_icd_term *icd_term = inst->icd_terms; icd_term != NULL; icd_term = icd_term->next) { struct loader_device *ldev = icd_term->logical_device_list; while (ldev) { - gdpa_value = - ldev->loader_dispatch.core_dispatch.GetDeviceProcAddr( - ldev->chain_device, funcName); + gdpa_value = ldev->loader_dispatch.core_dispatch.GetDeviceProcAddr(ldev->chain_device, funcName); if (gdpa_value != NULL) - ldev->loader_dispatch.ext_dispatch.dev_ext[idx] = - (PFN_vkDevExt)gdpa_value; + ldev->loader_dispatch.ext_dispatch.dev_ext[idx] = (PFN_vkDevExt)gdpa_value; ldev = ldev->next; } } @@ -3784,22 +3359,18 @@ static void loader_init_dispatch_dev_ext_entry(struct loader_instance *inst, * for dev for each of those extension entrypoints found in hash table. */ -void loader_init_dispatch_dev_ext(struct loader_instance *inst, - struct loader_device *dev) { +void loader_init_dispatch_dev_ext(struct loader_instance *inst, struct loader_device *dev) { for (uint32_t i = 0; i < MAX_NUM_UNKNOWN_EXTS; i++) { if (inst->dev_ext_disp_hash[i].func_name != NULL) - loader_init_dispatch_dev_ext_entry(inst, dev, i, - inst->dev_ext_disp_hash[i].func_name); + loader_init_dispatch_dev_ext_entry(inst, dev, i, inst->dev_ext_disp_hash[i].func_name); } } -static bool loader_check_icds_for_dev_ext_address(struct loader_instance *inst, - const char *funcName) { +static bool loader_check_icds_for_dev_ext_address(struct loader_instance *inst, const char *funcName) { struct loader_icd_term *icd_term; icd_term = inst->icd_terms; while (NULL != icd_term) { - if (icd_term->scanned_icd->GetInstanceProcAddr(icd_term->instance, - funcName)) + if (icd_term->scanned_icd->GetInstanceProcAddr(icd_term->instance, funcName)) // this icd supports funcName return true; icd_term = icd_term->next; @@ -3808,20 +3379,15 @@ static bool loader_check_icds_for_dev_ext_address(struct loader_instance *inst, return false; } -static bool loader_check_layer_list_for_dev_ext_address( - const struct loader_layer_list *const layers, const char *funcName) { +static bool loader_check_layer_list_for_dev_ext_address(const struct loader_layer_list *const layers, const char *funcName) { // Iterate over the layers. for (uint32_t layer = 0; layer < layers->count; ++layer) { // Iterate over the extensions. - const struct loader_device_extension_list *const extensions = - &(layers->list[layer].device_extension_list); - for (uint32_t extension = 0; extension < extensions->count; - ++extension) { + const struct loader_device_extension_list *const extensions = &(layers->list[layer].device_extension_list); + for (uint32_t extension = 0; extension < extensions->count; ++extension) { // Iterate over the entry points. - const struct loader_dev_ext_props *const property = - &(extensions->list[extension]); - for (uint32_t entry = 0; entry < property->entrypoint_count; - ++entry) { + const struct loader_dev_ext_props *const property = &(extensions->list[extension]); + for (uint32_t entry = 0; entry < property->entrypoint_count; ++entry) { if (strcmp(property->entrypoints[entry], funcName) == 0) { return true; } @@ -3840,8 +3406,7 @@ static void loader_free_dev_ext_table(struct loader_instance *inst) { memset(inst->dev_ext_disp_hash, 0, sizeof(inst->dev_ext_disp_hash)); } -static bool loader_add_dev_ext_table(struct loader_instance *inst, - uint32_t *ptr_idx, const char *funcName) { +static bool loader_add_dev_ext_table(struct loader_instance *inst, uint32_t *ptr_idx, const char *funcName) { uint32_t i; uint32_t idx = *ptr_idx; struct loader_dispatch_hash_list *list = &inst->dev_ext_disp_hash[idx].list; @@ -3850,42 +3415,33 @@ static bool loader_add_dev_ext_table(struct loader_instance *inst, // no entry here at this idx, so use it assert(list->capacity == 0); inst->dev_ext_disp_hash[idx].func_name = - (char *)loader_instance_heap_alloc( - inst, strlen(funcName) + 1, - VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); + (char *)loader_instance_heap_alloc(inst, strlen(funcName) + 1, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (inst->dev_ext_disp_hash[idx].func_name == NULL) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_add_dev_ext_table: Failed to allocate memory " - "for func_name %s", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_add_dev_ext_table: Failed to allocate memory " + "for func_name %s", funcName); return false; } - strncpy(inst->dev_ext_disp_hash[idx].func_name, funcName, - strlen(funcName) + 1); + strncpy(inst->dev_ext_disp_hash[idx].func_name, funcName, strlen(funcName) + 1); return true; } // check for enough capacity if (list->capacity == 0) { - list->index = - loader_instance_heap_alloc(inst, 8 * sizeof(*(list->index)), - VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); + list->index = loader_instance_heap_alloc(inst, 8 * sizeof(*(list->index)), VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (list->index == NULL) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_add_dev_ext_table: Failed to allocate memory " - "for list index", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_add_dev_ext_table: Failed to allocate memory " + "for list index", funcName); return false; } list->capacity = 8 * sizeof(*(list->index)); } else if (list->capacity < (list->count + 1) * sizeof(*(list->index))) { - list->index = loader_instance_heap_realloc( - inst, list->index, list->capacity, list->capacity * 2, - VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); + list->index = loader_instance_heap_realloc(inst, list->index, list->capacity, list->capacity * 2, + VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (list->index == NULL) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_add_dev_ext_table: Failed to reallocate memory " - "for list index", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_add_dev_ext_table: Failed to reallocate memory " + "for list index", funcName); return false; } @@ -3898,19 +3454,14 @@ static bool loader_add_dev_ext_table(struct loader_instance *inst, if (!inst->dev_ext_disp_hash[i].func_name) { assert(inst->dev_ext_disp_hash[i].list.capacity == 0); inst->dev_ext_disp_hash[i].func_name = - (char *)loader_instance_heap_alloc( - inst, strlen(funcName) + 1, - VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); + (char *)loader_instance_heap_alloc(inst, strlen(funcName) + 1, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (inst->dev_ext_disp_hash[i].func_name == NULL) { - loader_log( - inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_add_dev_ext_table: Failed to allocate memory " - "for func_name %s", - funcName); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_add_dev_ext_table: Failed to allocate memory " + "for func_name %s", + funcName); return false; } - strncpy(inst->dev_ext_disp_hash[i].func_name, funcName, - strlen(funcName) + 1); + strncpy(inst->dev_ext_disp_hash[i].func_name, funcName, strlen(funcName) + 1); list->index[list->count] = i; list->count++; *ptr_idx = i; @@ -3919,19 +3470,15 @@ static bool loader_add_dev_ext_table(struct loader_instance *inst, i = (i + 1) % MAX_NUM_UNKNOWN_EXTS; } while (i != idx); - loader_log( - inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_add_dev_ext_table: Could not insert into hash table; is " - "it full?"); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_add_dev_ext_table: Could not insert into hash table; is " + "it full?"); return false; } -static bool loader_name_in_dev_ext_table(struct loader_instance *inst, - uint32_t *idx, const char *funcName) { +static bool loader_name_in_dev_ext_table(struct loader_instance *inst, uint32_t *idx, const char *funcName) { uint32_t alt_idx; - if (inst->dev_ext_disp_hash[*idx].func_name && - !strcmp(inst->dev_ext_disp_hash[*idx].func_name, funcName)) + if (inst->dev_ext_disp_hash[*idx].func_name && !strcmp(inst->dev_ext_disp_hash[*idx].func_name, funcName)) return true; // funcName wasn't at the primary spot in the hash table @@ -3992,16 +3539,12 @@ void *loader_dev_ext_gpa(struct loader_instance *inst, const char *funcName) { return NULL; } -static bool -loader_check_icds_for_phys_dev_ext_address(struct loader_instance *inst, - const char *funcName) { +static bool loader_check_icds_for_phys_dev_ext_address(struct loader_instance *inst, const char *funcName) { struct loader_icd_term *icd_term; icd_term = inst->icd_terms; while (NULL != icd_term) { - if (icd_term->scanned_icd->interface_version >= - MIN_PHYS_DEV_EXTENSION_ICD_INTERFACE_VERSION && - icd_term->scanned_icd->GetPhysicalDeviceProcAddr(icd_term->instance, - funcName)) + if (icd_term->scanned_icd->interface_version >= MIN_PHYS_DEV_EXTENSION_ICD_INTERFACE_VERSION && + icd_term->scanned_icd->GetPhysicalDeviceProcAddr(icd_term->instance, funcName)) // this icd supports funcName return true; icd_term = icd_term->next; @@ -4010,21 +3553,15 @@ loader_check_icds_for_phys_dev_ext_address(struct loader_instance *inst, return false; } -static bool -loader_check_layer_list_for_phys_dev_ext_address(struct loader_instance *inst, - const char *funcName) { - struct loader_layer_properties *layer_prop_list = - inst->activated_layer_list.list; +static bool loader_check_layer_list_for_phys_dev_ext_address(struct loader_instance *inst, const char *funcName) { + struct loader_layer_properties *layer_prop_list = inst->activated_layer_list.list; for (uint32_t layer = 0; layer < inst->activated_layer_list.count; ++layer) { // If this layer supports the vk_layerGetPhysicalDeviceProcAddr, then call // it and see if it returns a valid pointer for this function name. if (layer_prop_list[layer].interface_version > 1) { - const struct loader_layer_functions *const functions = - &(layer_prop_list[layer].functions); + const struct loader_layer_functions *const functions = &(layer_prop_list[layer].functions); if (NULL != functions->get_physical_device_proc_addr && - NULL != - functions->get_physical_device_proc_addr((VkInstance)inst, - funcName)) { + NULL != functions->get_physical_device_proc_addr((VkInstance)inst, funcName)) { return true; } } @@ -4033,65 +3570,46 @@ loader_check_layer_list_for_phys_dev_ext_address(struct loader_instance *inst, return false; } - static void loader_free_phys_dev_ext_table(struct loader_instance *inst) { for (uint32_t i = 0; i < MAX_NUM_UNKNOWN_EXTS; i++) { - loader_instance_heap_free(inst, - inst->phys_dev_ext_disp_hash[i].func_name); - loader_instance_heap_free(inst, - inst->phys_dev_ext_disp_hash[i].list.index); + loader_instance_heap_free(inst, inst->phys_dev_ext_disp_hash[i].func_name); + loader_instance_heap_free(inst, inst->phys_dev_ext_disp_hash[i].list.index); } - memset(inst->phys_dev_ext_disp_hash, 0, - sizeof(inst->phys_dev_ext_disp_hash)); + memset(inst->phys_dev_ext_disp_hash, 0, sizeof(inst->phys_dev_ext_disp_hash)); } -static bool loader_add_phys_dev_ext_table(struct loader_instance *inst, - uint32_t *ptr_idx, - const char *funcName) { +static bool loader_add_phys_dev_ext_table(struct loader_instance *inst, uint32_t *ptr_idx, const char *funcName) { uint32_t i; uint32_t idx = *ptr_idx; - struct loader_dispatch_hash_list *list = - &inst->phys_dev_ext_disp_hash[idx].list; + struct loader_dispatch_hash_list *list = &inst->phys_dev_ext_disp_hash[idx].list; if (!inst->phys_dev_ext_disp_hash[idx].func_name) { // no entry here at this idx, so use it assert(list->capacity == 0); inst->phys_dev_ext_disp_hash[idx].func_name = - (char *)loader_instance_heap_alloc( - inst, strlen(funcName) + 1, - VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); + (char *)loader_instance_heap_alloc(inst, strlen(funcName) + 1, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (inst->phys_dev_ext_disp_hash[idx].func_name == NULL) { - loader_log( - inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_add_phys_dev_ext_table() can't allocate memory for " - "func_name"); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_add_phys_dev_ext_table() can't allocate memory for " + "func_name"); return false; } - strncpy(inst->phys_dev_ext_disp_hash[idx].func_name, funcName, - strlen(funcName) + 1); + strncpy(inst->phys_dev_ext_disp_hash[idx].func_name, funcName, strlen(funcName) + 1); return true; } // check for enough capacity if (list->capacity == 0) { - list->index = - loader_instance_heap_alloc(inst, 8 * sizeof(*(list->index)), - VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); + list->index = loader_instance_heap_alloc(inst, 8 * sizeof(*(list->index)), VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (list->index == NULL) { - loader_log( - inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_add_phys_dev_ext_table() can't allocate list memory"); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_add_phys_dev_ext_table() can't allocate list memory"); return false; } list->capacity = 8 * sizeof(*(list->index)); } else if (list->capacity < (list->count + 1) * sizeof(*(list->index))) { - list->index = loader_instance_heap_realloc( - inst, list->index, list->capacity, list->capacity * 2, - VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); + list->index = loader_instance_heap_realloc(inst, list->index, list->capacity, list->capacity * 2, + VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (list->index == NULL) { - loader_log( - inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_add_phys_dev_ext_table() can't reallocate list memory"); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_add_phys_dev_ext_table() can't reallocate list memory"); return false; } list->capacity *= 2; @@ -4103,17 +3621,13 @@ static bool loader_add_phys_dev_ext_table(struct loader_instance *inst, if (!inst->phys_dev_ext_disp_hash[i].func_name) { assert(inst->phys_dev_ext_disp_hash[i].list.capacity == 0); inst->phys_dev_ext_disp_hash[i].func_name = - (char *)loader_instance_heap_alloc( - inst, strlen(funcName) + 1, - VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); + (char *)loader_instance_heap_alloc(inst, strlen(funcName) + 1, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (inst->phys_dev_ext_disp_hash[i].func_name == NULL) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_add_dev_ext_table() can't rallocate " - "func_name memory"); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_add_dev_ext_table() can't rallocate " + "func_name memory"); return false; } - strncpy(inst->phys_dev_ext_disp_hash[i].func_name, funcName, - strlen(funcName) + 1); + strncpy(inst->phys_dev_ext_disp_hash[i].func_name, funcName, strlen(funcName) + 1); list->index[list->count] = i; list->count++; *ptr_idx = i; @@ -4122,24 +3636,19 @@ static bool loader_add_phys_dev_ext_table(struct loader_instance *inst, i = (i + 1) % MAX_NUM_UNKNOWN_EXTS; } while (i != idx); - loader_log( - inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_add_phys_dev_ext_table() couldn't insert into hash table; is " - "it full?"); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_add_phys_dev_ext_table() couldn't insert into hash table; is " + "it full?"); return false; } -static bool loader_name_in_phys_dev_ext_table(struct loader_instance* inst, - uint32_t *idx, const char *funcName) { +static bool loader_name_in_phys_dev_ext_table(struct loader_instance *inst, uint32_t *idx, const char *funcName) { uint32_t alt_idx; - if (inst->phys_dev_ext_disp_hash[*idx].func_name && - !strcmp(inst->phys_dev_ext_disp_hash[*idx].func_name, funcName)) + if (inst->phys_dev_ext_disp_hash[*idx].func_name && !strcmp(inst->phys_dev_ext_disp_hash[*idx].func_name, funcName)) return true; // funcName wasn't at the primary spot in the hash table // search the list of secondary locations (shallow search, not deep search) - for (uint32_t i = 0; i < inst->phys_dev_ext_disp_hash[*idx].list.count; - i++) { + for (uint32_t i = 0; i < inst->phys_dev_ext_disp_hash[*idx].list.count; i++) { alt_idx = inst->phys_dev_ext_disp_hash[*idx].list.index[i]; if (!strcmp(inst->phys_dev_ext_disp_hash[*idx].func_name, funcName)) { *idx = alt_idx; @@ -4166,8 +3675,7 @@ static bool loader_name_in_phys_dev_ext_table(struct loader_instance* inst, // addresses are returned. // Null is returned if the hash table is full or if no discovered layer or // ICD returns a non-NULL GetProcAddr for it. -bool loader_phys_dev_ext_gpa(struct loader_instance *inst, const char *funcName, - bool perform_checking, void **tramp_addr, +bool loader_phys_dev_ext_gpa(struct loader_instance *inst, const char *funcName, bool perform_checking, void **tramp_addr, void **term_addr) { uint32_t idx; uint32_t seed = 0; @@ -4188,15 +3696,13 @@ bool loader_phys_dev_ext_gpa(struct loader_instance *inst, const char *funcName, if (!loader_check_icds_for_phys_dev_ext_address(inst, funcName)) { // If we're not checking layers, or we are and it's not in a layer, just // return - if (!perform_checking || - !loader_check_layer_list_for_phys_dev_ext_address(inst, funcName)) { + if (!perform_checking || !loader_check_layer_list_for_phys_dev_ext_address(inst, funcName)) { goto out; } } idx = murmurhash(funcName, strlen(funcName), seed) % MAX_NUM_UNKNOWN_EXTS; - if (perform_checking && - !loader_name_in_phys_dev_ext_table(inst, &idx, funcName)) { + if (perform_checking && !loader_name_in_phys_dev_ext_table(inst, &idx, funcName)) { uint32_t i; bool added = false; @@ -4209,19 +3715,15 @@ bool loader_phys_dev_ext_gpa(struct loader_instance *inst, const char *funcName, // Setup the ICD function pointers struct loader_icd_term *icd_term = inst->icd_terms; while (NULL != icd_term) { - if (MIN_PHYS_DEV_EXTENSION_ICD_INTERFACE_VERSION <= - icd_term->scanned_icd->interface_version && + if (MIN_PHYS_DEV_EXTENSION_ICD_INTERFACE_VERSION <= icd_term->scanned_icd->interface_version && NULL != icd_term->scanned_icd->GetPhysicalDeviceProcAddr) { icd_term->phys_dev_ext[idx] = - (PFN_PhysDevExt) - icd_term->scanned_icd->GetPhysicalDeviceProcAddr( - icd_term->instance, funcName); + (PFN_PhysDevExt)icd_term->scanned_icd->GetPhysicalDeviceProcAddr(icd_term->instance, funcName); // Make sure we set the instance dispatch to point to the // loader's terminator now since we can at least handle it // in one ICD. - inst->disp->phys_dev_ext[idx] = - loader_get_phys_dev_ext_termin(idx); + inst->disp->phys_dev_ext[idx] = loader_get_phys_dev_ext_termin(idx); } else { icd_term->phys_dev_ext[idx] = NULL; } @@ -4232,14 +3734,10 @@ bool loader_phys_dev_ext_gpa(struct loader_instance *inst, const char *funcName, // Now, search for the first layer attached and query using it to get // the first entry point. for (i = 0; i < inst->activated_layer_list.count; i++) { - struct loader_layer_properties *layer_prop = - &inst->activated_layer_list.list[i]; - if (layer_prop->interface_version > 1 && - NULL != layer_prop->functions.get_physical_device_proc_addr) { + struct loader_layer_properties *layer_prop = &inst->activated_layer_list.list[i]; + if (layer_prop->interface_version > 1 && NULL != layer_prop->functions.get_physical_device_proc_addr) { inst->disp->phys_dev_ext[idx] = - (PFN_PhysDevExt) - layer_prop->functions.get_physical_device_proc_addr( - (VkInstance)inst, funcName); + (PFN_PhysDevExt)layer_prop->functions.get_physical_device_proc_addr((VkInstance)inst, funcName); if (NULL != inst->disp->phys_dev_ext[idx]) { break; } @@ -4269,8 +3767,7 @@ struct loader_instance *loader_get_instance(const VkInstance instance) { const VkLayerInstanceDispatchTable *disp; struct loader_instance *ptr_instance = NULL; disp = loader_get_instance_layer_dispatch(instance); - for (struct loader_instance *inst = loader.instances; inst; - inst = inst->next) { + for (struct loader_instance *inst = loader.instances; inst; inst = inst->next) { if (&inst->disp->layer_inst_disp == disp) { ptr_instance = inst; break; @@ -4279,37 +3776,28 @@ struct loader_instance *loader_get_instance(const VkInstance instance) { return ptr_instance; } -static loader_platform_dl_handle -loader_open_layer_lib(const struct loader_instance *inst, - const char *chain_type, - struct loader_layer_properties *prop) { +static loader_platform_dl_handle loader_open_layer_lib(const struct loader_instance *inst, const char *chain_type, + struct loader_layer_properties *prop) { - if ((prop->lib_handle = loader_platform_open_library(prop->lib_name)) == - NULL) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_open_layer_lib: Failed to open library %s", - prop->lib_name); + if ((prop->lib_handle = loader_platform_open_library(prop->lib_name)) == NULL) { + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_open_layer_lib: Failed to open library %s", prop->lib_name); } else { - loader_log(inst, VK_DEBUG_REPORT_DEBUG_BIT_EXT, 0, - "Loading layer library %s", prop->lib_name); + loader_log(inst, VK_DEBUG_REPORT_DEBUG_BIT_EXT, 0, "Loading layer library %s", prop->lib_name); } return prop->lib_handle; } -static void loader_close_layer_lib(const struct loader_instance *inst, - struct loader_layer_properties *prop) { +static void loader_close_layer_lib(const struct loader_instance *inst, struct loader_layer_properties *prop) { if (prop->lib_handle) { loader_platform_close_library(prop->lib_handle); - loader_log(inst, VK_DEBUG_REPORT_DEBUG_BIT_EXT, 0, - "Unloading layer library %s", prop->lib_name); + loader_log(inst, VK_DEBUG_REPORT_DEBUG_BIT_EXT, 0, "Unloading layer library %s", prop->lib_name); prop->lib_handle = NULL; } } -void loader_deactivate_layers(const struct loader_instance *instance, - struct loader_device *device, +void loader_deactivate_layers(const struct loader_instance *instance, struct loader_device *device, struct loader_layer_list *list) { /* delete instance list of enabled layers and close any layer libraries */ for (uint32_t i = 0; i < list->count; i++) { @@ -4324,11 +3812,8 @@ void loader_deactivate_layers(const struct loader_instance *instance, * Go through the search_list and find any layers which match type. If layer * type match is found in then add it to ext_list. */ -static void -loader_add_layer_implicit(const struct loader_instance *inst, - const enum layer_type type, - struct loader_layer_list *list, - const struct loader_layer_list *search_list) { +static void loader_add_layer_implicit(const struct loader_instance *inst, const enum layer_type type, + struct loader_layer_list *list, const struct loader_layer_list *search_list) { bool enable; char *env_value; uint32_t i; @@ -4372,11 +3857,8 @@ loader_add_layer_implicit(const struct loader_instance *inst, * is found in search_list then add it to layer_list. But only add it to * layer_list if type matches. */ -static void loader_add_layer_env(struct loader_instance *inst, - const enum layer_type type, - const char *env_name, - struct loader_layer_list *layer_list, - const struct loader_layer_list *search_list) { +static void loader_add_layer_env(struct loader_instance *inst, const enum layer_type type, const char *env_name, + struct loader_layer_list *layer_list, const struct loader_layer_list *search_list) { char *layerEnv; char *next, *name; @@ -4399,20 +3881,15 @@ static void loader_add_layer_env(struct loader_instance *inst, don't attempt to remove duplicate layers already added by app or env var */ - loader_log(inst, VK_DEBUG_REPORT_INFORMATION_BIT_EXT, 0, - "Expanding meta layer %s found in environment variable", + loader_log(inst, VK_DEBUG_REPORT_INFORMATION_BIT_EXT, 0, "Expanding meta layer %s found in environment variable", std_validation_str); if (type == VK_LAYER_TYPE_INSTANCE_EXPLICIT) inst->activated_layers_are_std_val = true; - for (uint32_t i = 0; i < sizeof(std_validation_names) / - sizeof(std_validation_names[0]); - i++) { - loader_find_layer_name_add_list(inst, std_validation_names[i], - type, search_list, layer_list); + for (uint32_t i = 0; i < sizeof(std_validation_names) / sizeof(std_validation_names[0]); i++) { + loader_find_layer_name_add_list(inst, std_validation_names[i], type, search_list, layer_list); } } else { - loader_find_layer_name_add_list(inst, name, type, search_list, - layer_list); + loader_find_layer_name_add_list(inst, name, type, search_list, layer_list); } name = next; } @@ -4420,42 +3897,34 @@ static void loader_add_layer_env(struct loader_instance *inst, return; } -VkResult -loader_enable_instance_layers(struct loader_instance *inst, - const VkInstanceCreateInfo *pCreateInfo, - const struct loader_layer_list *instance_layers) { +VkResult loader_enable_instance_layers(struct loader_instance *inst, const VkInstanceCreateInfo *pCreateInfo, + const struct loader_layer_list *instance_layers) { VkResult err; assert(inst && "Cannot have null instance"); if (!loader_init_layer_list(inst, &inst->activated_layer_list)) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_enable_instance_layers: Failed to initialize" - " the layer list"); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_enable_instance_layers: Failed to initialize" + " the layer list"); return VK_ERROR_OUT_OF_HOST_MEMORY; } /* Add any implicit layers first */ - loader_add_layer_implicit(inst, VK_LAYER_TYPE_INSTANCE_IMPLICIT, - &inst->activated_layer_list, instance_layers); + loader_add_layer_implicit(inst, VK_LAYER_TYPE_INSTANCE_IMPLICIT, &inst->activated_layer_list, instance_layers); /* Add any layers specified via environment variable next */ - loader_add_layer_env(inst, VK_LAYER_TYPE_INSTANCE_EXPLICIT, - "VK_INSTANCE_LAYERS", &inst->activated_layer_list, - instance_layers); + loader_add_layer_env(inst, VK_LAYER_TYPE_INSTANCE_EXPLICIT, "VK_INSTANCE_LAYERS", &inst->activated_layer_list, instance_layers); /* Add layers specified by the application */ - err = loader_add_layer_names_to_list( - inst, &inst->activated_layer_list, pCreateInfo->enabledLayerCount, - pCreateInfo->ppEnabledLayerNames, instance_layers); + err = loader_add_layer_names_to_list(inst, &inst->activated_layer_list, pCreateInfo->enabledLayerCount, + pCreateInfo->ppEnabledLayerNames, instance_layers); return err; } // Determine the layer interface version to use. -bool loader_get_layer_interface_version( - PFN_vkNegotiateLoaderLayerInterfaceVersion fp_negotiate_layer_version, - VkNegotiateLayerInterface *interface_struct) { +bool loader_get_layer_interface_version(PFN_vkNegotiateLoaderLayerInterfaceVersion fp_negotiate_layer_version, + VkNegotiateLayerInterface *interface_struct) { memset(interface_struct, 0, sizeof(VkNegotiateLayerInterface)); @@ -4465,8 +3934,7 @@ bool loader_get_layer_interface_version( if (fp_negotiate_layer_version != NULL) { // Layer supports the negotiation API, so call it with the loader's // latest version supported - interface_struct->loaderLayerInterfaceVersion = - CURRENT_LOADER_LAYER_INTERFACE_VERSION; + interface_struct->loaderLayerInterfaceVersion = CURRENT_LOADER_LAYER_INTERFACE_VERSION; VkResult result = fp_negotiate_layer_version(interface_struct); if (result != VK_SUCCESS) { @@ -4476,8 +3944,7 @@ bool loader_get_layer_interface_version( } } - if (interface_struct->loaderLayerInterfaceVersion < - MIN_SUPPORTED_LOADER_LAYER_INTERFACE_VERSION) { + if (interface_struct->loaderLayerInterfaceVersion < MIN_SUPPORTED_LOADER_LAYER_INTERFACE_VERSION) { // Loader no longer supports the layer's latest interface version so // fail loading the layer return false; @@ -4504,10 +3971,8 @@ bool loader_get_layer_interface_version( * that will call CreateInstance on all available ICD's and * cache those VkInstance objects for future use. */ -VkResult loader_create_instance_chain(const VkInstanceCreateInfo *pCreateInfo, - const VkAllocationCallbacks *pAllocator, - struct loader_instance *inst, - VkInstance *created_instance) { +VkResult loader_create_instance_chain(const VkInstanceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, + struct loader_instance *inst, VkInstance *created_instance) { uint32_t activated_layers = 0; VkLayerInstanceCreateInfo chain_info; VkLayerInstanceLink *layer_instance_link_info = NULL; @@ -4529,19 +3994,16 @@ VkResult loader_create_instance_chain(const VkInstanceCreateInfo *pCreateInfo, chain_info.function = VK_LAYER_LINK_INFO; loader_create_info.pNext = &chain_info; - layer_instance_link_info = loader_stack_alloc( - sizeof(VkLayerInstanceLink) * inst->activated_layer_list.count); + layer_instance_link_info = loader_stack_alloc(sizeof(VkLayerInstanceLink) * inst->activated_layer_list.count); if (!layer_instance_link_info) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_create_instance_chain: Failed to alloc Instance" - " objects for layer"); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_create_instance_chain: Failed to alloc Instance" + " objects for layer"); return VK_ERROR_OUT_OF_HOST_MEMORY; } // Create instance chain of enabled layers for (int32_t i = inst->activated_layer_list.count - 1; i >= 0; i--) { - struct loader_layer_properties *layer_prop = - &inst->activated_layer_list.list[i]; + struct loader_layer_properties *layer_prop = &inst->activated_layer_list.list[i]; loader_platform_dl_handle lib_handle; lib_handle = loader_open_layer_lib(inst, "instance", layer_prop); @@ -4550,22 +4012,14 @@ VkResult loader_create_instance_chain(const VkInstanceCreateInfo *pCreateInfo, } if (NULL == layer_prop->functions.negotiate_layer_interface) { - PFN_vkNegotiateLoaderLayerInterfaceVersion negotiate_interface = - NULL; + PFN_vkNegotiateLoaderLayerInterfaceVersion negotiate_interface = NULL; bool functions_in_interface = false; - if (strlen(layer_prop->functions.str_negotiate_interface) == - 0) { - negotiate_interface = - (PFN_vkNegotiateLoaderLayerInterfaceVersion) - loader_platform_get_proc_address( - lib_handle, - "vkNegotiateLoaderLayerInterfaceVersion"); + if (strlen(layer_prop->functions.str_negotiate_interface) == 0) { + negotiate_interface = (PFN_vkNegotiateLoaderLayerInterfaceVersion)loader_platform_get_proc_address( + lib_handle, "vkNegotiateLoaderLayerInterfaceVersion"); } else { - negotiate_interface = - (PFN_vkNegotiateLoaderLayerInterfaceVersion) - loader_platform_get_proc_address( - lib_handle, - layer_prop->functions.str_negotiate_interface); + negotiate_interface = (PFN_vkNegotiateLoaderLayerInterfaceVersion)loader_platform_get_proc_address( + lib_handle, layer_prop->functions.str_negotiate_interface); } // If we can negotiate an interface version, then we can also @@ -4573,18 +4027,15 @@ VkResult loader_create_instance_chain(const VkInstanceCreateInfo *pCreateInfo, // that first, and see if we can get all the function pointers // necessary from that one call. if (NULL != negotiate_interface) { - layer_prop->functions.negotiate_layer_interface = - negotiate_interface; + layer_prop->functions.negotiate_layer_interface = negotiate_interface; VkNegotiateLayerInterface interface_struct; - if (loader_get_layer_interface_version(negotiate_interface, - &interface_struct)) { + if (loader_get_layer_interface_version(negotiate_interface, &interface_struct)) { // Go ahead and set the properites version to the // correct value. - layer_prop->interface_version = - interface_struct.loaderLayerInterfaceVersion; + layer_prop->interface_version = interface_struct.loaderLayerInterfaceVersion; // If the interface is 2 or newer, we have access to the // new GetPhysicalDeviceProcAddr function, so grab it, @@ -4592,8 +4043,7 @@ VkResult loader_create_instance_chain(const VkInstanceCreateInfo *pCreateInfo, // structure. if (interface_struct.loaderLayerInterfaceVersion > 1) { cur_gipa = interface_struct.pfnGetInstanceProcAddr; - cur_gpdpa = - interface_struct.pfnGetPhysicalDeviceProcAddr; + cur_gpdpa = interface_struct.pfnGetPhysicalDeviceProcAddr; if (cur_gipa != NULL) { // We've set the functions, so make sure we // don't do the unnecessary calls later. @@ -4604,26 +4054,20 @@ VkResult loader_create_instance_chain(const VkInstanceCreateInfo *pCreateInfo, } if (!functions_in_interface) { - if ((cur_gipa = - layer_prop->functions.get_instance_proc_addr) == - NULL) { + if ((cur_gipa = layer_prop->functions.get_instance_proc_addr) == NULL) { if (strlen(layer_prop->functions.str_gipa) == 0) { - cur_gipa = (PFN_vkGetInstanceProcAddr) - loader_platform_get_proc_address( - lib_handle, "vkGetInstanceProcAddr"); - layer_prop->functions.get_instance_proc_addr = - cur_gipa; + cur_gipa = + (PFN_vkGetInstanceProcAddr)loader_platform_get_proc_address(lib_handle, "vkGetInstanceProcAddr"); + layer_prop->functions.get_instance_proc_addr = cur_gipa; } else { - cur_gipa = (PFN_vkGetInstanceProcAddr) - loader_platform_get_proc_address( - lib_handle, layer_prop->functions.str_gipa); + cur_gipa = (PFN_vkGetInstanceProcAddr)loader_platform_get_proc_address(lib_handle, + layer_prop->functions.str_gipa); } if (NULL == cur_gipa) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_create_instance_chain: Failed to" - " find \'vkGetInstanceProcAddr\' in " - "layer %s", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_create_instance_chain: Failed to" + " find \'vkGetInstanceProcAddr\' in " + "layer %s", layer_prop->lib_name); continue; } @@ -4631,31 +4075,25 @@ VkResult loader_create_instance_chain(const VkInstanceCreateInfo *pCreateInfo, } } - layer_instance_link_info[activated_layers].pNext = - chain_info.u.pLayerInfo; - layer_instance_link_info[activated_layers] - .pfnNextGetInstanceProcAddr = next_gipa; - layer_instance_link_info[activated_layers] - .pfnNextGetPhysicalDeviceProcAddr = next_gpdpa; + layer_instance_link_info[activated_layers].pNext = chain_info.u.pLayerInfo; + layer_instance_link_info[activated_layers].pfnNextGetInstanceProcAddr = next_gipa; + layer_instance_link_info[activated_layers].pfnNextGetPhysicalDeviceProcAddr = next_gpdpa; next_gipa = cur_gipa; if (layer_prop->interface_version > 1 && cur_gpdpa != NULL) { layer_prop->functions.get_physical_device_proc_addr = cur_gpdpa; next_gpdpa = cur_gpdpa; } - chain_info.u.pLayerInfo = - &layer_instance_link_info[activated_layers]; + chain_info.u.pLayerInfo = &layer_instance_link_info[activated_layers]; - loader_log(inst, VK_DEBUG_REPORT_INFORMATION_BIT_EXT, 0, - "Insert instance layer %s (%s)", - layer_prop->info.layerName, layer_prop->lib_name); + loader_log(inst, VK_DEBUG_REPORT_INFORMATION_BIT_EXT, 0, "Insert instance layer %s (%s)", layer_prop->info.layerName, + layer_prop->lib_name); activated_layers++; } } - PFN_vkCreateInstance fpCreateInstance = - (PFN_vkCreateInstance)next_gipa(*created_instance, "vkCreateInstance"); + PFN_vkCreateInstance fpCreateInstance = (PFN_vkCreateInstance)next_gipa(*created_instance, "vkCreateInstance"); if (fpCreateInstance) { VkLayerInstanceCreateInfo create_info_disp; @@ -4666,39 +4104,31 @@ VkResult loader_create_instance_chain(const VkInstanceCreateInfo *pCreateInfo, create_info_disp.pNext = loader_create_info.pNext; loader_create_info.pNext = &create_info_disp; - res = - fpCreateInstance(&loader_create_info, pAllocator, created_instance); + res = fpCreateInstance(&loader_create_info, pAllocator, created_instance); } else { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_create_instance_chain: Failed to find " - "\'vkCreateInstance\'"); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_create_instance_chain: Failed to find " + "\'vkCreateInstance\'"); // Couldn't find CreateInstance function! res = VK_ERROR_INITIALIZATION_FAILED; } if (res == VK_SUCCESS) { - loader_init_instance_core_dispatch_table(&inst->disp->layer_inst_disp, - next_gipa, *created_instance); + loader_init_instance_core_dispatch_table(&inst->disp->layer_inst_disp, next_gipa, *created_instance); inst->instance = *created_instance; } return res; } -void loader_activate_instance_layer_extensions(struct loader_instance *inst, - VkInstance created_inst) { +void loader_activate_instance_layer_extensions(struct loader_instance *inst, VkInstance created_inst) { - loader_init_instance_extension_dispatch_table( - &inst->disp->layer_inst_disp, - inst->disp->layer_inst_disp.GetInstanceProcAddr, created_inst); + loader_init_instance_extension_dispatch_table(&inst->disp->layer_inst_disp, inst->disp->layer_inst_disp.GetInstanceProcAddr, + created_inst); } -VkResult -loader_create_device_chain(const struct loader_physical_device_tramp *pd, - const VkDeviceCreateInfo *pCreateInfo, - const VkAllocationCallbacks *pAllocator, - const struct loader_instance *inst, - struct loader_device *dev) { +VkResult loader_create_device_chain(const struct loader_physical_device_tramp *pd, const VkDeviceCreateInfo *pCreateInfo, + const VkAllocationCallbacks *pAllocator, const struct loader_instance *inst, + struct loader_device *dev) { uint32_t activated_layers = 0; VkLayerDeviceLink *layer_device_link_info; VkLayerDeviceCreateInfo chain_info; @@ -4710,12 +4140,10 @@ loader_create_device_chain(const struct loader_physical_device_tramp *pd, memcpy(&loader_create_info, pCreateInfo, sizeof(VkDeviceCreateInfo)); - layer_device_link_info = loader_stack_alloc( - sizeof(VkLayerDeviceLink) * dev->activated_layer_list.count); + layer_device_link_info = loader_stack_alloc(sizeof(VkLayerDeviceLink) * dev->activated_layer_list.count); if (!layer_device_link_info) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_create_device_chain: Failed to alloc Device objects" - " for layer. Skipping Layer."); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_create_device_chain: Failed to alloc Device objects" + " for layer. Skipping Layer."); return VK_ERROR_OUT_OF_HOST_MEMORY; } @@ -4728,8 +4156,7 @@ loader_create_device_chain(const struct loader_physical_device_tramp *pd, // Create instance chain of enabled layers for (int32_t i = dev->activated_layer_list.count - 1; i >= 0; i--) { - struct loader_layer_properties *layer_prop = - &dev->activated_layer_list.list[i]; + struct loader_layer_properties *layer_prop = &dev->activated_layer_list.list[i]; loader_platform_dl_handle lib_handle; bool functions_in_interface = false; @@ -4743,36 +4170,25 @@ loader_create_device_chain(const struct loader_physical_device_tramp *pd, // that first, and see if we can get all the function pointers // necessary from that one call. if (NULL == layer_prop->functions.negotiate_layer_interface) { - PFN_vkNegotiateLoaderLayerInterfaceVersion negotiate_interface = - NULL; - if (strlen(layer_prop->functions.str_negotiate_interface) == - 0) { - negotiate_interface = - (PFN_vkNegotiateLoaderLayerInterfaceVersion) - loader_platform_get_proc_address( - lib_handle, - "vkNegotiateLoaderLayerInterfaceVersion"); + PFN_vkNegotiateLoaderLayerInterfaceVersion negotiate_interface = NULL; + if (strlen(layer_prop->functions.str_negotiate_interface) == 0) { + negotiate_interface = (PFN_vkNegotiateLoaderLayerInterfaceVersion)loader_platform_get_proc_address( + lib_handle, "vkNegotiateLoaderLayerInterfaceVersion"); } else { - negotiate_interface = - (PFN_vkNegotiateLoaderLayerInterfaceVersion) - loader_platform_get_proc_address( - lib_handle, - layer_prop->functions.str_negotiate_interface); + negotiate_interface = (PFN_vkNegotiateLoaderLayerInterfaceVersion)loader_platform_get_proc_address( + lib_handle, layer_prop->functions.str_negotiate_interface); } if (NULL != negotiate_interface) { - layer_prop->functions.negotiate_layer_interface = - negotiate_interface; + layer_prop->functions.negotiate_layer_interface = negotiate_interface; VkNegotiateLayerInterface interface_struct; - if (loader_get_layer_interface_version(negotiate_interface, - &interface_struct)) { + if (loader_get_layer_interface_version(negotiate_interface, &interface_struct)) { // Go ahead and set the properites version to the // correct value. - layer_prop->interface_version = - interface_struct.loaderLayerInterfaceVersion; + layer_prop->interface_version = interface_struct.loaderLayerInterfaceVersion; // If the interface is 2 or newer, we have access to the // new GetPhysicalDeviceProcAddr function, so grab it, @@ -4791,66 +4207,51 @@ loader_create_device_chain(const struct loader_physical_device_tramp *pd, } if (!functions_in_interface) { - if ((fpGIPA = layer_prop->functions.get_instance_proc_addr) == - NULL) { + if ((fpGIPA = layer_prop->functions.get_instance_proc_addr) == NULL) { if (strlen(layer_prop->functions.str_gipa) == 0) { - fpGIPA = (PFN_vkGetInstanceProcAddr) - loader_platform_get_proc_address( - lib_handle, "vkGetInstanceProcAddr"); + fpGIPA = (PFN_vkGetInstanceProcAddr)loader_platform_get_proc_address(lib_handle, "vkGetInstanceProcAddr"); layer_prop->functions.get_instance_proc_addr = fpGIPA; } else - fpGIPA = (PFN_vkGetInstanceProcAddr) - loader_platform_get_proc_address( - lib_handle, layer_prop->functions.str_gipa); + fpGIPA = + (PFN_vkGetInstanceProcAddr)loader_platform_get_proc_address(lib_handle, layer_prop->functions.str_gipa); if (!fpGIPA) { - loader_log( - inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_create_device_chain: Failed to find " - "\'vkGetInstanceProcAddr\' in layer %s. Skipping" - " layer.", - layer_prop->lib_name); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_create_device_chain: Failed to find " + "\'vkGetInstanceProcAddr\' in layer %s. Skipping" + " layer.", + layer_prop->lib_name); continue; } } if ((fpGDPA = layer_prop->functions.get_device_proc_addr) == NULL) { if (strlen(layer_prop->functions.str_gdpa) == 0) { - fpGDPA = (PFN_vkGetDeviceProcAddr) - loader_platform_get_proc_address(lib_handle, - "vkGetDeviceProcAddr"); + fpGDPA = (PFN_vkGetDeviceProcAddr)loader_platform_get_proc_address(lib_handle, "vkGetDeviceProcAddr"); layer_prop->functions.get_device_proc_addr = fpGDPA; } else - fpGDPA = (PFN_vkGetDeviceProcAddr) - loader_platform_get_proc_address( - lib_handle, layer_prop->functions.str_gdpa); + fpGDPA = + (PFN_vkGetDeviceProcAddr)loader_platform_get_proc_address(lib_handle, layer_prop->functions.str_gdpa); if (!fpGDPA) { - loader_log(inst, VK_DEBUG_REPORT_INFORMATION_BIT_EXT, 0, - "Failed to find vkGetDeviceProcAddr in layer %s", - layer_prop->lib_name); + loader_log(inst, VK_DEBUG_REPORT_INFORMATION_BIT_EXT, 0, "Failed to find vkGetDeviceProcAddr in layer %s", + layer_prop->lib_name); continue; } } } - layer_device_link_info[activated_layers].pNext = - chain_info.u.pLayerInfo; - layer_device_link_info[activated_layers] - .pfnNextGetInstanceProcAddr = nextGIPA; - layer_device_link_info[activated_layers].pfnNextGetDeviceProcAddr = - nextGDPA; + layer_device_link_info[activated_layers].pNext = chain_info.u.pLayerInfo; + layer_device_link_info[activated_layers].pfnNextGetInstanceProcAddr = nextGIPA; + layer_device_link_info[activated_layers].pfnNextGetDeviceProcAddr = nextGDPA; chain_info.u.pLayerInfo = &layer_device_link_info[activated_layers]; nextGIPA = fpGIPA; nextGDPA = fpGDPA; - loader_log(inst, VK_DEBUG_REPORT_INFORMATION_BIT_EXT, 0, - "Insert device layer %s (%s)", - layer_prop->info.layerName, layer_prop->lib_name); + loader_log(inst, VK_DEBUG_REPORT_INFORMATION_BIT_EXT, 0, "Insert device layer %s (%s)", layer_prop->info.layerName, + layer_prop->lib_name); activated_layers++; } } VkDevice created_device = (VkDevice)dev; - PFN_vkCreateDevice fpCreateDevice = - (PFN_vkCreateDevice)nextGIPA(inst->instance, "vkCreateDevice"); + PFN_vkCreateDevice fpCreateDevice = (PFN_vkCreateDevice)nextGIPA(inst->instance, "vkCreateDevice"); if (fpCreateDevice) { VkLayerDeviceCreateInfo create_info_disp; @@ -4861,49 +4262,40 @@ loader_create_device_chain(const struct loader_physical_device_tramp *pd, create_info_disp.pNext = loader_create_info.pNext; loader_create_info.pNext = &create_info_disp; - res = fpCreateDevice(pd->phys_dev, &loader_create_info, pAllocator, - &created_device); + res = fpCreateDevice(pd->phys_dev, &loader_create_info, pAllocator, &created_device); if (res != VK_SUCCESS) { return res; } dev->chain_device = created_device; } else { - loader_log( - inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_create_device_chain: Failed to find \'vkCreateDevice\' " - "in layer %s"); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_create_device_chain: Failed to find \'vkCreateDevice\' " + "in layer %s"); // Couldn't find CreateDevice function! return VK_ERROR_INITIALIZATION_FAILED; } // Initialize device dispatch table - loader_init_device_dispatch_table(&dev->loader_dispatch, nextGDPA, - dev->chain_device); + loader_init_device_dispatch_table(&dev->loader_dispatch, nextGDPA, dev->chain_device); return res; } -VkResult loader_validate_layers(const struct loader_instance *inst, - const uint32_t layer_count, - const char *const *ppEnabledLayerNames, - const struct loader_layer_list *list) { +VkResult loader_validate_layers(const struct loader_instance *inst, const uint32_t layer_count, + const char *const *ppEnabledLayerNames, const struct loader_layer_list *list) { struct loader_layer_properties *prop; for (uint32_t i = 0; i < layer_count; i++) { - VkStringErrorFlags result = - vk_string_validate(MaxLoaderStringLength, ppEnabledLayerNames[i]); + VkStringErrorFlags result = vk_string_validate(MaxLoaderStringLength, ppEnabledLayerNames[i]); if (result != VK_STRING_ERROR_NONE) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_validate_layers: Device ppEnabledLayerNames " - "contains string that is too long or is badly formed"); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_validate_layers: Device ppEnabledLayerNames " + "contains string that is too long or is badly formed"); return VK_ERROR_LAYER_NOT_PRESENT; } prop = loader_get_layer_property(ppEnabledLayerNames[i], list); if (!prop) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_validate_layers: Layer %d does not exist in " - "the list of available layers", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_validate_layers: Layer %d does not exist in " + "the list of available layers", i); return VK_ERROR_LAYER_NOT_PRESENT; } @@ -4911,31 +4303,26 @@ VkResult loader_validate_layers(const struct loader_instance *inst, return VK_SUCCESS; } -VkResult loader_validate_instance_extensions( - const struct loader_instance *inst, - const struct loader_extension_list *icd_exts, - const struct loader_layer_list *instance_layers, - const VkInstanceCreateInfo *pCreateInfo) { +VkResult loader_validate_instance_extensions(const struct loader_instance *inst, const struct loader_extension_list *icd_exts, + const struct loader_layer_list *instance_layers, + const VkInstanceCreateInfo *pCreateInfo) { VkExtensionProperties *extension_prop; struct loader_layer_properties *layer_prop; for (uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; i++) { - VkStringErrorFlags result = vk_string_validate( - MaxLoaderStringLength, pCreateInfo->ppEnabledExtensionNames[i]); + VkStringErrorFlags result = vk_string_validate(MaxLoaderStringLength, pCreateInfo->ppEnabledExtensionNames[i]); if (result != VK_STRING_ERROR_NONE) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_validate_instance_extensions: Instance " - "ppEnabledExtensionNames contains " - "string that is too long or is badly formed"); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_validate_instance_extensions: Instance " + "ppEnabledExtensionNames contains " + "string that is too long or is badly formed"); return VK_ERROR_EXTENSION_NOT_PRESENT; } // See if the extension is in the list of supported extensions bool found = false; for (uint32_t j = 0; LOADER_INSTANCE_EXTENSIONS[j] != NULL; j++) { - if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], - LOADER_INSTANCE_EXTENSIONS[j]) == 0) { + if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], LOADER_INSTANCE_EXTENSIONS[j]) == 0) { found = true; break; } @@ -4943,15 +4330,13 @@ VkResult loader_validate_instance_extensions( // If it isn't in the list, return an error if (!found) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_validate_instance_extensions: Extension %d " - "not found in list of available extensions.", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_validate_instance_extensions: Extension %d " + "not found in list of available extensions.", i); return VK_ERROR_EXTENSION_NOT_PRESENT; } - extension_prop = get_extension_property( - pCreateInfo->ppEnabledExtensionNames[i], icd_exts); + extension_prop = get_extension_property(pCreateInfo->ppEnabledExtensionNames[i], icd_exts); if (extension_prop) { continue; @@ -4961,8 +4346,7 @@ VkResult loader_validate_instance_extensions( /* Not in global list, search layer extension lists */ for (uint32_t j = 0; j < pCreateInfo->enabledLayerCount; j++) { - layer_prop = loader_get_layer_property( - pCreateInfo->ppEnabledLayerNames[j], instance_layers); + layer_prop = loader_get_layer_property(pCreateInfo->ppEnabledLayerNames[j], instance_layers); if (!layer_prop) { /* Should NOT get here, loader_validate_layers * should have already filtered this case out. @@ -4970,9 +4354,7 @@ VkResult loader_validate_instance_extensions( continue; } - extension_prop = - get_extension_property(pCreateInfo->ppEnabledExtensionNames[i], - &layer_prop->instance_extension_list); + extension_prop = get_extension_property(pCreateInfo->ppEnabledExtensionNames[i], &layer_prop->instance_extension_list); if (extension_prop) { /* Found the extension in one of the layers enabled by the app. */ @@ -4982,9 +4364,8 @@ VkResult loader_validate_instance_extensions( if (!extension_prop) { // Didn't find extension name in any of the global layers, error out - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "loader_validate_instance_extensions: Extension %d " - "not found in enabled layer list extensions.", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_validate_instance_extensions: Extension %d " + "not found in enabled layer list extensions.", i); return VK_ERROR_EXTENSION_NOT_PRESENT; } @@ -4992,23 +4373,19 @@ VkResult loader_validate_instance_extensions( return VK_SUCCESS; } -VkResult loader_validate_device_extensions( - struct loader_physical_device_tramp *phys_dev, - const struct loader_layer_list *activated_device_layers, - const struct loader_extension_list *icd_exts, - const VkDeviceCreateInfo *pCreateInfo) { +VkResult loader_validate_device_extensions(struct loader_physical_device_tramp *phys_dev, + const struct loader_layer_list *activated_device_layers, + const struct loader_extension_list *icd_exts, const VkDeviceCreateInfo *pCreateInfo) { VkExtensionProperties *extension_prop; struct loader_layer_properties *layer_prop; for (uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; i++) { - VkStringErrorFlags result = vk_string_validate( - MaxLoaderStringLength, pCreateInfo->ppEnabledExtensionNames[i]); + VkStringErrorFlags result = vk_string_validate(MaxLoaderStringLength, pCreateInfo->ppEnabledExtensionNames[i]); if (result != VK_STRING_ERROR_NONE) { - loader_log(phys_dev->this_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, - 0, "loader_validate_device_extensions: Device " - "ppEnabledExtensionNames contains " - "string that is too long or is badly formed"); + loader_log(phys_dev->this_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_validate_device_extensions: Device " + "ppEnabledExtensionNames contains " + "string that is too long or is badly formed"); return VK_ERROR_EXTENSION_NOT_PRESENT; } @@ -5023,8 +4400,7 @@ VkResult loader_validate_device_extensions( for (uint32_t j = 0; j < activated_device_layers->count; j++) { layer_prop = &activated_device_layers->list[j]; - extension_prop = get_dev_extension_property( - extension_name, &layer_prop->device_extension_list); + extension_prop = get_dev_extension_property(extension_name, &layer_prop->device_extension_list); if (extension_prop) { // Found the extension in one of the layers enabled by the app. break; @@ -5033,9 +4409,8 @@ VkResult loader_validate_device_extensions( if (!extension_prop) { // Didn't find extension name in any of the device layers, error out - loader_log(phys_dev->this_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, - 0, "loader_validate_device_extensions: Extension %d " - "not found in enabled layer list extensions.", + loader_log(phys_dev->this_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "loader_validate_device_extensions: Extension %d " + "not found in enabled layer list extensions.", i); return VK_ERROR_EXTENSION_NOT_PRESENT; } @@ -5045,9 +4420,8 @@ VkResult loader_validate_device_extensions( // Terminator functions for the Instance chain // All named terminator_<Vulakn API name> -VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateInstance( - const VkInstanceCreateInfo *pCreateInfo, - const VkAllocationCallbacks *pAllocator, VkInstance *pInstance) { +VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateInstance(const VkInstanceCreateInfo *pCreateInfo, + const VkAllocationCallbacks *pAllocator, VkInstance *pInstance) { struct loader_icd_term *icd_term; VkExtensionProperties *prop; char **filtered_extension_names = NULL; @@ -5065,27 +4439,21 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateInstance( // No ICD will advertise support for layers. An ICD library could // support a layer, but it would be independent of the actual ICD, // just in the same library. - filtered_extension_names = - loader_stack_alloc(pCreateInfo->enabledExtensionCount * sizeof(char *)); + filtered_extension_names = loader_stack_alloc(pCreateInfo->enabledExtensionCount * sizeof(char *)); if (!filtered_extension_names) { - loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "terminator_CreateInstance: Failed create extension name " - "array for %d extensions", + loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "terminator_CreateInstance: Failed create extension name " + "array for %d extensions", pCreateInfo->enabledExtensionCount); res = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; } - icd_create_info.ppEnabledExtensionNames = - (const char *const *)filtered_extension_names; + icd_create_info.ppEnabledExtensionNames = (const char *const *)filtered_extension_names; for (uint32_t i = 0; i < ptr_instance->icd_tramp_list.count; i++) { - icd_term = loader_icd_add( - ptr_instance, &ptr_instance->icd_tramp_list.scanned_list[i]); + icd_term = loader_icd_add(ptr_instance, &ptr_instance->icd_tramp_list.scanned_list[i]); if (NULL == icd_term) { - loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, - 0, - "terminator_CreateInstance: Failed to add ICD %d to ICD " - "trampoline list.", + loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "terminator_CreateInstance: Failed to add ICD %d to ICD " + "trampoline list.", i); res = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; @@ -5094,13 +4462,10 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateInstance( icd_create_info.enabledExtensionCount = 0; struct loader_extension_list icd_exts; - loader_log(ptr_instance, VK_DEBUG_REPORT_DEBUG_BIT_EXT, 0, - "Build ICD instance extension list"); + loader_log(ptr_instance, VK_DEBUG_REPORT_DEBUG_BIT_EXT, 0, "Build ICD instance extension list"); // traverse scanned icd list adding non-duplicate extensions to the // list - res = loader_init_generic_list(ptr_instance, - (struct loader_generic_list *)&icd_exts, - sizeof(VkExtensionProperties)); + res = loader_init_generic_list(ptr_instance, (struct loader_generic_list *)&icd_exts, sizeof(VkExtensionProperties)); if (VK_ERROR_OUT_OF_HOST_MEMORY == res) { // If out of memory, bail immediately. goto out; @@ -5113,13 +4478,10 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateInstance( continue; } - res = loader_add_instance_extensions( - ptr_instance, - icd_term->scanned_icd->EnumerateInstanceExtensionProperties, - icd_term->scanned_icd->lib_name, &icd_exts); + res = loader_add_instance_extensions(ptr_instance, icd_term->scanned_icd->EnumerateInstanceExtensionProperties, + icd_term->scanned_icd->lib_name, &icd_exts); if (VK_SUCCESS != res) { - loader_destroy_generic_list( - ptr_instance, (struct loader_generic_list *)&icd_exts); + loader_destroy_generic_list(ptr_instance, (struct loader_generic_list *)&icd_exts); if (VK_ERROR_OUT_OF_HOST_MEMORY == res) { // If out of memory, bail immediately. goto out; @@ -5134,30 +4496,24 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateInstance( } for (uint32_t j = 0; j < pCreateInfo->enabledExtensionCount; j++) { - prop = get_extension_property( - pCreateInfo->ppEnabledExtensionNames[j], &icd_exts); + prop = get_extension_property(pCreateInfo->ppEnabledExtensionNames[j], &icd_exts); if (prop) { - filtered_extension_names[icd_create_info - .enabledExtensionCount] = - (char *)pCreateInfo->ppEnabledExtensionNames[j]; + filtered_extension_names[icd_create_info.enabledExtensionCount] = (char *)pCreateInfo->ppEnabledExtensionNames[j]; icd_create_info.enabledExtensionCount++; } } - loader_destroy_generic_list(ptr_instance, - (struct loader_generic_list *)&icd_exts); + loader_destroy_generic_list(ptr_instance, (struct loader_generic_list *)&icd_exts); VkResult icd_result = - ptr_instance->icd_tramp_list.scanned_list[i].CreateInstance( - &icd_create_info, pAllocator, &(icd_term->instance)); + ptr_instance->icd_tramp_list.scanned_list[i].CreateInstance(&icd_create_info, pAllocator, &(icd_term->instance)); if (VK_ERROR_OUT_OF_HOST_MEMORY == icd_result) { // If out of memory, bail immediately. res = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; } else if (VK_SUCCESS != icd_result) { - loader_log(ptr_instance, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, - "terminator_CreateInstance: Failed to CreateInstance in " - "ICD %d. Skipping ICD.", + loader_log(ptr_instance, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, "terminator_CreateInstance: Failed to CreateInstance in " + "ICD %d. Skipping ICD.", i); ptr_instance->icd_terms = icd_term->next; icd_term->next = NULL; @@ -5166,12 +4522,10 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateInstance( } if (!loader_icd_init_entrys(icd_term, icd_term->instance, - ptr_instance->icd_tramp_list.scanned_list[i] - .GetInstanceProcAddr)) { - loader_log( - ptr_instance, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, - "terminator_CreateInstance: Failed to CreateInstance and find " - "entrypoints with ICD. Skipping ICD."); + ptr_instance->icd_tramp_list.scanned_list[i].GetInstanceProcAddr)) { + loader_log(ptr_instance, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, + "terminator_CreateInstance: Failed to CreateInstance and find " + "entrypoints with ICD. Skipping ICD."); continue; } @@ -5182,8 +4536,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateInstance( // If no ICDs were added to instance list and res is unchanged // from it's initial value, the loader was unable to find // a suitable ICD. - if (VK_SUCCESS == res && - (ptr_instance->icd_terms == NULL || !one_icd_successful)) { + if (VK_SUCCESS == res && (ptr_instance->icd_terms == NULL || !one_icd_successful)) { res = VK_ERROR_INCOMPATIBLE_DRIVER; } @@ -5203,8 +4556,7 @@ out: return res; } -VKAPI_ATTR void VKAPI_CALL terminator_DestroyInstance( - VkInstance instance, const VkAllocationCallbacks *pAllocator) { +VKAPI_ATTR void VKAPI_CALL terminator_DestroyInstance(VkInstance instance, const VkAllocationCallbacks *pAllocator) { struct loader_instance *ptr_instance = loader_instance(instance); if (NULL == ptr_instance) { return; @@ -5239,15 +4591,12 @@ VKAPI_ATTR void VKAPI_CALL terminator_DestroyInstance( icd_terms = next_icd_term; } - loader_delete_layer_properties(ptr_instance, - &ptr_instance->instance_layer_list); + loader_delete_layer_properties(ptr_instance, &ptr_instance->instance_layer_list); loader_scanned_icd_clear(ptr_instance, &ptr_instance->icd_tramp_list); - loader_destroy_generic_list( - ptr_instance, (struct loader_generic_list *)&ptr_instance->ext_list); + loader_destroy_generic_list(ptr_instance, (struct loader_generic_list *)&ptr_instance->ext_list); if (NULL != ptr_instance->phys_devs_term) { for (uint32_t i = 0; i < ptr_instance->phys_dev_count_term; i++) { - loader_instance_heap_free(ptr_instance, - ptr_instance->phys_devs_term[i]); + loader_instance_heap_free(ptr_instance, ptr_instance->phys_devs_term[i]); } loader_instance_heap_free(ptr_instance, ptr_instance->phys_devs_term); } @@ -5255,9 +4604,8 @@ VKAPI_ATTR void VKAPI_CALL terminator_DestroyInstance( loader_free_phys_dev_ext_table(ptr_instance); } -VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDevice( - VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo, - const VkAllocationCallbacks *pAllocator, VkDevice *pDevice) { +VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo, + const VkAllocationCallbacks *pAllocator, VkDevice *pDevice) { VkResult res = VK_SUCCESS; struct loader_physical_device_term *phys_dev_term; phys_dev_term = (struct loader_physical_device_term *)physicalDevice; @@ -5288,8 +4636,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDevice( // support a layer, but it would be independent of the actual ICD, // just in the same library. char **filtered_extension_names = NULL; - filtered_extension_names = - loader_stack_alloc(pCreateInfo->enabledExtensionCount * sizeof(char *)); + filtered_extension_names = loader_stack_alloc(pCreateInfo->enabledExtensionCount * sizeof(char *)); if (NULL == filtered_extension_names) { loader_log(icd_term->this_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "terminator_CreateDevice: Failed to create extension name " @@ -5302,42 +4649,34 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDevice( localCreateInfo.ppEnabledLayerNames = NULL; localCreateInfo.enabledExtensionCount = 0; - localCreateInfo.ppEnabledExtensionNames = - (const char *const *)filtered_extension_names; + localCreateInfo.ppEnabledExtensionNames = (const char *const *)filtered_extension_names; // Get the physical device (ICD) extensions - res = loader_init_generic_list(icd_term->this_instance, - (struct loader_generic_list *)&icd_exts, - sizeof(VkExtensionProperties)); + res = loader_init_generic_list(icd_term->this_instance, (struct loader_generic_list *)&icd_exts, sizeof(VkExtensionProperties)); if (VK_SUCCESS != res) { goto out; } - res = loader_add_device_extensions( - icd_term->this_instance, icd_term->EnumerateDeviceExtensionProperties, - phys_dev_term->phys_dev, icd_term->scanned_icd->lib_name, &icd_exts); + res = loader_add_device_extensions(icd_term->this_instance, icd_term->EnumerateDeviceExtensionProperties, + phys_dev_term->phys_dev, icd_term->scanned_icd->lib_name, &icd_exts); if (res != VK_SUCCESS) { goto out; } for (uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; i++) { const char *extension_name = pCreateInfo->ppEnabledExtensionNames[i]; - VkExtensionProperties *prop = - get_extension_property(extension_name, &icd_exts); + VkExtensionProperties *prop = get_extension_property(extension_name, &icd_exts); if (prop) { - filtered_extension_names[localCreateInfo.enabledExtensionCount] = - (char *)extension_name; + filtered_extension_names[localCreateInfo.enabledExtensionCount] = (char *)extension_name; localCreateInfo.enabledExtensionCount++; } else { - loader_log(icd_term->this_instance, VK_DEBUG_REPORT_WARNING_BIT_EXT, - 0, "vkCreateDevice extension %s not available for " - "devices associated with ICD %s", + loader_log(icd_term->this_instance, VK_DEBUG_REPORT_WARNING_BIT_EXT, 0, "vkCreateDevice extension %s not available for " + "devices associated with ICD %s", extension_name, icd_term->scanned_icd->lib_name); } } - res = fpCreateDevice(phys_dev_term->phys_dev, &localCreateInfo, pAllocator, - &dev->icd_device); + res = fpCreateDevice(phys_dev_term->phys_dev, &localCreateInfo, pAllocator, &dev->icd_device); if (res != VK_SUCCESS) { loader_log(icd_term->this_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "terminator_CreateDevice: Failed in ICD %s vkCreateDevice" @@ -5354,8 +4693,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDevice( out: if (NULL != icd_exts.list) { - loader_destroy_generic_list(icd_term->this_instance, - (struct loader_generic_list *)&icd_exts); + loader_destroy_generic_list(icd_term->this_instance, (struct loader_generic_list *)&icd_exts); } return res; @@ -5377,44 +4715,34 @@ VkResult setupLoaderTrampPhysDevs(VkInstance instance) { // Create an array for the new physical devices, which will be stored // in the instance for the trampoline code. - new_phys_devs = - (struct loader_physical_device_tramp **)loader_instance_heap_alloc( - inst, - total_count * sizeof(struct loader_physical_device_tramp *), - VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); + new_phys_devs = (struct loader_physical_device_tramp **)loader_instance_heap_alloc( + inst, total_count * sizeof(struct loader_physical_device_tramp *), VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (NULL == new_phys_devs) { - loader_log( - inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "setupLoaderTrampPhysDevs: Failed to allocate new physical device" - " array of size %d", - total_count); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "setupLoaderTrampPhysDevs: Failed to allocate new physical device" + " array of size %d", + total_count); res = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; } - memset(new_phys_devs, 0, - total_count * sizeof(struct loader_physical_device_tramp *)); + memset(new_phys_devs, 0, total_count * sizeof(struct loader_physical_device_tramp *)); // Create a temporary array (on the stack) to keep track of the // returned VkPhysicalDevice values. - local_phys_devs = - loader_stack_alloc(sizeof(VkPhysicalDevice) * total_count); + local_phys_devs = loader_stack_alloc(sizeof(VkPhysicalDevice) * total_count); if (NULL == local_phys_devs) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "setupLoaderTrampPhysDevs: Failed to allocate local " - "physical device array of size %d", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "setupLoaderTrampPhysDevs: Failed to allocate local " + "physical device array of size %d", total_count); res = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; } memset(local_phys_devs, 0, sizeof(VkPhysicalDevice) * total_count); - res = inst->disp->layer_inst_disp.EnumeratePhysicalDevices( - instance, &total_count, local_phys_devs); + res = inst->disp->layer_inst_disp.EnumeratePhysicalDevices(instance, &total_count, local_phys_devs); if (VK_SUCCESS != res) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "setupLoaderTrampPhysDevs: Failed during dispatch call " - "of \'vkEnumeratePhysicalDevices\' to lower layers or " - "loader."); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "setupLoaderTrampPhysDevs: Failed during dispatch call " + "of \'vkEnumeratePhysicalDevices\' to lower layers or " + "loader."); goto out; } @@ -5422,11 +4750,8 @@ VkResult setupLoaderTrampPhysDevs(VkInstance instance) { for (uint32_t new_idx = 0; new_idx < total_count; new_idx++) { // Check if this physical device is already in the old buffer - for (uint32_t old_idx = 0; - old_idx < inst->phys_dev_count_tramp; - old_idx++) { - if (local_phys_devs[new_idx] == - inst->phys_devs_tramp[old_idx]->phys_dev) { + for (uint32_t old_idx = 0; old_idx < inst->phys_dev_count_tramp; old_idx++) { + if (local_phys_devs[new_idx] == inst->phys_devs_tramp[old_idx]->phys_dev) { new_phys_devs[new_idx] = inst->phys_devs_tramp[old_idx]; break; } @@ -5434,14 +4759,11 @@ VkResult setupLoaderTrampPhysDevs(VkInstance instance) { // If this physical device isn't in the old buffer, create it if (NULL == new_phys_devs[new_idx]) { - new_phys_devs[new_idx] = (struct loader_physical_device_tramp *) - loader_instance_heap_alloc( - inst, sizeof(struct loader_physical_device_tramp), - VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); + new_phys_devs[new_idx] = (struct loader_physical_device_tramp *)loader_instance_heap_alloc( + inst, sizeof(struct loader_physical_device_tramp), VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (NULL == new_phys_devs[new_idx]) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "setupLoaderTrampPhysDevs: Failed to allocate " - "physical device trampoline object %d", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "setupLoaderTrampPhysDevs: Failed to allocate " + "physical device trampoline object %d", new_idx); total_count = new_idx; res = VK_ERROR_OUT_OF_HOST_MEMORY; @@ -5478,8 +4800,7 @@ out: } } if (!found) { - loader_instance_heap_free(inst, - inst->phys_devs_tramp[i]); + loader_instance_heap_free(inst, inst->phys_devs_tramp[i]); } } loader_instance_heap_free(inst, inst->phys_devs_tramp); @@ -5504,49 +4825,42 @@ VkResult setupLoaderTermPhysDevs(struct loader_instance *inst) { // Allocate something to store the physical device characteristics // that we read from each ICD. - icd_phys_dev_array = (struct loader_phys_dev_per_icd *)loader_stack_alloc( - sizeof(struct loader_phys_dev_per_icd) * inst->total_icd_count); + icd_phys_dev_array = + (struct loader_phys_dev_per_icd *)loader_stack_alloc(sizeof(struct loader_phys_dev_per_icd) * inst->total_icd_count); if (NULL == icd_phys_dev_array) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "setupLoaderTermPhysDevs: Failed to allocate temporary " - "ICD Physical device info array of size %d", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "setupLoaderTermPhysDevs: Failed to allocate temporary " + "ICD Physical device info array of size %d", inst->total_gpu_count); res = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; } - memset(icd_phys_dev_array, 0, - sizeof(struct loader_phys_dev_per_icd) * inst->total_icd_count); + memset(icd_phys_dev_array, 0, sizeof(struct loader_phys_dev_per_icd) * inst->total_icd_count); icd_term = inst->icd_terms; // For each ICD, query the number of physical devices, and then get an // internal value for those physical devices. while (NULL != icd_term) { - res = icd_term->EnumeratePhysicalDevices( - icd_term->instance, &icd_phys_dev_array[i].count, NULL); + res = icd_term->EnumeratePhysicalDevices(icd_term->instance, &icd_phys_dev_array[i].count, NULL); if (VK_SUCCESS != res) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "setupLoaderTermPhysDevs: Call to " - "ICD %d's \'vkEnumeratePhysicalDevices\' failed with" - " error 0x%08x", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "setupLoaderTermPhysDevs: Call to " + "ICD %d's \'vkEnumeratePhysicalDevices\' failed with" + " error 0x%08x", i, res); goto out; } icd_phys_dev_array[i].phys_devs = - (VkPhysicalDevice *)loader_stack_alloc(icd_phys_dev_array[i].count * - sizeof(VkPhysicalDevice)); + (VkPhysicalDevice *)loader_stack_alloc(icd_phys_dev_array[i].count * sizeof(VkPhysicalDevice)); if (NULL == icd_phys_dev_array[i].phys_devs) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "setupLoaderTermPhysDevs: Failed to allocate temporary " - "ICD Physical device array for ICD %d of size %d", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "setupLoaderTermPhysDevs: Failed to allocate temporary " + "ICD Physical device array for ICD %d of size %d", i, inst->total_gpu_count); res = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; } - res = icd_term->EnumeratePhysicalDevices( - icd_term->instance, &(icd_phys_dev_array[i].count), - icd_phys_dev_array[i].phys_devs); + res = + icd_term->EnumeratePhysicalDevices(icd_term->instance, &(icd_phys_dev_array[i].count), icd_phys_dev_array[i].phys_devs); if (VK_SUCCESS != res) { goto out; } @@ -5558,41 +4872,32 @@ VkResult setupLoaderTermPhysDevs(struct loader_instance *inst) { } if (0 == inst->total_gpu_count) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "setupLoaderTermPhysDevs: Failed to detect any valid" - " GPUs in the current config"); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "setupLoaderTermPhysDevs: Failed to detect any valid" + " GPUs in the current config"); res = VK_ERROR_INITIALIZATION_FAILED; goto out; } - new_phys_devs = loader_instance_heap_alloc( - inst, - sizeof(struct loader_physical_device_term *) * inst->total_gpu_count, - VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); + new_phys_devs = loader_instance_heap_alloc(inst, sizeof(struct loader_physical_device_term *) * inst->total_gpu_count, + VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (NULL == new_phys_devs) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "setupLoaderTermPhysDevs: Failed to allocate new physical" - " device array of size %d", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "setupLoaderTermPhysDevs: Failed to allocate new physical" + " device array of size %d", inst->total_gpu_count); res = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; } - memset(new_phys_devs, 0, sizeof(struct loader_physical_device_term *) * - inst->total_gpu_count); + memset(new_phys_devs, 0, sizeof(struct loader_physical_device_term *) * inst->total_gpu_count); // Copy or create everything to fill the new array of physical devices uint32_t idx = 0; for (uint32_t icd_idx = 0; icd_idx < inst->total_icd_count; icd_idx++) { - for (uint32_t pd_idx = 0; pd_idx < icd_phys_dev_array[icd_idx].count; - pd_idx++) { + for (uint32_t pd_idx = 0; pd_idx < icd_phys_dev_array[icd_idx].count; pd_idx++) { // Check if this physical device is already in the old buffer if (NULL != inst->phys_devs_term) { - for (uint32_t old_idx = 0; - old_idx < inst->phys_dev_count_term; - old_idx++) { - if (icd_phys_dev_array[icd_idx].phys_devs[pd_idx] == - inst->phys_devs_term[old_idx]->phys_dev) { + for (uint32_t old_idx = 0; old_idx < inst->phys_dev_count_term; old_idx++) { + if (icd_phys_dev_array[icd_idx].phys_devs[pd_idx] == inst->phys_devs_term[old_idx]->phys_dev) { new_phys_devs[idx] = inst->phys_devs_term[old_idx]; break; } @@ -5601,13 +4906,11 @@ VkResult setupLoaderTermPhysDevs(struct loader_instance *inst) { // If this physical device isn't in the old buffer, then we // need to create it. if (NULL == new_phys_devs[idx]) { - new_phys_devs[idx] = loader_instance_heap_alloc( - inst, sizeof(struct loader_physical_device_term), - VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); + new_phys_devs[idx] = loader_instance_heap_alloc(inst, sizeof(struct loader_physical_device_term), + VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (NULL == new_phys_devs[idx]) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "setupLoaderTermPhysDevs: Failed to allocate " - "physical device terminator object %d", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "setupLoaderTermPhysDevs: Failed to allocate " + "physical device terminator object %d", idx); inst->total_gpu_count = idx; res = VK_ERROR_OUT_OF_HOST_MEMORY; @@ -5615,11 +4918,9 @@ VkResult setupLoaderTermPhysDevs(struct loader_instance *inst) { } loader_set_dispatch((void *)new_phys_devs[idx], inst->disp); - new_phys_devs[idx]->this_icd_term = - icd_phys_dev_array[icd_idx].this_icd_term; + new_phys_devs[idx]->this_icd_term = icd_phys_dev_array[icd_idx].this_icd_term; new_phys_devs[idx]->icd_index = (uint8_t)(icd_idx); - new_phys_devs[idx]->phys_dev = - icd_phys_dev_array[icd_idx].phys_devs[pd_idx]; + new_phys_devs[idx]->phys_dev = icd_phys_dev_array[icd_idx].phys_devs[pd_idx]; } idx++; } @@ -5642,21 +4943,16 @@ out: // physical devices. Everything else will have been copied over // to the new array. if (NULL != inst->phys_devs_term) { - for (uint32_t cur_pd = 0; cur_pd < inst->phys_dev_count_term; - cur_pd++) { + for (uint32_t cur_pd = 0; cur_pd < inst->phys_dev_count_term; cur_pd++) { bool found = false; - for (uint32_t new_pd_idx = 0; - new_pd_idx < inst->total_gpu_count; - new_pd_idx++) { - if (inst->phys_devs_term[cur_pd] == - new_phys_devs[new_pd_idx]) { + for (uint32_t new_pd_idx = 0; new_pd_idx < inst->total_gpu_count; new_pd_idx++) { + if (inst->phys_devs_term[cur_pd] == new_phys_devs[new_pd_idx]) { found = true; break; } } if (!found) { - loader_instance_heap_free(inst, - inst->phys_devs_term[cur_pd]); + loader_instance_heap_free(inst, inst->phys_devs_term[cur_pd]); } } loader_instance_heap_free(inst, inst->phys_devs_term); @@ -5670,9 +4966,8 @@ out: return res; } -VKAPI_ATTR VkResult VKAPI_CALL terminator_EnumeratePhysicalDevices( - VkInstance instance, uint32_t *pPhysicalDeviceCount, - VkPhysicalDevice *pPhysicalDevices) { +VKAPI_ATTR VkResult VKAPI_CALL terminator_EnumeratePhysicalDevices(VkInstance instance, uint32_t *pPhysicalDeviceCount, + VkPhysicalDevice *pPhysicalDevices) { struct loader_instance *inst = (struct loader_instance *)instance; VkResult res = VK_SUCCESS; @@ -5704,70 +4999,57 @@ out: return res; } -VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceProperties( - VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties *pProperties) { - struct loader_physical_device_term *phys_dev_term = - (struct loader_physical_device_term *)physicalDevice; +VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice, + VkPhysicalDeviceProperties *pProperties) { + struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; if (NULL != icd_term->GetPhysicalDeviceProperties) { - icd_term->GetPhysicalDeviceProperties(phys_dev_term->phys_dev, - pProperties); + icd_term->GetPhysicalDeviceProperties(phys_dev_term->phys_dev, pProperties); } } -VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceQueueFamilyProperties( - VkPhysicalDevice physicalDevice, uint32_t *pQueueFamilyPropertyCount, - VkQueueFamilyProperties *pProperties) { - struct loader_physical_device_term *phys_dev_term = - (struct loader_physical_device_term *)physicalDevice; +VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceQueueFamilyProperties(VkPhysicalDevice physicalDevice, + uint32_t *pQueueFamilyPropertyCount, + VkQueueFamilyProperties *pProperties) { + struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; if (NULL != icd_term->GetPhysicalDeviceQueueFamilyProperties) { - icd_term->GetPhysicalDeviceQueueFamilyProperties( - phys_dev_term->phys_dev, pQueueFamilyPropertyCount, pProperties); + icd_term->GetPhysicalDeviceQueueFamilyProperties(phys_dev_term->phys_dev, pQueueFamilyPropertyCount, pProperties); } } -VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceMemoryProperties( - VkPhysicalDevice physicalDevice, - VkPhysicalDeviceMemoryProperties *pProperties) { - struct loader_physical_device_term *phys_dev_term = - (struct loader_physical_device_term *)physicalDevice; +VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceMemoryProperties(VkPhysicalDevice physicalDevice, + VkPhysicalDeviceMemoryProperties *pProperties) { + struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; if (NULL != icd_term->GetPhysicalDeviceMemoryProperties) { - icd_term->GetPhysicalDeviceMemoryProperties(phys_dev_term->phys_dev, - pProperties); + icd_term->GetPhysicalDeviceMemoryProperties(phys_dev_term->phys_dev, pProperties); } } -VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceFeatures( - VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures *pFeatures) { - struct loader_physical_device_term *phys_dev_term = - (struct loader_physical_device_term *)physicalDevice; +VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice, + VkPhysicalDeviceFeatures *pFeatures) { + struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; if (NULL != icd_term->GetPhysicalDeviceFeatures) { icd_term->GetPhysicalDeviceFeatures(phys_dev_term->phys_dev, pFeatures); } } -VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceFormatProperties( - VkPhysicalDevice physicalDevice, VkFormat format, - VkFormatProperties *pFormatInfo) { - struct loader_physical_device_term *phys_dev_term = - (struct loader_physical_device_term *)physicalDevice; +VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, + VkFormatProperties *pFormatInfo) { + struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; if (NULL != icd_term->GetPhysicalDeviceFormatProperties) { - icd_term->GetPhysicalDeviceFormatProperties(phys_dev_term->phys_dev, - format, pFormatInfo); + icd_term->GetPhysicalDeviceFormatProperties(phys_dev_term->phys_dev, format, pFormatInfo); } } -VKAPI_ATTR VkResult VKAPI_CALL -terminator_GetPhysicalDeviceImageFormatProperties( - VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, - VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, - VkImageFormatProperties *pImageFormatProperties) { - struct loader_physical_device_term *phys_dev_term = - (struct loader_physical_device_term *)physicalDevice; +VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, + VkImageType type, VkImageTiling tiling, + VkImageUsageFlags usage, VkImageCreateFlags flags, + VkImageFormatProperties *pImageFormatProperties) { + struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; if (NULL == icd_term->GetPhysicalDeviceImageFormatProperties) { loader_log(icd_term->this_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, @@ -5775,30 +5057,26 @@ terminator_GetPhysicalDeviceImageFormatProperties( "terminator. This means a layer improperly continued."); return VK_ERROR_INITIALIZATION_FAILED; } - return icd_term->GetPhysicalDeviceImageFormatProperties( - phys_dev_term->phys_dev, format, type, tiling, usage, flags, - pImageFormatProperties); + return icd_term->GetPhysicalDeviceImageFormatProperties(phys_dev_term->phys_dev, format, type, tiling, usage, flags, + pImageFormatProperties); } -VKAPI_ATTR void VKAPI_CALL -terminator_GetPhysicalDeviceSparseImageFormatProperties( - VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, - VkSampleCountFlagBits samples, VkImageUsageFlags usage, - VkImageTiling tiling, uint32_t *pNumProperties, - VkSparseImageFormatProperties *pProperties) { - struct loader_physical_device_term *phys_dev_term = - (struct loader_physical_device_term *)physicalDevice; +VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceSparseImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, + VkImageType type, VkSampleCountFlagBits samples, + VkImageUsageFlags usage, VkImageTiling tiling, + uint32_t *pNumProperties, + VkSparseImageFormatProperties *pProperties) { + struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; if (NULL != icd_term->GetPhysicalDeviceSparseImageFormatProperties) { - icd_term->GetPhysicalDeviceSparseImageFormatProperties( - phys_dev_term->phys_dev, format, type, samples, usage, tiling, - pNumProperties, pProperties); + icd_term->GetPhysicalDeviceSparseImageFormatProperties(phys_dev_term->phys_dev, format, type, samples, usage, tiling, + pNumProperties, pProperties); } } -VKAPI_ATTR VkResult VKAPI_CALL terminator_EnumerateDeviceExtensionProperties( - VkPhysicalDevice physicalDevice, const char *pLayerName, - uint32_t *pPropertyCount, VkExtensionProperties *pProperties) { +VKAPI_ATTR VkResult VKAPI_CALL terminator_EnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, + const char *pLayerName, uint32_t *pPropertyCount, + VkExtensionProperties *pProperties) { struct loader_physical_device_term *phys_dev_term; struct loader_layer_list implicit_layer_list = {0}; @@ -5818,30 +5096,25 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_EnumerateDeviceExtensionProperties( VkResult res; /* get device extensions */ - res = icd_term->EnumerateDeviceExtensionProperties( - phys_dev_term->phys_dev, NULL, &icd_ext_count, pProperties); + res = icd_term->EnumerateDeviceExtensionProperties(phys_dev_term->phys_dev, NULL, &icd_ext_count, pProperties); if (res != VK_SUCCESS) { goto out; } - if (!loader_init_layer_list(icd_term->this_instance, - &implicit_layer_list)) { + if (!loader_init_layer_list(icd_term->this_instance, &implicit_layer_list)) { res = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; } - loader_add_layer_implicit( - icd_term->this_instance, VK_LAYER_TYPE_INSTANCE_IMPLICIT, - &implicit_layer_list, &icd_term->this_instance->instance_layer_list); + loader_add_layer_implicit(icd_term->this_instance, VK_LAYER_TYPE_INSTANCE_IMPLICIT, &implicit_layer_list, + &icd_term->this_instance->instance_layer_list); /* we need to determine which implicit layers are active, * and then add their extensions. This can't be cached as * it depends on results of environment variables (which can change). */ if (pProperties != NULL) { /* initialize dev_extension list within the physicalDevice object */ - res = loader_init_device_extensions(icd_term->this_instance, - phys_dev_term, icd_ext_count, - pProperties, &icd_exts); + res = loader_init_device_extensions(icd_term->this_instance, phys_dev_term, icd_ext_count, pProperties, &icd_exts); if (res != VK_SUCCESS) { goto out; } @@ -5851,26 +5124,18 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_EnumerateDeviceExtensionProperties( * it depends on results of environment variables (which can * change). */ - res = loader_add_to_ext_list(icd_term->this_instance, &all_exts, - icd_exts.count, icd_exts.list); + res = loader_add_to_ext_list(icd_term->this_instance, &all_exts, icd_exts.count, icd_exts.list); if (res != VK_SUCCESS) { goto out; } - loader_add_layer_implicit( - icd_term->this_instance, VK_LAYER_TYPE_INSTANCE_IMPLICIT, - &implicit_layer_list, - &icd_term->this_instance->instance_layer_list); + loader_add_layer_implicit(icd_term->this_instance, VK_LAYER_TYPE_INSTANCE_IMPLICIT, &implicit_layer_list, + &icd_term->this_instance->instance_layer_list); for (uint32_t i = 0; i < implicit_layer_list.count; i++) { - for (uint32_t j = 0; - j < implicit_layer_list.list[i].device_extension_list.count; - j++) { - res = loader_add_to_ext_list(icd_term->this_instance, &all_exts, - 1, - &implicit_layer_list.list[i] - .device_extension_list.list[j] - .props); + for (uint32_t j = 0; j < implicit_layer_list.list[i].device_extension_list.count; j++) { + res = loader_add_to_ext_list(icd_term->this_instance, &all_exts, 1, + &implicit_layer_list.list[i].device_extension_list.list[j].props); if (res != VK_SUCCESS) { goto out; } @@ -5896,8 +5161,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_EnumerateDeviceExtensionProperties( *pPropertyCount = icd_ext_count; for (uint32_t i = 0; i < implicit_layer_list.count; i++) { - *pPropertyCount += - implicit_layer_list.list[i].device_extension_list.count; + *pPropertyCount += implicit_layer_list.list[i].device_extension_list.count; } res = VK_SUCCESS; } @@ -5905,31 +5169,24 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_EnumerateDeviceExtensionProperties( out: if (NULL != implicit_layer_list.list) { - loader_destroy_generic_list( - icd_term->this_instance, - (struct loader_generic_list *)&implicit_layer_list); + loader_destroy_generic_list(icd_term->this_instance, (struct loader_generic_list *)&implicit_layer_list); } if (NULL != all_exts.list) { - loader_destroy_generic_list(icd_term->this_instance, - (struct loader_generic_list *)&all_exts); + loader_destroy_generic_list(icd_term->this_instance, (struct loader_generic_list *)&all_exts); } if (NULL != icd_exts.list) { - loader_destroy_generic_list(icd_term->this_instance, - (struct loader_generic_list *)&icd_exts); + loader_destroy_generic_list(icd_term->this_instance, (struct loader_generic_list *)&icd_exts); } return res; } -VKAPI_ATTR VkResult VKAPI_CALL terminator_EnumerateDeviceLayerProperties( - VkPhysicalDevice physicalDevice, uint32_t *pPropertyCount, - VkLayerProperties *pProperties) { - struct loader_physical_device_term *phys_dev_term = - (struct loader_physical_device_term *)physicalDevice; +VKAPI_ATTR VkResult VKAPI_CALL terminator_EnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice, uint32_t *pPropertyCount, + VkLayerProperties *pProperties) { + struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; - loader_log(icd_term->this_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "Encountered the vkEnumerateDeviceLayerProperties " - "terminator. This means a layer improperly continued."); + loader_log(icd_term->this_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "Encountered the vkEnumerateDeviceLayerProperties " + "terminator. This means a layer improperly continued."); // Should never get here this call isn't dispatched down the chain return VK_ERROR_INITIALIZATION_FAILED; } diff --git a/loader/loader.h b/loader/loader.h index 019125f0..e355b553 100644 --- a/loader/loader.h +++ b/loader/loader.h @@ -58,7 +58,6 @@ #define MAX_NUM_UNKNOWN_EXTS 250 #endif - enum layer_type { VK_LAYER_TYPE_INSTANCE_EXPLICIT = 0x1, VK_LAYER_TYPE_INSTANCE_IMPLICIT = 0x2, @@ -83,14 +82,13 @@ static const char UTF8_DATA_BYTE_CODE = 0x80; static const char UTF8_DATA_BYTE_MASK = 0xC0; static const char std_validation_names[7][VK_MAX_EXTENSION_NAME_SIZE] = { - "VK_LAYER_GOOGLE_threading", "VK_LAYER_LUNARG_parameter_validation", - "VK_LAYER_LUNARG_object_tracker", "VK_LAYER_LUNARG_image", - "VK_LAYER_LUNARG_core_validation", "VK_LAYER_LUNARG_swapchain", - "VK_LAYER_GOOGLE_unique_objects"}; + "VK_LAYER_GOOGLE_threading", "VK_LAYER_LUNARG_parameter_validation", "VK_LAYER_LUNARG_object_tracker", + "VK_LAYER_LUNARG_image", "VK_LAYER_LUNARG_core_validation", "VK_LAYER_LUNARG_swapchain", + "VK_LAYER_GOOGLE_unique_objects"}; struct VkStructureHeader { VkStructureType sType; - const void* pNext; + const void *pNext; }; // form of all dynamic lists/arrays @@ -159,7 +157,6 @@ struct loader_dispatch_hash_list { uint32_t *index; // index into the dev_ext dispatch table }; - // loader_dispatch_hash_entry and loader_dev_ext_dispatch_table.dev_ext have // one to one correspondence; one loader_dispatch_hash_entry for one dev_ext // dispatch entry. @@ -183,7 +180,7 @@ struct loader_dev_dispatch_table { struct loader_device { struct loader_dev_dispatch_table loader_dispatch; VkDevice chain_device; // device object from the dispatch chain - VkDevice icd_device; // device object from the icd + VkDevice icd_device; // device object from the icd struct loader_physical_device_term *phys_dev_term; struct loader_layer_list activated_layer_list; @@ -205,54 +202,41 @@ struct loader_icd_term { PFN_vkEnumeratePhysicalDevices EnumeratePhysicalDevices; PFN_vkGetPhysicalDeviceFeatures GetPhysicalDeviceFeatures; PFN_vkGetPhysicalDeviceFormatProperties GetPhysicalDeviceFormatProperties; - PFN_vkGetPhysicalDeviceImageFormatProperties - GetPhysicalDeviceImageFormatProperties; + PFN_vkGetPhysicalDeviceImageFormatProperties GetPhysicalDeviceImageFormatProperties; PFN_vkCreateDevice CreateDevice; PFN_vkGetPhysicalDeviceProperties GetPhysicalDeviceProperties; - PFN_vkGetPhysicalDeviceQueueFamilyProperties - GetPhysicalDeviceQueueFamilyProperties; + PFN_vkGetPhysicalDeviceQueueFamilyProperties GetPhysicalDeviceQueueFamilyProperties; PFN_vkGetPhysicalDeviceMemoryProperties GetPhysicalDeviceMemoryProperties; PFN_vkEnumerateDeviceExtensionProperties EnumerateDeviceExtensionProperties; - PFN_vkGetPhysicalDeviceSparseImageFormatProperties - GetPhysicalDeviceSparseImageFormatProperties; + PFN_vkGetPhysicalDeviceSparseImageFormatProperties GetPhysicalDeviceSparseImageFormatProperties; // WSI extensions PFN_vkGetPhysicalDeviceSurfaceSupportKHR GetPhysicalDeviceSurfaceSupportKHR; - PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR - GetPhysicalDeviceSurfaceCapabilitiesKHR; + PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR GetPhysicalDeviceSurfaceCapabilitiesKHR; PFN_vkGetPhysicalDeviceSurfaceFormatsKHR GetPhysicalDeviceSurfaceFormatsKHR; - PFN_vkGetPhysicalDeviceSurfacePresentModesKHR - GetPhysicalDeviceSurfacePresentModesKHR; + PFN_vkGetPhysicalDeviceSurfacePresentModesKHR GetPhysicalDeviceSurfacePresentModesKHR; #ifdef VK_USE_PLATFORM_WIN32_KHR PFN_vkCreateWin32SurfaceKHR CreateWin32SurfaceKHR; - PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR - GetPhysicalDeviceWin32PresentationSupportKHR; + PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR GetPhysicalDeviceWin32PresentationSupportKHR; #endif #ifdef VK_USE_PLATFORM_MIR_KHR PFN_vkCreateMirSurfaceKHR CreateMirSurfaceKHR; - PFN_vkGetPhysicalDeviceMirPresentationSupportKHR - GetPhysicalDeviceMirPresentationSupportKHR; + PFN_vkGetPhysicalDeviceMirPresentationSupportKHR GetPhysicalDeviceMirPresentationSupportKHR; #endif #ifdef VK_USE_PLATFORM_WAYLAND_KHR PFN_vkCreateWaylandSurfaceKHR CreateWaylandSurfaceKHR; - PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR - GetPhysicalDeviceWaylandPresentationSupportKHR; + PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR GetPhysicalDeviceWaylandPresentationSupportKHR; #endif #ifdef VK_USE_PLATFORM_XCB_KHR PFN_vkCreateXcbSurfaceKHR CreateXcbSurfaceKHR; - PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR - GetPhysicalDeviceXcbPresentationSupportKHR; + PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR GetPhysicalDeviceXcbPresentationSupportKHR; #endif #ifdef VK_USE_PLATFORM_XLIB_KHR PFN_vkCreateXlibSurfaceKHR CreateXlibSurfaceKHR; - PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR - GetPhysicalDeviceXlibPresentationSupportKHR; + PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR GetPhysicalDeviceXlibPresentationSupportKHR; #endif - PFN_vkGetPhysicalDeviceDisplayPropertiesKHR - GetPhysicalDeviceDisplayPropertiesKHR; - PFN_vkGetPhysicalDeviceDisplayPlanePropertiesKHR - GetPhysicalDeviceDisplayPlanePropertiesKHR; - PFN_vkGetDisplayPlaneSupportedDisplaysKHR - GetDisplayPlaneSupportedDisplaysKHR; + PFN_vkGetPhysicalDeviceDisplayPropertiesKHR GetPhysicalDeviceDisplayPropertiesKHR; + PFN_vkGetPhysicalDeviceDisplayPlanePropertiesKHR GetPhysicalDeviceDisplayPlanePropertiesKHR; + PFN_vkGetDisplayPlaneSupportedDisplaysKHR GetDisplayPlaneSupportedDisplaysKHR; PFN_vkGetDisplayModePropertiesKHR GetDisplayModePropertiesKHR; PFN_vkCreateDisplayModeKHR CreateDisplayModeKHR; PFN_vkGetDisplayPlaneCapabilitiesKHR GetDisplayPlaneCapabilitiesKHR; @@ -264,16 +248,11 @@ struct loader_icd_term { // KHR_get_physical_device_properties2 PFN_vkGetPhysicalDeviceFeatures2KHR GetPhysicalDeviceFeatures2KHR; PFN_vkGetPhysicalDeviceProperties2KHR GetPhysicalDeviceProperties2KHR; - PFN_vkGetPhysicalDeviceFormatProperties2KHR - GetPhysicalDeviceFormatProperties2KHR; - PFN_vkGetPhysicalDeviceImageFormatProperties2KHR - GetPhysicalDeviceImageFormatProperties2KHR; - PFN_vkGetPhysicalDeviceQueueFamilyProperties2KHR - GetPhysicalDeviceQueueFamilyProperties2KHR; - PFN_vkGetPhysicalDeviceMemoryProperties2KHR - GetPhysicalDeviceMemoryProperties2KHR; - PFN_vkGetPhysicalDeviceSparseImageFormatProperties2KHR - GetPhysicalDeviceSparseImageFormatProperties2KHR; + PFN_vkGetPhysicalDeviceFormatProperties2KHR GetPhysicalDeviceFormatProperties2KHR; + PFN_vkGetPhysicalDeviceImageFormatProperties2KHR GetPhysicalDeviceImageFormatProperties2KHR; + PFN_vkGetPhysicalDeviceQueueFamilyProperties2KHR GetPhysicalDeviceQueueFamilyProperties2KHR; + PFN_vkGetPhysicalDeviceMemoryProperties2KHR GetPhysicalDeviceMemoryProperties2KHR; + PFN_vkGetPhysicalDeviceSparseImageFormatProperties2KHR GetPhysicalDeviceSparseImageFormatProperties2KHR; #ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT // EXT_acquire_xlib_display @@ -294,20 +273,17 @@ struct loader_icd_term { PFN_vkReleaseDisplayEXT ReleaseDisplayEXT; // EXT_display_surface_counter - PFN_vkGetPhysicalDeviceSurfaceCapabilities2EXT - GetPhysicalDeviceSurfaceCapabilities2EXT; + PFN_vkGetPhysicalDeviceSurfaceCapabilities2EXT GetPhysicalDeviceSurfaceCapabilities2EXT; // NV_external_memory_capabilities - PFN_vkGetPhysicalDeviceExternalImageFormatPropertiesNV - GetPhysicalDeviceExternalImageFormatPropertiesNV; + PFN_vkGetPhysicalDeviceExternalImageFormatPropertiesNV GetPhysicalDeviceExternalImageFormatPropertiesNV; // NVX_device_generated_commands - PFN_vkGetPhysicalDeviceGeneratedCommandsPropertiesNVX - GetPhysicalDeviceGeneratedCommandsPropertiesNVX; + PFN_vkGetPhysicalDeviceGeneratedCommandsPropertiesNVX GetPhysicalDeviceGeneratedCommandsPropertiesNVX; struct loader_icd_term *next; - PFN_PhysDevExt phys_dev_ext[MAX_NUM_UNKNOWN_EXTS]; + PFN_PhysDevExt phys_dev_ext[MAX_NUM_UNKNOWN_EXTS]; }; // per ICD library structure @@ -333,7 +309,7 @@ struct loader_instance_dispatch_table { VkLayerInstanceDispatchTable layer_inst_disp; // must be first entry in structure // Physical device functions unknown to the loader - PFN_PhysDevExt phys_dev_ext[MAX_NUM_UNKNOWN_EXTS]; + PFN_PhysDevExt phys_dev_ext[MAX_NUM_UNKNOWN_EXTS]; }; // per instance structure @@ -434,49 +410,36 @@ struct loader_scanned_icd { PFN_vkGetInstanceProcAddr GetInstanceProcAddr; PFN_GetPhysicalDeviceProcAddr GetPhysicalDeviceProcAddr; PFN_vkCreateInstance CreateInstance; - PFN_vkEnumerateInstanceExtensionProperties - EnumerateInstanceExtensionProperties; + PFN_vkEnumerateInstanceExtensionProperties EnumerateInstanceExtensionProperties; }; -static inline struct loader_instance *loader_instance(VkInstance instance) { - return (struct loader_instance *)instance; -} +static inline struct loader_instance *loader_instance(VkInstance instance) { return (struct loader_instance *)instance; } -static inline VkPhysicalDevice -loader_unwrap_physical_device(VkPhysicalDevice physicalDevice) { - struct loader_physical_device_tramp *phys_dev = - (struct loader_physical_device_tramp *)physicalDevice; +static inline VkPhysicalDevice loader_unwrap_physical_device(VkPhysicalDevice physicalDevice) { + struct loader_physical_device_tramp *phys_dev = (struct loader_physical_device_tramp *)physicalDevice; return phys_dev->phys_dev; } -static inline void loader_set_dispatch(void *obj, const void *data) { - *((const void **)obj) = data; -} +static inline void loader_set_dispatch(void *obj, const void *data) { *((const void **)obj) = data; } -static inline VkLayerDispatchTable *loader_get_dispatch(const void *obj) { - return *((VkLayerDispatchTable **)obj); -} +static inline VkLayerDispatchTable *loader_get_dispatch(const void *obj) { return *((VkLayerDispatchTable **)obj); } -static inline struct loader_dev_dispatch_table * -loader_get_dev_dispatch(const void *obj) { +static inline struct loader_dev_dispatch_table *loader_get_dev_dispatch(const void *obj) { return *((struct loader_dev_dispatch_table **)obj); } -static inline VkLayerInstanceDispatchTable * -loader_get_instance_layer_dispatch(const void *obj) { +static inline VkLayerInstanceDispatchTable *loader_get_instance_layer_dispatch(const void *obj) { return *((VkLayerInstanceDispatchTable **)obj); } -static inline struct loader_instance_dispatch_table * -loader_get_instance_dispatch(const void *obj) { +static inline struct loader_instance_dispatch_table *loader_get_instance_dispatch(const void *obj) { return *((struct loader_instance_dispatch_table **)obj); } static inline void loader_init_dispatch(void *obj, const void *data) { #ifdef DEBUG - assert(valid_loader_magic_value(obj) && - "Incompatible ICD, first dword must be initialized to " - "ICD_LOADER_MAGIC. See loader/README.md for details."); + assert(valid_loader_magic_value(obj) && "Incompatible ICD, first dword must be initialized to " + "ICD_LOADER_MAGIC. See loader/README.md for details."); #endif loader_set_dispatch(obj, data); @@ -497,241 +460,154 @@ struct loader_msg_callback_map_entry { }; /* helper function definitions */ -void *loader_instance_heap_alloc(const struct loader_instance *instance, - size_t size, - VkSystemAllocationScope allocationScope); -void loader_instance_heap_free(const struct loader_instance *instance, - void *pMemory); -void *loader_instance_heap_realloc(const struct loader_instance *instance, - void *pMemory, size_t orig_size, size_t size, +void *loader_instance_heap_alloc(const struct loader_instance *instance, size_t size, VkSystemAllocationScope allocationScope); +void loader_instance_heap_free(const struct loader_instance *instance, void *pMemory); +void *loader_instance_heap_realloc(const struct loader_instance *instance, void *pMemory, size_t orig_size, size_t size, VkSystemAllocationScope alloc_scope); void *loader_instance_tls_heap_alloc(size_t size); void loader_instance_tls_heap_free(void *pMemory); -void *loader_device_heap_alloc(const struct loader_device *device, size_t size, - VkSystemAllocationScope allocationScope); +void *loader_device_heap_alloc(const struct loader_device *device, size_t size, VkSystemAllocationScope allocationScope); void loader_device_heap_free(const struct loader_device *device, void *pMemory); -void *loader_device_heap_realloc(const struct loader_device *device, - void *pMemory, size_t orig_size, size_t size, +void *loader_device_heap_realloc(const struct loader_device *device, void *pMemory, size_t orig_size, size_t size, VkSystemAllocationScope alloc_scope); -void loader_log(const struct loader_instance *inst, VkFlags msg_type, - int32_t msg_code, const char *format, ...); +void loader_log(const struct loader_instance *inst, VkFlags msg_type, int32_t msg_code, const char *format, ...); -bool compare_vk_extension_properties(const VkExtensionProperties *op1, - const VkExtensionProperties *op2); +bool compare_vk_extension_properties(const VkExtensionProperties *op1, const VkExtensionProperties *op2); -VkResult loader_validate_layers(const struct loader_instance *inst, - const uint32_t layer_count, - const char *const *ppEnabledLayerNames, - const struct loader_layer_list *list); +VkResult loader_validate_layers(const struct loader_instance *inst, const uint32_t layer_count, + const char *const *ppEnabledLayerNames, const struct loader_layer_list *list); -VkResult loader_validate_instance_extensions( - const struct loader_instance *inst, - const struct loader_extension_list *icd_exts, - const struct loader_layer_list *instance_layer, - const VkInstanceCreateInfo *pCreateInfo); +VkResult loader_validate_instance_extensions(const struct loader_instance *inst, const struct loader_extension_list *icd_exts, + const struct loader_layer_list *instance_layer, + const VkInstanceCreateInfo *pCreateInfo); void loader_initialize(void); -VkResult loader_copy_layer_properties(const struct loader_instance *inst, - struct loader_layer_properties *dst, +VkResult loader_copy_layer_properties(const struct loader_instance *inst, struct loader_layer_properties *dst, struct loader_layer_properties *src); -bool has_vk_extension_property_array(const VkExtensionProperties *vk_ext_prop, - const uint32_t count, +bool has_vk_extension_property_array(const VkExtensionProperties *vk_ext_prop, const uint32_t count, const VkExtensionProperties *ext_array); -bool has_vk_extension_property(const VkExtensionProperties *vk_ext_prop, - const struct loader_extension_list *ext_list); - -VkResult loader_add_to_ext_list(const struct loader_instance *inst, - struct loader_extension_list *ext_list, - uint32_t prop_list_count, - const VkExtensionProperties *props); -VkResult -loader_add_to_dev_ext_list(const struct loader_instance *inst, - struct loader_device_extension_list *ext_list, - const VkExtensionProperties *props, - uint32_t entry_count, char **entrys); +bool has_vk_extension_property(const VkExtensionProperties *vk_ext_prop, const struct loader_extension_list *ext_list); + +VkResult loader_add_to_ext_list(const struct loader_instance *inst, struct loader_extension_list *ext_list, + uint32_t prop_list_count, const VkExtensionProperties *props); +VkResult loader_add_to_dev_ext_list(const struct loader_instance *inst, struct loader_device_extension_list *ext_list, + const VkExtensionProperties *props, uint32_t entry_count, char **entrys); VkResult loader_add_device_extensions(const struct loader_instance *inst, - PFN_vkEnumerateDeviceExtensionProperties - fpEnumerateDeviceExtensionProperties, - VkPhysicalDevice physical_device, - const char *lib_name, + PFN_vkEnumerateDeviceExtensionProperties fpEnumerateDeviceExtensionProperties, + VkPhysicalDevice physical_device, const char *lib_name, struct loader_extension_list *ext_list); -VkResult loader_init_generic_list(const struct loader_instance *inst, - struct loader_generic_list *list_info, - size_t element_size); -void loader_destroy_generic_list(const struct loader_instance *inst, - struct loader_generic_list *list); -void loader_destroy_layer_list(const struct loader_instance *inst, - struct loader_device *device, +VkResult loader_init_generic_list(const struct loader_instance *inst, struct loader_generic_list *list_info, size_t element_size); +void loader_destroy_generic_list(const struct loader_instance *inst, struct loader_generic_list *list); +void loader_destroy_layer_list(const struct loader_instance *inst, struct loader_device *device, struct loader_layer_list *layer_list); -void loader_delete_layer_properties(const struct loader_instance *inst, - struct loader_layer_list *layer_list); -bool loader_find_layer_name_array( - const char *name, uint32_t layer_count, - const char layer_list[][VK_MAX_EXTENSION_NAME_SIZE]); -VkResult loader_expand_layer_names( - struct loader_instance *inst, const char *key_name, uint32_t expand_count, - const char expand_names[][VK_MAX_EXTENSION_NAME_SIZE], - uint32_t *layer_count, char const *const **ppp_layer_names); +void loader_delete_layer_properties(const struct loader_instance *inst, struct loader_layer_list *layer_list); +bool loader_find_layer_name_array(const char *name, uint32_t layer_count, const char layer_list[][VK_MAX_EXTENSION_NAME_SIZE]); +VkResult loader_expand_layer_names(struct loader_instance *inst, const char *key_name, uint32_t expand_count, + const char expand_names[][VK_MAX_EXTENSION_NAME_SIZE], uint32_t *layer_count, + char const *const **ppp_layer_names); void loader_init_std_validation_props(struct loader_layer_properties *props); -void loader_delete_shadow_dev_layer_names(const struct loader_instance *inst, - const VkDeviceCreateInfo *orig, +void loader_delete_shadow_dev_layer_names(const struct loader_instance *inst, const VkDeviceCreateInfo *orig, VkDeviceCreateInfo *ours); -void loader_delete_shadow_inst_layer_names(const struct loader_instance *inst, - const VkInstanceCreateInfo *orig, +void loader_delete_shadow_inst_layer_names(const struct loader_instance *inst, const VkInstanceCreateInfo *orig, VkInstanceCreateInfo *ours); -VkResult loader_add_to_layer_list(const struct loader_instance *inst, - struct loader_layer_list *list, - uint32_t prop_list_count, +VkResult loader_add_to_layer_list(const struct loader_instance *inst, struct loader_layer_list *list, uint32_t prop_list_count, const struct loader_layer_properties *props); -void loader_find_layer_name_add_list( - const struct loader_instance *inst, const char *name, - const enum layer_type type, const struct loader_layer_list *search_list, - struct loader_layer_list *found_list); -void loader_scanned_icd_clear(const struct loader_instance *inst, - struct loader_icd_tramp_list *icd_tramp_list); -VkResult loader_icd_scan(const struct loader_instance *inst, - struct loader_icd_tramp_list *icd_tramp_list); -void loader_layer_scan(const struct loader_instance *inst, - struct loader_layer_list *instance_layers); -void loader_implicit_layer_scan(const struct loader_instance *inst, - struct loader_layer_list *instance_layers); -VkResult loader_get_icd_loader_instance_extensions( - const struct loader_instance *inst, - struct loader_icd_tramp_list *icd_tramp_list, - struct loader_extension_list *inst_exts); -struct loader_icd_term * -loader_get_icd_and_device(const VkDevice device, - struct loader_device **found_dev, - uint32_t *icd_index); -void loader_init_dispatch_dev_ext(struct loader_instance *inst, - struct loader_device *dev); +void loader_find_layer_name_add_list(const struct loader_instance *inst, const char *name, const enum layer_type type, + const struct loader_layer_list *search_list, struct loader_layer_list *found_list); +void loader_scanned_icd_clear(const struct loader_instance *inst, struct loader_icd_tramp_list *icd_tramp_list); +VkResult loader_icd_scan(const struct loader_instance *inst, struct loader_icd_tramp_list *icd_tramp_list); +void loader_layer_scan(const struct loader_instance *inst, struct loader_layer_list *instance_layers); +void loader_implicit_layer_scan(const struct loader_instance *inst, struct loader_layer_list *instance_layers); +VkResult loader_get_icd_loader_instance_extensions(const struct loader_instance *inst, struct loader_icd_tramp_list *icd_tramp_list, + struct loader_extension_list *inst_exts); +struct loader_icd_term *loader_get_icd_and_device(const VkDevice device, struct loader_device **found_dev, uint32_t *icd_index); +void loader_init_dispatch_dev_ext(struct loader_instance *inst, struct loader_device *dev); void *loader_dev_ext_gpa(struct loader_instance *inst, const char *funcName); void *loader_get_dev_ext_trampoline(uint32_t index); -bool loader_phys_dev_ext_gpa(struct loader_instance *inst, const char *funcName, - bool perform_checking, void **tramp_addr, void **term_addr); +bool loader_phys_dev_ext_gpa(struct loader_instance *inst, const char *funcName, bool perform_checking, void **tramp_addr, + void **term_addr); void *loader_get_phys_dev_ext_tramp(uint32_t index); void *loader_get_phys_dev_ext_termin(uint32_t index); struct loader_instance *loader_get_instance(const VkInstance instance); -void loader_deactivate_layers(const struct loader_instance *instance, - struct loader_device *device, - struct loader_layer_list *list); -struct loader_device * -loader_create_logical_device(const struct loader_instance *inst, - const VkAllocationCallbacks *pAllocator); -void loader_add_logical_device(const struct loader_instance *inst, - struct loader_icd_term *icd_term, +void loader_deactivate_layers(const struct loader_instance *instance, struct loader_device *device, struct loader_layer_list *list); +struct loader_device *loader_create_logical_device(const struct loader_instance *inst, const VkAllocationCallbacks *pAllocator); +void loader_add_logical_device(const struct loader_instance *inst, struct loader_icd_term *icd_term, struct loader_device *found_dev); -void loader_remove_logical_device(const struct loader_instance *inst, - struct loader_icd_term *icd_term, - struct loader_device *found_dev, - const VkAllocationCallbacks *pAllocator); +void loader_remove_logical_device(const struct loader_instance *inst, struct loader_icd_term *icd_term, + struct loader_device *found_dev, const VkAllocationCallbacks *pAllocator); // NOTE: Outside of loader, this entry-point is only proivided for error // cleanup. -void loader_destroy_logical_device(const struct loader_instance *inst, - struct loader_device *dev, +void loader_destroy_logical_device(const struct loader_instance *inst, struct loader_device *dev, const VkAllocationCallbacks *pAllocator); -VkResult -loader_enable_instance_layers(struct loader_instance *inst, - const VkInstanceCreateInfo *pCreateInfo, - const struct loader_layer_list *instance_layers); +VkResult loader_enable_instance_layers(struct loader_instance *inst, const VkInstanceCreateInfo *pCreateInfo, + const struct loader_layer_list *instance_layers); void loader_deactivate_instance_layers(struct loader_instance *instance); -VkResult loader_create_instance_chain(const VkInstanceCreateInfo *pCreateInfo, - const VkAllocationCallbacks *pAllocator, - struct loader_instance *inst, - VkInstance *created_instance); - -void loader_activate_instance_layer_extensions(struct loader_instance *inst, - VkInstance created_inst); -VkResult -loader_enable_device_layers(const struct loader_instance *inst, - struct loader_layer_list *activated_layer_list, - const VkDeviceCreateInfo *pCreateInfo, - const struct loader_layer_list *device_layers); - -VkResult -loader_create_device_chain(const struct loader_physical_device_tramp *pd, - const VkDeviceCreateInfo *pCreateInfo, - const VkAllocationCallbacks *pAllocator, - const struct loader_instance *inst, - struct loader_device *dev); - -VkResult loader_validate_device_extensions( - struct loader_physical_device_tramp *phys_dev, - const struct loader_layer_list *activated_device_layers, - const struct loader_extension_list *icd_exts, - const VkDeviceCreateInfo *pCreateInfo); +VkResult loader_create_instance_chain(const VkInstanceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, + struct loader_instance *inst, VkInstance *created_instance); + +void loader_activate_instance_layer_extensions(struct loader_instance *inst, VkInstance created_inst); +VkResult loader_enable_device_layers(const struct loader_instance *inst, struct loader_layer_list *activated_layer_list, + const VkDeviceCreateInfo *pCreateInfo, const struct loader_layer_list *device_layers); + +VkResult loader_create_device_chain(const struct loader_physical_device_tramp *pd, const VkDeviceCreateInfo *pCreateInfo, + const VkAllocationCallbacks *pAllocator, const struct loader_instance *inst, + struct loader_device *dev); + +VkResult loader_validate_device_extensions(struct loader_physical_device_tramp *phys_dev, + const struct loader_layer_list *activated_device_layers, + const struct loader_extension_list *icd_exts, const VkDeviceCreateInfo *pCreateInfo); VkResult setupLoaderTrampPhysDevs(VkInstance instance); VkResult setupLoaderTermPhysDevs(struct loader_instance *inst); /* instance layer chain termination entrypoint definitions */ -VKAPI_ATTR VkResult VKAPI_CALL -terminator_CreateInstance(const VkInstanceCreateInfo *pCreateInfo, - const VkAllocationCallbacks *pAllocator, - VkInstance *pInstance); - -VKAPI_ATTR void VKAPI_CALL -terminator_DestroyInstance(VkInstance instance, - const VkAllocationCallbacks *pAllocator); - -VKAPI_ATTR VkResult VKAPI_CALL -terminator_EnumeratePhysicalDevices(VkInstance instance, - uint32_t *pPhysicalDeviceCount, - VkPhysicalDevice *pPhysicalDevices); - -VKAPI_ATTR void VKAPI_CALL -terminator_GetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice, - VkPhysicalDeviceFeatures *pFeatures); - -VKAPI_ATTR void VKAPI_CALL -terminator_GetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice, - VkFormat format, - VkFormatProperties *pFormatInfo); - -VKAPI_ATTR VkResult VKAPI_CALL -terminator_GetPhysicalDeviceImageFormatProperties( - VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, - VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, - VkImageFormatProperties *pImageFormatProperties); - -VKAPI_ATTR void VKAPI_CALL -terminator_GetPhysicalDeviceSparseImageFormatProperties( - VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, - VkSampleCountFlagBits samples, VkImageUsageFlags usage, - VkImageTiling tiling, uint32_t *pNumProperties, - VkSparseImageFormatProperties *pProperties); - -VKAPI_ATTR void VKAPI_CALL -terminator_GetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice, - VkPhysicalDeviceProperties *pProperties); - -VKAPI_ATTR VkResult VKAPI_CALL terminator_EnumerateDeviceExtensionProperties( - VkPhysicalDevice physicalDevice, const char *pLayerName, uint32_t *pCount, - VkExtensionProperties *pProperties); - -VKAPI_ATTR VkResult VKAPI_CALL -terminator_EnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice, - uint32_t *pCount, - VkLayerProperties *pProperties); - -VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceQueueFamilyProperties( - VkPhysicalDevice physicalDevice, uint32_t *pCount, - VkQueueFamilyProperties *pProperties); - -VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceMemoryProperties( - VkPhysicalDevice physicalDevice, - VkPhysicalDeviceMemoryProperties *pProperties); - -VKAPI_ATTR VkResult VKAPI_CALL -terminator_CreateDevice(VkPhysicalDevice gpu, - const VkDeviceCreateInfo *pCreateInfo, - const VkAllocationCallbacks *pAllocator, - VkDevice *pDevice); - -VkStringErrorFlags vk_string_validate(const int max_length, - const char *char_array); +VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateInstance(const VkInstanceCreateInfo *pCreateInfo, + const VkAllocationCallbacks *pAllocator, VkInstance *pInstance); + +VKAPI_ATTR void VKAPI_CALL terminator_DestroyInstance(VkInstance instance, const VkAllocationCallbacks *pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL terminator_EnumeratePhysicalDevices(VkInstance instance, uint32_t *pPhysicalDeviceCount, + VkPhysicalDevice *pPhysicalDevices); + +VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice, + VkPhysicalDeviceFeatures *pFeatures); + +VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, + VkFormatProperties *pFormatInfo); + +VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, + VkImageType type, VkImageTiling tiling, + VkImageUsageFlags usage, VkImageCreateFlags flags, + VkImageFormatProperties *pImageFormatProperties); + +VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceSparseImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, + VkImageType type, VkSampleCountFlagBits samples, + VkImageUsageFlags usage, VkImageTiling tiling, + uint32_t *pNumProperties, + VkSparseImageFormatProperties *pProperties); + +VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice, + VkPhysicalDeviceProperties *pProperties); + +VKAPI_ATTR VkResult VKAPI_CALL terminator_EnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, + const char *pLayerName, uint32_t *pCount, + VkExtensionProperties *pProperties); + +VKAPI_ATTR VkResult VKAPI_CALL terminator_EnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice, uint32_t *pCount, + VkLayerProperties *pProperties); + +VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceQueueFamilyProperties(VkPhysicalDevice physicalDevice, uint32_t *pCount, + VkQueueFamilyProperties *pProperties); + +VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceMemoryProperties(VkPhysicalDevice physicalDevice, + VkPhysicalDeviceMemoryProperties *pProperties); + +VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDevice(VkPhysicalDevice gpu, const VkDeviceCreateInfo *pCreateInfo, + const VkAllocationCallbacks *pAllocator, VkDevice *pDevice); + +VkStringErrorFlags vk_string_validate(const int max_length, const char *char_array); #endif /* LOADER_H */ diff --git a/loader/phys_dev_ext.c b/loader/phys_dev_ext.c index 27a09ef3..cf2ada57 100644 --- a/loader/phys_dev_ext.c +++ b/loader/phys_dev_ext.c @@ -34,30 +34,24 @@ #endif // Trampoline function macro for unknown physical device extension command. -#define PhysDevExtTramp(num) \ -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp##num( \ - VkPhysicalDevice physical_device) { \ - const struct loader_instance_dispatch_table *disp; \ - disp = loader_get_instance_dispatch(physical_device); \ - disp->phys_dev_ext[num]( \ - loader_unwrap_physical_device(physical_device)); \ +#define PhysDevExtTramp(num) \ + VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTramp##num(VkPhysicalDevice physical_device) { \ + const struct loader_instance_dispatch_table *disp; \ + disp = loader_get_instance_dispatch(physical_device); \ + disp->phys_dev_ext[num](loader_unwrap_physical_device(physical_device)); \ } // Terminator function macro for unknown physical device extension command. -#define PhysDevExtTermin(num) \ -VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin##num( \ - VkPhysicalDevice physical_device) { \ - struct loader_physical_device_term *phys_dev_term = \ - (struct loader_physical_device_term *)physical_device; \ - struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; \ - struct loader_instance *inst = \ - (struct loader_instance *)icd_term->this_instance; \ - if (NULL == icd_term->phys_dev_ext[num]) { \ - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, \ - "Extension %s not supported for this physical device", \ - inst->phys_dev_ext_disp_hash[num].func_name); \ - } \ - icd_term->phys_dev_ext[num](phys_dev_term->phys_dev); \ +#define PhysDevExtTermin(num) \ + VKAPI_ATTR void VKAPI_CALL vkPhysDevExtTermin##num(VkPhysicalDevice physical_device) { \ + struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physical_device; \ + struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; \ + struct loader_instance *inst = (struct loader_instance *)icd_term->this_instance; \ + if (NULL == icd_term->phys_dev_ext[num]) { \ + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "Extension %s not supported for this physical device", \ + inst->phys_dev_ext_disp_hash[num].func_name); \ + } \ + icd_term->phys_dev_ext[num](phys_dev_term->phys_dev); \ } // Disable clang-format for lists of macros diff --git a/loader/table_ops.h b/loader/table_ops.h index b3b90795..15a7e996 100644 --- a/loader/table_ops.h +++ b/loader/table_ops.h @@ -32,8 +32,7 @@ static VkResult VKAPI_CALL vkDevExtError(VkDevice dev) { struct loader_device *found_dev; // The device going in is a trampoline device - struct loader_icd_term *icd_term = - loader_get_icd_and_device(dev, &found_dev, NULL); + struct loader_icd_term *icd_term = loader_get_icd_and_device(dev, &found_dev, NULL); if (icd_term) loader_log(icd_term->this_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, @@ -42,15 +41,13 @@ static VkResult VKAPI_CALL vkDevExtError(VkDevice dev) { return VK_ERROR_EXTENSION_NOT_PRESENT; } -static inline void -loader_init_device_dispatch_table(struct loader_dev_dispatch_table *dev_table, - PFN_vkGetDeviceProcAddr gpa, VkDevice dev) { +static inline void loader_init_device_dispatch_table(struct loader_dev_dispatch_table *dev_table, PFN_vkGetDeviceProcAddr gpa, + VkDevice dev) { VkLayerDispatchTable *table = &dev_table->core_dispatch; for (uint32_t i = 0; i < MAX_NUM_UNKNOWN_EXTS; i++) dev_table->ext_dispatch.dev_ext[i] = (PFN_vkDevExt)vkDevExtError; - table->GetDeviceProcAddr = - (PFN_vkGetDeviceProcAddr)gpa(dev, "vkGetDeviceProcAddr"); + table->GetDeviceProcAddr = (PFN_vkGetDeviceProcAddr)gpa(dev, "vkGetDeviceProcAddr"); table->DestroyDevice = (PFN_vkDestroyDevice)gpa(dev, "vkDestroyDevice"); table->GetDeviceQueue = (PFN_vkGetDeviceQueue)gpa(dev, "vkGetDeviceQueue"); table->QueueSubmit = (PFN_vkQueueSubmit)gpa(dev, "vkQueueSubmit"); @@ -60,284 +57,170 @@ loader_init_device_dispatch_table(struct loader_dev_dispatch_table *dev_table, table->FreeMemory = (PFN_vkFreeMemory)gpa(dev, "vkFreeMemory"); table->MapMemory = (PFN_vkMapMemory)gpa(dev, "vkMapMemory"); table->UnmapMemory = (PFN_vkUnmapMemory)gpa(dev, "vkUnmapMemory"); - table->FlushMappedMemoryRanges = - (PFN_vkFlushMappedMemoryRanges)gpa(dev, "vkFlushMappedMemoryRanges"); - table->InvalidateMappedMemoryRanges = - (PFN_vkInvalidateMappedMemoryRanges)gpa( - dev, "vkInvalidateMappedMemoryRanges"); - table->GetDeviceMemoryCommitment = (PFN_vkGetDeviceMemoryCommitment)gpa( - dev, "vkGetDeviceMemoryCommitment"); + table->FlushMappedMemoryRanges = (PFN_vkFlushMappedMemoryRanges)gpa(dev, "vkFlushMappedMemoryRanges"); + table->InvalidateMappedMemoryRanges = (PFN_vkInvalidateMappedMemoryRanges)gpa(dev, "vkInvalidateMappedMemoryRanges"); + table->GetDeviceMemoryCommitment = (PFN_vkGetDeviceMemoryCommitment)gpa(dev, "vkGetDeviceMemoryCommitment"); table->GetImageSparseMemoryRequirements = - (PFN_vkGetImageSparseMemoryRequirements)gpa( - dev, "vkGetImageSparseMemoryRequirements"); - table->GetBufferMemoryRequirements = (PFN_vkGetBufferMemoryRequirements)gpa( - dev, "vkGetBufferMemoryRequirements"); - table->GetImageMemoryRequirements = (PFN_vkGetImageMemoryRequirements)gpa( - dev, "vkGetImageMemoryRequirements"); - table->BindBufferMemory = - (PFN_vkBindBufferMemory)gpa(dev, "vkBindBufferMemory"); - table->BindImageMemory = - (PFN_vkBindImageMemory)gpa(dev, "vkBindImageMemory"); - table->QueueBindSparse = - (PFN_vkQueueBindSparse)gpa(dev, "vkQueueBindSparse"); + (PFN_vkGetImageSparseMemoryRequirements)gpa(dev, "vkGetImageSparseMemoryRequirements"); + table->GetBufferMemoryRequirements = (PFN_vkGetBufferMemoryRequirements)gpa(dev, "vkGetBufferMemoryRequirements"); + table->GetImageMemoryRequirements = (PFN_vkGetImageMemoryRequirements)gpa(dev, "vkGetImageMemoryRequirements"); + table->BindBufferMemory = (PFN_vkBindBufferMemory)gpa(dev, "vkBindBufferMemory"); + table->BindImageMemory = (PFN_vkBindImageMemory)gpa(dev, "vkBindImageMemory"); + table->QueueBindSparse = (PFN_vkQueueBindSparse)gpa(dev, "vkQueueBindSparse"); table->CreateFence = (PFN_vkCreateFence)gpa(dev, "vkCreateFence"); table->DestroyFence = (PFN_vkDestroyFence)gpa(dev, "vkDestroyFence"); table->ResetFences = (PFN_vkResetFences)gpa(dev, "vkResetFences"); table->GetFenceStatus = (PFN_vkGetFenceStatus)gpa(dev, "vkGetFenceStatus"); table->WaitForFences = (PFN_vkWaitForFences)gpa(dev, "vkWaitForFences"); - table->CreateSemaphore = - (PFN_vkCreateSemaphore)gpa(dev, "vkCreateSemaphore"); - table->DestroySemaphore = - (PFN_vkDestroySemaphore)gpa(dev, "vkDestroySemaphore"); + table->CreateSemaphore = (PFN_vkCreateSemaphore)gpa(dev, "vkCreateSemaphore"); + table->DestroySemaphore = (PFN_vkDestroySemaphore)gpa(dev, "vkDestroySemaphore"); table->CreateEvent = (PFN_vkCreateEvent)gpa(dev, "vkCreateEvent"); table->DestroyEvent = (PFN_vkDestroyEvent)gpa(dev, "vkDestroyEvent"); table->GetEventStatus = (PFN_vkGetEventStatus)gpa(dev, "vkGetEventStatus"); table->SetEvent = (PFN_vkSetEvent)gpa(dev, "vkSetEvent"); table->ResetEvent = (PFN_vkResetEvent)gpa(dev, "vkResetEvent"); - table->CreateQueryPool = - (PFN_vkCreateQueryPool)gpa(dev, "vkCreateQueryPool"); - table->DestroyQueryPool = - (PFN_vkDestroyQueryPool)gpa(dev, "vkDestroyQueryPool"); - table->GetQueryPoolResults = - (PFN_vkGetQueryPoolResults)gpa(dev, "vkGetQueryPoolResults"); + table->CreateQueryPool = (PFN_vkCreateQueryPool)gpa(dev, "vkCreateQueryPool"); + table->DestroyQueryPool = (PFN_vkDestroyQueryPool)gpa(dev, "vkDestroyQueryPool"); + table->GetQueryPoolResults = (PFN_vkGetQueryPoolResults)gpa(dev, "vkGetQueryPoolResults"); table->CreateBuffer = (PFN_vkCreateBuffer)gpa(dev, "vkCreateBuffer"); table->DestroyBuffer = (PFN_vkDestroyBuffer)gpa(dev, "vkDestroyBuffer"); - table->CreateBufferView = - (PFN_vkCreateBufferView)gpa(dev, "vkCreateBufferView"); - table->DestroyBufferView = - (PFN_vkDestroyBufferView)gpa(dev, "vkDestroyBufferView"); + table->CreateBufferView = (PFN_vkCreateBufferView)gpa(dev, "vkCreateBufferView"); + table->DestroyBufferView = (PFN_vkDestroyBufferView)gpa(dev, "vkDestroyBufferView"); table->CreateImage = (PFN_vkCreateImage)gpa(dev, "vkCreateImage"); table->DestroyImage = (PFN_vkDestroyImage)gpa(dev, "vkDestroyImage"); - table->GetImageSubresourceLayout = (PFN_vkGetImageSubresourceLayout)gpa( - dev, "vkGetImageSubresourceLayout"); - table->CreateImageView = - (PFN_vkCreateImageView)gpa(dev, "vkCreateImageView"); - table->DestroyImageView = - (PFN_vkDestroyImageView)gpa(dev, "vkDestroyImageView"); - table->CreateShaderModule = - (PFN_vkCreateShaderModule)gpa(dev, "vkCreateShaderModule"); - table->DestroyShaderModule = - (PFN_vkDestroyShaderModule)gpa(dev, "vkDestroyShaderModule"); - table->CreatePipelineCache = - (PFN_vkCreatePipelineCache)gpa(dev, "vkCreatePipelineCache"); - table->DestroyPipelineCache = - (PFN_vkDestroyPipelineCache)gpa(dev, "vkDestroyPipelineCache"); - table->GetPipelineCacheData = - (PFN_vkGetPipelineCacheData)gpa(dev, "vkGetPipelineCacheData"); - table->MergePipelineCaches = - (PFN_vkMergePipelineCaches)gpa(dev, "vkMergePipelineCaches"); - table->CreateGraphicsPipelines = - (PFN_vkCreateGraphicsPipelines)gpa(dev, "vkCreateGraphicsPipelines"); - table->CreateComputePipelines = - (PFN_vkCreateComputePipelines)gpa(dev, "vkCreateComputePipelines"); - table->DestroyPipeline = - (PFN_vkDestroyPipeline)gpa(dev, "vkDestroyPipeline"); - table->CreatePipelineLayout = - (PFN_vkCreatePipelineLayout)gpa(dev, "vkCreatePipelineLayout"); - table->DestroyPipelineLayout = - (PFN_vkDestroyPipelineLayout)gpa(dev, "vkDestroyPipelineLayout"); + table->GetImageSubresourceLayout = (PFN_vkGetImageSubresourceLayout)gpa(dev, "vkGetImageSubresourceLayout"); + table->CreateImageView = (PFN_vkCreateImageView)gpa(dev, "vkCreateImageView"); + table->DestroyImageView = (PFN_vkDestroyImageView)gpa(dev, "vkDestroyImageView"); + table->CreateShaderModule = (PFN_vkCreateShaderModule)gpa(dev, "vkCreateShaderModule"); + table->DestroyShaderModule = (PFN_vkDestroyShaderModule)gpa(dev, "vkDestroyShaderModule"); + table->CreatePipelineCache = (PFN_vkCreatePipelineCache)gpa(dev, "vkCreatePipelineCache"); + table->DestroyPipelineCache = (PFN_vkDestroyPipelineCache)gpa(dev, "vkDestroyPipelineCache"); + table->GetPipelineCacheData = (PFN_vkGetPipelineCacheData)gpa(dev, "vkGetPipelineCacheData"); + table->MergePipelineCaches = (PFN_vkMergePipelineCaches)gpa(dev, "vkMergePipelineCaches"); + table->CreateGraphicsPipelines = (PFN_vkCreateGraphicsPipelines)gpa(dev, "vkCreateGraphicsPipelines"); + table->CreateComputePipelines = (PFN_vkCreateComputePipelines)gpa(dev, "vkCreateComputePipelines"); + table->DestroyPipeline = (PFN_vkDestroyPipeline)gpa(dev, "vkDestroyPipeline"); + table->CreatePipelineLayout = (PFN_vkCreatePipelineLayout)gpa(dev, "vkCreatePipelineLayout"); + table->DestroyPipelineLayout = (PFN_vkDestroyPipelineLayout)gpa(dev, "vkDestroyPipelineLayout"); table->CreateSampler = (PFN_vkCreateSampler)gpa(dev, "vkCreateSampler"); table->DestroySampler = (PFN_vkDestroySampler)gpa(dev, "vkDestroySampler"); - table->CreateDescriptorSetLayout = (PFN_vkCreateDescriptorSetLayout)gpa( - dev, "vkCreateDescriptorSetLayout"); - table->DestroyDescriptorSetLayout = (PFN_vkDestroyDescriptorSetLayout)gpa( - dev, "vkDestroyDescriptorSetLayout"); - table->CreateDescriptorPool = - (PFN_vkCreateDescriptorPool)gpa(dev, "vkCreateDescriptorPool"); - table->DestroyDescriptorPool = - (PFN_vkDestroyDescriptorPool)gpa(dev, "vkDestroyDescriptorPool"); - table->ResetDescriptorPool = - (PFN_vkResetDescriptorPool)gpa(dev, "vkResetDescriptorPool"); - table->AllocateDescriptorSets = - (PFN_vkAllocateDescriptorSets)gpa(dev, "vkAllocateDescriptorSets"); - table->FreeDescriptorSets = - (PFN_vkFreeDescriptorSets)gpa(dev, "vkFreeDescriptorSets"); - table->UpdateDescriptorSets = - (PFN_vkUpdateDescriptorSets)gpa(dev, "vkUpdateDescriptorSets"); - table->CreateFramebuffer = - (PFN_vkCreateFramebuffer)gpa(dev, "vkCreateFramebuffer"); - table->DestroyFramebuffer = - (PFN_vkDestroyFramebuffer)gpa(dev, "vkDestroyFramebuffer"); - table->CreateRenderPass = - (PFN_vkCreateRenderPass)gpa(dev, "vkCreateRenderPass"); - table->DestroyRenderPass = - (PFN_vkDestroyRenderPass)gpa(dev, "vkDestroyRenderPass"); - table->GetRenderAreaGranularity = - (PFN_vkGetRenderAreaGranularity)gpa(dev, "vkGetRenderAreaGranularity"); - table->CreateCommandPool = - (PFN_vkCreateCommandPool)gpa(dev, "vkCreateCommandPool"); - table->DestroyCommandPool = - (PFN_vkDestroyCommandPool)gpa(dev, "vkDestroyCommandPool"); - table->ResetCommandPool = - (PFN_vkResetCommandPool)gpa(dev, "vkResetCommandPool"); - table->AllocateCommandBuffers = - (PFN_vkAllocateCommandBuffers)gpa(dev, "vkAllocateCommandBuffers"); - table->FreeCommandBuffers = - (PFN_vkFreeCommandBuffers)gpa(dev, "vkFreeCommandBuffers"); - table->BeginCommandBuffer = - (PFN_vkBeginCommandBuffer)gpa(dev, "vkBeginCommandBuffer"); - table->EndCommandBuffer = - (PFN_vkEndCommandBuffer)gpa(dev, "vkEndCommandBuffer"); - table->ResetCommandBuffer = - (PFN_vkResetCommandBuffer)gpa(dev, "vkResetCommandBuffer"); - table->CmdBindPipeline = - (PFN_vkCmdBindPipeline)gpa(dev, "vkCmdBindPipeline"); + table->CreateDescriptorSetLayout = (PFN_vkCreateDescriptorSetLayout)gpa(dev, "vkCreateDescriptorSetLayout"); + table->DestroyDescriptorSetLayout = (PFN_vkDestroyDescriptorSetLayout)gpa(dev, "vkDestroyDescriptorSetLayout"); + table->CreateDescriptorPool = (PFN_vkCreateDescriptorPool)gpa(dev, "vkCreateDescriptorPool"); + table->DestroyDescriptorPool = (PFN_vkDestroyDescriptorPool)gpa(dev, "vkDestroyDescriptorPool"); + table->ResetDescriptorPool = (PFN_vkResetDescriptorPool)gpa(dev, "vkResetDescriptorPool"); + table->AllocateDescriptorSets = (PFN_vkAllocateDescriptorSets)gpa(dev, "vkAllocateDescriptorSets"); + table->FreeDescriptorSets = (PFN_vkFreeDescriptorSets)gpa(dev, "vkFreeDescriptorSets"); + table->UpdateDescriptorSets = (PFN_vkUpdateDescriptorSets)gpa(dev, "vkUpdateDescriptorSets"); + table->CreateFramebuffer = (PFN_vkCreateFramebuffer)gpa(dev, "vkCreateFramebuffer"); + table->DestroyFramebuffer = (PFN_vkDestroyFramebuffer)gpa(dev, "vkDestroyFramebuffer"); + table->CreateRenderPass = (PFN_vkCreateRenderPass)gpa(dev, "vkCreateRenderPass"); + table->DestroyRenderPass = (PFN_vkDestroyRenderPass)gpa(dev, "vkDestroyRenderPass"); + table->GetRenderAreaGranularity = (PFN_vkGetRenderAreaGranularity)gpa(dev, "vkGetRenderAreaGranularity"); + table->CreateCommandPool = (PFN_vkCreateCommandPool)gpa(dev, "vkCreateCommandPool"); + table->DestroyCommandPool = (PFN_vkDestroyCommandPool)gpa(dev, "vkDestroyCommandPool"); + table->ResetCommandPool = (PFN_vkResetCommandPool)gpa(dev, "vkResetCommandPool"); + table->AllocateCommandBuffers = (PFN_vkAllocateCommandBuffers)gpa(dev, "vkAllocateCommandBuffers"); + table->FreeCommandBuffers = (PFN_vkFreeCommandBuffers)gpa(dev, "vkFreeCommandBuffers"); + table->BeginCommandBuffer = (PFN_vkBeginCommandBuffer)gpa(dev, "vkBeginCommandBuffer"); + table->EndCommandBuffer = (PFN_vkEndCommandBuffer)gpa(dev, "vkEndCommandBuffer"); + table->ResetCommandBuffer = (PFN_vkResetCommandBuffer)gpa(dev, "vkResetCommandBuffer"); + table->CmdBindPipeline = (PFN_vkCmdBindPipeline)gpa(dev, "vkCmdBindPipeline"); table->CmdSetViewport = (PFN_vkCmdSetViewport)gpa(dev, "vkCmdSetViewport"); table->CmdSetScissor = (PFN_vkCmdSetScissor)gpa(dev, "vkCmdSetScissor"); - table->CmdSetLineWidth = - (PFN_vkCmdSetLineWidth)gpa(dev, "vkCmdSetLineWidth"); - table->CmdSetDepthBias = - (PFN_vkCmdSetDepthBias)gpa(dev, "vkCmdSetDepthBias"); - table->CmdSetBlendConstants = - (PFN_vkCmdSetBlendConstants)gpa(dev, "vkCmdSetBlendConstants"); - table->CmdSetDepthBounds = - (PFN_vkCmdSetDepthBounds)gpa(dev, "vkCmdSetDepthBounds"); - table->CmdSetStencilCompareMask = - (PFN_vkCmdSetStencilCompareMask)gpa(dev, "vkCmdSetStencilCompareMask"); - table->CmdSetStencilWriteMask = - (PFN_vkCmdSetStencilWriteMask)gpa(dev, "vkCmdSetStencilWriteMask"); - table->CmdSetStencilReference = - (PFN_vkCmdSetStencilReference)gpa(dev, "vkCmdSetStencilReference"); - table->CmdBindDescriptorSets = - (PFN_vkCmdBindDescriptorSets)gpa(dev, "vkCmdBindDescriptorSets"); - table->CmdBindVertexBuffers = - (PFN_vkCmdBindVertexBuffers)gpa(dev, "vkCmdBindVertexBuffers"); - table->CmdBindIndexBuffer = - (PFN_vkCmdBindIndexBuffer)gpa(dev, "vkCmdBindIndexBuffer"); + table->CmdSetLineWidth = (PFN_vkCmdSetLineWidth)gpa(dev, "vkCmdSetLineWidth"); + table->CmdSetDepthBias = (PFN_vkCmdSetDepthBias)gpa(dev, "vkCmdSetDepthBias"); + table->CmdSetBlendConstants = (PFN_vkCmdSetBlendConstants)gpa(dev, "vkCmdSetBlendConstants"); + table->CmdSetDepthBounds = (PFN_vkCmdSetDepthBounds)gpa(dev, "vkCmdSetDepthBounds"); + table->CmdSetStencilCompareMask = (PFN_vkCmdSetStencilCompareMask)gpa(dev, "vkCmdSetStencilCompareMask"); + table->CmdSetStencilWriteMask = (PFN_vkCmdSetStencilWriteMask)gpa(dev, "vkCmdSetStencilWriteMask"); + table->CmdSetStencilReference = (PFN_vkCmdSetStencilReference)gpa(dev, "vkCmdSetStencilReference"); + table->CmdBindDescriptorSets = (PFN_vkCmdBindDescriptorSets)gpa(dev, "vkCmdBindDescriptorSets"); + table->CmdBindVertexBuffers = (PFN_vkCmdBindVertexBuffers)gpa(dev, "vkCmdBindVertexBuffers"); + table->CmdBindIndexBuffer = (PFN_vkCmdBindIndexBuffer)gpa(dev, "vkCmdBindIndexBuffer"); table->CmdDraw = (PFN_vkCmdDraw)gpa(dev, "vkCmdDraw"); table->CmdDrawIndexed = (PFN_vkCmdDrawIndexed)gpa(dev, "vkCmdDrawIndexed"); - table->CmdDrawIndirect = - (PFN_vkCmdDrawIndirect)gpa(dev, "vkCmdDrawIndirect"); - table->CmdDrawIndexedIndirect = - (PFN_vkCmdDrawIndexedIndirect)gpa(dev, "vkCmdDrawIndexedIndirect"); + table->CmdDrawIndirect = (PFN_vkCmdDrawIndirect)gpa(dev, "vkCmdDrawIndirect"); + table->CmdDrawIndexedIndirect = (PFN_vkCmdDrawIndexedIndirect)gpa(dev, "vkCmdDrawIndexedIndirect"); table->CmdDispatch = (PFN_vkCmdDispatch)gpa(dev, "vkCmdDispatch"); - table->CmdDispatchIndirect = - (PFN_vkCmdDispatchIndirect)gpa(dev, "vkCmdDispatchIndirect"); + table->CmdDispatchIndirect = (PFN_vkCmdDispatchIndirect)gpa(dev, "vkCmdDispatchIndirect"); table->CmdCopyBuffer = (PFN_vkCmdCopyBuffer)gpa(dev, "vkCmdCopyBuffer"); table->CmdCopyImage = (PFN_vkCmdCopyImage)gpa(dev, "vkCmdCopyImage"); table->CmdBlitImage = (PFN_vkCmdBlitImage)gpa(dev, "vkCmdBlitImage"); - table->CmdCopyBufferToImage = - (PFN_vkCmdCopyBufferToImage)gpa(dev, "vkCmdCopyBufferToImage"); - table->CmdCopyImageToBuffer = - (PFN_vkCmdCopyImageToBuffer)gpa(dev, "vkCmdCopyImageToBuffer"); - table->CmdUpdateBuffer = - (PFN_vkCmdUpdateBuffer)gpa(dev, "vkCmdUpdateBuffer"); + table->CmdCopyBufferToImage = (PFN_vkCmdCopyBufferToImage)gpa(dev, "vkCmdCopyBufferToImage"); + table->CmdCopyImageToBuffer = (PFN_vkCmdCopyImageToBuffer)gpa(dev, "vkCmdCopyImageToBuffer"); + table->CmdUpdateBuffer = (PFN_vkCmdUpdateBuffer)gpa(dev, "vkCmdUpdateBuffer"); table->CmdFillBuffer = (PFN_vkCmdFillBuffer)gpa(dev, "vkCmdFillBuffer"); - table->CmdClearColorImage = - (PFN_vkCmdClearColorImage)gpa(dev, "vkCmdClearColorImage"); - table->CmdClearDepthStencilImage = (PFN_vkCmdClearDepthStencilImage)gpa( - dev, "vkCmdClearDepthStencilImage"); - table->CmdClearAttachments = - (PFN_vkCmdClearAttachments)gpa(dev, "vkCmdClearAttachments"); - table->CmdResolveImage = - (PFN_vkCmdResolveImage)gpa(dev, "vkCmdResolveImage"); + table->CmdClearColorImage = (PFN_vkCmdClearColorImage)gpa(dev, "vkCmdClearColorImage"); + table->CmdClearDepthStencilImage = (PFN_vkCmdClearDepthStencilImage)gpa(dev, "vkCmdClearDepthStencilImage"); + table->CmdClearAttachments = (PFN_vkCmdClearAttachments)gpa(dev, "vkCmdClearAttachments"); + table->CmdResolveImage = (PFN_vkCmdResolveImage)gpa(dev, "vkCmdResolveImage"); table->CmdSetEvent = (PFN_vkCmdSetEvent)gpa(dev, "vkCmdSetEvent"); table->CmdResetEvent = (PFN_vkCmdResetEvent)gpa(dev, "vkCmdResetEvent"); table->CmdWaitEvents = (PFN_vkCmdWaitEvents)gpa(dev, "vkCmdWaitEvents"); - table->CmdPipelineBarrier = - (PFN_vkCmdPipelineBarrier)gpa(dev, "vkCmdPipelineBarrier"); + table->CmdPipelineBarrier = (PFN_vkCmdPipelineBarrier)gpa(dev, "vkCmdPipelineBarrier"); table->CmdBeginQuery = (PFN_vkCmdBeginQuery)gpa(dev, "vkCmdBeginQuery"); table->CmdEndQuery = (PFN_vkCmdEndQuery)gpa(dev, "vkCmdEndQuery"); - table->CmdResetQueryPool = - (PFN_vkCmdResetQueryPool)gpa(dev, "vkCmdResetQueryPool"); - table->CmdWriteTimestamp = - (PFN_vkCmdWriteTimestamp)gpa(dev, "vkCmdWriteTimestamp"); - table->CmdCopyQueryPoolResults = - (PFN_vkCmdCopyQueryPoolResults)gpa(dev, "vkCmdCopyQueryPoolResults"); - table->CmdPushConstants = - (PFN_vkCmdPushConstants)gpa(dev, "vkCmdPushConstants"); - table->CmdBeginRenderPass = - (PFN_vkCmdBeginRenderPass)gpa(dev, "vkCmdBeginRenderPass"); + table->CmdResetQueryPool = (PFN_vkCmdResetQueryPool)gpa(dev, "vkCmdResetQueryPool"); + table->CmdWriteTimestamp = (PFN_vkCmdWriteTimestamp)gpa(dev, "vkCmdWriteTimestamp"); + table->CmdCopyQueryPoolResults = (PFN_vkCmdCopyQueryPoolResults)gpa(dev, "vkCmdCopyQueryPoolResults"); + table->CmdPushConstants = (PFN_vkCmdPushConstants)gpa(dev, "vkCmdPushConstants"); + table->CmdBeginRenderPass = (PFN_vkCmdBeginRenderPass)gpa(dev, "vkCmdBeginRenderPass"); table->CmdNextSubpass = (PFN_vkCmdNextSubpass)gpa(dev, "vkCmdNextSubpass"); - table->CmdEndRenderPass = - (PFN_vkCmdEndRenderPass)gpa(dev, "vkCmdEndRenderPass"); - table->CmdExecuteCommands = - (PFN_vkCmdExecuteCommands)gpa(dev, "vkCmdExecuteCommands"); + table->CmdEndRenderPass = (PFN_vkCmdEndRenderPass)gpa(dev, "vkCmdEndRenderPass"); + table->CmdExecuteCommands = (PFN_vkCmdExecuteCommands)gpa(dev, "vkCmdExecuteCommands"); } -static inline void loader_init_device_extension_dispatch_table( - struct loader_dev_dispatch_table *dev_table, PFN_vkGetDeviceProcAddr gpa, - VkDevice dev) { +static inline void loader_init_device_extension_dispatch_table(struct loader_dev_dispatch_table *dev_table, + PFN_vkGetDeviceProcAddr gpa, VkDevice dev) { VkLayerDispatchTable *table = &dev_table->core_dispatch; - table->AcquireNextImageKHR = - (PFN_vkAcquireNextImageKHR)gpa(dev, "vkAcquireNextImageKHR"); - table->CreateSwapchainKHR = - (PFN_vkCreateSwapchainKHR)gpa(dev, "vkCreateSwapchainKHR"); - table->DestroySwapchainKHR = - (PFN_vkDestroySwapchainKHR)gpa(dev, "vkDestroySwapchainKHR"); - table->GetSwapchainImagesKHR = - (PFN_vkGetSwapchainImagesKHR)gpa(dev, "vkGetSwapchainImagesKHR"); - table->QueuePresentKHR = - (PFN_vkQueuePresentKHR)gpa(dev, "vkQueuePresentKHR"); + table->AcquireNextImageKHR = (PFN_vkAcquireNextImageKHR)gpa(dev, "vkAcquireNextImageKHR"); + table->CreateSwapchainKHR = (PFN_vkCreateSwapchainKHR)gpa(dev, "vkCreateSwapchainKHR"); + table->DestroySwapchainKHR = (PFN_vkDestroySwapchainKHR)gpa(dev, "vkDestroySwapchainKHR"); + table->GetSwapchainImagesKHR = (PFN_vkGetSwapchainImagesKHR)gpa(dev, "vkGetSwapchainImagesKHR"); + table->QueuePresentKHR = (PFN_vkQueuePresentKHR)gpa(dev, "vkQueuePresentKHR"); // KHR_display_swapchain - table->CreateSharedSwapchainsKHR = (PFN_vkCreateSharedSwapchainsKHR)gpa( - dev, "vkCreateSharedSwapchainsKHR"); + table->CreateSharedSwapchainsKHR = (PFN_vkCreateSharedSwapchainsKHR)gpa(dev, "vkCreateSharedSwapchainsKHR"); // KHR_maintenance1 - table->TrimCommandPoolKHR = - (PFN_vkTrimCommandPoolKHR)gpa(dev, "vkTrimCommandPoolKHR"); + table->TrimCommandPoolKHR = (PFN_vkTrimCommandPoolKHR)gpa(dev, "vkTrimCommandPoolKHR"); // EXT_display_control - table->DisplayPowerControlEXT = - (PFN_vkDisplayPowerControlEXT)gpa(dev, "vkDisplayPowerControlEXT"); - table->RegisterDeviceEventEXT = - (PFN_vkRegisterDeviceEventEXT)gpa(dev, "vkRegisterDeviceEventEXT"); - table->RegisterDisplayEventEXT = - (PFN_vkRegisterDisplayEventEXT)gpa(dev, "vkRegisterDisplayEventEXT"); - table->GetSwapchainCounterEXT = - (PFN_vkGetSwapchainCounterEXT)gpa(dev, "vkGetSwapchainCounterEXT"); + table->DisplayPowerControlEXT = (PFN_vkDisplayPowerControlEXT)gpa(dev, "vkDisplayPowerControlEXT"); + table->RegisterDeviceEventEXT = (PFN_vkRegisterDeviceEventEXT)gpa(dev, "vkRegisterDeviceEventEXT"); + table->RegisterDisplayEventEXT = (PFN_vkRegisterDisplayEventEXT)gpa(dev, "vkRegisterDisplayEventEXT"); + table->GetSwapchainCounterEXT = (PFN_vkGetSwapchainCounterEXT)gpa(dev, "vkGetSwapchainCounterEXT"); // EXT_debug_marker - table->DebugMarkerSetObjectTagEXT = (PFN_vkDebugMarkerSetObjectTagEXT)gpa( - dev, "vkDebugMarkerSetObjectTagEXT"); - table->DebugMarkerSetObjectNameEXT = (PFN_vkDebugMarkerSetObjectNameEXT)gpa( - dev, "vkDebugMarkerSetObjectNameEXT"); - table->CmdDebugMarkerBeginEXT = - (PFN_vkCmdDebugMarkerBeginEXT)gpa(dev, "vkCmdDebugMarkerBeginEXT"); - table->CmdDebugMarkerEndEXT = - (PFN_vkCmdDebugMarkerEndEXT)gpa(dev, "vkCmdDebugMarkerEndEXT"); - table->CmdDebugMarkerInsertEXT = - (PFN_vkCmdDebugMarkerInsertEXT)gpa(dev, "vkCmdDebugMarkerInsertEXT"); + table->DebugMarkerSetObjectTagEXT = (PFN_vkDebugMarkerSetObjectTagEXT)gpa(dev, "vkDebugMarkerSetObjectTagEXT"); + table->DebugMarkerSetObjectNameEXT = (PFN_vkDebugMarkerSetObjectNameEXT)gpa(dev, "vkDebugMarkerSetObjectNameEXT"); + table->CmdDebugMarkerBeginEXT = (PFN_vkCmdDebugMarkerBeginEXT)gpa(dev, "vkCmdDebugMarkerBeginEXT"); + table->CmdDebugMarkerEndEXT = (PFN_vkCmdDebugMarkerEndEXT)gpa(dev, "vkCmdDebugMarkerEndEXT"); + table->CmdDebugMarkerInsertEXT = (PFN_vkCmdDebugMarkerInsertEXT)gpa(dev, "vkCmdDebugMarkerInsertEXT"); // AMD_draw_indirect_count - table->CmdDrawIndirectCountAMD = - (PFN_vkCmdDrawIndirectCountAMD)gpa(dev, "vkCmdDrawIndirectCountAMD"); - table->CmdDrawIndexedIndirectCountAMD = - (PFN_vkCmdDrawIndexedIndirectCountAMD)gpa( - dev, "vkCmdDrawIndexedIndirectCountAMD"); + table->CmdDrawIndirectCountAMD = (PFN_vkCmdDrawIndirectCountAMD)gpa(dev, "vkCmdDrawIndirectCountAMD"); + table->CmdDrawIndexedIndirectCountAMD = (PFN_vkCmdDrawIndexedIndirectCountAMD)gpa(dev, "vkCmdDrawIndexedIndirectCountAMD"); #ifdef VK_USE_PLATFORM_WIN32_KHR // NV_external_memory_win32 - table->GetMemoryWin32HandleNV = - (PFN_vkGetMemoryWin32HandleNV)gpa(dev, "vkGetMemoryWin32HandleNV"); + table->GetMemoryWin32HandleNV = (PFN_vkGetMemoryWin32HandleNV)gpa(dev, "vkGetMemoryWin32HandleNV"); #endif // NVX_device_generated_commands - table->CmdProcessCommandsNVX = - (PFN_vkCmdProcessCommandsNVX)gpa(dev, "vkCmdProcessCommandsNVX"); - table->CmdReserveSpaceForCommandsNVX = - (PFN_vkCmdReserveSpaceForCommandsNVX)gpa( - dev, "vkCmdReserveSpaceForCommandsNVX"); - table->CreateIndirectCommandsLayoutNVX = - (PFN_vkCreateIndirectCommandsLayoutNVX)gpa( - dev, "vkCreateIndirectCommandsLayoutNVX"); + table->CmdProcessCommandsNVX = (PFN_vkCmdProcessCommandsNVX)gpa(dev, "vkCmdProcessCommandsNVX"); + table->CmdReserveSpaceForCommandsNVX = (PFN_vkCmdReserveSpaceForCommandsNVX)gpa(dev, "vkCmdReserveSpaceForCommandsNVX"); + table->CreateIndirectCommandsLayoutNVX = (PFN_vkCreateIndirectCommandsLayoutNVX)gpa(dev, "vkCreateIndirectCommandsLayoutNVX"); table->DestroyIndirectCommandsLayoutNVX = - (PFN_vkDestroyIndirectCommandsLayoutNVX)gpa( - dev, "vkDestroyIndirectCommandsLayoutNVX"); - table->CreateObjectTableNVX = - (PFN_vkCreateObjectTableNVX)gpa(dev, "vkCreateObjectTableNVX"); - table->DestroyObjectTableNVX = - (PFN_vkDestroyObjectTableNVX)gpa(dev, "vkDestroyObjectTableNVX"); - table->RegisterObjectsNVX = - (PFN_vkRegisterObjectsNVX)gpa(dev, "vkRegisterObjectsNVX"); - table->UnregisterObjectsNVX = - (PFN_vkUnregisterObjectsNVX)gpa(dev, "vkUnregisterObjectsNVX"); + (PFN_vkDestroyIndirectCommandsLayoutNVX)gpa(dev, "vkDestroyIndirectCommandsLayoutNVX"); + table->CreateObjectTableNVX = (PFN_vkCreateObjectTableNVX)gpa(dev, "vkCreateObjectTableNVX"); + table->DestroyObjectTableNVX = (PFN_vkDestroyObjectTableNVX)gpa(dev, "vkDestroyObjectTableNVX"); + table->RegisterObjectsNVX = (PFN_vkRegisterObjectsNVX)gpa(dev, "vkRegisterObjectsNVX"); + table->UnregisterObjectsNVX = (PFN_vkUnregisterObjectsNVX)gpa(dev, "vkUnregisterObjectsNVX"); } -static inline void * -loader_lookup_device_dispatch_table(const VkLayerDispatchTable *table, - const char *name) { +static inline void *loader_lookup_device_dispatch_table(const VkLayerDispatchTable *table, const char *name) { if (!name || name[0] != 'v' || name[1] != 'k') return NULL; @@ -612,180 +495,119 @@ loader_lookup_device_dispatch_table(const VkLayerDispatchTable *table, return NULL; } -static inline void -loader_init_instance_core_dispatch_table(VkLayerInstanceDispatchTable *table, - PFN_vkGetInstanceProcAddr gpa, - VkInstance inst) { - table->GetInstanceProcAddr = - (PFN_vkGetInstanceProcAddr)gpa(inst, "vkGetInstanceProcAddr"); - table->DestroyInstance = - (PFN_vkDestroyInstance)gpa(inst, "vkDestroyInstance"); - table->EnumeratePhysicalDevices = - (PFN_vkEnumeratePhysicalDevices)gpa(inst, "vkEnumeratePhysicalDevices"); - table->GetPhysicalDeviceFeatures = (PFN_vkGetPhysicalDeviceFeatures)gpa( - inst, "vkGetPhysicalDeviceFeatures"); +static inline void loader_init_instance_core_dispatch_table(VkLayerInstanceDispatchTable *table, PFN_vkGetInstanceProcAddr gpa, + VkInstance inst) { + table->GetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)gpa(inst, "vkGetInstanceProcAddr"); + table->DestroyInstance = (PFN_vkDestroyInstance)gpa(inst, "vkDestroyInstance"); + table->EnumeratePhysicalDevices = (PFN_vkEnumeratePhysicalDevices)gpa(inst, "vkEnumeratePhysicalDevices"); + table->GetPhysicalDeviceFeatures = (PFN_vkGetPhysicalDeviceFeatures)gpa(inst, "vkGetPhysicalDeviceFeatures"); table->GetPhysicalDeviceImageFormatProperties = - (PFN_vkGetPhysicalDeviceImageFormatProperties)gpa( - inst, "vkGetPhysicalDeviceImageFormatProperties"); + (PFN_vkGetPhysicalDeviceImageFormatProperties)gpa(inst, "vkGetPhysicalDeviceImageFormatProperties"); table->GetPhysicalDeviceFormatProperties = - (PFN_vkGetPhysicalDeviceFormatProperties)gpa( - inst, "vkGetPhysicalDeviceFormatProperties"); + (PFN_vkGetPhysicalDeviceFormatProperties)gpa(inst, "vkGetPhysicalDeviceFormatProperties"); table->GetPhysicalDeviceSparseImageFormatProperties = - (PFN_vkGetPhysicalDeviceSparseImageFormatProperties)gpa( - inst, "vkGetPhysicalDeviceSparseImageFormatProperties"); - table->GetPhysicalDeviceProperties = (PFN_vkGetPhysicalDeviceProperties)gpa( - inst, "vkGetPhysicalDeviceProperties"); + (PFN_vkGetPhysicalDeviceSparseImageFormatProperties)gpa(inst, "vkGetPhysicalDeviceSparseImageFormatProperties"); + table->GetPhysicalDeviceProperties = (PFN_vkGetPhysicalDeviceProperties)gpa(inst, "vkGetPhysicalDeviceProperties"); table->GetPhysicalDeviceQueueFamilyProperties = - (PFN_vkGetPhysicalDeviceQueueFamilyProperties)gpa( - inst, "vkGetPhysicalDeviceQueueFamilyProperties"); + (PFN_vkGetPhysicalDeviceQueueFamilyProperties)gpa(inst, "vkGetPhysicalDeviceQueueFamilyProperties"); table->GetPhysicalDeviceMemoryProperties = - (PFN_vkGetPhysicalDeviceMemoryProperties)gpa( - inst, "vkGetPhysicalDeviceMemoryProperties"); + (PFN_vkGetPhysicalDeviceMemoryProperties)gpa(inst, "vkGetPhysicalDeviceMemoryProperties"); table->EnumerateDeviceExtensionProperties = - (PFN_vkEnumerateDeviceExtensionProperties)gpa( - inst, "vkEnumerateDeviceExtensionProperties"); - table->EnumerateDeviceLayerProperties = - (PFN_vkEnumerateDeviceLayerProperties)gpa( - inst, "vkEnumerateDeviceLayerProperties"); + (PFN_vkEnumerateDeviceExtensionProperties)gpa(inst, "vkEnumerateDeviceExtensionProperties"); + table->EnumerateDeviceLayerProperties = (PFN_vkEnumerateDeviceLayerProperties)gpa(inst, "vkEnumerateDeviceLayerProperties"); } -static inline void loader_init_instance_extension_dispatch_table( - VkLayerInstanceDispatchTable *table, PFN_vkGetInstanceProcAddr gpa, - VkInstance inst) { +static inline void loader_init_instance_extension_dispatch_table(VkLayerInstanceDispatchTable *table, PFN_vkGetInstanceProcAddr gpa, + VkInstance inst) { // WSI extensions - table->DestroySurfaceKHR = - (PFN_vkDestroySurfaceKHR)gpa(inst, "vkDestroySurfaceKHR"); + table->DestroySurfaceKHR = (PFN_vkDestroySurfaceKHR)gpa(inst, "vkDestroySurfaceKHR"); table->GetPhysicalDeviceSurfaceSupportKHR = - (PFN_vkGetPhysicalDeviceSurfaceSupportKHR)gpa( - inst, "vkGetPhysicalDeviceSurfaceSupportKHR"); + (PFN_vkGetPhysicalDeviceSurfaceSupportKHR)gpa(inst, "vkGetPhysicalDeviceSurfaceSupportKHR"); table->GetPhysicalDeviceSurfaceCapabilitiesKHR = - (PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR)gpa( - inst, "vkGetPhysicalDeviceSurfaceCapabilitiesKHR"); + (PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR)gpa(inst, "vkGetPhysicalDeviceSurfaceCapabilitiesKHR"); table->GetPhysicalDeviceSurfaceFormatsKHR = - (PFN_vkGetPhysicalDeviceSurfaceFormatsKHR)gpa( - inst, "vkGetPhysicalDeviceSurfaceFormatsKHR"); + (PFN_vkGetPhysicalDeviceSurfaceFormatsKHR)gpa(inst, "vkGetPhysicalDeviceSurfaceFormatsKHR"); table->GetPhysicalDeviceSurfacePresentModesKHR = - (PFN_vkGetPhysicalDeviceSurfacePresentModesKHR)gpa( - inst, "vkGetPhysicalDeviceSurfacePresentModesKHR"); + (PFN_vkGetPhysicalDeviceSurfacePresentModesKHR)gpa(inst, "vkGetPhysicalDeviceSurfacePresentModesKHR"); #ifdef VK_USE_PLATFORM_MIR_KHR - table->CreateMirSurfaceKHR = - (PFN_vkCreateMirSurfaceKHR)gpa(inst, "vkCreateMirSurfaceKHR"); + table->CreateMirSurfaceKHR = (PFN_vkCreateMirSurfaceKHR)gpa(inst, "vkCreateMirSurfaceKHR"); table->GetPhysicalDeviceMirPresentationSupportKHR = - (PFN_vkGetPhysicalDeviceMirPresentationSupportKHR)gpa( - inst, "vkGetPhysicalDeviceMirPresentationSupportKHR"); + (PFN_vkGetPhysicalDeviceMirPresentationSupportKHR)gpa(inst, "vkGetPhysicalDeviceMirPresentationSupportKHR"); #endif #ifdef VK_USE_PLATFORM_WAYLAND_KHR - table->CreateWaylandSurfaceKHR = - (PFN_vkCreateWaylandSurfaceKHR)gpa(inst, "vkCreateWaylandSurfaceKHR"); + table->CreateWaylandSurfaceKHR = (PFN_vkCreateWaylandSurfaceKHR)gpa(inst, "vkCreateWaylandSurfaceKHR"); table->GetPhysicalDeviceWaylandPresentationSupportKHR = - (PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR)gpa( - inst, "vkGetPhysicalDeviceWaylandPresentationSupportKHR"); + (PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR)gpa(inst, "vkGetPhysicalDeviceWaylandPresentationSupportKHR"); #endif #ifdef VK_USE_PLATFORM_WIN32_KHR - table->CreateWin32SurfaceKHR = - (PFN_vkCreateWin32SurfaceKHR)gpa(inst, "vkCreateWin32SurfaceKHR"); + table->CreateWin32SurfaceKHR = (PFN_vkCreateWin32SurfaceKHR)gpa(inst, "vkCreateWin32SurfaceKHR"); table->GetPhysicalDeviceWin32PresentationSupportKHR = - (PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR)gpa( - inst, "vkGetPhysicalDeviceWin32PresentationSupportKHR"); + (PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR)gpa(inst, "vkGetPhysicalDeviceWin32PresentationSupportKHR"); #endif #ifdef VK_USE_PLATFORM_XCB_KHR - table->CreateXcbSurfaceKHR = - (PFN_vkCreateXcbSurfaceKHR)gpa(inst, "vkCreateXcbSurfaceKHR"); + table->CreateXcbSurfaceKHR = (PFN_vkCreateXcbSurfaceKHR)gpa(inst, "vkCreateXcbSurfaceKHR"); table->GetPhysicalDeviceXcbPresentationSupportKHR = - (PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR)gpa( - inst, "vkGetPhysicalDeviceXcbPresentationSupportKHR"); + (PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR)gpa(inst, "vkGetPhysicalDeviceXcbPresentationSupportKHR"); #endif #ifdef VK_USE_PLATFORM_XLIB_KHR - table->CreateXlibSurfaceKHR = - (PFN_vkCreateXlibSurfaceKHR)gpa(inst, "vkCreateXlibSurfaceKHR"); + table->CreateXlibSurfaceKHR = (PFN_vkCreateXlibSurfaceKHR)gpa(inst, "vkCreateXlibSurfaceKHR"); table->GetPhysicalDeviceXlibPresentationSupportKHR = - (PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR)gpa( - inst, "vkGetPhysicalDeviceXlibPresentationSupportKHR"); + (PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR)gpa(inst, "vkGetPhysicalDeviceXlibPresentationSupportKHR"); #endif table->GetPhysicalDeviceDisplayPropertiesKHR = - (PFN_vkGetPhysicalDeviceDisplayPropertiesKHR)gpa( - inst, "vkGetPhysicalDeviceDisplayPropertiesKHR"); + (PFN_vkGetPhysicalDeviceDisplayPropertiesKHR)gpa(inst, "vkGetPhysicalDeviceDisplayPropertiesKHR"); table->GetPhysicalDeviceDisplayPlanePropertiesKHR = - (PFN_vkGetPhysicalDeviceDisplayPlanePropertiesKHR)gpa( - inst, "vkGetPhysicalDeviceDisplayPlanePropertiesKHR"); + (PFN_vkGetPhysicalDeviceDisplayPlanePropertiesKHR)gpa(inst, "vkGetPhysicalDeviceDisplayPlanePropertiesKHR"); table->GetDisplayPlaneSupportedDisplaysKHR = - (PFN_vkGetDisplayPlaneSupportedDisplaysKHR)gpa( - inst, "vkGetDisplayPlaneSupportedDisplaysKHR"); - table->GetDisplayModePropertiesKHR = (PFN_vkGetDisplayModePropertiesKHR)gpa( - inst, "vkGetDisplayModePropertiesKHR"); - table->CreateDisplayModeKHR = - (PFN_vkCreateDisplayModeKHR)gpa(inst, "vkCreateDisplayModeKHR"); - table->GetDisplayPlaneCapabilitiesKHR = - (PFN_vkGetDisplayPlaneCapabilitiesKHR)gpa( - inst, "vkGetDisplayPlaneCapabilitiesKHR"); - table->CreateDisplayPlaneSurfaceKHR = - (PFN_vkCreateDisplayPlaneSurfaceKHR)gpa( - inst, "vkCreateDisplayPlaneSurfaceKHR"); + (PFN_vkGetDisplayPlaneSupportedDisplaysKHR)gpa(inst, "vkGetDisplayPlaneSupportedDisplaysKHR"); + table->GetDisplayModePropertiesKHR = (PFN_vkGetDisplayModePropertiesKHR)gpa(inst, "vkGetDisplayModePropertiesKHR"); + table->CreateDisplayModeKHR = (PFN_vkCreateDisplayModeKHR)gpa(inst, "vkCreateDisplayModeKHR"); + table->GetDisplayPlaneCapabilitiesKHR = (PFN_vkGetDisplayPlaneCapabilitiesKHR)gpa(inst, "vkGetDisplayPlaneCapabilitiesKHR"); + table->CreateDisplayPlaneSurfaceKHR = (PFN_vkCreateDisplayPlaneSurfaceKHR)gpa(inst, "vkCreateDisplayPlaneSurfaceKHR"); // KHR_get_physical_device_properties2 - table->GetPhysicalDeviceFeatures2KHR = - (PFN_vkGetPhysicalDeviceFeatures2KHR)gpa( - inst, "vkGetPhysicalDeviceFeatures2KHR"); - table->GetPhysicalDeviceProperties2KHR = - (PFN_vkGetPhysicalDeviceProperties2KHR)gpa( - inst, "vkGetPhysicalDeviceProperties2KHR"); + table->GetPhysicalDeviceFeatures2KHR = (PFN_vkGetPhysicalDeviceFeatures2KHR)gpa(inst, "vkGetPhysicalDeviceFeatures2KHR"); + table->GetPhysicalDeviceProperties2KHR = (PFN_vkGetPhysicalDeviceProperties2KHR)gpa(inst, "vkGetPhysicalDeviceProperties2KHR"); table->GetPhysicalDeviceFormatProperties2KHR = - (PFN_vkGetPhysicalDeviceFormatProperties2KHR)gpa( - inst, "vkGetPhysicalDeviceFormatProperties2KHR"); + (PFN_vkGetPhysicalDeviceFormatProperties2KHR)gpa(inst, "vkGetPhysicalDeviceFormatProperties2KHR"); table->GetPhysicalDeviceImageFormatProperties2KHR = - (PFN_vkGetPhysicalDeviceImageFormatProperties2KHR)gpa( - inst, "vkGetPhysicalDeviceImageFormatProperties2KHR"); + (PFN_vkGetPhysicalDeviceImageFormatProperties2KHR)gpa(inst, "vkGetPhysicalDeviceImageFormatProperties2KHR"); table->GetPhysicalDeviceQueueFamilyProperties2KHR = - (PFN_vkGetPhysicalDeviceQueueFamilyProperties2KHR)gpa( - inst, "vkGetPhysicalDeviceQueueFamilyProperties2KHR"); + (PFN_vkGetPhysicalDeviceQueueFamilyProperties2KHR)gpa(inst, "vkGetPhysicalDeviceQueueFamilyProperties2KHR"); table->GetPhysicalDeviceMemoryProperties2KHR = - (PFN_vkGetPhysicalDeviceMemoryProperties2KHR)gpa( - inst, "vkGetPhysicalDeviceMemoryProperties2KHR"); + (PFN_vkGetPhysicalDeviceMemoryProperties2KHR)gpa(inst, "vkGetPhysicalDeviceMemoryProperties2KHR"); table->GetPhysicalDeviceSparseImageFormatProperties2KHR = - (PFN_vkGetPhysicalDeviceSparseImageFormatProperties2KHR)gpa( - inst, "vkGetPhysicalDeviceSparseImageFormatProperties2KHR"); + (PFN_vkGetPhysicalDeviceSparseImageFormatProperties2KHR)gpa(inst, "vkGetPhysicalDeviceSparseImageFormatProperties2KHR"); #ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT // EXT_acquire_xlib_display - table->AcquireXlibDisplayEXT = - (PFN_vkAcquireXlibDisplayEXT)gpa(inst, "vkAcquireXlibDisplayEXT"); - table->GetRandROutputDisplayEXT = - (PFN_vkGetRandROutputDisplayEXT)gpa(inst, "vkGetRandROutputDisplayEXT"); + table->AcquireXlibDisplayEXT = (PFN_vkAcquireXlibDisplayEXT)gpa(inst, "vkAcquireXlibDisplayEXT"); + table->GetRandROutputDisplayEXT = (PFN_vkGetRandROutputDisplayEXT)gpa(inst, "vkGetRandROutputDisplayEXT"); #endif // EXT_debug_report - table->CreateDebugReportCallbackEXT = - (PFN_vkCreateDebugReportCallbackEXT)gpa( - inst, "vkCreateDebugReportCallbackEXT"); - table->DestroyDebugReportCallbackEXT = - (PFN_vkDestroyDebugReportCallbackEXT)gpa( - inst, "vkDestroyDebugReportCallbackEXT"); - table->DebugReportMessageEXT = - (PFN_vkDebugReportMessageEXT)gpa(inst, "vkDebugReportMessageEXT"); + table->CreateDebugReportCallbackEXT = (PFN_vkCreateDebugReportCallbackEXT)gpa(inst, "vkCreateDebugReportCallbackEXT"); + table->DestroyDebugReportCallbackEXT = (PFN_vkDestroyDebugReportCallbackEXT)gpa(inst, "vkDestroyDebugReportCallbackEXT"); + table->DebugReportMessageEXT = (PFN_vkDebugReportMessageEXT)gpa(inst, "vkDebugReportMessageEXT"); // EXT_direct_mode_display - table->ReleaseDisplayEXT = - (PFN_vkReleaseDisplayEXT)gpa(inst, "vkReleaseDisplayEXT"); + table->ReleaseDisplayEXT = (PFN_vkReleaseDisplayEXT)gpa(inst, "vkReleaseDisplayEXT"); // EXT_display_surface_counter table->GetPhysicalDeviceSurfaceCapabilities2EXT = - (PFN_vkGetPhysicalDeviceSurfaceCapabilities2EXT)gpa( - inst, "vkGetPhysicalDeviceSurfaceCapabilities2EXT"); + (PFN_vkGetPhysicalDeviceSurfaceCapabilities2EXT)gpa(inst, "vkGetPhysicalDeviceSurfaceCapabilities2EXT"); // NV_external_memory_capabilities table->GetPhysicalDeviceExternalImageFormatPropertiesNV = - (PFN_vkGetPhysicalDeviceExternalImageFormatPropertiesNV)gpa( - inst, "vkGetPhysicalDeviceExternalImageFormatPropertiesNV"); + (PFN_vkGetPhysicalDeviceExternalImageFormatPropertiesNV)gpa(inst, "vkGetPhysicalDeviceExternalImageFormatPropertiesNV"); // NVX_device_generated_commands (physical device command) table->GetPhysicalDeviceGeneratedCommandsPropertiesNVX = - (PFN_vkGetPhysicalDeviceGeneratedCommandsPropertiesNVX)gpa( - inst, "vkGetPhysicalDeviceGeneratedCommandsPropertiesNVX"); + (PFN_vkGetPhysicalDeviceGeneratedCommandsPropertiesNVX)gpa(inst, "vkGetPhysicalDeviceGeneratedCommandsPropertiesNVX"); } -static inline void *loader_lookup_instance_extension_dispatch_table( - const VkLayerInstanceDispatchTable *table, const char *name, - bool *found_name) { +static inline void *loader_lookup_instance_extension_dispatch_table(const VkLayerInstanceDispatchTable *table, const char *name, + bool *found_name) { *found_name = true; @@ -841,9 +663,8 @@ static inline void *loader_lookup_instance_extension_dispatch_table( return NULL; } -static inline void * -loader_lookup_instance_dispatch_table(const VkLayerInstanceDispatchTable *table, - const char *name, bool *found_name) { +static inline void *loader_lookup_instance_dispatch_table(const VkLayerInstanceDispatchTable *table, const char *name, + bool *found_name) { if (!name || name[0] != 'v' || name[1] != 'k') { *found_name = false; return NULL; @@ -930,6 +751,5 @@ loader_lookup_instance_dispatch_table(const VkLayerInstanceDispatchTable *table, if (!strcmp(name, "CreateDisplayPlaneSurfaceKHR")) return (void *)table->CreateDisplayPlaneSurfaceKHR; - return loader_lookup_instance_extension_dispatch_table(table, name, - found_name); + return loader_lookup_instance_extension_dispatch_table(table, name, found_name); } diff --git a/loader/trampoline.c b/loader/trampoline.c index 207a7476..31352ae9 100644 --- a/loader/trampoline.c +++ b/loader/trampoline.c @@ -45,8 +45,7 @@ * Vulkan * functions both core and extensions. */ -LOADER_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL -vkGetInstanceProcAddr(VkInstance instance, const char *pName) { +LOADER_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetInstanceProcAddr(VkInstance instance, const char *pName) { void *addr; @@ -81,8 +80,7 @@ vkGetInstanceProcAddr(VkInstance instance, const char *pName) { * entry points both core and extensions. * Device relative means call down the device chain. */ -LOADER_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL -vkGetDeviceProcAddr(VkDevice device, const char *pName) { +LOADER_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetDeviceProcAddr(VkDevice device, const char *pName) { void *addr; /* for entrypoints that loader must handle (ie non-dispatchable or create @@ -113,10 +111,9 @@ vkGetDeviceProcAddr(VkDevice device, const char *pName) { return disp_table->GetDeviceProcAddr(device, pName); } -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL -vkEnumerateInstanceExtensionProperties(const char *pLayerName, - uint32_t *pPropertyCount, - VkExtensionProperties *pProperties) { +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceExtensionProperties(const char *pLayerName, + uint32_t *pPropertyCount, + VkExtensionProperties *pProperties) { struct loader_extension_list *global_ext_list = NULL; struct loader_layer_list instance_layers; struct loader_extension_list local_ext_list; @@ -131,8 +128,7 @@ vkEnumerateInstanceExtensionProperties(const char *pLayerName, /* get layer libraries if needed */ if (pLayerName && strlen(pLayerName) != 0) { - if (vk_string_validate(MaxLoaderStringLength, pLayerName) != - VK_STRING_ERROR_NONE) { + if (vk_string_validate(MaxLoaderStringLength, pLayerName) != VK_STRING_ERROR_NONE) { assert(VK_FALSE && "vkEnumerateInstanceExtensionProperties: " "pLayerName is too long or is badly formed"); res = VK_ERROR_EXTENSION_NOT_PRESENT; @@ -143,26 +139,20 @@ vkEnumerateInstanceExtensionProperties(const char *pLayerName, if (strcmp(pLayerName, std_validation_str) == 0) { struct loader_layer_list local_list; memset(&local_list, 0, sizeof(local_list)); - for (uint32_t i = 0; i < sizeof(std_validation_names) / - sizeof(std_validation_names[0]); - i++) { - loader_find_layer_name_add_list(NULL, std_validation_names[i], - VK_LAYER_TYPE_INSTANCE_EXPLICIT, - &instance_layers, &local_list); + for (uint32_t i = 0; i < sizeof(std_validation_names) / sizeof(std_validation_names[0]); i++) { + loader_find_layer_name_add_list(NULL, std_validation_names[i], VK_LAYER_TYPE_INSTANCE_EXPLICIT, &instance_layers, + &local_list); } for (uint32_t i = 0; i < local_list.count; i++) { - struct loader_extension_list *ext_list = - &local_list.list[i].instance_extension_list; - loader_add_to_ext_list(NULL, &local_ext_list, ext_list->count, - ext_list->list); + struct loader_extension_list *ext_list = &local_list.list[i].instance_extension_list; + loader_add_to_ext_list(NULL, &local_ext_list, ext_list->count, ext_list->list); } loader_destroy_layer_list(NULL, NULL, &local_list); global_ext_list = &local_ext_list; } else { for (uint32_t i = 0; i < instance_layers.count; i++) { - struct loader_layer_properties *props = - &instance_layers.list[i]; + struct loader_layer_properties *props = &instance_layers.list[i]; if (strcmp(props->info.layerName, pLayerName) == 0) { global_ext_list = &props->instance_extension_list; break; @@ -177,8 +167,7 @@ vkEnumerateInstanceExtensionProperties(const char *pLayerName, goto out; } /* get extensions from all ICD's, merge so no duplicates */ - res = loader_get_icd_loader_instance_extensions(NULL, &icd_tramp_list, - &local_ext_list); + res = loader_get_icd_loader_instance_extensions(NULL, &icd_tramp_list, &local_ext_list); if (VK_SUCCESS != res) { goto out; } @@ -187,10 +176,8 @@ vkEnumerateInstanceExtensionProperties(const char *pLayerName, // Append implicit layers. loader_implicit_layer_scan(NULL, &instance_layers); for (uint32_t i = 0; i < instance_layers.count; i++) { - struct loader_extension_list *ext_list = - &instance_layers.list[i].instance_extension_list; - loader_add_to_ext_list(NULL, &local_ext_list, ext_list->count, - ext_list->list); + struct loader_extension_list *ext_list = &instance_layers.list[i].instance_extension_list; + loader_add_to_ext_list(NULL, &local_ext_list, ext_list->count, ext_list->list); } global_ext_list = &local_ext_list; @@ -206,12 +193,9 @@ vkEnumerateInstanceExtensionProperties(const char *pLayerName, goto out; } - copy_size = *pPropertyCount < global_ext_list->count - ? *pPropertyCount - : global_ext_list->count; + copy_size = *pPropertyCount < global_ext_list->count ? *pPropertyCount : global_ext_list->count; for (uint32_t i = 0; i < copy_size; i++) { - memcpy(&pProperties[i], &global_ext_list->list[i], - sizeof(VkExtensionProperties)); + memcpy(&pProperties[i], &global_ext_list->list[i], sizeof(VkExtensionProperties)); } *pPropertyCount = copy_size; @@ -222,14 +206,13 @@ vkEnumerateInstanceExtensionProperties(const char *pLayerName, out: - loader_destroy_generic_list(NULL, - (struct loader_generic_list *)&local_ext_list); + loader_destroy_generic_list(NULL, (struct loader_generic_list *)&local_ext_list); loader_delete_layer_properties(NULL, &instance_layers); return res; } -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceLayerProperties( - uint32_t *pPropertyCount, VkLayerProperties *pProperties) { +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceLayerProperties(uint32_t *pPropertyCount, + VkLayerProperties *pProperties) { struct loader_layer_list instance_layer_list; tls_instance = NULL; @@ -248,12 +231,9 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceLayerProperties( return VK_SUCCESS; } - copy_size = (*pPropertyCount < instance_layer_list.count) - ? *pPropertyCount - : instance_layer_list.count; + copy_size = (*pPropertyCount < instance_layer_list.count) ? *pPropertyCount : instance_layer_list.count; for (uint32_t i = 0; i < copy_size; i++) { - memcpy(&pProperties[i], &instance_layer_list.list[i].info, - sizeof(VkLayerProperties)); + memcpy(&pProperties[i], &instance_layer_list.list[i].info, sizeof(VkLayerProperties)); } *pPropertyCount = copy_size; @@ -268,9 +248,8 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceLayerProperties( return VK_SUCCESS; } -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateInstance( - const VkInstanceCreateInfo *pCreateInfo, - const VkAllocationCallbacks *pAllocator, VkInstance *pInstance) { +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateInstance(const VkInstanceCreateInfo *pCreateInfo, + const VkAllocationCallbacks *pAllocator, VkInstance *pInstance) { struct loader_instance *ptr_instance = NULL; VkInstance created_instance = VK_NULL_HANDLE; bool loaderLocked = false; @@ -282,13 +261,11 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateInstance( { #else if (pAllocator) { - ptr_instance = (struct loader_instance *)pAllocator->pfnAllocation( - pAllocator->pUserData, sizeof(struct loader_instance), - sizeof(int *), VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); + ptr_instance = (struct loader_instance *)pAllocator->pfnAllocation(pAllocator->pUserData, sizeof(struct loader_instance), + sizeof(int *), VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); } else { #endif - ptr_instance = - (struct loader_instance *)malloc(sizeof(struct loader_instance)); + ptr_instance = (struct loader_instance *)malloc(sizeof(struct loader_instance)); } VkInstanceCreateInfo ici = *pCreateInfo; @@ -313,20 +290,16 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateInstance( ptr_instance->num_tmp_callbacks = 0; ptr_instance->tmp_dbg_create_infos = NULL; ptr_instance->tmp_callbacks = NULL; - if (util_CopyDebugReportCreateInfos(pCreateInfo->pNext, pAllocator, - &ptr_instance->num_tmp_callbacks, - &ptr_instance->tmp_dbg_create_infos, - &ptr_instance->tmp_callbacks)) { + if (util_CopyDebugReportCreateInfos(pCreateInfo->pNext, pAllocator, &ptr_instance->num_tmp_callbacks, + &ptr_instance->tmp_dbg_create_infos, &ptr_instance->tmp_callbacks)) { // One or more were found, but allocation failed. Therefore, clean up // and fail this function: res = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; } else if (ptr_instance->num_tmp_callbacks > 0) { // Setup the temporary callback(s) here to catch early issues: - if (util_CreateDebugReportCallbacks(ptr_instance, pAllocator, - ptr_instance->num_tmp_callbacks, - ptr_instance->tmp_dbg_create_infos, - ptr_instance->tmp_callbacks)) { + if (util_CreateDebugReportCallbacks(ptr_instance, pAllocator, ptr_instance->num_tmp_callbacks, + ptr_instance->tmp_dbg_create_infos, ptr_instance->tmp_callbacks)) { // Failure of setting up one or more of the callback. Therefore, // clean up and fail this function: res = VK_ERROR_OUT_OF_HOST_MEMORY; @@ -337,59 +310,49 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateInstance( /* Due to implicit layers need to get layer list even if * enabledLayerCount == 0 and VK_INSTANCE_LAYERS is unset. For now always * get layer list via loader_layer_scan(). */ - memset(&ptr_instance->instance_layer_list, 0, - sizeof(ptr_instance->instance_layer_list)); + memset(&ptr_instance->instance_layer_list, 0, sizeof(ptr_instance->instance_layer_list)); loader_layer_scan(ptr_instance, &ptr_instance->instance_layer_list); /* validate the app requested layers to be enabled */ if (pCreateInfo->enabledLayerCount > 0) { - res = - loader_validate_layers(ptr_instance, pCreateInfo->enabledLayerCount, - pCreateInfo->ppEnabledLayerNames, - &ptr_instance->instance_layer_list); + res = loader_validate_layers(ptr_instance, pCreateInfo->enabledLayerCount, pCreateInfo->ppEnabledLayerNames, + &ptr_instance->instance_layer_list); if (res != VK_SUCCESS) { goto out; } } /* convert any meta layers to the actual layers makes a copy of layer name*/ - VkResult layerErr = loader_expand_layer_names( - ptr_instance, std_validation_str, - sizeof(std_validation_names) / sizeof(std_validation_names[0]), - std_validation_names, &ici.enabledLayerCount, &ici.ppEnabledLayerNames); + VkResult layerErr = + loader_expand_layer_names(ptr_instance, std_validation_str, sizeof(std_validation_names) / sizeof(std_validation_names[0]), + std_validation_names, &ici.enabledLayerCount, &ici.ppEnabledLayerNames); if (VK_SUCCESS != layerErr) { res = layerErr; goto out; } /* Scan/discover all ICD libraries */ - memset(&ptr_instance->icd_tramp_list, 0, - sizeof(ptr_instance->icd_tramp_list)); + memset(&ptr_instance->icd_tramp_list, 0, sizeof(ptr_instance->icd_tramp_list)); res = loader_icd_scan(ptr_instance, &ptr_instance->icd_tramp_list); if (res != VK_SUCCESS) { goto out; } /* get extensions from all ICD's, merge so no duplicates, then validate */ - res = loader_get_icd_loader_instance_extensions( - ptr_instance, &ptr_instance->icd_tramp_list, &ptr_instance->ext_list); + res = loader_get_icd_loader_instance_extensions(ptr_instance, &ptr_instance->icd_tramp_list, &ptr_instance->ext_list); if (res != VK_SUCCESS) { goto out; } - res = loader_validate_instance_extensions( - ptr_instance, &ptr_instance->ext_list, - &ptr_instance->instance_layer_list, &ici); + res = loader_validate_instance_extensions(ptr_instance, &ptr_instance->ext_list, &ptr_instance->instance_layer_list, &ici); if (res != VK_SUCCESS) { goto out; } - ptr_instance->disp = loader_instance_heap_alloc( - ptr_instance, sizeof(VkLayerInstanceDispatchTable), - VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); + ptr_instance->disp = + loader_instance_heap_alloc(ptr_instance, sizeof(VkLayerInstanceDispatchTable), VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (ptr_instance->disp == NULL) { - loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "vkCreateInstance: Failed to allocate Instance dispatch" - " table."); + loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "vkCreateInstance: Failed to allocate Instance dispatch" + " table."); res = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; } @@ -398,15 +361,13 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateInstance( loader.instances = ptr_instance; /* activate any layers on instance chain */ - res = loader_enable_instance_layers(ptr_instance, &ici, - &ptr_instance->instance_layer_list); + res = loader_enable_instance_layers(ptr_instance, &ici, &ptr_instance->instance_layer_list); if (res != VK_SUCCESS) { goto out; } created_instance = (VkInstance)ptr_instance; - res = loader_create_instance_chain(&ici, pAllocator, ptr_instance, - &created_instance); + res = loader_create_instance_chain(&ici, pAllocator, ptr_instance, &created_instance); if (res == VK_SUCCESS) { memset(ptr_instance->enabled_known_extensions.padding, 0, sizeof(uint64_t) * 4); @@ -437,35 +398,24 @@ out: loader_instance_heap_free(ptr_instance, ptr_instance->disp); } if (ptr_instance->num_tmp_callbacks > 0) { - util_DestroyDebugReportCallbacks( - ptr_instance, pAllocator, ptr_instance->num_tmp_callbacks, - ptr_instance->tmp_callbacks); - util_FreeDebugReportCreateInfos( - pAllocator, ptr_instance->tmp_dbg_create_infos, - ptr_instance->tmp_callbacks); + util_DestroyDebugReportCallbacks(ptr_instance, pAllocator, ptr_instance->num_tmp_callbacks, + ptr_instance->tmp_callbacks); + util_FreeDebugReportCreateInfos(pAllocator, ptr_instance->tmp_dbg_create_infos, ptr_instance->tmp_callbacks); } - loader_deactivate_layers(ptr_instance, NULL, - &ptr_instance->activated_layer_list); + loader_deactivate_layers(ptr_instance, NULL, &ptr_instance->activated_layer_list); - loader_delete_shadow_inst_layer_names(ptr_instance, pCreateInfo, - &ici); - loader_delete_layer_properties(ptr_instance, - &ptr_instance->instance_layer_list); - loader_scanned_icd_clear(ptr_instance, - &ptr_instance->icd_tramp_list); - loader_destroy_generic_list( - ptr_instance, - (struct loader_generic_list *)&ptr_instance->ext_list); + loader_delete_shadow_inst_layer_names(ptr_instance, pCreateInfo, &ici); + loader_delete_layer_properties(ptr_instance, &ptr_instance->instance_layer_list); + loader_scanned_icd_clear(ptr_instance, &ptr_instance->icd_tramp_list); + loader_destroy_generic_list(ptr_instance, (struct loader_generic_list *)&ptr_instance->ext_list); loader_instance_heap_free(ptr_instance, ptr_instance); } else { /* Remove temporary debug_report callback */ - util_DestroyDebugReportCallbacks(ptr_instance, pAllocator, - ptr_instance->num_tmp_callbacks, + util_DestroyDebugReportCallbacks(ptr_instance, pAllocator, ptr_instance->num_tmp_callbacks, ptr_instance->tmp_callbacks); - loader_delete_shadow_inst_layer_names(ptr_instance, pCreateInfo, - &ici); + loader_delete_shadow_inst_layer_names(ptr_instance, pCreateInfo, &ici); } if (loaderLocked) { @@ -476,8 +426,7 @@ out: return res; } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyInstance( - VkInstance instance, const VkAllocationCallbacks *pAllocator) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyInstance(VkInstance instance, const VkAllocationCallbacks *pAllocator) { const VkLayerInstanceDispatchTable *disp; struct loader_instance *ptr_instance = NULL; bool callback_setup = false; @@ -498,43 +447,34 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyInstance( if (ptr_instance->num_tmp_callbacks > 0) { // Setup the temporary callback(s) here to catch cleanup issues: - if (!util_CreateDebugReportCallbacks(ptr_instance, pAllocator, - ptr_instance->num_tmp_callbacks, - ptr_instance->tmp_dbg_create_infos, - ptr_instance->tmp_callbacks)) { + if (!util_CreateDebugReportCallbacks(ptr_instance, pAllocator, ptr_instance->num_tmp_callbacks, + ptr_instance->tmp_dbg_create_infos, ptr_instance->tmp_callbacks)) { callback_setup = true; } } disp->DestroyInstance(instance, pAllocator); - loader_deactivate_layers(ptr_instance, NULL, - &ptr_instance->activated_layer_list); + loader_deactivate_layers(ptr_instance, NULL, &ptr_instance->activated_layer_list); if (ptr_instance->phys_devs_tramp) { for (uint32_t i = 0; i < ptr_instance->phys_dev_count_tramp; i++) { - loader_instance_heap_free(ptr_instance, - ptr_instance->phys_devs_tramp[i]); + loader_instance_heap_free(ptr_instance, ptr_instance->phys_devs_tramp[i]); } loader_instance_heap_free(ptr_instance, ptr_instance->phys_devs_tramp); } if (callback_setup) { - util_DestroyDebugReportCallbacks(ptr_instance, pAllocator, - ptr_instance->num_tmp_callbacks, - ptr_instance->tmp_callbacks); - util_FreeDebugReportCreateInfos(pAllocator, - ptr_instance->tmp_dbg_create_infos, - ptr_instance->tmp_callbacks); + util_DestroyDebugReportCallbacks(ptr_instance, pAllocator, ptr_instance->num_tmp_callbacks, ptr_instance->tmp_callbacks); + util_FreeDebugReportCreateInfos(pAllocator, ptr_instance->tmp_dbg_create_infos, ptr_instance->tmp_callbacks); } loader_instance_heap_free(ptr_instance, ptr_instance->disp); loader_instance_heap_free(ptr_instance, ptr_instance); loader_platform_thread_unlock_mutex(&loader_lock); } -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL -vkEnumeratePhysicalDevices(VkInstance instance, uint32_t *pPhysicalDeviceCount, - VkPhysicalDevice *pPhysicalDevices) { +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumeratePhysicalDevices(VkInstance instance, uint32_t *pPhysicalDeviceCount, + VkPhysicalDevice *pPhysicalDevices) { const VkLayerInstanceDispatchTable *disp; VkResult res = VK_SUCCESS; uint32_t count, i; @@ -552,12 +492,10 @@ vkEnumeratePhysicalDevices(VkInstance instance, uint32_t *pPhysicalDeviceCount, if (NULL == pPhysicalDevices || 0 == inst->total_gpu_count) { // Call down. At the lower levels, this will setup the terminator // structures in the loader. - res = disp->EnumeratePhysicalDevices(instance, pPhysicalDeviceCount, - pPhysicalDevices); + res = disp->EnumeratePhysicalDevices(instance, pPhysicalDeviceCount, pPhysicalDevices); if (VK_SUCCESS != res) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "vkEnumeratePhysicalDevices: Failed in dispatch call" - " used to determine number of available GPUs"); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "vkEnumeratePhysicalDevices: Failed in dispatch call" + " used to determine number of available GPUs"); } } @@ -574,9 +512,8 @@ vkEnumeratePhysicalDevices(VkInstance instance, uint32_t *pPhysicalDeviceCount, // Wrap the PhysDev object for loader usage, return wrapped objects if (inst->total_gpu_count > *pPhysicalDeviceCount) { - loader_log(inst, VK_DEBUG_REPORT_INFORMATION_BIT_EXT, 0, - "vkEnumeratePhysicalDevices: Trimming device count down" - " by application request from %d to %d physical devices", + loader_log(inst, VK_DEBUG_REPORT_INFORMATION_BIT_EXT, 0, "vkEnumeratePhysicalDevices: Trimming device count down" + " by application request from %d to %d physical devices", inst->total_gpu_count, *pPhysicalDeviceCount); count = *pPhysicalDeviceCount; res = VK_INCOMPLETE; @@ -595,74 +532,59 @@ out: return res; } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFeatures( - VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures *pFeatures) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice, + VkPhysicalDeviceFeatures *pFeatures) { const VkLayerInstanceDispatchTable *disp; - VkPhysicalDevice unwrapped_phys_dev = - loader_unwrap_physical_device(physicalDevice); + VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); disp = loader_get_instance_layer_dispatch(physicalDevice); disp->GetPhysicalDeviceFeatures(unwrapped_phys_dev, pFeatures); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFormatProperties( - VkPhysicalDevice physicalDevice, VkFormat format, - VkFormatProperties *pFormatInfo) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, + VkFormatProperties *pFormatInfo) { const VkLayerInstanceDispatchTable *disp; - VkPhysicalDevice unwrapped_pd = - loader_unwrap_physical_device(physicalDevice); + VkPhysicalDevice unwrapped_pd = loader_unwrap_physical_device(physicalDevice); disp = loader_get_instance_layer_dispatch(physicalDevice); disp->GetPhysicalDeviceFormatProperties(unwrapped_pd, format, pFormatInfo); } -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL -vkGetPhysicalDeviceImageFormatProperties( - VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, - VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, - VkImageFormatProperties *pImageFormatProperties) { +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceImageFormatProperties( + VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, + VkImageCreateFlags flags, VkImageFormatProperties *pImageFormatProperties) { const VkLayerInstanceDispatchTable *disp; - VkPhysicalDevice unwrapped_phys_dev = - loader_unwrap_physical_device(physicalDevice); + VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); disp = loader_get_instance_layer_dispatch(physicalDevice); - return disp->GetPhysicalDeviceImageFormatProperties( - unwrapped_phys_dev, format, type, tiling, usage, flags, - pImageFormatProperties); + return disp->GetPhysicalDeviceImageFormatProperties(unwrapped_phys_dev, format, type, tiling, usage, flags, + pImageFormatProperties); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceProperties( - VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties *pProperties) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice, + VkPhysicalDeviceProperties *pProperties) { const VkLayerInstanceDispatchTable *disp; - VkPhysicalDevice unwrapped_phys_dev = - loader_unwrap_physical_device(physicalDevice); + VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); disp = loader_get_instance_layer_dispatch(physicalDevice); disp->GetPhysicalDeviceProperties(unwrapped_phys_dev, pProperties); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkGetPhysicalDeviceQueueFamilyProperties( - VkPhysicalDevice physicalDevice, uint32_t *pQueueFamilyPropertyCount, - VkQueueFamilyProperties *pQueueProperties) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceQueueFamilyProperties(VkPhysicalDevice physicalDevice, + uint32_t *pQueueFamilyPropertyCount, + VkQueueFamilyProperties *pQueueProperties) { const VkLayerInstanceDispatchTable *disp; - VkPhysicalDevice unwrapped_phys_dev = - loader_unwrap_physical_device(physicalDevice); + VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); disp = loader_get_instance_layer_dispatch(physicalDevice); - disp->GetPhysicalDeviceQueueFamilyProperties( - unwrapped_phys_dev, pQueueFamilyPropertyCount, pQueueProperties); + disp->GetPhysicalDeviceQueueFamilyProperties(unwrapped_phys_dev, pQueueFamilyPropertyCount, pQueueProperties); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceMemoryProperties( - VkPhysicalDevice physicalDevice, - VkPhysicalDeviceMemoryProperties *pMemoryProperties) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceMemoryProperties(VkPhysicalDevice physicalDevice, + VkPhysicalDeviceMemoryProperties *pMemoryProperties) { const VkLayerInstanceDispatchTable *disp; - VkPhysicalDevice unwrapped_phys_dev = - loader_unwrap_physical_device(physicalDevice); + VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); disp = loader_get_instance_layer_dispatch(physicalDevice); - disp->GetPhysicalDeviceMemoryProperties(unwrapped_phys_dev, - pMemoryProperties); + disp->GetPhysicalDeviceMemoryProperties(unwrapped_phys_dev, pMemoryProperties); } -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateDevice( - VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo, - const VkAllocationCallbacks *pAllocator, VkDevice *pDevice) { +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo, + const VkAllocationCallbacks *pAllocator, VkDevice *pDevice) { VkResult res; struct loader_physical_device_tramp *phys_dev = NULL; struct loader_device *dev = NULL; @@ -678,30 +600,23 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateDevice( /* Get the physical device (ICD) extensions */ struct loader_extension_list icd_exts; icd_exts.list = NULL; - res = - loader_init_generic_list(inst, (struct loader_generic_list *)&icd_exts, - sizeof(VkExtensionProperties)); + res = loader_init_generic_list(inst, (struct loader_generic_list *)&icd_exts, sizeof(VkExtensionProperties)); if (VK_SUCCESS != res) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "vkCreateDevice: Failed to create ICD extension list"); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "vkCreateDevice: Failed to create ICD extension list"); goto out; } - res = loader_add_device_extensions( - inst, inst->disp->layer_inst_disp.EnumerateDeviceExtensionProperties, - phys_dev->phys_dev, "Unknown", &icd_exts); + res = loader_add_device_extensions(inst, inst->disp->layer_inst_disp.EnumerateDeviceExtensionProperties, phys_dev->phys_dev, + "Unknown", &icd_exts); if (res != VK_SUCCESS) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "vkCreateDevice: Failed to add extensions to list"); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "vkCreateDevice: Failed to add extensions to list"); goto out; } /* make sure requested extensions to be enabled are supported */ - res = loader_validate_device_extensions( - phys_dev, &inst->activated_layer_list, &icd_exts, pCreateInfo); + res = loader_validate_device_extensions(phys_dev, &inst->activated_layer_list, &icd_exts, pCreateInfo); if (res != VK_SUCCESS) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "vkCreateDevice: Failed to validate extensions in list"); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "vkCreateDevice: Failed to validate extensions in list"); goto out; } @@ -715,25 +630,20 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateDevice( dev->activated_layer_list.capacity = inst->activated_layer_list.capacity; dev->activated_layer_list.count = inst->activated_layer_list.count; dev->activated_layer_list.list = - loader_device_heap_alloc(dev, inst->activated_layer_list.capacity, - VK_SYSTEM_ALLOCATION_SCOPE_DEVICE); + loader_device_heap_alloc(dev, inst->activated_layer_list.capacity, VK_SYSTEM_ALLOCATION_SCOPE_DEVICE); if (dev->activated_layer_list.list == NULL) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "vkCreateDevice: Failed to allocate activated layer" - "list of size %d.", + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "vkCreateDevice: Failed to allocate activated layer" + "list of size %d.", inst->activated_layer_list.capacity); res = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; } memcpy(dev->activated_layer_list.list, inst->activated_layer_list.list, - sizeof(*dev->activated_layer_list.list) * - dev->activated_layer_list.count); + sizeof(*dev->activated_layer_list.list) * dev->activated_layer_list.count); - res = loader_create_device_chain(phys_dev, pCreateInfo, pAllocator, inst, - dev); + res = loader_create_device_chain(phys_dev, pCreateInfo, pAllocator, inst, dev); if (res != VK_SUCCESS) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "vkCreateDevice: Failed to create device chain."); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "vkCreateDevice: Failed to create device chain."); goto out; } @@ -744,9 +654,8 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateDevice( // Initialize WSI device extensions as part of core dispatch since loader // has dedicated trampoline code for these*/ - loader_init_device_extension_dispatch_table( - &dev->loader_dispatch, - dev->loader_dispatch.core_dispatch.GetDeviceProcAddr, *pDevice); + loader_init_device_extension_dispatch_table(&dev->loader_dispatch, dev->loader_dispatch.core_dispatch.GetDeviceProcAddr, + *pDevice); out: @@ -758,15 +667,13 @@ out: } if (NULL != icd_exts.list) { - loader_destroy_generic_list(inst, - (struct loader_generic_list *)&icd_exts); + loader_destroy_generic_list(inst, (struct loader_generic_list *)&icd_exts); } loader_platform_thread_unlock_mutex(&loader_lock); return res; } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkDestroyDevice(VkDevice device, const VkAllocationCallbacks *pAllocator) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyDevice(VkDevice device, const VkAllocationCallbacks *pAllocator) { const VkLayerDispatchTable *disp; struct loader_device *dev; @@ -776,8 +683,7 @@ vkDestroyDevice(VkDevice device, const VkAllocationCallbacks *pAllocator) { loader_platform_thread_lock_mutex(&loader_lock); - struct loader_icd_term *icd_term = - loader_get_icd_and_device(device, &dev, NULL); + struct loader_icd_term *icd_term = loader_get_icd_and_device(device, &dev, NULL); const struct loader_instance *inst = icd_term->this_instance; disp = loader_get_dispatch(device); @@ -789,11 +695,9 @@ vkDestroyDevice(VkDevice device, const VkAllocationCallbacks *pAllocator) { loader_platform_thread_unlock_mutex(&loader_lock); } -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL -vkEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, - const char *pLayerName, - uint32_t *pPropertyCount, - VkExtensionProperties *pProperties) { +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, + const char *pLayerName, uint32_t *pPropertyCount, + VkExtensionProperties *pProperties) { VkResult res = VK_SUCCESS; struct loader_physical_device_tramp *phys_dev; phys_dev = (struct loader_physical_device_tramp *)physicalDevice; @@ -808,8 +712,7 @@ vkEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, const VkLayerInstanceDispatchTable *disp; disp = loader_get_instance_layer_dispatch(physicalDevice); - res = disp->EnumerateDeviceExtensionProperties( - phys_dev->phys_dev, NULL, pPropertyCount, pProperties); + res = disp->EnumerateDeviceExtensionProperties(phys_dev->phys_dev, NULL, pPropertyCount, pProperties); } else { uint32_t count; @@ -818,34 +721,25 @@ vkEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, struct loader_device_extension_list *dev_ext_list = NULL; struct loader_device_extension_list local_ext_list; memset(&local_ext_list, 0, sizeof(local_ext_list)); - if (vk_string_validate(MaxLoaderStringLength, pLayerName) == - VK_STRING_ERROR_NONE) { + if (vk_string_validate(MaxLoaderStringLength, pLayerName) == VK_STRING_ERROR_NONE) { if (strcmp(pLayerName, std_validation_str) == 0) { struct loader_layer_list local_list; memset(&local_list, 0, sizeof(local_list)); - for (uint32_t i = 0; i < sizeof(std_validation_names) / - sizeof(std_validation_names[0]); - i++) { - loader_find_layer_name_add_list( - NULL, std_validation_names[i], - VK_LAYER_TYPE_INSTANCE_EXPLICIT, - &inst->instance_layer_list, &local_list); + for (uint32_t i = 0; i < sizeof(std_validation_names) / sizeof(std_validation_names[0]); i++) { + loader_find_layer_name_add_list(NULL, std_validation_names[i], VK_LAYER_TYPE_INSTANCE_EXPLICIT, + &inst->instance_layer_list, &local_list); } for (uint32_t i = 0; i < local_list.count; i++) { - struct loader_device_extension_list *ext_list = - &local_list.list[i].device_extension_list; + struct loader_device_extension_list *ext_list = &local_list.list[i].device_extension_list; for (uint32_t j = 0; j < ext_list->count; j++) { - loader_add_to_dev_ext_list(NULL, &local_ext_list, - &ext_list->list[j].props, 0, - NULL); + loader_add_to_dev_ext_list(NULL, &local_ext_list, &ext_list->list[j].props, 0, NULL); } } dev_ext_list = &local_ext_list; } else { for (uint32_t i = 0; i < inst->instance_layer_list.count; i++) { - struct loader_layer_properties *props = - &inst->instance_layer_list.list[i]; + struct loader_layer_properties *props = &inst->instance_layer_list.list[i]; if (strcmp(props->info.layerName, pLayerName) == 0) { dev_ext_list = &props->device_extension_list; } @@ -855,29 +749,25 @@ vkEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, count = (dev_ext_list == NULL) ? 0 : dev_ext_list->count; if (pProperties == NULL) { *pPropertyCount = count; - loader_destroy_generic_list( - inst, (struct loader_generic_list *)&local_ext_list); + loader_destroy_generic_list(inst, (struct loader_generic_list *)&local_ext_list); loader_platform_thread_unlock_mutex(&loader_lock); return VK_SUCCESS; } copy_size = *pPropertyCount < count ? *pPropertyCount : count; for (uint32_t i = 0; i < copy_size; i++) { - memcpy(&pProperties[i], &dev_ext_list->list[i].props, - sizeof(VkExtensionProperties)); + memcpy(&pProperties[i], &dev_ext_list->list[i].props, sizeof(VkExtensionProperties)); } *pPropertyCount = copy_size; - loader_destroy_generic_list( - inst, (struct loader_generic_list *)&local_ext_list); + loader_destroy_generic_list(inst, (struct loader_generic_list *)&local_ext_list); if (copy_size < count) { loader_platform_thread_unlock_mutex(&loader_lock); return VK_INCOMPLETE; } } else { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "vkEnumerateDeviceExtensionProperties: pLayerName " - "is too long or is badly formed"); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "vkEnumerateDeviceExtensionProperties: pLayerName " + "is too long or is badly formed"); loader_platform_thread_unlock_mutex(&loader_lock); return VK_ERROR_EXTENSION_NOT_PRESENT; } @@ -887,15 +777,13 @@ vkEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, return res; } -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL -vkEnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice, - uint32_t *pPropertyCount, - VkLayerProperties *pProperties) { +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice, + uint32_t *pPropertyCount, + VkLayerProperties *pProperties) { uint32_t copy_size; struct loader_physical_device_tramp *phys_dev; struct loader_layer_list *enabled_layers, layers_list; - uint32_t std_val_count = sizeof(std_validation_names) / - sizeof(std_validation_names[0]); + uint32_t std_val_count = sizeof(std_validation_names) / sizeof(std_validation_names[0]); memset(&layers_list, 0, sizeof(layers_list)); loader_platform_thread_lock_mutex(&loader_lock); @@ -920,54 +808,41 @@ vkEnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice, if (inst->activated_layers_are_std_val) { enabled_layers = &layers_list; enabled_layers->count = count; - enabled_layers->capacity = enabled_layers->count * - sizeof(struct loader_layer_properties); - enabled_layers->list = loader_instance_heap_alloc(inst, enabled_layers->capacity, - VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); + enabled_layers->capacity = enabled_layers->count * sizeof(struct loader_layer_properties); + enabled_layers->list = loader_instance_heap_alloc(inst, enabled_layers->capacity, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (!enabled_layers->list) { - loader_log( - inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "vkEnumerateDeviceLayerProperties: Failed to allocate enabled" - "layer list of size %d", - enabled_layers->capacity); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "vkEnumerateDeviceLayerProperties: Failed to allocate enabled" + "layer list of size %d", + enabled_layers->capacity); return VK_ERROR_OUT_OF_HOST_MEMORY; } uint32_t j = 0; for (uint32_t i = 0; i < inst->activated_layer_list.count; j++) { - if (loader_find_layer_name_array( - inst->activated_layer_list.list[i].info.layerName, - std_val_count, std_validation_names)) { + if (loader_find_layer_name_array(inst->activated_layer_list.list[i].info.layerName, std_val_count, + std_validation_names)) { struct loader_layer_properties props; loader_init_std_validation_props(&props); - VkResult err = loader_copy_layer_properties(inst, - &enabled_layers->list[j], - &props); + VkResult err = loader_copy_layer_properties(inst, &enabled_layers->list[j], &props); if (err != VK_SUCCESS) { return err; } i += std_val_count; - } - else { - VkResult err = loader_copy_layer_properties(inst, - &enabled_layers->list[j], - &inst->activated_layer_list.list[i++]); + } else { + VkResult err = loader_copy_layer_properties(inst, &enabled_layers->list[j], &inst->activated_layer_list.list[i++]); if (err != VK_SUCCESS) { return err; } } } + } else { + enabled_layers = (struct loader_layer_list *)&inst->activated_layer_list; } - else { - enabled_layers = (struct loader_layer_list *) &inst->activated_layer_list; - } - copy_size = (*pPropertyCount < count) ? *pPropertyCount : count; for (uint32_t i = 0; i < copy_size; i++) { - memcpy(&pProperties[i], &(enabled_layers->list[i].info), - sizeof(VkLayerProperties)); + memcpy(&pProperties[i], &(enabled_layers->list[i].info), sizeof(VkLayerProperties)); } *pPropertyCount = copy_size; @@ -983,9 +858,8 @@ vkEnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice, return VK_SUCCESS; } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkGetDeviceQueue(VkDevice device, uint32_t queueNodeIndex, uint32_t queueIndex, - VkQueue *pQueue) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetDeviceQueue(VkDevice device, uint32_t queueNodeIndex, uint32_t queueIndex, + VkQueue *pQueue) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); @@ -994,9 +868,8 @@ vkGetDeviceQueue(VkDevice device, uint32_t queueNodeIndex, uint32_t queueIndex, loader_set_dispatch(*pQueue, disp); } -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL -vkQueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo *pSubmits, - VkFence fence) { +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkQueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo *pSubmits, + VkFence fence) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(queue); @@ -1020,10 +893,8 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkDeviceWaitIdle(VkDevice device) { return disp->DeviceWaitIdle(device); } -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL -vkAllocateMemory(VkDevice device, const VkMemoryAllocateInfo *pAllocateInfo, - const VkAllocationCallbacks *pAllocator, - VkDeviceMemory *pMemory) { +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkAllocateMemory(VkDevice device, const VkMemoryAllocateInfo *pAllocateInfo, + const VkAllocationCallbacks *pAllocator, VkDeviceMemory *pMemory) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); @@ -1031,9 +902,8 @@ vkAllocateMemory(VkDevice device, const VkMemoryAllocateInfo *pAllocateInfo, return disp->AllocateMemory(device, pAllocateInfo, pAllocator, pMemory); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkFreeMemory(VkDevice device, VkDeviceMemory mem, - const VkAllocationCallbacks *pAllocator) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkFreeMemory(VkDevice device, VkDeviceMemory mem, + const VkAllocationCallbacks *pAllocator) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); @@ -1041,9 +911,8 @@ vkFreeMemory(VkDevice device, VkDeviceMemory mem, disp->FreeMemory(device, mem, pAllocator); } -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL -vkMapMemory(VkDevice device, VkDeviceMemory mem, VkDeviceSize offset, - VkDeviceSize size, VkFlags flags, void **ppData) { +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkMapMemory(VkDevice device, VkDeviceMemory mem, VkDeviceSize offset, + VkDeviceSize size, VkFlags flags, void **ppData) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); @@ -1051,8 +920,7 @@ vkMapMemory(VkDevice device, VkDeviceMemory mem, VkDeviceSize offset, return disp->MapMemory(device, mem, offset, size, flags, ppData); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkUnmapMemory(VkDevice device, VkDeviceMemory mem) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkUnmapMemory(VkDevice device, VkDeviceMemory mem) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); @@ -1060,31 +928,26 @@ vkUnmapMemory(VkDevice device, VkDeviceMemory mem) { disp->UnmapMemory(device, mem); } -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL -vkFlushMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount, - const VkMappedMemoryRange *pMemoryRanges) { +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkFlushMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount, + const VkMappedMemoryRange *pMemoryRanges) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); - return disp->FlushMappedMemoryRanges(device, memoryRangeCount, - pMemoryRanges); + return disp->FlushMappedMemoryRanges(device, memoryRangeCount, pMemoryRanges); } -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL -vkInvalidateMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount, - const VkMappedMemoryRange *pMemoryRanges) { +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkInvalidateMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount, + const VkMappedMemoryRange *pMemoryRanges) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); - return disp->InvalidateMappedMemoryRanges(device, memoryRangeCount, - pMemoryRanges); + return disp->InvalidateMappedMemoryRanges(device, memoryRangeCount, pMemoryRanges); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkGetDeviceMemoryCommitment(VkDevice device, VkDeviceMemory memory, - VkDeviceSize *pCommittedMemoryInBytes) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetDeviceMemoryCommitment(VkDevice device, VkDeviceMemory memory, + VkDeviceSize *pCommittedMemoryInBytes) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); @@ -1092,9 +955,8 @@ vkGetDeviceMemoryCommitment(VkDevice device, VkDeviceMemory memory, disp->GetDeviceMemoryCommitment(device, memory, pCommittedMemoryInBytes); } -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL -vkBindBufferMemory(VkDevice device, VkBuffer buffer, VkDeviceMemory mem, - VkDeviceSize offset) { +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkBindBufferMemory(VkDevice device, VkBuffer buffer, VkDeviceMemory mem, + VkDeviceSize offset) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); @@ -1102,9 +964,8 @@ vkBindBufferMemory(VkDevice device, VkBuffer buffer, VkDeviceMemory mem, return disp->BindBufferMemory(device, buffer, mem, offset); } -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL -vkBindImageMemory(VkDevice device, VkImage image, VkDeviceMemory mem, - VkDeviceSize offset) { +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkBindImageMemory(VkDevice device, VkImage image, VkDeviceMemory mem, + VkDeviceSize offset) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); @@ -1112,9 +973,8 @@ vkBindImageMemory(VkDevice device, VkImage image, VkDeviceMemory mem, return disp->BindImageMemory(device, image, mem, offset); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkGetBufferMemoryRequirements(VkDevice device, VkBuffer buffer, - VkMemoryRequirements *pMemoryRequirements) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetBufferMemoryRequirements(VkDevice device, VkBuffer buffer, + VkMemoryRequirements *pMemoryRequirements) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); @@ -1122,9 +982,8 @@ vkGetBufferMemoryRequirements(VkDevice device, VkBuffer buffer, disp->GetBufferMemoryRequirements(device, buffer, pMemoryRequirements); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkGetImageMemoryRequirements(VkDevice device, VkImage image, - VkMemoryRequirements *pMemoryRequirements) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetImageMemoryRequirements(VkDevice device, VkImage image, + VkMemoryRequirements *pMemoryRequirements) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); @@ -1132,37 +991,29 @@ vkGetImageMemoryRequirements(VkDevice device, VkImage image, disp->GetImageMemoryRequirements(device, image, pMemoryRequirements); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetImageSparseMemoryRequirements( - VkDevice device, VkImage image, uint32_t *pSparseMemoryRequirementCount, - VkSparseImageMemoryRequirements *pSparseMemoryRequirements) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL +vkGetImageSparseMemoryRequirements(VkDevice device, VkImage image, uint32_t *pSparseMemoryRequirementCount, + VkSparseImageMemoryRequirements *pSparseMemoryRequirements) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); - disp->GetImageSparseMemoryRequirements(device, image, - pSparseMemoryRequirementCount, - pSparseMemoryRequirements); + disp->GetImageSparseMemoryRequirements(device, image, pSparseMemoryRequirementCount, pSparseMemoryRequirements); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkGetPhysicalDeviceSparseImageFormatProperties( - VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, - VkSampleCountFlagBits samples, VkImageUsageFlags usage, - VkImageTiling tiling, uint32_t *pPropertyCount, - VkSparseImageFormatProperties *pProperties) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceSparseImageFormatProperties( + VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkSampleCountFlagBits samples, VkImageUsageFlags usage, + VkImageTiling tiling, uint32_t *pPropertyCount, VkSparseImageFormatProperties *pProperties) { const VkLayerInstanceDispatchTable *disp; - VkPhysicalDevice unwrapped_phys_dev = - loader_unwrap_physical_device(physicalDevice); + VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); disp = loader_get_instance_layer_dispatch(physicalDevice); - disp->GetPhysicalDeviceSparseImageFormatProperties( - unwrapped_phys_dev, format, type, samples, usage, tiling, - pPropertyCount, pProperties); + disp->GetPhysicalDeviceSparseImageFormatProperties(unwrapped_phys_dev, format, type, samples, usage, tiling, pPropertyCount, + pProperties); } -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL -vkQueueBindSparse(VkQueue queue, uint32_t bindInfoCount, - const VkBindSparseInfo *pBindInfo, VkFence fence) { +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkQueueBindSparse(VkQueue queue, uint32_t bindInfoCount, + const VkBindSparseInfo *pBindInfo, VkFence fence) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(queue); @@ -1170,9 +1021,8 @@ vkQueueBindSparse(VkQueue queue, uint32_t bindInfoCount, return disp->QueueBindSparse(queue, bindInfoCount, pBindInfo, fence); } -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL -vkCreateFence(VkDevice device, const VkFenceCreateInfo *pCreateInfo, - const VkAllocationCallbacks *pAllocator, VkFence *pFence) { +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateFence(VkDevice device, const VkFenceCreateInfo *pCreateInfo, + const VkAllocationCallbacks *pAllocator, VkFence *pFence) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); @@ -1180,9 +1030,7 @@ vkCreateFence(VkDevice device, const VkFenceCreateInfo *pCreateInfo, return disp->CreateFence(device, pCreateInfo, pAllocator, pFence); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkDestroyFence(VkDevice device, VkFence fence, - const VkAllocationCallbacks *pAllocator) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyFence(VkDevice device, VkFence fence, const VkAllocationCallbacks *pAllocator) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); @@ -1190,8 +1038,7 @@ vkDestroyFence(VkDevice device, VkFence fence, disp->DestroyFence(device, fence, pAllocator); } -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL -vkResetFences(VkDevice device, uint32_t fenceCount, const VkFence *pFences) { +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkResetFences(VkDevice device, uint32_t fenceCount, const VkFence *pFences) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); @@ -1199,8 +1046,7 @@ vkResetFences(VkDevice device, uint32_t fenceCount, const VkFence *pFences) { return disp->ResetFences(device, fenceCount, pFences); } -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL -vkGetFenceStatus(VkDevice device, VkFence fence) { +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetFenceStatus(VkDevice device, VkFence fence) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); @@ -1208,9 +1054,8 @@ vkGetFenceStatus(VkDevice device, VkFence fence) { return disp->GetFenceStatus(device, fence); } -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL -vkWaitForFences(VkDevice device, uint32_t fenceCount, const VkFence *pFences, - VkBool32 waitAll, uint64_t timeout) { +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkWaitForFences(VkDevice device, uint32_t fenceCount, const VkFence *pFences, + VkBool32 waitAll, uint64_t timeout) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); @@ -1218,10 +1063,8 @@ vkWaitForFences(VkDevice device, uint32_t fenceCount, const VkFence *pFences, return disp->WaitForFences(device, fenceCount, pFences, waitAll, timeout); } -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL -vkCreateSemaphore(VkDevice device, const VkSemaphoreCreateInfo *pCreateInfo, - const VkAllocationCallbacks *pAllocator, - VkSemaphore *pSemaphore) { +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateSemaphore(VkDevice device, const VkSemaphoreCreateInfo *pCreateInfo, + const VkAllocationCallbacks *pAllocator, VkSemaphore *pSemaphore) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); @@ -1229,9 +1072,8 @@ vkCreateSemaphore(VkDevice device, const VkSemaphoreCreateInfo *pCreateInfo, return disp->CreateSemaphore(device, pCreateInfo, pAllocator, pSemaphore); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkDestroySemaphore(VkDevice device, VkSemaphore semaphore, - const VkAllocationCallbacks *pAllocator) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroySemaphore(VkDevice device, VkSemaphore semaphore, + const VkAllocationCallbacks *pAllocator) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); @@ -1239,9 +1081,8 @@ vkDestroySemaphore(VkDevice device, VkSemaphore semaphore, disp->DestroySemaphore(device, semaphore, pAllocator); } -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL -vkCreateEvent(VkDevice device, const VkEventCreateInfo *pCreateInfo, - const VkAllocationCallbacks *pAllocator, VkEvent *pEvent) { +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateEvent(VkDevice device, const VkEventCreateInfo *pCreateInfo, + const VkAllocationCallbacks *pAllocator, VkEvent *pEvent) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); @@ -1249,9 +1090,7 @@ vkCreateEvent(VkDevice device, const VkEventCreateInfo *pCreateInfo, return disp->CreateEvent(device, pCreateInfo, pAllocator, pEvent); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkDestroyEvent(VkDevice device, VkEvent event, - const VkAllocationCallbacks *pAllocator) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyEvent(VkDevice device, VkEvent event, const VkAllocationCallbacks *pAllocator) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); @@ -1259,8 +1098,7 @@ vkDestroyEvent(VkDevice device, VkEvent event, disp->DestroyEvent(device, event, pAllocator); } -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL -vkGetEventStatus(VkDevice device, VkEvent event) { +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetEventStatus(VkDevice device, VkEvent event) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); @@ -1268,8 +1106,7 @@ vkGetEventStatus(VkDevice device, VkEvent event) { return disp->GetEventStatus(device, event); } -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL -vkSetEvent(VkDevice device, VkEvent event) { +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkSetEvent(VkDevice device, VkEvent event) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); @@ -1277,8 +1114,7 @@ vkSetEvent(VkDevice device, VkEvent event) { return disp->SetEvent(device, event); } -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL -vkResetEvent(VkDevice device, VkEvent event) { +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkResetEvent(VkDevice device, VkEvent event) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); @@ -1286,10 +1122,8 @@ vkResetEvent(VkDevice device, VkEvent event) { return disp->ResetEvent(device, event); } -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL -vkCreateQueryPool(VkDevice device, const VkQueryPoolCreateInfo *pCreateInfo, - const VkAllocationCallbacks *pAllocator, - VkQueryPool *pQueryPool) { +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateQueryPool(VkDevice device, const VkQueryPoolCreateInfo *pCreateInfo, + const VkAllocationCallbacks *pAllocator, VkQueryPool *pQueryPool) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); @@ -1297,9 +1131,8 @@ vkCreateQueryPool(VkDevice device, const VkQueryPoolCreateInfo *pCreateInfo, return disp->CreateQueryPool(device, pCreateInfo, pAllocator, pQueryPool); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkDestroyQueryPool(VkDevice device, VkQueryPool queryPool, - const VkAllocationCallbacks *pAllocator) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyQueryPool(VkDevice device, VkQueryPool queryPool, + const VkAllocationCallbacks *pAllocator) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); @@ -1307,22 +1140,18 @@ vkDestroyQueryPool(VkDevice device, VkQueryPool queryPool, disp->DestroyQueryPool(device, queryPool, pAllocator); } -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL -vkGetQueryPoolResults(VkDevice device, VkQueryPool queryPool, - uint32_t firstQuery, uint32_t queryCount, size_t dataSize, - void *pData, VkDeviceSize stride, - VkQueryResultFlags flags) { +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetQueryPoolResults(VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, + uint32_t queryCount, size_t dataSize, void *pData, + VkDeviceSize stride, VkQueryResultFlags flags) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); - return disp->GetQueryPoolResults(device, queryPool, firstQuery, queryCount, - dataSize, pData, stride, flags); + return disp->GetQueryPoolResults(device, queryPool, firstQuery, queryCount, dataSize, pData, stride, flags); } -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL -vkCreateBuffer(VkDevice device, const VkBufferCreateInfo *pCreateInfo, - const VkAllocationCallbacks *pAllocator, VkBuffer *pBuffer) { +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateBuffer(VkDevice device, const VkBufferCreateInfo *pCreateInfo, + const VkAllocationCallbacks *pAllocator, VkBuffer *pBuffer) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); @@ -1330,9 +1159,8 @@ vkCreateBuffer(VkDevice device, const VkBufferCreateInfo *pCreateInfo, return disp->CreateBuffer(device, pCreateInfo, pAllocator, pBuffer); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkDestroyBuffer(VkDevice device, VkBuffer buffer, - const VkAllocationCallbacks *pAllocator) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyBuffer(VkDevice device, VkBuffer buffer, + const VkAllocationCallbacks *pAllocator) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); @@ -1340,10 +1168,8 @@ vkDestroyBuffer(VkDevice device, VkBuffer buffer, disp->DestroyBuffer(device, buffer, pAllocator); } -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL -vkCreateBufferView(VkDevice device, const VkBufferViewCreateInfo *pCreateInfo, - const VkAllocationCallbacks *pAllocator, - VkBufferView *pView) { +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateBufferView(VkDevice device, const VkBufferViewCreateInfo *pCreateInfo, + const VkAllocationCallbacks *pAllocator, VkBufferView *pView) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); @@ -1351,9 +1177,8 @@ vkCreateBufferView(VkDevice device, const VkBufferViewCreateInfo *pCreateInfo, return disp->CreateBufferView(device, pCreateInfo, pAllocator, pView); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkDestroyBufferView(VkDevice device, VkBufferView bufferView, - const VkAllocationCallbacks *pAllocator) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyBufferView(VkDevice device, VkBufferView bufferView, + const VkAllocationCallbacks *pAllocator) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); @@ -1361,9 +1186,8 @@ vkDestroyBufferView(VkDevice device, VkBufferView bufferView, disp->DestroyBufferView(device, bufferView, pAllocator); } -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL -vkCreateImage(VkDevice device, const VkImageCreateInfo *pCreateInfo, - const VkAllocationCallbacks *pAllocator, VkImage *pImage) { +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateImage(VkDevice device, const VkImageCreateInfo *pCreateInfo, + const VkAllocationCallbacks *pAllocator, VkImage *pImage) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); @@ -1371,9 +1195,7 @@ vkCreateImage(VkDevice device, const VkImageCreateInfo *pCreateInfo, return disp->CreateImage(device, pCreateInfo, pAllocator, pImage); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkDestroyImage(VkDevice device, VkImage image, - const VkAllocationCallbacks *pAllocator) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyImage(VkDevice device, VkImage image, const VkAllocationCallbacks *pAllocator) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); @@ -1381,10 +1203,9 @@ vkDestroyImage(VkDevice device, VkImage image, disp->DestroyImage(device, image, pAllocator); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkGetImageSubresourceLayout(VkDevice device, VkImage image, - const VkImageSubresource *pSubresource, - VkSubresourceLayout *pLayout) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetImageSubresourceLayout(VkDevice device, VkImage image, + const VkImageSubresource *pSubresource, + VkSubresourceLayout *pLayout) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); @@ -1392,9 +1213,8 @@ vkGetImageSubresourceLayout(VkDevice device, VkImage image, disp->GetImageSubresourceLayout(device, image, pSubresource, pLayout); } -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL -vkCreateImageView(VkDevice device, const VkImageViewCreateInfo *pCreateInfo, - const VkAllocationCallbacks *pAllocator, VkImageView *pView) { +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateImageView(VkDevice device, const VkImageViewCreateInfo *pCreateInfo, + const VkAllocationCallbacks *pAllocator, VkImageView *pView) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); @@ -1402,9 +1222,8 @@ vkCreateImageView(VkDevice device, const VkImageViewCreateInfo *pCreateInfo, return disp->CreateImageView(device, pCreateInfo, pAllocator, pView); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkDestroyImageView(VkDevice device, VkImageView imageView, - const VkAllocationCallbacks *pAllocator) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyImageView(VkDevice device, VkImageView imageView, + const VkAllocationCallbacks *pAllocator) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); @@ -1412,11 +1231,9 @@ vkDestroyImageView(VkDevice device, VkImageView imageView, disp->DestroyImageView(device, imageView, pAllocator); } -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL -vkCreateShaderModule(VkDevice device, - const VkShaderModuleCreateInfo *pCreateInfo, - const VkAllocationCallbacks *pAllocator, - VkShaderModule *pShader) { +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateShaderModule(VkDevice device, const VkShaderModuleCreateInfo *pCreateInfo, + const VkAllocationCallbacks *pAllocator, + VkShaderModule *pShader) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); @@ -1424,9 +1241,8 @@ vkCreateShaderModule(VkDevice device, return disp->CreateShaderModule(device, pCreateInfo, pAllocator, pShader); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkDestroyShaderModule(VkDevice device, VkShaderModule shaderModule, - const VkAllocationCallbacks *pAllocator) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyShaderModule(VkDevice device, VkShaderModule shaderModule, + const VkAllocationCallbacks *pAllocator) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); @@ -1434,22 +1250,18 @@ vkDestroyShaderModule(VkDevice device, VkShaderModule shaderModule, disp->DestroyShaderModule(device, shaderModule, pAllocator); } -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL -vkCreatePipelineCache(VkDevice device, - const VkPipelineCacheCreateInfo *pCreateInfo, - const VkAllocationCallbacks *pAllocator, - VkPipelineCache *pPipelineCache) { +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreatePipelineCache(VkDevice device, const VkPipelineCacheCreateInfo *pCreateInfo, + const VkAllocationCallbacks *pAllocator, + VkPipelineCache *pPipelineCache) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); - return disp->CreatePipelineCache(device, pCreateInfo, pAllocator, - pPipelineCache); + return disp->CreatePipelineCache(device, pCreateInfo, pAllocator, pPipelineCache); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkDestroyPipelineCache(VkDevice device, VkPipelineCache pipelineCache, - const VkAllocationCallbacks *pAllocator) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyPipelineCache(VkDevice device, VkPipelineCache pipelineCache, + const VkAllocationCallbacks *pAllocator) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); @@ -1457,9 +1269,8 @@ vkDestroyPipelineCache(VkDevice device, VkPipelineCache pipelineCache, disp->DestroyPipelineCache(device, pipelineCache, pAllocator); } -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL -vkGetPipelineCacheData(VkDevice device, VkPipelineCache pipelineCache, - size_t *pDataSize, void *pData) { +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetPipelineCacheData(VkDevice device, VkPipelineCache pipelineCache, + size_t *pDataSize, void *pData) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); @@ -1467,49 +1278,41 @@ vkGetPipelineCacheData(VkDevice device, VkPipelineCache pipelineCache, return disp->GetPipelineCacheData(device, pipelineCache, pDataSize, pData); } -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL -vkMergePipelineCaches(VkDevice device, VkPipelineCache dstCache, - uint32_t srcCacheCount, - const VkPipelineCache *pSrcCaches) { +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkMergePipelineCaches(VkDevice device, VkPipelineCache dstCache, + uint32_t srcCacheCount, const VkPipelineCache *pSrcCaches) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); - return disp->MergePipelineCaches(device, dstCache, srcCacheCount, - pSrcCaches); + return disp->MergePipelineCaches(device, dstCache, srcCacheCount, pSrcCaches); } -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL -vkCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache, - uint32_t createInfoCount, - const VkGraphicsPipelineCreateInfo *pCreateInfos, - const VkAllocationCallbacks *pAllocator, - VkPipeline *pPipelines) { +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache, + uint32_t createInfoCount, + const VkGraphicsPipelineCreateInfo *pCreateInfos, + const VkAllocationCallbacks *pAllocator, + VkPipeline *pPipelines) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); - return disp->CreateGraphicsPipelines(device, pipelineCache, createInfoCount, - pCreateInfos, pAllocator, pPipelines); + return disp->CreateGraphicsPipelines(device, pipelineCache, createInfoCount, pCreateInfos, pAllocator, pPipelines); } -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL -vkCreateComputePipelines(VkDevice device, VkPipelineCache pipelineCache, - uint32_t createInfoCount, - const VkComputePipelineCreateInfo *pCreateInfos, - const VkAllocationCallbacks *pAllocator, - VkPipeline *pPipelines) { +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateComputePipelines(VkDevice device, VkPipelineCache pipelineCache, + uint32_t createInfoCount, + const VkComputePipelineCreateInfo *pCreateInfos, + const VkAllocationCallbacks *pAllocator, + VkPipeline *pPipelines) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); - return disp->CreateComputePipelines(device, pipelineCache, createInfoCount, - pCreateInfos, pAllocator, pPipelines); + return disp->CreateComputePipelines(device, pipelineCache, createInfoCount, pCreateInfos, pAllocator, pPipelines); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkDestroyPipeline(VkDevice device, VkPipeline pipeline, - const VkAllocationCallbacks *pAllocator) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyPipeline(VkDevice device, VkPipeline pipeline, + const VkAllocationCallbacks *pAllocator) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); @@ -1517,22 +1320,18 @@ vkDestroyPipeline(VkDevice device, VkPipeline pipeline, disp->DestroyPipeline(device, pipeline, pAllocator); } -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL -vkCreatePipelineLayout(VkDevice device, - const VkPipelineLayoutCreateInfo *pCreateInfo, - const VkAllocationCallbacks *pAllocator, - VkPipelineLayout *pPipelineLayout) { +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreatePipelineLayout(VkDevice device, const VkPipelineLayoutCreateInfo *pCreateInfo, + const VkAllocationCallbacks *pAllocator, + VkPipelineLayout *pPipelineLayout) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); - return disp->CreatePipelineLayout(device, pCreateInfo, pAllocator, - pPipelineLayout); + return disp->CreatePipelineLayout(device, pCreateInfo, pAllocator, pPipelineLayout); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkDestroyPipelineLayout(VkDevice device, VkPipelineLayout pipelineLayout, - const VkAllocationCallbacks *pAllocator) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyPipelineLayout(VkDevice device, VkPipelineLayout pipelineLayout, + const VkAllocationCallbacks *pAllocator) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); @@ -1540,9 +1339,8 @@ vkDestroyPipelineLayout(VkDevice device, VkPipelineLayout pipelineLayout, disp->DestroyPipelineLayout(device, pipelineLayout, pAllocator); } -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL -vkCreateSampler(VkDevice device, const VkSamplerCreateInfo *pCreateInfo, - const VkAllocationCallbacks *pAllocator, VkSampler *pSampler) { +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateSampler(VkDevice device, const VkSamplerCreateInfo *pCreateInfo, + const VkAllocationCallbacks *pAllocator, VkSampler *pSampler) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); @@ -1550,9 +1348,8 @@ vkCreateSampler(VkDevice device, const VkSamplerCreateInfo *pCreateInfo, return disp->CreateSampler(device, pCreateInfo, pAllocator, pSampler); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkDestroySampler(VkDevice device, VkSampler sampler, - const VkAllocationCallbacks *pAllocator) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroySampler(VkDevice device, VkSampler sampler, + const VkAllocationCallbacks *pAllocator) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); @@ -1560,23 +1357,19 @@ vkDestroySampler(VkDevice device, VkSampler sampler, disp->DestroySampler(device, sampler, pAllocator); } -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL -vkCreateDescriptorSetLayout(VkDevice device, - const VkDescriptorSetLayoutCreateInfo *pCreateInfo, - const VkAllocationCallbacks *pAllocator, - VkDescriptorSetLayout *pSetLayout) { +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateDescriptorSetLayout(VkDevice device, + const VkDescriptorSetLayoutCreateInfo *pCreateInfo, + const VkAllocationCallbacks *pAllocator, + VkDescriptorSetLayout *pSetLayout) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); - return disp->CreateDescriptorSetLayout(device, pCreateInfo, pAllocator, - pSetLayout); + return disp->CreateDescriptorSetLayout(device, pCreateInfo, pAllocator, pSetLayout); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkDestroyDescriptorSetLayout(VkDevice device, - VkDescriptorSetLayout descriptorSetLayout, - const VkAllocationCallbacks *pAllocator) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyDescriptorSetLayout(VkDevice device, VkDescriptorSetLayout descriptorSetLayout, + const VkAllocationCallbacks *pAllocator) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); @@ -1584,22 +1377,18 @@ vkDestroyDescriptorSetLayout(VkDevice device, disp->DestroyDescriptorSetLayout(device, descriptorSetLayout, pAllocator); } -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL -vkCreateDescriptorPool(VkDevice device, - const VkDescriptorPoolCreateInfo *pCreateInfo, - const VkAllocationCallbacks *pAllocator, - VkDescriptorPool *pDescriptorPool) { +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateDescriptorPool(VkDevice device, const VkDescriptorPoolCreateInfo *pCreateInfo, + const VkAllocationCallbacks *pAllocator, + VkDescriptorPool *pDescriptorPool) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); - return disp->CreateDescriptorPool(device, pCreateInfo, pAllocator, - pDescriptorPool); + return disp->CreateDescriptorPool(device, pCreateInfo, pAllocator, pDescriptorPool); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkDestroyDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, - const VkAllocationCallbacks *pAllocator) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, + const VkAllocationCallbacks *pAllocator) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); @@ -1607,9 +1396,8 @@ vkDestroyDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, disp->DestroyDescriptorPool(device, descriptorPool, pAllocator); } -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL -vkResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, - VkDescriptorPoolResetFlags flags) { +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, + VkDescriptorPoolResetFlags flags) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); @@ -1617,10 +1405,9 @@ vkResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, return disp->ResetDescriptorPool(device, descriptorPool, flags); } -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL -vkAllocateDescriptorSets(VkDevice device, - const VkDescriptorSetAllocateInfo *pAllocateInfo, - VkDescriptorSet *pDescriptorSets) { +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkAllocateDescriptorSets(VkDevice device, + const VkDescriptorSetAllocateInfo *pAllocateInfo, + VkDescriptorSet *pDescriptorSets) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); @@ -1628,46 +1415,39 @@ vkAllocateDescriptorSets(VkDevice device, return disp->AllocateDescriptorSets(device, pAllocateInfo, pDescriptorSets); } -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL -vkFreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, - uint32_t descriptorSetCount, - const VkDescriptorSet *pDescriptorSets) { +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkFreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, + uint32_t descriptorSetCount, + const VkDescriptorSet *pDescriptorSets) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); - return disp->FreeDescriptorSets(device, descriptorPool, descriptorSetCount, - pDescriptorSets); + return disp->FreeDescriptorSets(device, descriptorPool, descriptorSetCount, pDescriptorSets); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkUpdateDescriptorSets(VkDevice device, uint32_t descriptorWriteCount, - const VkWriteDescriptorSet *pDescriptorWrites, - uint32_t descriptorCopyCount, - const VkCopyDescriptorSet *pDescriptorCopies) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkUpdateDescriptorSets(VkDevice device, uint32_t descriptorWriteCount, + const VkWriteDescriptorSet *pDescriptorWrites, + uint32_t descriptorCopyCount, + const VkCopyDescriptorSet *pDescriptorCopies) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); - disp->UpdateDescriptorSets(device, descriptorWriteCount, pDescriptorWrites, - descriptorCopyCount, pDescriptorCopies); + disp->UpdateDescriptorSets(device, descriptorWriteCount, pDescriptorWrites, descriptorCopyCount, pDescriptorCopies); } -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL -vkCreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo *pCreateInfo, - const VkAllocationCallbacks *pAllocator, - VkFramebuffer *pFramebuffer) { +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo *pCreateInfo, + const VkAllocationCallbacks *pAllocator, + VkFramebuffer *pFramebuffer) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); - return disp->CreateFramebuffer(device, pCreateInfo, pAllocator, - pFramebuffer); + return disp->CreateFramebuffer(device, pCreateInfo, pAllocator, pFramebuffer); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkDestroyFramebuffer(VkDevice device, VkFramebuffer framebuffer, - const VkAllocationCallbacks *pAllocator) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyFramebuffer(VkDevice device, VkFramebuffer framebuffer, + const VkAllocationCallbacks *pAllocator) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); @@ -1675,10 +1455,9 @@ vkDestroyFramebuffer(VkDevice device, VkFramebuffer framebuffer, disp->DestroyFramebuffer(device, framebuffer, pAllocator); } -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL -vkCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo *pCreateInfo, - const VkAllocationCallbacks *pAllocator, - VkRenderPass *pRenderPass) { +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo *pCreateInfo, + const VkAllocationCallbacks *pAllocator, + VkRenderPass *pRenderPass) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); @@ -1686,9 +1465,8 @@ vkCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo *pCreateInfo, return disp->CreateRenderPass(device, pCreateInfo, pAllocator, pRenderPass); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkDestroyRenderPass(VkDevice device, VkRenderPass renderPass, - const VkAllocationCallbacks *pAllocator) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyRenderPass(VkDevice device, VkRenderPass renderPass, + const VkAllocationCallbacks *pAllocator) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); @@ -1696,9 +1474,8 @@ vkDestroyRenderPass(VkDevice device, VkRenderPass renderPass, disp->DestroyRenderPass(device, renderPass, pAllocator); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkGetRenderAreaGranularity(VkDevice device, VkRenderPass renderPass, - VkExtent2D *pGranularity) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetRenderAreaGranularity(VkDevice device, VkRenderPass renderPass, + VkExtent2D *pGranularity) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); @@ -1706,21 +1483,18 @@ vkGetRenderAreaGranularity(VkDevice device, VkRenderPass renderPass, disp->GetRenderAreaGranularity(device, renderPass, pGranularity); } -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL -vkCreateCommandPool(VkDevice device, const VkCommandPoolCreateInfo *pCreateInfo, - const VkAllocationCallbacks *pAllocator, - VkCommandPool *pCommandPool) { +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateCommandPool(VkDevice device, const VkCommandPoolCreateInfo *pCreateInfo, + const VkAllocationCallbacks *pAllocator, + VkCommandPool *pCommandPool) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); - return disp->CreateCommandPool(device, pCreateInfo, pAllocator, - pCommandPool); + return disp->CreateCommandPool(device, pCreateInfo, pAllocator, pCommandPool); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkDestroyCommandPool(VkDevice device, VkCommandPool commandPool, - const VkAllocationCallbacks *pAllocator) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyCommandPool(VkDevice device, VkCommandPool commandPool, + const VkAllocationCallbacks *pAllocator) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); @@ -1728,9 +1502,8 @@ vkDestroyCommandPool(VkDevice device, VkCommandPool commandPool, disp->DestroyCommandPool(device, commandPool, pAllocator); } -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL -vkResetCommandPool(VkDevice device, VkCommandPool commandPool, - VkCommandPoolResetFlags flags) { +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkResetCommandPool(VkDevice device, VkCommandPool commandPool, + VkCommandPoolResetFlags flags) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); @@ -1738,10 +1511,9 @@ vkResetCommandPool(VkDevice device, VkCommandPool commandPool, return disp->ResetCommandPool(device, commandPool, flags); } -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL -vkAllocateCommandBuffers(VkDevice device, - const VkCommandBufferAllocateInfo *pAllocateInfo, - VkCommandBuffer *pCommandBuffers) { +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkAllocateCommandBuffers(VkDevice device, + const VkCommandBufferAllocateInfo *pAllocateInfo, + VkCommandBuffer *pCommandBuffers) { const VkLayerDispatchTable *disp; VkResult res; @@ -1759,21 +1531,17 @@ vkAllocateCommandBuffers(VkDevice device, return res; } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkFreeCommandBuffers(VkDevice device, VkCommandPool commandPool, - uint32_t commandBufferCount, - const VkCommandBuffer *pCommandBuffers) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkFreeCommandBuffers(VkDevice device, VkCommandPool commandPool, + uint32_t commandBufferCount, const VkCommandBuffer *pCommandBuffers) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); - disp->FreeCommandBuffers(device, commandPool, commandBufferCount, - pCommandBuffers); + disp->FreeCommandBuffers(device, commandPool, commandBufferCount, pCommandBuffers); } -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL -vkBeginCommandBuffer(VkCommandBuffer commandBuffer, - const VkCommandBufferBeginInfo *pBeginInfo) { +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkBeginCommandBuffer(VkCommandBuffer commandBuffer, + const VkCommandBufferBeginInfo *pBeginInfo) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(commandBuffer); @@ -1781,8 +1549,7 @@ vkBeginCommandBuffer(VkCommandBuffer commandBuffer, return disp->BeginCommandBuffer(commandBuffer, pBeginInfo); } -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL -vkEndCommandBuffer(VkCommandBuffer commandBuffer) { +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEndCommandBuffer(VkCommandBuffer commandBuffer) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(commandBuffer); @@ -1790,9 +1557,7 @@ vkEndCommandBuffer(VkCommandBuffer commandBuffer) { return disp->EndCommandBuffer(commandBuffer); } -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL -vkResetCommandBuffer(VkCommandBuffer commandBuffer, - VkCommandBufferResetFlags flags) { +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkResetCommandBuffer(VkCommandBuffer commandBuffer, VkCommandBufferResetFlags flags) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(commandBuffer); @@ -1800,9 +1565,8 @@ vkResetCommandBuffer(VkCommandBuffer commandBuffer, return disp->ResetCommandBuffer(commandBuffer, flags); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkCmdBindPipeline(VkCommandBuffer commandBuffer, - VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdBindPipeline(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, + VkPipeline pipeline) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(commandBuffer); @@ -1810,20 +1574,17 @@ vkCmdBindPipeline(VkCommandBuffer commandBuffer, disp->CmdBindPipeline(commandBuffer, pipelineBindPoint, pipeline); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkCmdSetViewport(VkCommandBuffer commandBuffer, uint32_t firstViewport, - uint32_t viewportCount, const VkViewport *pViewports) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdSetViewport(VkCommandBuffer commandBuffer, uint32_t firstViewport, + uint32_t viewportCount, const VkViewport *pViewports) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(commandBuffer); - disp->CmdSetViewport(commandBuffer, firstViewport, viewportCount, - pViewports); + disp->CmdSetViewport(commandBuffer, firstViewport, viewportCount, pViewports); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkCmdSetScissor(VkCommandBuffer commandBuffer, uint32_t firstScissor, - uint32_t scissorCount, const VkRect2D *pScissors) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdSetScissor(VkCommandBuffer commandBuffer, uint32_t firstScissor, + uint32_t scissorCount, const VkRect2D *pScissors) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(commandBuffer); @@ -1831,8 +1592,7 @@ vkCmdSetScissor(VkCommandBuffer commandBuffer, uint32_t firstScissor, disp->CmdSetScissor(commandBuffer, firstScissor, scissorCount, pScissors); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkCmdSetLineWidth(VkCommandBuffer commandBuffer, float lineWidth) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdSetLineWidth(VkCommandBuffer commandBuffer, float lineWidth) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(commandBuffer); @@ -1840,20 +1600,16 @@ vkCmdSetLineWidth(VkCommandBuffer commandBuffer, float lineWidth) { disp->CmdSetLineWidth(commandBuffer, lineWidth); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkCmdSetDepthBias(VkCommandBuffer commandBuffer, float depthBiasConstantFactor, - float depthBiasClamp, float depthBiasSlopeFactor) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdSetDepthBias(VkCommandBuffer commandBuffer, float depthBiasConstantFactor, + float depthBiasClamp, float depthBiasSlopeFactor) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(commandBuffer); - disp->CmdSetDepthBias(commandBuffer, depthBiasConstantFactor, - depthBiasClamp, depthBiasSlopeFactor); + disp->CmdSetDepthBias(commandBuffer, depthBiasConstantFactor, depthBiasClamp, depthBiasSlopeFactor); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkCmdSetBlendConstants(VkCommandBuffer commandBuffer, - const float blendConstants[4]) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdSetBlendConstants(VkCommandBuffer commandBuffer, const float blendConstants[4]) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(commandBuffer); @@ -1861,9 +1617,8 @@ vkCmdSetBlendConstants(VkCommandBuffer commandBuffer, disp->CmdSetBlendConstants(commandBuffer, blendConstants); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkCmdSetDepthBounds(VkCommandBuffer commandBuffer, float minDepthBounds, - float maxDepthBounds) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdSetDepthBounds(VkCommandBuffer commandBuffer, float minDepthBounds, + float maxDepthBounds) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(commandBuffer); @@ -1871,9 +1626,8 @@ vkCmdSetDepthBounds(VkCommandBuffer commandBuffer, float minDepthBounds, disp->CmdSetDepthBounds(commandBuffer, minDepthBounds, maxDepthBounds); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkCmdSetStencilCompareMask(VkCommandBuffer commandBuffer, - VkStencilFaceFlags faceMask, uint32_t compareMask) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdSetStencilCompareMask(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, + uint32_t compareMask) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(commandBuffer); @@ -1881,9 +1635,8 @@ vkCmdSetStencilCompareMask(VkCommandBuffer commandBuffer, disp->CmdSetStencilCompareMask(commandBuffer, faceMask, compareMask); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkCmdSetStencilWriteMask(VkCommandBuffer commandBuffer, - VkStencilFaceFlags faceMask, uint32_t writeMask) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdSetStencilWriteMask(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, + uint32_t writeMask) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(commandBuffer); @@ -1891,9 +1644,8 @@ vkCmdSetStencilWriteMask(VkCommandBuffer commandBuffer, disp->CmdSetStencilWriteMask(commandBuffer, faceMask, writeMask); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkCmdSetStencilReference(VkCommandBuffer commandBuffer, - VkStencilFaceFlags faceMask, uint32_t reference) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdSetStencilReference(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, + uint32_t reference) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(commandBuffer); @@ -1901,23 +1653,21 @@ vkCmdSetStencilReference(VkCommandBuffer commandBuffer, disp->CmdSetStencilReference(commandBuffer, faceMask, reference); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdBindDescriptorSets( - VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, - VkPipelineLayout layout, uint32_t firstSet, uint32_t descriptorSetCount, - const VkDescriptorSet *pDescriptorSets, uint32_t dynamicOffsetCount, - const uint32_t *pDynamicOffsets) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdBindDescriptorSets(VkCommandBuffer commandBuffer, + VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout, + uint32_t firstSet, uint32_t descriptorSetCount, + const VkDescriptorSet *pDescriptorSets, + uint32_t dynamicOffsetCount, const uint32_t *pDynamicOffsets) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(commandBuffer); - disp->CmdBindDescriptorSets(commandBuffer, pipelineBindPoint, layout, - firstSet, descriptorSetCount, pDescriptorSets, + disp->CmdBindDescriptorSets(commandBuffer, pipelineBindPoint, layout, firstSet, descriptorSetCount, pDescriptorSets, dynamicOffsetCount, pDynamicOffsets); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkCmdBindIndexBuffer(VkCommandBuffer commandBuffer, VkBuffer buffer, - VkDeviceSize offset, VkIndexType indexType) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdBindIndexBuffer(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, + VkIndexType indexType) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(commandBuffer); @@ -1925,45 +1675,37 @@ vkCmdBindIndexBuffer(VkCommandBuffer commandBuffer, VkBuffer buffer, disp->CmdBindIndexBuffer(commandBuffer, buffer, offset, indexType); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkCmdBindVertexBuffers(VkCommandBuffer commandBuffer, uint32_t firstBinding, - uint32_t bindingCount, const VkBuffer *pBuffers, - const VkDeviceSize *pOffsets) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdBindVertexBuffers(VkCommandBuffer commandBuffer, uint32_t firstBinding, + uint32_t bindingCount, const VkBuffer *pBuffers, + const VkDeviceSize *pOffsets) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(commandBuffer); - disp->CmdBindVertexBuffers(commandBuffer, firstBinding, bindingCount, - pBuffers, pOffsets); + disp->CmdBindVertexBuffers(commandBuffer, firstBinding, bindingCount, pBuffers, pOffsets); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkCmdDraw(VkCommandBuffer commandBuffer, uint32_t vertexCount, - uint32_t instanceCount, uint32_t firstVertex, - uint32_t firstInstance) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdDraw(VkCommandBuffer commandBuffer, uint32_t vertexCount, uint32_t instanceCount, + uint32_t firstVertex, uint32_t firstInstance) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(commandBuffer); - disp->CmdDraw(commandBuffer, vertexCount, instanceCount, firstVertex, - firstInstance); + disp->CmdDraw(commandBuffer, vertexCount, instanceCount, firstVertex, firstInstance); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkCmdDrawIndexed(VkCommandBuffer commandBuffer, uint32_t indexCount, - uint32_t instanceCount, uint32_t firstIndex, - int32_t vertexOffset, uint32_t firstInstance) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndexed(VkCommandBuffer commandBuffer, uint32_t indexCount, + uint32_t instanceCount, uint32_t firstIndex, int32_t vertexOffset, + uint32_t firstInstance) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(commandBuffer); - disp->CmdDrawIndexed(commandBuffer, indexCount, instanceCount, firstIndex, - vertexOffset, firstInstance); + disp->CmdDrawIndexed(commandBuffer, indexCount, instanceCount, firstIndex, vertexOffset, firstInstance); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkCmdDrawIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, - VkDeviceSize offset, uint32_t drawCount, uint32_t stride) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, + uint32_t drawCount, uint32_t stride) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(commandBuffer); @@ -1971,21 +1713,16 @@ vkCmdDrawIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, disp->CmdDrawIndirect(commandBuffer, buffer, offset, drawCount, stride); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkCmdDrawIndexedIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, - VkDeviceSize offset, uint32_t drawCount, - uint32_t stride) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndexedIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, + VkDeviceSize offset, uint32_t drawCount, uint32_t stride) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(commandBuffer); - disp->CmdDrawIndexedIndirect(commandBuffer, buffer, offset, drawCount, - stride); + disp->CmdDrawIndexedIndirect(commandBuffer, buffer, offset, drawCount, stride); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkCmdDispatch(VkCommandBuffer commandBuffer, uint32_t x, uint32_t y, - uint32_t z) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdDispatch(VkCommandBuffer commandBuffer, uint32_t x, uint32_t y, uint32_t z) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(commandBuffer); @@ -1993,9 +1730,8 @@ vkCmdDispatch(VkCommandBuffer commandBuffer, uint32_t x, uint32_t y, disp->CmdDispatch(commandBuffer, x, y, z); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkCmdDispatchIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, - VkDeviceSize offset) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdDispatchIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, + VkDeviceSize offset) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(commandBuffer); @@ -2003,74 +1739,59 @@ vkCmdDispatchIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, disp->CmdDispatchIndirect(commandBuffer, buffer, offset); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkCmdCopyBuffer(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, - VkBuffer dstBuffer, uint32_t regionCount, - const VkBufferCopy *pRegions) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdCopyBuffer(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkBuffer dstBuffer, + uint32_t regionCount, const VkBufferCopy *pRegions) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(commandBuffer); - disp->CmdCopyBuffer(commandBuffer, srcBuffer, dstBuffer, regionCount, - pRegions); + disp->CmdCopyBuffer(commandBuffer, srcBuffer, dstBuffer, regionCount, pRegions); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkCmdCopyImage(VkCommandBuffer commandBuffer, VkImage srcImage, - VkImageLayout srcImageLayout, VkImage dstImage, - VkImageLayout dstImageLayout, uint32_t regionCount, - const VkImageCopy *pRegions) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdCopyImage(VkCommandBuffer commandBuffer, VkImage srcImage, + VkImageLayout srcImageLayout, VkImage dstImage, + VkImageLayout dstImageLayout, uint32_t regionCount, + const VkImageCopy *pRegions) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(commandBuffer); - disp->CmdCopyImage(commandBuffer, srcImage, srcImageLayout, dstImage, - dstImageLayout, regionCount, pRegions); + disp->CmdCopyImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkCmdBlitImage(VkCommandBuffer commandBuffer, VkImage srcImage, - VkImageLayout srcImageLayout, VkImage dstImage, - VkImageLayout dstImageLayout, uint32_t regionCount, - const VkImageBlit *pRegions, VkFilter filter) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdBlitImage(VkCommandBuffer commandBuffer, VkImage srcImage, + VkImageLayout srcImageLayout, VkImage dstImage, + VkImageLayout dstImageLayout, uint32_t regionCount, + const VkImageBlit *pRegions, VkFilter filter) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(commandBuffer); - disp->CmdBlitImage(commandBuffer, srcImage, srcImageLayout, dstImage, - dstImageLayout, regionCount, pRegions, filter); + disp->CmdBlitImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions, filter); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkCmdCopyBufferToImage(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, - VkImage dstImage, VkImageLayout dstImageLayout, - uint32_t regionCount, - const VkBufferImageCopy *pRegions) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdCopyBufferToImage(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkImage dstImage, + VkImageLayout dstImageLayout, uint32_t regionCount, + const VkBufferImageCopy *pRegions) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(commandBuffer); - disp->CmdCopyBufferToImage(commandBuffer, srcBuffer, dstImage, - dstImageLayout, regionCount, pRegions); + disp->CmdCopyBufferToImage(commandBuffer, srcBuffer, dstImage, dstImageLayout, regionCount, pRegions); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkCmdCopyImageToBuffer(VkCommandBuffer commandBuffer, VkImage srcImage, - VkImageLayout srcImageLayout, VkBuffer dstBuffer, - uint32_t regionCount, - const VkBufferImageCopy *pRegions) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdCopyImageToBuffer(VkCommandBuffer commandBuffer, VkImage srcImage, + VkImageLayout srcImageLayout, VkBuffer dstBuffer, + uint32_t regionCount, const VkBufferImageCopy *pRegions) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(commandBuffer); - disp->CmdCopyImageToBuffer(commandBuffer, srcImage, srcImageLayout, - dstBuffer, regionCount, pRegions); + disp->CmdCopyImageToBuffer(commandBuffer, srcImage, srcImageLayout, dstBuffer, regionCount, pRegions); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkCmdUpdateBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, - VkDeviceSize dstOffset, VkDeviceSize dataSize, - const void *pData) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdUpdateBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, + VkDeviceSize dstOffset, VkDeviceSize dataSize, const void *pData) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(commandBuffer); @@ -2078,9 +1799,8 @@ vkCmdUpdateBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, disp->CmdUpdateBuffer(commandBuffer, dstBuffer, dstOffset, dataSize, pData); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkCmdFillBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, - VkDeviceSize dstOffset, VkDeviceSize size, uint32_t data) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdFillBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, + VkDeviceSize size, uint32_t data) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(commandBuffer); @@ -2088,61 +1808,50 @@ vkCmdFillBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, disp->CmdFillBuffer(commandBuffer, dstBuffer, dstOffset, size, data); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkCmdClearColorImage(VkCommandBuffer commandBuffer, VkImage image, - VkImageLayout imageLayout, const VkClearColorValue *pColor, - uint32_t rangeCount, - const VkImageSubresourceRange *pRanges) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdClearColorImage(VkCommandBuffer commandBuffer, VkImage image, + VkImageLayout imageLayout, const VkClearColorValue *pColor, + uint32_t rangeCount, const VkImageSubresourceRange *pRanges) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(commandBuffer); - disp->CmdClearColorImage(commandBuffer, image, imageLayout, pColor, - rangeCount, pRanges); + disp->CmdClearColorImage(commandBuffer, image, imageLayout, pColor, rangeCount, pRanges); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkCmdClearDepthStencilImage(VkCommandBuffer commandBuffer, VkImage image, - VkImageLayout imageLayout, - const VkClearDepthStencilValue *pDepthStencil, - uint32_t rangeCount, - const VkImageSubresourceRange *pRanges) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdClearDepthStencilImage(VkCommandBuffer commandBuffer, VkImage image, + VkImageLayout imageLayout, + const VkClearDepthStencilValue *pDepthStencil, + uint32_t rangeCount, const VkImageSubresourceRange *pRanges) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(commandBuffer); - disp->CmdClearDepthStencilImage(commandBuffer, image, imageLayout, - pDepthStencil, rangeCount, pRanges); + disp->CmdClearDepthStencilImage(commandBuffer, image, imageLayout, pDepthStencil, rangeCount, pRanges); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkCmdClearAttachments(VkCommandBuffer commandBuffer, uint32_t attachmentCount, - const VkClearAttachment *pAttachments, uint32_t rectCount, - const VkClearRect *pRects) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdClearAttachments(VkCommandBuffer commandBuffer, uint32_t attachmentCount, + const VkClearAttachment *pAttachments, uint32_t rectCount, + const VkClearRect *pRects) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(commandBuffer); - disp->CmdClearAttachments(commandBuffer, attachmentCount, pAttachments, - rectCount, pRects); + disp->CmdClearAttachments(commandBuffer, attachmentCount, pAttachments, rectCount, pRects); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkCmdResolveImage(VkCommandBuffer commandBuffer, VkImage srcImage, - VkImageLayout srcImageLayout, VkImage dstImage, - VkImageLayout dstImageLayout, uint32_t regionCount, - const VkImageResolve *pRegions) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdResolveImage(VkCommandBuffer commandBuffer, VkImage srcImage, + VkImageLayout srcImageLayout, VkImage dstImage, + VkImageLayout dstImageLayout, uint32_t regionCount, + const VkImageResolve *pRegions) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(commandBuffer); - disp->CmdResolveImage(commandBuffer, srcImage, srcImageLayout, dstImage, - dstImageLayout, regionCount, pRegions); + disp->CmdResolveImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkCmdSetEvent(VkCommandBuffer commandBuffer, VkEvent event, - VkPipelineStageFlags stageMask) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdSetEvent(VkCommandBuffer commandBuffer, VkEvent event, + VkPipelineStageFlags stageMask) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(commandBuffer); @@ -2150,9 +1859,8 @@ vkCmdSetEvent(VkCommandBuffer commandBuffer, VkEvent event, disp->CmdSetEvent(commandBuffer, event, stageMask); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkCmdResetEvent(VkCommandBuffer commandBuffer, VkEvent event, - VkPipelineStageFlags stageMask) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdResetEvent(VkCommandBuffer commandBuffer, VkEvent event, + VkPipelineStageFlags stageMask) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(commandBuffer); @@ -2160,46 +1868,38 @@ vkCmdResetEvent(VkCommandBuffer commandBuffer, VkEvent event, disp->CmdResetEvent(commandBuffer, event, stageMask); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkCmdWaitEvents(VkCommandBuffer commandBuffer, uint32_t eventCount, - const VkEvent *pEvents, VkPipelineStageFlags sourceStageMask, - VkPipelineStageFlags dstStageMask, uint32_t memoryBarrierCount, - const VkMemoryBarrier *pMemoryBarriers, - uint32_t bufferMemoryBarrierCount, - const VkBufferMemoryBarrier *pBufferMemoryBarriers, - uint32_t imageMemoryBarrierCount, - const VkImageMemoryBarrier *pImageMemoryBarriers) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdWaitEvents(VkCommandBuffer commandBuffer, uint32_t eventCount, const VkEvent *pEvents, + VkPipelineStageFlags sourceStageMask, VkPipelineStageFlags dstStageMask, + uint32_t memoryBarrierCount, const VkMemoryBarrier *pMemoryBarriers, + uint32_t bufferMemoryBarrierCount, + const VkBufferMemoryBarrier *pBufferMemoryBarriers, + uint32_t imageMemoryBarrierCount, + const VkImageMemoryBarrier *pImageMemoryBarriers) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(commandBuffer); - disp->CmdWaitEvents(commandBuffer, eventCount, pEvents, sourceStageMask, - dstStageMask, memoryBarrierCount, pMemoryBarriers, - bufferMemoryBarrierCount, pBufferMemoryBarriers, - imageMemoryBarrierCount, pImageMemoryBarriers); + disp->CmdWaitEvents(commandBuffer, eventCount, pEvents, sourceStageMask, dstStageMask, memoryBarrierCount, pMemoryBarriers, + bufferMemoryBarrierCount, pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdPipelineBarrier( - VkCommandBuffer commandBuffer, VkPipelineStageFlags srcStageMask, - VkPipelineStageFlags dstStageMask, VkDependencyFlags dependencyFlags, - uint32_t memoryBarrierCount, const VkMemoryBarrier *pMemoryBarriers, - uint32_t bufferMemoryBarrierCount, - const VkBufferMemoryBarrier *pBufferMemoryBarriers, - uint32_t imageMemoryBarrierCount, - const VkImageMemoryBarrier *pImageMemoryBarriers) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdPipelineBarrier(VkCommandBuffer commandBuffer, VkPipelineStageFlags srcStageMask, + VkPipelineStageFlags dstStageMask, VkDependencyFlags dependencyFlags, + uint32_t memoryBarrierCount, const VkMemoryBarrier *pMemoryBarriers, + uint32_t bufferMemoryBarrierCount, + const VkBufferMemoryBarrier *pBufferMemoryBarriers, + uint32_t imageMemoryBarrierCount, + const VkImageMemoryBarrier *pImageMemoryBarriers) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(commandBuffer); - disp->CmdPipelineBarrier( - commandBuffer, srcStageMask, dstStageMask, dependencyFlags, - memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount, - pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers); + disp->CmdPipelineBarrier(commandBuffer, srcStageMask, dstStageMask, dependencyFlags, memoryBarrierCount, pMemoryBarriers, + bufferMemoryBarrierCount, pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkCmdBeginQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool, - uint32_t slot, VkFlags flags) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdBeginQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t slot, + VkFlags flags) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(commandBuffer); @@ -2207,9 +1907,7 @@ vkCmdBeginQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool, disp->CmdBeginQuery(commandBuffer, queryPool, slot, flags); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkCmdEndQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool, - uint32_t slot) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdEndQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t slot) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(commandBuffer); @@ -2217,9 +1915,8 @@ vkCmdEndQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool, disp->CmdEndQuery(commandBuffer, queryPool, slot); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkCmdResetQueryPool(VkCommandBuffer commandBuffer, VkQueryPool queryPool, - uint32_t firstQuery, uint32_t queryCount) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdResetQueryPool(VkCommandBuffer commandBuffer, VkQueryPool queryPool, + uint32_t firstQuery, uint32_t queryCount) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(commandBuffer); @@ -2227,10 +1924,8 @@ vkCmdResetQueryPool(VkCommandBuffer commandBuffer, VkQueryPool queryPool, disp->CmdResetQueryPool(commandBuffer, queryPool, firstQuery, queryCount); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkCmdWriteTimestamp(VkCommandBuffer commandBuffer, - VkPipelineStageFlagBits pipelineStage, - VkQueryPool queryPool, uint32_t slot) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdWriteTimestamp(VkCommandBuffer commandBuffer, VkPipelineStageFlagBits pipelineStage, + VkQueryPool queryPool, uint32_t slot) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(commandBuffer); @@ -2238,36 +1933,29 @@ vkCmdWriteTimestamp(VkCommandBuffer commandBuffer, disp->CmdWriteTimestamp(commandBuffer, pipelineStage, queryPool, slot); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkCmdCopyQueryPoolResults(VkCommandBuffer commandBuffer, VkQueryPool queryPool, - uint32_t firstQuery, uint32_t queryCount, - VkBuffer dstBuffer, VkDeviceSize dstOffset, - VkDeviceSize stride, VkFlags flags) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdCopyQueryPoolResults(VkCommandBuffer commandBuffer, VkQueryPool queryPool, + uint32_t firstQuery, uint32_t queryCount, VkBuffer dstBuffer, + VkDeviceSize dstOffset, VkDeviceSize stride, VkFlags flags) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(commandBuffer); - disp->CmdCopyQueryPoolResults(commandBuffer, queryPool, firstQuery, - queryCount, dstBuffer, dstOffset, stride, - flags); + disp->CmdCopyQueryPoolResults(commandBuffer, queryPool, firstQuery, queryCount, dstBuffer, dstOffset, stride, flags); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkCmdPushConstants(VkCommandBuffer commandBuffer, VkPipelineLayout layout, - VkShaderStageFlags stageFlags, uint32_t offset, - uint32_t size, const void *pValues) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdPushConstants(VkCommandBuffer commandBuffer, VkPipelineLayout layout, + VkShaderStageFlags stageFlags, uint32_t offset, uint32_t size, + const void *pValues) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(commandBuffer); - disp->CmdPushConstants(commandBuffer, layout, stageFlags, offset, size, - pValues); + disp->CmdPushConstants(commandBuffer, layout, stageFlags, offset, size, pValues); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkCmdBeginRenderPass(VkCommandBuffer commandBuffer, - const VkRenderPassBeginInfo *pRenderPassBegin, - VkSubpassContents contents) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdBeginRenderPass(VkCommandBuffer commandBuffer, + const VkRenderPassBeginInfo *pRenderPassBegin, + VkSubpassContents contents) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(commandBuffer); @@ -2275,8 +1963,7 @@ vkCmdBeginRenderPass(VkCommandBuffer commandBuffer, disp->CmdBeginRenderPass(commandBuffer, pRenderPassBegin, contents); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkCmdNextSubpass(VkCommandBuffer commandBuffer, VkSubpassContents contents) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdNextSubpass(VkCommandBuffer commandBuffer, VkSubpassContents contents) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(commandBuffer); @@ -2284,8 +1971,7 @@ vkCmdNextSubpass(VkCommandBuffer commandBuffer, VkSubpassContents contents) { disp->CmdNextSubpass(commandBuffer, contents); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkCmdEndRenderPass(VkCommandBuffer commandBuffer) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdEndRenderPass(VkCommandBuffer commandBuffer) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(commandBuffer); @@ -2293,14 +1979,11 @@ vkCmdEndRenderPass(VkCommandBuffer commandBuffer) { disp->CmdEndRenderPass(commandBuffer); } -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkCmdExecuteCommands(VkCommandBuffer commandBuffer, - uint32_t commandBuffersCount, - const VkCommandBuffer *pCommandBuffers) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdExecuteCommands(VkCommandBuffer commandBuffer, uint32_t commandBuffersCount, + const VkCommandBuffer *pCommandBuffers) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(commandBuffer); - disp->CmdExecuteCommands(commandBuffer, commandBuffersCount, - pCommandBuffers); + disp->CmdExecuteCommands(commandBuffer, commandBuffersCount, pCommandBuffers); } diff --git a/loader/vk_loader_layer.h b/loader/vk_loader_layer.h index 2207c029..425154d8 100644 --- a/loader/vk_loader_layer.h +++ b/loader/vk_loader_layer.h @@ -29,4 +29,3 @@ typedef struct VkLayerDbgFunctionNode_ { void *pUserData; struct VkLayerDbgFunctionNode_ *pNext; } VkLayerDbgFunctionNode; - diff --git a/loader/vk_loader_platform.h b/loader/vk_loader_platform.h index dc4ac109..e0af8965 100644 --- a/loader/vk_loader_platform.h +++ b/loader/vk_loader_platform.h @@ -50,20 +50,17 @@ #define PATH_SEPARATOR ':' #define DIRECTORY_SYMBOL '/' -#define VULKAN_DIR "/vulkan/" -#define VULKAN_ICDCONF_DIR "icd.d" -#define VULKAN_ICD_DIR "icd" +#define VULKAN_DIR "/vulkan/" +#define VULKAN_ICDCONF_DIR "icd.d" +#define VULKAN_ICD_DIR "icd" #define VULKAN_ELAYERCONF_DIR "explicit_layer.d" #define VULKAN_ILAYERCONF_DIR "implicit_layer.d" -#define VULKAN_LAYER_DIR "layer" +#define VULKAN_LAYER_DIR "layer" #if defined(EXTRASYSCONFDIR) -#define EXTRA_DRIVERS_SYSCONFDIR_INFO ":" \ - EXTRASYSCONFDIR VULKAN_DIR VULKAN_ICDCONF_DIR -#define EXTRA_ELAYERS_SYSCONFDIR_INFO ":" \ - EXTRASYSCONFDIR VULKAN_DIR VULKAN_ELAYERCONF_DIR -#define EXTRA_ILAYERS_SYSCONFDIR_INFO ":" \ - EXTRASYSCONFDIR VULKAN_DIR VULKAN_ILAYERCONF_DIR +#define EXTRA_DRIVERS_SYSCONFDIR_INFO ":" EXTRASYSCONFDIR VULKAN_DIR VULKAN_ICDCONF_DIR +#define EXTRA_ELAYERS_SYSCONFDIR_INFO ":" EXTRASYSCONFDIR VULKAN_DIR VULKAN_ELAYERCONF_DIR +#define EXTRA_ILAYERS_SYSCONFDIR_INFO ":" EXTRASYSCONFDIR VULKAN_DIR VULKAN_ILAYERCONF_DIR #else #define EXTRA_DRIVERS_SYSCONFDIR_INFO #define EXTRA_ELAYERS_SYSCONFDIR_INFO @@ -71,33 +68,24 @@ #endif #if defined(EXTRADATADIR) -#define EXTRA_DRIVERS_DATADIR_INFO ":" \ - EXTRADATADIR VULKAN_DIR VULKAN_ICDCONF_DIR -#define EXTRA_ELAYERS_DATADIR_INFO ":" \ - EXTRADATADIR VULKAN_DIR VULKAN_ELAYERCONF_DIR -#define EXTRA_ILAYERS_DATADIR_INFO ":" \ - EXTRADATADIR VULKAN_DIR VULKAN_ILAYERCONF_DIR +#define EXTRA_DRIVERS_DATADIR_INFO ":" EXTRADATADIR VULKAN_DIR VULKAN_ICDCONF_DIR +#define EXTRA_ELAYERS_DATADIR_INFO ":" EXTRADATADIR VULKAN_DIR VULKAN_ELAYERCONF_DIR +#define EXTRA_ILAYERS_DATADIR_INFO ":" EXTRADATADIR VULKAN_DIR VULKAN_ILAYERCONF_DIR #else #define EXTRA_DRIVERS_DATADIR_INFO #define EXTRA_ELAYERS_DATADIR_INFO #define EXTRA_ILAYERS_DATADIR_INFO #endif -#define DEFAULT_VK_DRIVERS_INFO \ - SYSCONFDIR VULKAN_DIR VULKAN_ICDCONF_DIR ":" \ - DATADIR VULKAN_DIR VULKAN_ICDCONF_DIR \ - EXTRA_DRIVERS_SYSCONFDIR_INFO \ - EXTRA_DRIVERS_DATADIR_INFO -#define DEFAULT_VK_ELAYERS_INFO \ - SYSCONFDIR VULKAN_DIR VULKAN_ELAYERCONF_DIR ":" \ - DATADIR VULKAN_DIR VULKAN_ELAYERCONF_DIR \ - EXTRA_ELAYERS_SYSCONFDIR_INFO \ - EXTRA_ELAYERS_DATADIR_INFO -#define DEFAULT_VK_ILAYERS_INFO \ - SYSCONFDIR VULKAN_DIR VULKAN_ILAYERCONF_DIR ":" \ - DATADIR VULKAN_DIR VULKAN_ILAYERCONF_DIR \ - EXTRA_ILAYERS_SYSCONFDIR_INFO \ - EXTRA_ILAYERS_DATADIR_INFO +#define DEFAULT_VK_DRIVERS_INFO \ + SYSCONFDIR VULKAN_DIR VULKAN_ICDCONF_DIR \ + ":" DATADIR VULKAN_DIR VULKAN_ICDCONF_DIR EXTRA_DRIVERS_SYSCONFDIR_INFO EXTRA_DRIVERS_DATADIR_INFO +#define DEFAULT_VK_ELAYERS_INFO \ + SYSCONFDIR VULKAN_DIR VULKAN_ELAYERCONF_DIR \ + ":" DATADIR VULKAN_DIR VULKAN_ELAYERCONF_DIR EXTRA_ELAYERS_SYSCONFDIR_INFO EXTRA_ELAYERS_DATADIR_INFO +#define DEFAULT_VK_ILAYERS_INFO \ + SYSCONFDIR VULKAN_DIR VULKAN_ILAYERCONF_DIR \ + ":" DATADIR VULKAN_DIR VULKAN_ILAYERCONF_DIR EXTRA_ILAYERS_SYSCONFDIR_INFO EXTRA_ILAYERS_DATADIR_INFO #define DEFAULT_VK_DRIVERS_PATH "" #if !defined(DEFAULT_VK_LAYERS_PATH) @@ -131,44 +119,28 @@ static inline bool loader_platform_is_path_absolute(const char *path) { return false; } -static inline char *loader_platform_dirname(char *path) { - return dirname(path); -} +static inline char *loader_platform_dirname(char *path) { return dirname(path); } // Dynamic Loading of libraries: typedef void *loader_platform_dl_handle; -static inline loader_platform_dl_handle -loader_platform_open_library(const char *libPath) { +static inline loader_platform_dl_handle loader_platform_open_library(const char *libPath) { return dlopen(libPath, RTLD_LAZY | RTLD_LOCAL); } -static inline const char * -loader_platform_open_library_error(const char *libPath) { - return dlerror(); -} -static inline void -loader_platform_close_library(loader_platform_dl_handle library) { - dlclose(library); -} -static inline void * -loader_platform_get_proc_address(loader_platform_dl_handle library, - const char *name) { +static inline const char *loader_platform_open_library_error(const char *libPath) { return dlerror(); } +static inline void loader_platform_close_library(loader_platform_dl_handle library) { dlclose(library); } +static inline void *loader_platform_get_proc_address(loader_platform_dl_handle library, const char *name) { assert(library); assert(name); return dlsym(library, name); } -static inline const char * -loader_platform_get_proc_address_error(const char *name) { - return dlerror(); -} +static inline const char *loader_platform_get_proc_address_error(const char *name) { return dlerror(); } // Threads: typedef pthread_t loader_platform_thread; #define THREAD_LOCAL_DECL __thread -#define LOADER_PLATFORM_THREAD_ONCE_DECLARATION(var) \ - pthread_once_t var = PTHREAD_ONCE_INIT; +#define LOADER_PLATFORM_THREAD_ONCE_DECLARATION(var) pthread_once_t var = PTHREAD_ONCE_INIT; #define LOADER_PLATFORM_THREAD_ONCE_DEFINITION(var) pthread_once_t var; -static inline void loader_platform_thread_once(pthread_once_t *ctl, - void (*func)(void)) { +static inline void loader_platform_thread_once(pthread_once_t *ctl, void (*func)(void)) { assert(func != NULL); assert(ctl != NULL); pthread_once(ctl, func); @@ -176,42 +148,20 @@ static inline void loader_platform_thread_once(pthread_once_t *ctl, // Thread IDs: typedef pthread_t loader_platform_thread_id; -static inline loader_platform_thread_id loader_platform_get_thread_id() { - return pthread_self(); -} +static inline loader_platform_thread_id loader_platform_get_thread_id() { return pthread_self(); } // Thread mutex: typedef pthread_mutex_t loader_platform_thread_mutex; -static inline void -loader_platform_thread_create_mutex(loader_platform_thread_mutex *pMutex) { - pthread_mutex_init(pMutex, NULL); -} -static inline void -loader_platform_thread_lock_mutex(loader_platform_thread_mutex *pMutex) { - pthread_mutex_lock(pMutex); -} -static inline void -loader_platform_thread_unlock_mutex(loader_platform_thread_mutex *pMutex) { - pthread_mutex_unlock(pMutex); -} -static inline void -loader_platform_thread_delete_mutex(loader_platform_thread_mutex *pMutex) { - pthread_mutex_destroy(pMutex); -} +static inline void loader_platform_thread_create_mutex(loader_platform_thread_mutex *pMutex) { pthread_mutex_init(pMutex, NULL); } +static inline void loader_platform_thread_lock_mutex(loader_platform_thread_mutex *pMutex) { pthread_mutex_lock(pMutex); } +static inline void loader_platform_thread_unlock_mutex(loader_platform_thread_mutex *pMutex) { pthread_mutex_unlock(pMutex); } +static inline void loader_platform_thread_delete_mutex(loader_platform_thread_mutex *pMutex) { pthread_mutex_destroy(pMutex); } typedef pthread_cond_t loader_platform_thread_cond; -static inline void -loader_platform_thread_init_cond(loader_platform_thread_cond *pCond) { - pthread_cond_init(pCond, NULL); -} -static inline void -loader_platform_thread_cond_wait(loader_platform_thread_cond *pCond, - loader_platform_thread_mutex *pMutex) { +static inline void loader_platform_thread_init_cond(loader_platform_thread_cond *pCond) { pthread_cond_init(pCond, NULL); } +static inline void loader_platform_thread_cond_wait(loader_platform_thread_cond *pCond, loader_platform_thread_mutex *pMutex) { pthread_cond_wait(pCond, pMutex); } -static inline void -loader_platform_thread_cond_broadcast(loader_platform_thread_cond *pCond) { - pthread_cond_broadcast(pCond); -} +static inline void loader_platform_thread_cond_broadcast(loader_platform_thread_cond *pCond) { pthread_cond_broadcast(pCond); } #define loader_stack_alloc(size) alloca(size) @@ -264,9 +214,7 @@ static bool loader_platform_file_exists(const char *path) { return true; } -static bool loader_platform_is_path_absolute(const char *path) { - return !PathIsRelative(path); -} +static bool loader_platform_is_path_absolute(const char *path) { return !PathIsRelative(path); } // WIN32 runtime doesn't have dirname(). static inline char *loader_platform_dirname(char *path) { @@ -315,40 +263,30 @@ static char *loader_platform_basename(char *pathname) { // Dynamic Loading: typedef HMODULE loader_platform_dl_handle; -static loader_platform_dl_handle -loader_platform_open_library(const char *libPath) { - return LoadLibrary(libPath); -} +static loader_platform_dl_handle loader_platform_open_library(const char *libPath) { return LoadLibrary(libPath); } static char *loader_platform_open_library_error(const char *libPath) { static char errorMsg[164]; - (void)snprintf(errorMsg, 163, "Failed to open dynamic library \"%s\"", - libPath); + (void)snprintf(errorMsg, 163, "Failed to open dynamic library \"%s\"", libPath); return errorMsg; } -static void loader_platform_close_library(loader_platform_dl_handle library) { - FreeLibrary(library); -} -static void *loader_platform_get_proc_address(loader_platform_dl_handle library, - const char *name) { +static void loader_platform_close_library(loader_platform_dl_handle library) { FreeLibrary(library); } +static void *loader_platform_get_proc_address(loader_platform_dl_handle library, const char *name) { assert(library); assert(name); return GetProcAddress(library, name); } static char *loader_platform_get_proc_address_error(const char *name) { static char errorMsg[120]; - (void)snprintf(errorMsg, 119, - "Failed to find function \"%s\" in dynamic library", name); + (void)snprintf(errorMsg, 119, "Failed to find function \"%s\" in dynamic library", name); return errorMsg; } // Threads: typedef HANDLE loader_platform_thread; #define THREAD_LOCAL_DECL __declspec(thread) -#define LOADER_PLATFORM_THREAD_ONCE_DECLARATION(var) \ - INIT_ONCE var = INIT_ONCE_STATIC_INIT; +#define LOADER_PLATFORM_THREAD_ONCE_DECLARATION(var) INIT_ONCE var = INIT_ONCE_STATIC_INIT; #define LOADER_PLATFORM_THREAD_ONCE_DEFINITION(var) INIT_ONCE var; -static BOOL CALLBACK -InitFuncWrapper(PINIT_ONCE InitOnce, PVOID Parameter, PVOID *Context) { +static BOOL CALLBACK InitFuncWrapper(PINIT_ONCE InitOnce, PVOID Parameter, PVOID *Context) { void (*func)(void) = (void (*)(void))Parameter; func(); return TRUE; @@ -362,46 +300,23 @@ static void loader_platform_thread_once(void *ctl, void (*func)(void)) { // Thread IDs: typedef DWORD loader_platform_thread_id; -static loader_platform_thread_id loader_platform_get_thread_id() { - return GetCurrentThreadId(); -} +static loader_platform_thread_id loader_platform_get_thread_id() { return GetCurrentThreadId(); } // Thread mutex: typedef CRITICAL_SECTION loader_platform_thread_mutex; -static void -loader_platform_thread_create_mutex(loader_platform_thread_mutex *pMutex) { - InitializeCriticalSection(pMutex); -} -static void -loader_platform_thread_lock_mutex(loader_platform_thread_mutex *pMutex) { - EnterCriticalSection(pMutex); -} -static void -loader_platform_thread_unlock_mutex(loader_platform_thread_mutex *pMutex) { - LeaveCriticalSection(pMutex); -} -static void -loader_platform_thread_delete_mutex(loader_platform_thread_mutex *pMutex) { - DeleteCriticalSection(pMutex); -} +static void loader_platform_thread_create_mutex(loader_platform_thread_mutex *pMutex) { InitializeCriticalSection(pMutex); } +static void loader_platform_thread_lock_mutex(loader_platform_thread_mutex *pMutex) { EnterCriticalSection(pMutex); } +static void loader_platform_thread_unlock_mutex(loader_platform_thread_mutex *pMutex) { LeaveCriticalSection(pMutex); } +static void loader_platform_thread_delete_mutex(loader_platform_thread_mutex *pMutex) { DeleteCriticalSection(pMutex); } typedef CONDITION_VARIABLE loader_platform_thread_cond; -static void -loader_platform_thread_init_cond(loader_platform_thread_cond *pCond) { - InitializeConditionVariable(pCond); -} -static void -loader_platform_thread_cond_wait(loader_platform_thread_cond *pCond, - loader_platform_thread_mutex *pMutex) { +static void loader_platform_thread_init_cond(loader_platform_thread_cond *pCond) { InitializeConditionVariable(pCond); } +static void loader_platform_thread_cond_wait(loader_platform_thread_cond *pCond, loader_platform_thread_mutex *pMutex) { SleepConditionVariableCS(pCond, pMutex, INFINITE); } -static void -loader_platform_thread_cond_broadcast(loader_platform_thread_cond *pCond) { - WakeAllConditionVariable(pCond); -} +static void loader_platform_thread_cond_broadcast(loader_platform_thread_cond *pCond) { WakeAllConditionVariable(pCond); } // Windows Registry: -char *loader_get_registry_string(const HKEY hive, const LPCTSTR sub_key, - const char *value); +char *loader_get_registry_string(const HKEY hive, const LPCTSTR sub_key, const char *value); #define loader_stack_alloc(size) _alloca(size) #else // defined(_WIN32) @@ -419,6 +334,4 @@ char *loader_get_registry_string(const HKEY hive, const LPCTSTR sub_key, // returns true if the given string appears to be a relative or absolute // path, as opposed to a bare filename. -static inline bool loader_platform_is_path(const char *path) { - return strchr(path, DIRECTORY_SYMBOL) != NULL; -} +static inline bool loader_platform_is_path(const char *path) { return strchr(path, DIRECTORY_SYMBOL) != NULL; } diff --git a/loader/wsi.c b/loader/wsi.c index b2e96f8d..a34498fe 100644 --- a/loader/wsi.c +++ b/loader/wsi.c @@ -34,8 +34,7 @@ // the ICDs. #define ICD_VER_SUPPORTS_ICD_SURFACE_KHR 3 -void wsi_create_instance(struct loader_instance *ptr_instance, - const VkInstanceCreateInfo *pCreateInfo) { +void wsi_create_instance(struct loader_instance *ptr_instance, const VkInstanceCreateInfo *pCreateInfo) { ptr_instance->wsi_surface_enabled = false; #ifdef VK_USE_PLATFORM_WIN32_KHR @@ -60,55 +59,47 @@ void wsi_create_instance(struct loader_instance *ptr_instance, ptr_instance->wsi_display_enabled = false; for (uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; i++) { - if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], - VK_KHR_SURFACE_EXTENSION_NAME) == 0) { + if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_SURFACE_EXTENSION_NAME) == 0) { ptr_instance->wsi_surface_enabled = true; continue; } #ifdef VK_USE_PLATFORM_WIN32_KHR - if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], - VK_KHR_WIN32_SURFACE_EXTENSION_NAME) == 0) { + if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_WIN32_SURFACE_EXTENSION_NAME) == 0) { ptr_instance->wsi_win32_surface_enabled = true; continue; } #endif // VK_USE_PLATFORM_WIN32_KHR #ifdef VK_USE_PLATFORM_MIR_KHR - if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], - VK_KHR_MIR_SURFACE_EXTENSION_NAME) == 0) { + if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_MIR_SURFACE_EXTENSION_NAME) == 0) { ptr_instance->wsi_mir_surface_enabled = true; continue; } #endif // VK_USE_PLATFORM_MIR_KHR #ifdef VK_USE_PLATFORM_WAYLAND_KHR - if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], - VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME) == 0) { + if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME) == 0) { ptr_instance->wsi_wayland_surface_enabled = true; continue; } #endif // VK_USE_PLATFORM_WAYLAND_KHR #ifdef VK_USE_PLATFORM_XCB_KHR - if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], - VK_KHR_XCB_SURFACE_EXTENSION_NAME) == 0) { + if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_XCB_SURFACE_EXTENSION_NAME) == 0) { ptr_instance->wsi_xcb_surface_enabled = true; continue; } #endif // VK_USE_PLATFORM_XCB_KHR #ifdef VK_USE_PLATFORM_XLIB_KHR - if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], - VK_KHR_XLIB_SURFACE_EXTENSION_NAME) == 0) { + if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_XLIB_SURFACE_EXTENSION_NAME) == 0) { ptr_instance->wsi_xlib_surface_enabled = true; continue; } #endif // VK_USE_PLATFORM_XLIB_KHR #ifdef VK_USE_PLATFORM_ANDROID_KHR - if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], - VK_KHR_ANDROID_SURFACE_EXTENSION_NAME) == 0) { + if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_ANDROID_SURFACE_EXTENSION_NAME) == 0) { ptr_instance->wsi_android_surface_enabled = true; continue; } #endif // VK_USE_PLATFORM_ANDROID_KHR - if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], - VK_KHR_DISPLAY_EXTENSION_NAME) == 0) { + if (strcmp(pCreateInfo->ppEnabledExtensionNames[i], VK_KHR_DISPLAY_EXTENSION_NAME) == 0) { ptr_instance->wsi_display_enabled = true; continue; } @@ -148,9 +139,8 @@ bool wsi_unsupported_instance_extension(const VkExtensionProperties *ext_prop) { // Functions for the VK_KHR_surface extension: // This is the trampoline entrypoint for DestroySurfaceKHR -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkDestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface, - const VkAllocationCallbacks *pAllocator) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface, + const VkAllocationCallbacks *pAllocator) { const VkLayerInstanceDispatchTable *disp; disp = loader_get_instance_layer_dispatch(instance); disp->DestroySurfaceKHR(instance, surface, pAllocator); @@ -159,37 +149,28 @@ vkDestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface, // TODO probably need to lock around all the loader_get_instance() calls. // This is the instance chain terminator function for DestroySurfaceKHR -VKAPI_ATTR void VKAPI_CALL -terminator_DestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface, - const VkAllocationCallbacks *pAllocator) { +VKAPI_ATTR void VKAPI_CALL terminator_DestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface, + const VkAllocationCallbacks *pAllocator) { struct loader_instance *ptr_instance = loader_get_instance(instance); VkIcdSurface *icd_surface = (VkIcdSurface *)(uintptr_t)surface; if (NULL != icd_surface) { if (NULL != icd_surface->real_icd_surfaces) { uint32_t i = 0; - for (struct loader_icd_term *icd_term = ptr_instance->icd_terms; - icd_term != NULL; icd_term = icd_term->next, i++) { - if (icd_term->scanned_icd->interface_version >= - ICD_VER_SUPPORTS_ICD_SURFACE_KHR) { - if (NULL != icd_term->DestroySurfaceKHR && - (VkSurfaceKHR)NULL != - icd_surface->real_icd_surfaces[i]) { - icd_term->DestroySurfaceKHR( - icd_term->instance, - icd_surface->real_icd_surfaces[i], pAllocator); + for (struct loader_icd_term *icd_term = ptr_instance->icd_terms; icd_term != NULL; icd_term = icd_term->next, i++) { + if (icd_term->scanned_icd->interface_version >= ICD_VER_SUPPORTS_ICD_SURFACE_KHR) { + if (NULL != icd_term->DestroySurfaceKHR && (VkSurfaceKHR)NULL != icd_surface->real_icd_surfaces[i]) { + icd_term->DestroySurfaceKHR(icd_term->instance, icd_surface->real_icd_surfaces[i], pAllocator); icd_surface->real_icd_surfaces[i] = (VkSurfaceKHR)NULL; } } else { // The real_icd_surface for any ICD not supporting the // proper interface version should be NULL. If not, then // we have a problem. - assert((VkSurfaceKHR)NULL == - icd_surface->real_icd_surfaces[i]); + assert((VkSurfaceKHR)NULL == icd_surface->real_icd_surfaces[i]); } } - loader_instance_heap_free(ptr_instance, - icd_surface->real_icd_surfaces); + loader_instance_heap_free(ptr_instance, icd_surface->real_icd_surfaces); } loader_instance_heap_free(ptr_instance, (void *)(uintptr_t)surface); @@ -197,93 +178,71 @@ terminator_DestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface, } // This is the trampoline entrypoint for GetPhysicalDeviceSurfaceSupportKHR -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL -vkGetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevice physicalDevice, - uint32_t queueFamilyIndex, - VkSurfaceKHR surface, - VkBool32 *pSupported) { +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevice physicalDevice, + uint32_t queueFamilyIndex, VkSurfaceKHR surface, + VkBool32 *pSupported) { const VkLayerInstanceDispatchTable *disp; - VkPhysicalDevice unwrapped_phys_dev = - loader_unwrap_physical_device(physicalDevice); + VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); disp = loader_get_instance_layer_dispatch(physicalDevice); - VkResult res = disp->GetPhysicalDeviceSurfaceSupportKHR( - unwrapped_phys_dev, queueFamilyIndex, surface, pSupported); + VkResult res = disp->GetPhysicalDeviceSurfaceSupportKHR(unwrapped_phys_dev, queueFamilyIndex, surface, pSupported); return res; } // This is the instance chain terminator function for // GetPhysicalDeviceSurfaceSupportKHR -VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSurfaceSupportKHR( - VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, - VkSurfaceKHR surface, VkBool32 *pSupported) { +VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevice physicalDevice, + uint32_t queueFamilyIndex, VkSurfaceKHR surface, + VkBool32 *pSupported) { // First, check to ensure the appropriate extension was enabled: - struct loader_physical_device_term *phys_dev_term = - (struct loader_physical_device_term *)physicalDevice; + struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; - struct loader_instance *ptr_instance = - (struct loader_instance *)icd_term->this_instance; + struct loader_instance *ptr_instance = (struct loader_instance *)icd_term->this_instance; if (!ptr_instance->wsi_surface_enabled) { - loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "VK_KHR_VK_KHR_surface extension not enabled. " - "vkGetPhysicalDeviceSurfaceSupportKHR not executed!\n"); + loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "VK_KHR_VK_KHR_surface extension not enabled. " + "vkGetPhysicalDeviceSurfaceSupportKHR not executed!\n"); return VK_SUCCESS; } // Next, if so, proceed with the implementation of this function: - assert(pSupported && - "GetPhysicalDeviceSurfaceSupportKHR: Error, null pSupported"); + assert(pSupported && "GetPhysicalDeviceSurfaceSupportKHR: Error, null pSupported"); *pSupported = false; - assert(icd_term->GetPhysicalDeviceSurfaceSupportKHR && - "loader: null GetPhysicalDeviceSurfaceSupportKHR ICD pointer"); + assert(icd_term->GetPhysicalDeviceSurfaceSupportKHR && "loader: null GetPhysicalDeviceSurfaceSupportKHR ICD pointer"); VkIcdSurface *icd_surface = (VkIcdSurface *)(uintptr_t)surface; - if (NULL != icd_surface->real_icd_surfaces && - (VkSurfaceKHR)NULL != - icd_surface->real_icd_surfaces[phys_dev_term->icd_index]) { - return icd_term->GetPhysicalDeviceSurfaceSupportKHR( - phys_dev_term->phys_dev, queueFamilyIndex, - icd_surface->real_icd_surfaces[phys_dev_term->icd_index], - pSupported); + if (NULL != icd_surface->real_icd_surfaces && (VkSurfaceKHR)NULL != icd_surface->real_icd_surfaces[phys_dev_term->icd_index]) { + return icd_term->GetPhysicalDeviceSurfaceSupportKHR(phys_dev_term->phys_dev, queueFamilyIndex, + icd_surface->real_icd_surfaces[phys_dev_term->icd_index], pSupported); } - return icd_term->GetPhysicalDeviceSurfaceSupportKHR( - phys_dev_term->phys_dev, queueFamilyIndex, surface, pSupported); + return icd_term->GetPhysicalDeviceSurfaceSupportKHR(phys_dev_term->phys_dev, queueFamilyIndex, surface, pSupported); } // This is the trampoline entrypoint for GetPhysicalDeviceSurfaceCapabilitiesKHR -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL -vkGetPhysicalDeviceSurfaceCapabilitiesKHR( - VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, - VkSurfaceCapabilitiesKHR *pSurfaceCapabilities) { +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceCapabilitiesKHR( + VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, VkSurfaceCapabilitiesKHR *pSurfaceCapabilities) { const VkLayerInstanceDispatchTable *disp; - VkPhysicalDevice unwrapped_phys_dev = - loader_unwrap_physical_device(physicalDevice); + VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); disp = loader_get_instance_layer_dispatch(physicalDevice); - VkResult res = disp->GetPhysicalDeviceSurfaceCapabilitiesKHR( - unwrapped_phys_dev, surface, pSurfaceCapabilities); + VkResult res = disp->GetPhysicalDeviceSurfaceCapabilitiesKHR(unwrapped_phys_dev, surface, pSurfaceCapabilities); return res; } // This is the instance chain terminator function for // GetPhysicalDeviceSurfaceCapabilitiesKHR -VKAPI_ATTR VkResult VKAPI_CALL -terminator_GetPhysicalDeviceSurfaceCapabilitiesKHR( - VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, - VkSurfaceCapabilitiesKHR *pSurfaceCapabilities) { +VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice physicalDevice, + VkSurfaceKHR surface, + VkSurfaceCapabilitiesKHR *pSurfaceCapabilities) { // First, check to ensure the appropriate extension was enabled: - struct loader_physical_device_term *phys_dev_term = - (struct loader_physical_device_term *)physicalDevice; + struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; - struct loader_instance *ptr_instance = - (struct loader_instance *)icd_term->this_instance; + struct loader_instance *ptr_instance = (struct loader_instance *)icd_term->this_instance; if (!ptr_instance->wsi_surface_enabled) { - loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "VK_KHR_surface extension not enabled. " - "vkGetPhysicalDeviceSurfaceCapabilitiesKHR not executed!\n"); + loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "VK_KHR_surface extension not enabled. " + "vkGetPhysicalDeviceSurfaceCapabilitiesKHR not executed!\n"); return VK_SUCCESS; } @@ -291,111 +250,85 @@ terminator_GetPhysicalDeviceSurfaceCapabilitiesKHR( assert(pSurfaceCapabilities && "GetPhysicalDeviceSurfaceCapabilitiesKHR: " "Error, null pSurfaceCapabilities"); - assert(icd_term->GetPhysicalDeviceSurfaceCapabilitiesKHR && - "loader: null GetPhysicalDeviceSurfaceCapabilitiesKHR ICD pointer"); + assert(icd_term->GetPhysicalDeviceSurfaceCapabilitiesKHR && "loader: null GetPhysicalDeviceSurfaceCapabilitiesKHR ICD pointer"); VkIcdSurface *icd_surface = (VkIcdSurface *)(uintptr_t)surface; - if (NULL != icd_surface->real_icd_surfaces && - (VkSurfaceKHR)NULL != - icd_surface->real_icd_surfaces[phys_dev_term->icd_index]) { + if (NULL != icd_surface->real_icd_surfaces && (VkSurfaceKHR)NULL != icd_surface->real_icd_surfaces[phys_dev_term->icd_index]) { return icd_term->GetPhysicalDeviceSurfaceCapabilitiesKHR( - phys_dev_term->phys_dev, - icd_surface->real_icd_surfaces[phys_dev_term->icd_index], - pSurfaceCapabilities); + phys_dev_term->phys_dev, icd_surface->real_icd_surfaces[phys_dev_term->icd_index], pSurfaceCapabilities); } - return icd_term->GetPhysicalDeviceSurfaceCapabilitiesKHR( - phys_dev_term->phys_dev, surface, pSurfaceCapabilities); + return icd_term->GetPhysicalDeviceSurfaceCapabilitiesKHR(phys_dev_term->phys_dev, surface, pSurfaceCapabilities); } // This is the trampoline entrypoint for GetPhysicalDeviceSurfaceFormatsKHR -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL -vkGetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice physicalDevice, - VkSurfaceKHR surface, - uint32_t *pSurfaceFormatCount, - VkSurfaceFormatKHR *pSurfaceFormats) { - VkPhysicalDevice unwrapped_phys_dev = - loader_unwrap_physical_device(physicalDevice); +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice physicalDevice, + VkSurfaceKHR surface, + uint32_t *pSurfaceFormatCount, + VkSurfaceFormatKHR *pSurfaceFormats) { + VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); const VkLayerInstanceDispatchTable *disp; disp = loader_get_instance_layer_dispatch(physicalDevice); - VkResult res = disp->GetPhysicalDeviceSurfaceFormatsKHR( - unwrapped_phys_dev, surface, pSurfaceFormatCount, pSurfaceFormats); + VkResult res = disp->GetPhysicalDeviceSurfaceFormatsKHR(unwrapped_phys_dev, surface, pSurfaceFormatCount, pSurfaceFormats); return res; } // This is the instance chain terminator function for // GetPhysicalDeviceSurfaceFormatsKHR -VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSurfaceFormatsKHR( - VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, - uint32_t *pSurfaceFormatCount, VkSurfaceFormatKHR *pSurfaceFormats) { +VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, + uint32_t *pSurfaceFormatCount, + VkSurfaceFormatKHR *pSurfaceFormats) { // First, check to ensure the appropriate extension was enabled: - struct loader_physical_device_term *phys_dev_term = - (struct loader_physical_device_term *)physicalDevice; + struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; - struct loader_instance *ptr_instance = - (struct loader_instance *)icd_term->this_instance; + struct loader_instance *ptr_instance = (struct loader_instance *)icd_term->this_instance; if (!ptr_instance->wsi_surface_enabled) { - loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "VK_KHR_surface extension not enabled. " - "vkGetPhysicalDeviceSurfaceFormatsKHR not executed!\n"); + loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "VK_KHR_surface extension not enabled. " + "vkGetPhysicalDeviceSurfaceFormatsKHR not executed!\n"); return VK_SUCCESS; } // Next, if so, proceed with the implementation of this function: - assert( - pSurfaceFormatCount && - "GetPhysicalDeviceSurfaceFormatsKHR: Error, null pSurfaceFormatCount"); + assert(pSurfaceFormatCount && "GetPhysicalDeviceSurfaceFormatsKHR: Error, null pSurfaceFormatCount"); - assert(icd_term->GetPhysicalDeviceSurfaceFormatsKHR && - "loader: null GetPhysicalDeviceSurfaceFormatsKHR ICD pointer"); + assert(icd_term->GetPhysicalDeviceSurfaceFormatsKHR && "loader: null GetPhysicalDeviceSurfaceFormatsKHR ICD pointer"); VkIcdSurface *icd_surface = (VkIcdSurface *)(uintptr_t)surface; - if (NULL != icd_surface->real_icd_surfaces && - (VkSurfaceKHR)NULL != - icd_surface->real_icd_surfaces[phys_dev_term->icd_index]) { - return icd_term->GetPhysicalDeviceSurfaceFormatsKHR( - phys_dev_term->phys_dev, - icd_surface->real_icd_surfaces[phys_dev_term->icd_index], - pSurfaceFormatCount, pSurfaceFormats); + if (NULL != icd_surface->real_icd_surfaces && (VkSurfaceKHR)NULL != icd_surface->real_icd_surfaces[phys_dev_term->icd_index]) { + return icd_term->GetPhysicalDeviceSurfaceFormatsKHR(phys_dev_term->phys_dev, + icd_surface->real_icd_surfaces[phys_dev_term->icd_index], + pSurfaceFormatCount, pSurfaceFormats); } - return icd_term->GetPhysicalDeviceSurfaceFormatsKHR( - phys_dev_term->phys_dev, surface, pSurfaceFormatCount, pSurfaceFormats); + return icd_term->GetPhysicalDeviceSurfaceFormatsKHR(phys_dev_term->phys_dev, surface, pSurfaceFormatCount, pSurfaceFormats); } // This is the trampoline entrypoint for GetPhysicalDeviceSurfacePresentModesKHR -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL -vkGetPhysicalDeviceSurfacePresentModesKHR(VkPhysicalDevice physicalDevice, - VkSurfaceKHR surface, - uint32_t *pPresentModeCount, - VkPresentModeKHR *pPresentModes) { - VkPhysicalDevice unwrapped_phys_dev = - loader_unwrap_physical_device(physicalDevice); +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfacePresentModesKHR(VkPhysicalDevice physicalDevice, + VkSurfaceKHR surface, + uint32_t *pPresentModeCount, + VkPresentModeKHR *pPresentModes) { + VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); const VkLayerInstanceDispatchTable *disp; disp = loader_get_instance_layer_dispatch(physicalDevice); - VkResult res = disp->GetPhysicalDeviceSurfacePresentModesKHR( - unwrapped_phys_dev, surface, pPresentModeCount, pPresentModes); + VkResult res = disp->GetPhysicalDeviceSurfacePresentModesKHR(unwrapped_phys_dev, surface, pPresentModeCount, pPresentModes); return res; } // This is the instance chain terminator function for // GetPhysicalDeviceSurfacePresentModesKHR -VKAPI_ATTR VkResult VKAPI_CALL -terminator_GetPhysicalDeviceSurfacePresentModesKHR( - VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, - uint32_t *pPresentModeCount, VkPresentModeKHR *pPresentModes) { +VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSurfacePresentModesKHR(VkPhysicalDevice physicalDevice, + VkSurfaceKHR surface, uint32_t *pPresentModeCount, + VkPresentModeKHR *pPresentModes) { // First, check to ensure the appropriate extension was enabled: - struct loader_physical_device_term *phys_dev_term = - (struct loader_physical_device_term *)physicalDevice; + struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; - struct loader_instance *ptr_instance = - (struct loader_instance *)icd_term->this_instance; + struct loader_instance *ptr_instance = (struct loader_instance *)icd_term->this_instance; if (!ptr_instance->wsi_surface_enabled) { - loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "VK_KHR_surface extension not enabled. " - "vkGetPhysicalDeviceSurfacePresentModesKHR not executed!\n"); + loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "VK_KHR_surface extension not enabled. " + "vkGetPhysicalDeviceSurfacePresentModesKHR not executed!\n"); return VK_SUCCESS; } @@ -403,74 +336,58 @@ terminator_GetPhysicalDeviceSurfacePresentModesKHR( assert(pPresentModeCount && "GetPhysicalDeviceSurfacePresentModesKHR: " "Error, null pPresentModeCount"); - assert(icd_term->GetPhysicalDeviceSurfacePresentModesKHR && - "loader: null GetPhysicalDeviceSurfacePresentModesKHR ICD pointer"); + assert(icd_term->GetPhysicalDeviceSurfacePresentModesKHR && "loader: null GetPhysicalDeviceSurfacePresentModesKHR ICD pointer"); VkIcdSurface *icd_surface = (VkIcdSurface *)(uintptr_t)surface; - if (NULL != icd_surface->real_icd_surfaces && - (VkSurfaceKHR)NULL != - icd_surface->real_icd_surfaces[phys_dev_term->icd_index]) { + if (NULL != icd_surface->real_icd_surfaces && (VkSurfaceKHR)NULL != icd_surface->real_icd_surfaces[phys_dev_term->icd_index]) { return icd_term->GetPhysicalDeviceSurfacePresentModesKHR( - phys_dev_term->phys_dev, - icd_surface->real_icd_surfaces[phys_dev_term->icd_index], - pPresentModeCount, pPresentModes); + phys_dev_term->phys_dev, icd_surface->real_icd_surfaces[phys_dev_term->icd_index], pPresentModeCount, pPresentModes); } - return icd_term->GetPhysicalDeviceSurfacePresentModesKHR( - phys_dev_term->phys_dev, surface, pPresentModeCount, pPresentModes); + return icd_term->GetPhysicalDeviceSurfacePresentModesKHR(phys_dev_term->phys_dev, surface, pPresentModeCount, pPresentModes); } // Functions for the VK_KHR_swapchain extension: // This is the trampoline entrypoint for CreateSwapchainKHR -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateSwapchainKHR( - VkDevice device, const VkSwapchainCreateInfoKHR *pCreateInfo, - const VkAllocationCallbacks *pAllocator, VkSwapchainKHR *pSwapchain) { +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR *pCreateInfo, + const VkAllocationCallbacks *pAllocator, + VkSwapchainKHR *pSwapchain) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); - return disp->CreateSwapchainKHR(device, pCreateInfo, pAllocator, - pSwapchain); + return disp->CreateSwapchainKHR(device, pCreateInfo, pAllocator, pSwapchain); } -VKAPI_ATTR VkResult VKAPI_CALL terminator_vkCreateSwapchainKHR( - VkDevice device, const VkSwapchainCreateInfoKHR *pCreateInfo, - const VkAllocationCallbacks *pAllocator, VkSwapchainKHR *pSwapchain) { +VKAPI_ATTR VkResult VKAPI_CALL terminator_vkCreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR *pCreateInfo, + const VkAllocationCallbacks *pAllocator, + VkSwapchainKHR *pSwapchain) { uint32_t icd_index = 0; struct loader_device *dev; - struct loader_icd_term *icd_term = - loader_get_icd_and_device(device, &dev, &icd_index); + struct loader_icd_term *icd_term = loader_get_icd_and_device(device, &dev, &icd_index); if (NULL != icd_term && NULL != icd_term->CreateSwapchainKHR) { - VkIcdSurface *icd_surface = - (VkIcdSurface *)(uintptr_t)pCreateInfo->surface; + VkIcdSurface *icd_surface = (VkIcdSurface *)(uintptr_t)pCreateInfo->surface; if (NULL != icd_surface->real_icd_surfaces) { - if ((VkSurfaceKHR)NULL != - icd_surface->real_icd_surfaces[icd_index]) { + if ((VkSurfaceKHR)NULL != icd_surface->real_icd_surfaces[icd_index]) { // We found the ICD, and there is an ICD KHR surface // associated with it, so copy the CreateInfo struct // and point it at the ICD's surface. - VkSwapchainCreateInfoKHR *pCreateCopy = - loader_stack_alloc(sizeof(VkSwapchainCreateInfoKHR)); + VkSwapchainCreateInfoKHR *pCreateCopy = loader_stack_alloc(sizeof(VkSwapchainCreateInfoKHR)); if (NULL == pCreateCopy) { return VK_ERROR_OUT_OF_HOST_MEMORY; } - memcpy(pCreateCopy, pCreateInfo, - sizeof(VkSwapchainCreateInfoKHR)); - pCreateCopy->surface = - icd_surface->real_icd_surfaces[icd_index]; - return icd_term->CreateSwapchainKHR(device, pCreateCopy, - pAllocator, pSwapchain); + memcpy(pCreateCopy, pCreateInfo, sizeof(VkSwapchainCreateInfoKHR)); + pCreateCopy->surface = icd_surface->real_icd_surfaces[icd_index]; + return icd_term->CreateSwapchainKHR(device, pCreateCopy, pAllocator, pSwapchain); } } - return icd_term->CreateSwapchainKHR(device, pCreateInfo, pAllocator, - pSwapchain); + return icd_term->CreateSwapchainKHR(device, pCreateInfo, pAllocator, pSwapchain); } return VK_SUCCESS; } // This is the trampoline entrypoint for DestroySwapchainKHR -LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL -vkDestroySwapchainKHR(VkDevice device, VkSwapchainKHR swapchain, - const VkAllocationCallbacks *pAllocator) { +LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroySwapchainKHR(VkDevice device, VkSwapchainKHR swapchain, + const VkAllocationCallbacks *pAllocator) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); disp->DestroySwapchainKHR(device, swapchain, pAllocator); @@ -480,60 +397,49 @@ vkDestroySwapchainKHR(VkDevice device, VkSwapchainKHR swapchain, * This is the trampoline entrypoint * for GetSwapchainImagesKHR */ -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetSwapchainImagesKHR( - VkDevice device, VkSwapchainKHR swapchain, uint32_t *pSwapchainImageCount, - VkImage *pSwapchainImages) { +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetSwapchainImagesKHR(VkDevice device, VkSwapchainKHR swapchain, + uint32_t *pSwapchainImageCount, VkImage *pSwapchainImages) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); - return disp->GetSwapchainImagesKHR(device, swapchain, pSwapchainImageCount, - pSwapchainImages); + return disp->GetSwapchainImagesKHR(device, swapchain, pSwapchainImageCount, pSwapchainImages); } /* * This is the trampoline entrypoint * for AcquireNextImageKHR */ -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkAcquireNextImageKHR( - VkDevice device, VkSwapchainKHR swapchain, uint64_t timeout, - VkSemaphore semaphore, VkFence fence, uint32_t *pImageIndex) { +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkAcquireNextImageKHR(VkDevice device, VkSwapchainKHR swapchain, uint64_t timeout, + VkSemaphore semaphore, VkFence fence, uint32_t *pImageIndex) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); - return disp->AcquireNextImageKHR(device, swapchain, timeout, semaphore, - fence, pImageIndex); + return disp->AcquireNextImageKHR(device, swapchain, timeout, semaphore, fence, pImageIndex); } // This is the trampoline entrypoint for QueuePresentKHR -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL -vkQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR *pPresentInfo) { +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR *pPresentInfo) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(queue); return disp->QueuePresentKHR(queue, pPresentInfo); } -static VkIcdSurface *AllocateIcdSurfaceStruct(struct loader_instance *instance, - size_t base_size, - size_t platform_size) { +static VkIcdSurface *AllocateIcdSurfaceStruct(struct loader_instance *instance, size_t base_size, size_t platform_size) { // Next, if so, proceed with the implementation of this function: - VkIcdSurface *pIcdSurface = loader_instance_heap_alloc( - instance, sizeof(VkIcdSurface), VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); + VkIcdSurface *pIcdSurface = loader_instance_heap_alloc(instance, sizeof(VkIcdSurface), VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); if (pIcdSurface != NULL) { // Setup the new sizes and offsets so we can grow the structures in the // future without having problems pIcdSurface->base_size = (uint32_t)base_size; pIcdSurface->platform_size = (uint32_t)platform_size; - pIcdSurface->non_platform_offset = (uint32_t)( - (uint8_t *)(&pIcdSurface->base_size) - (uint8_t *)pIcdSurface); + pIcdSurface->non_platform_offset = (uint32_t)((uint8_t *)(&pIcdSurface->base_size) - (uint8_t *)pIcdSurface); pIcdSurface->entire_size = sizeof(VkIcdSurface); - pIcdSurface->real_icd_surfaces = loader_instance_heap_alloc( - instance, sizeof(VkSurfaceKHR) * instance->total_icd_count, - VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); + pIcdSurface->real_icd_surfaces = loader_instance_heap_alloc(instance, sizeof(VkSurfaceKHR) * instance->total_icd_count, + VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); if (pIcdSurface->real_icd_surfaces == NULL) { loader_instance_heap_free(instance, pIcdSurface); pIcdSurface = NULL; } else { - memset(pIcdSurface->real_icd_surfaces, 0, - sizeof(VkSurfaceKHR) * instance->total_icd_count); + memset(pIcdSurface->real_icd_surfaces, 0, sizeof(VkSurfaceKHR) * instance->total_icd_count); } } return pIcdSurface; @@ -544,22 +450,21 @@ static VkIcdSurface *AllocateIcdSurfaceStruct(struct loader_instance *instance, // Functions for the VK_KHR_win32_surface extension: // This is the trampoline entrypoint for CreateWin32SurfaceKHR -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateWin32SurfaceKHR( - VkInstance instance, const VkWin32SurfaceCreateInfoKHR *pCreateInfo, - const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateWin32SurfaceKHR(VkInstance instance, + const VkWin32SurfaceCreateInfoKHR *pCreateInfo, + const VkAllocationCallbacks *pAllocator, + VkSurfaceKHR *pSurface) { const VkLayerInstanceDispatchTable *disp; disp = loader_get_instance_layer_dispatch(instance); VkResult res; - res = disp->CreateWin32SurfaceKHR(instance, pCreateInfo, pAllocator, - pSurface); + res = disp->CreateWin32SurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); return res; } // This is the instance chain terminator function for CreateWin32SurfaceKHR -VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateWin32SurfaceKHR( - VkInstance instance, const VkWin32SurfaceCreateInfoKHR *pCreateInfo, - const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { +VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateWin32SurfaceKHR(VkInstance instance, const VkWin32SurfaceCreateInfoKHR *pCreateInfo, + const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { VkResult vkRes = VK_SUCCESS; VkIcdSurface *pIcdSurface = NULL; uint32_t i = 0; @@ -569,17 +474,14 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateWin32SurfaceKHR( // First, check to ensure the appropriate extension was enabled: struct loader_instance *ptr_instance = loader_get_instance(instance); if (!ptr_instance->wsi_win32_surface_enabled) { - loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "VK_KHR_win32_surface extension not enabled. " - "vkCreateWin32SurfaceKHR not executed!\n"); + loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "VK_KHR_win32_surface extension not enabled. " + "vkCreateWin32SurfaceKHR not executed!\n"); vkRes = VK_ERROR_EXTENSION_NOT_PRESENT; goto out; } // Next, if so, proceed with the implementation of this function: - pIcdSurface = AllocateIcdSurfaceStruct(ptr_instance, - sizeof(pIcdSurface->win_surf.base), - sizeof(pIcdSurface->win_surf)); + pIcdSurface = AllocateIcdSurfaceStruct(ptr_instance, sizeof(pIcdSurface->win_surf.base), sizeof(pIcdSurface->win_surf)); if (pIcdSurface == NULL) { vkRes = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; @@ -590,14 +492,11 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateWin32SurfaceKHR( pIcdSurface->win_surf.hwnd = pCreateInfo->hwnd; // Loop through each ICD and determine if they need to create a surface - for (struct loader_icd_term *icd_term = ptr_instance->icd_terms; - icd_term != NULL; icd_term = icd_term->next, i++) { - if (icd_term->scanned_icd->interface_version >= - ICD_VER_SUPPORTS_ICD_SURFACE_KHR) { + for (struct loader_icd_term *icd_term = ptr_instance->icd_terms; icd_term != NULL; icd_term = icd_term->next, i++) { + if (icd_term->scanned_icd->interface_version >= ICD_VER_SUPPORTS_ICD_SURFACE_KHR) { if (NULL != icd_term->CreateWin32SurfaceKHR) { - vkRes = icd_term->CreateWin32SurfaceKHR( - icd_term->instance, pCreateInfo, pAllocator, - &pIcdSurface->real_icd_surfaces[i]); + vkRes = icd_term->CreateWin32SurfaceKHR(icd_term->instance, pCreateInfo, pAllocator, + &pIcdSurface->real_icd_surfaces[i]); if (VK_SUCCESS != vkRes) { goto out; } @@ -612,17 +511,12 @@ out: if (VK_SUCCESS != vkRes && NULL != pIcdSurface) { if (NULL != pIcdSurface->real_icd_surfaces) { i = 0; - for (struct loader_icd_term *icd_term = ptr_instance->icd_terms; - icd_term != NULL; icd_term = icd_term->next, i++) { - if ((VkSurfaceKHR)NULL != pIcdSurface->real_icd_surfaces[i] && - NULL != icd_term->DestroySurfaceKHR) { - icd_term->DestroySurfaceKHR( - icd_term->instance, pIcdSurface->real_icd_surfaces[i], - pAllocator); + for (struct loader_icd_term *icd_term = ptr_instance->icd_terms; icd_term != NULL; icd_term = icd_term->next, i++) { + if ((VkSurfaceKHR)NULL != pIcdSurface->real_icd_surfaces[i] && NULL != icd_term->DestroySurfaceKHR) { + icd_term->DestroySurfaceKHR(icd_term->instance, pIcdSurface->real_icd_surfaces[i], pAllocator); } } - loader_instance_heap_free(ptr_instance, - pIcdSurface->real_icd_surfaces); + loader_instance_heap_free(ptr_instance, pIcdSurface->real_icd_surfaces); } loader_instance_heap_free(ptr_instance, pIcdSurface); } @@ -632,34 +526,27 @@ out: // This is the trampoline entrypoint for // GetPhysicalDeviceWin32PresentationSupportKHR -LOADER_EXPORT VKAPI_ATTR VkBool32 VKAPI_CALL -vkGetPhysicalDeviceWin32PresentationSupportKHR(VkPhysicalDevice physicalDevice, - uint32_t queueFamilyIndex) { - VkPhysicalDevice unwrapped_phys_dev = - loader_unwrap_physical_device(physicalDevice); +LOADER_EXPORT VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceWin32PresentationSupportKHR(VkPhysicalDevice physicalDevice, + uint32_t queueFamilyIndex) { + VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); const VkLayerInstanceDispatchTable *disp; disp = loader_get_instance_layer_dispatch(physicalDevice); - VkBool32 res = disp->GetPhysicalDeviceWin32PresentationSupportKHR( - unwrapped_phys_dev, queueFamilyIndex); + VkBool32 res = disp->GetPhysicalDeviceWin32PresentationSupportKHR(unwrapped_phys_dev, queueFamilyIndex); return res; } // This is the instance chain terminator function for // GetPhysicalDeviceWin32PresentationSupportKHR -VKAPI_ATTR VkBool32 VKAPI_CALL -terminator_GetPhysicalDeviceWin32PresentationSupportKHR( - VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex) { +VKAPI_ATTR VkBool32 VKAPI_CALL terminator_GetPhysicalDeviceWin32PresentationSupportKHR(VkPhysicalDevice physicalDevice, + uint32_t queueFamilyIndex) { // First, check to ensure the appropriate extension was enabled: - struct loader_physical_device_term *phys_dev_term = - (struct loader_physical_device_term *)physicalDevice; + struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; - struct loader_instance *ptr_instance = - (struct loader_instance *)icd_term->this_instance; + struct loader_instance *ptr_instance = (struct loader_instance *)icd_term->this_instance; if (!ptr_instance->wsi_win32_surface_enabled) { - loader_log( - ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "VK_KHR_win32_surface extension not enabled. " - "vkGetPhysicalDeviceWin32PresentationSupportKHR not executed!\n"); + loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "VK_KHR_win32_surface extension not enabled. " + "vkGetPhysicalDeviceWin32PresentationSupportKHR not executed!\n"); return VK_SUCCESS; } @@ -668,8 +555,7 @@ terminator_GetPhysicalDeviceWin32PresentationSupportKHR( "loader: null GetPhysicalDeviceWin32PresentationSupportKHR ICD " "pointer"); - return icd_term->GetPhysicalDeviceWin32PresentationSupportKHR( - phys_dev_term->phys_dev, queueFamilyIndex); + return icd_term->GetPhysicalDeviceWin32PresentationSupportKHR(phys_dev_term->phys_dev, queueFamilyIndex); } #endif // VK_USE_PLATFORM_WIN32_KHR @@ -678,22 +564,21 @@ terminator_GetPhysicalDeviceWin32PresentationSupportKHR( // Functions for the VK_KHR_mir_surface extension: // This is the trampoline entrypoint for CreateMirSurfaceKHR -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateMirSurfaceKHR( - VkInstance instance, const VkMirSurfaceCreateInfoKHR *pCreateInfo, - const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateMirSurfaceKHR(VkInstance instance, + const VkMirSurfaceCreateInfoKHR *pCreateInfo, + const VkAllocationCallbacks *pAllocator, + VkSurfaceKHR *pSurface) { const VkLayerInstanceDispatchTable *disp; disp = loader_get_instance_layer_dispatch(instance); VkResult res; - res = - disp->CreateMirSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); + res = disp->CreateMirSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); return res; } // This is the instance chain terminator function for CreateMirSurfaceKHR -VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateMirSurfaceKHR( - VkInstance instance, const VkMirSurfaceCreateInfoKHR *pCreateInfo, - const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { +VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateMirSurfaceKHR(VkInstance instance, const VkMirSurfaceCreateInfoKHR *pCreateInfo, + const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { VkResult vkRes = VK_SUCCESS; VkIcdSurface *pIcdSurface = NULL; uint32_t i = 0; @@ -701,17 +586,14 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateMirSurfaceKHR( // First, check to ensure the appropriate extension was enabled: struct loader_instance *ptr_instance = loader_get_instance(instance); if (!ptr_instance->wsi_mir_surface_enabled) { - loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "VK_KHR_mir_surface extension not enabled. " - "vkCreateMirSurfaceKHR not executed!\n"); + loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "VK_KHR_mir_surface extension not enabled. " + "vkCreateMirSurfaceKHR not executed!\n"); vkRes = VK_ERROR_EXTENSION_NOT_PRESENT; goto out; } // Next, if so, proceed with the implementation of this function: - pIcdSurface = AllocateIcdSurfaceStruct(ptr_instance, - sizeof(pIcdSurface->mir_surf.base), - sizeof(pIcdSurface->mir_surf)); + pIcdSurface = AllocateIcdSurfaceStruct(ptr_instance, sizeof(pIcdSurface->mir_surf.base), sizeof(pIcdSurface->mir_surf)); if (pIcdSurface == NULL) { vkRes = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; @@ -722,14 +604,11 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateMirSurfaceKHR( pIcdSurface->mir_surf.mirSurface = pCreateInfo->mirSurface; // Loop through each ICD and determine if they need to create a surface - for (struct loader_icd_term *icd_term = ptr_instance->icd_terms; - icd_term != NULL; icd_term = icd_term->next, i++) { - if (icd_term->scanned_icd->interface_version >= - ICD_VER_SUPPORTS_ICD_SURFACE_KHR) { + for (struct loader_icd_term *icd_term = ptr_instance->icd_terms; icd_term != NULL; icd_term = icd_term->next, i++) { + if (icd_term->scanned_icd->interface_version >= ICD_VER_SUPPORTS_ICD_SURFACE_KHR) { if (NULL != icd_term->CreateMirSurfaceKHR) { - vkRes = icd_term->CreateMirSurfaceKHR( - icd_term->instance, pCreateInfo, pAllocator, - &pIcdSurface->real_icd_surfaces[i]); + vkRes = + icd_term->CreateMirSurfaceKHR(icd_term->instance, pCreateInfo, pAllocator, &pIcdSurface->real_icd_surfaces[i]); if (VK_SUCCESS != vkRes) { goto out; } @@ -744,17 +623,12 @@ out: if (VK_SUCCESS != vkRes && NULL != pIcdSurface) { if (NULL != pIcdSurface->real_icd_surfaces) { i = 0; - for (struct loader_icd_term *icd_term = ptr_instance->icd_terms; - icd_term != NULL; icd_term = icd_term->next, i++) { - if ((VkSurfaceKHR)NULL != pIcdSurface->real_icd_surfaces[i] && - NULL != icd_term->DestroySurfaceKHR) { - icd_term->DestroySurfaceKHR( - icd_term->instance, pIcdSurface->real_icd_surfaces[i], - pAllocator); + for (struct loader_icd_term *icd_term = ptr_instance->icd_terms; icd_term != NULL; icd_term = icd_term->next, i++) { + if ((VkSurfaceKHR)NULL != pIcdSurface->real_icd_surfaces[i] && NULL != icd_term->DestroySurfaceKHR) { + icd_term->DestroySurfaceKHR(icd_term->instance, pIcdSurface->real_icd_surfaces[i], pAllocator); } } - loader_instance_heap_free(ptr_instance, - pIcdSurface->real_icd_surfaces); + loader_instance_heap_free(ptr_instance, pIcdSurface->real_icd_surfaces); } loader_instance_heap_free(ptr_instance, pIcdSurface); } @@ -764,47 +638,37 @@ out: // This is the trampoline entrypoint for // GetPhysicalDeviceMirPresentationSupportKHR -LOADER_EXPORT VKAPI_ATTR VkBool32 VKAPI_CALL -vkGetPhysicalDeviceMirPresentationSupportKHR(VkPhysicalDevice physicalDevice, - uint32_t queueFamilyIndex, - MirConnection *connection) { - VkPhysicalDevice unwrapped_phys_dev = - loader_unwrap_physical_device(physicalDevice); +LOADER_EXPORT VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceMirPresentationSupportKHR(VkPhysicalDevice physicalDevice, + uint32_t queueFamilyIndex, + MirConnection *connection) { + VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); const VkLayerInstanceDispatchTable *disp; disp = loader_get_instance_layer_dispatch(physicalDevice); - VkBool32 res = disp->GetPhysicalDeviceMirPresentationSupportKHR( - unwrapped_phys_dev, queueFamilyIndex, connection); + VkBool32 res = disp->GetPhysicalDeviceMirPresentationSupportKHR(unwrapped_phys_dev, queueFamilyIndex, connection); return res; } // This is the instance chain terminator function for // GetPhysicalDeviceMirPresentationSupportKHR -VKAPI_ATTR VkBool32 VKAPI_CALL -terminator_GetPhysicalDeviceMirPresentationSupportKHR( - VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, - MirConnection *connection) { +VKAPI_ATTR VkBool32 VKAPI_CALL terminator_GetPhysicalDeviceMirPresentationSupportKHR(VkPhysicalDevice physicalDevice, + uint32_t queueFamilyIndex, + MirConnection *connection) { // First, check to ensure the appropriate extension was enabled: - struct loader_physical_device_term *phys_dev_term = - (struct loader_physical_device_term *)physicalDevice; + struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; - struct loader_instance *ptr_instance = - (struct loader_instance *)icd_term->this_instance; + struct loader_instance *ptr_instance = (struct loader_instance *)icd_term->this_instance; if (!ptr_instance->wsi_mir_surface_enabled) { - loader_log( - ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "VK_KHR_mir_surface extension not enabled. " - "vkGetPhysicalDeviceMirPresentationSupportKHR not executed!\n"); + loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "VK_KHR_mir_surface extension not enabled. " + "vkGetPhysicalDeviceMirPresentationSupportKHR not executed!\n"); return VK_SUCCESS; } // Next, if so, proceed with the implementation of this function: - assert( - icd_term->GetPhysicalDeviceMirPresentationSupportKHR && - "loader: null GetPhysicalDeviceMirPresentationSupportKHR ICD pointer"); + assert(icd_term->GetPhysicalDeviceMirPresentationSupportKHR && + "loader: null GetPhysicalDeviceMirPresentationSupportKHR ICD pointer"); - return icd_term->GetPhysicalDeviceMirPresentationSupportKHR( - phys_dev_term->phys_dev, queueFamilyIndex, connection); + return icd_term->GetPhysicalDeviceMirPresentationSupportKHR(phys_dev_term->phys_dev, queueFamilyIndex, connection); } #endif // VK_USE_PLATFORM_MIR_KHR @@ -814,22 +678,22 @@ terminator_GetPhysicalDeviceMirPresentationSupportKHR( * This is the trampoline entrypoint * for CreateWaylandSurfaceKHR */ -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateWaylandSurfaceKHR( - VkInstance instance, const VkWaylandSurfaceCreateInfoKHR *pCreateInfo, - const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateWaylandSurfaceKHR(VkInstance instance, + const VkWaylandSurfaceCreateInfoKHR *pCreateInfo, + const VkAllocationCallbacks *pAllocator, + VkSurfaceKHR *pSurface) { const VkLayerInstanceDispatchTable *disp; disp = loader_get_instance_layer_dispatch(instance); VkResult res; - res = disp->CreateWaylandSurfaceKHR(instance, pCreateInfo, pAllocator, - pSurface); + res = disp->CreateWaylandSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); return res; } // This is the instance chain terminator function for CreateWaylandSurfaceKHR -VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateWaylandSurfaceKHR( - VkInstance instance, const VkWaylandSurfaceCreateInfoKHR *pCreateInfo, - const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { +VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateWaylandSurfaceKHR(VkInstance instance, + const VkWaylandSurfaceCreateInfoKHR *pCreateInfo, + const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { VkResult vkRes = VK_SUCCESS; VkIcdSurface *pIcdSurface = NULL; uint32_t i = 0; @@ -837,17 +701,14 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateWaylandSurfaceKHR( // First, check to ensure the appropriate extension was enabled: struct loader_instance *ptr_instance = loader_get_instance(instance); if (!ptr_instance->wsi_wayland_surface_enabled) { - loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "VK_KHR_wayland_surface extension not enabled. " - "vkCreateWaylandSurfaceKHR not executed!\n"); + loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "VK_KHR_wayland_surface extension not enabled. " + "vkCreateWaylandSurfaceKHR not executed!\n"); vkRes = VK_ERROR_EXTENSION_NOT_PRESENT; goto out; } // Next, if so, proceed with the implementation of this function: - pIcdSurface = AllocateIcdSurfaceStruct( - ptr_instance, sizeof(pIcdSurface->wayland_surf.base), - sizeof(pIcdSurface->wayland_surf)); + pIcdSurface = AllocateIcdSurfaceStruct(ptr_instance, sizeof(pIcdSurface->wayland_surf.base), sizeof(pIcdSurface->wayland_surf)); if (pIcdSurface == NULL) { vkRes = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; @@ -858,14 +719,11 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateWaylandSurfaceKHR( pIcdSurface->wayland_surf.surface = pCreateInfo->surface; // Loop through each ICD and determine if they need to create a surface - for (struct loader_icd_term *icd_term = ptr_instance->icd_terms; - icd_term != NULL; icd_term = icd_term->next, i++) { - if (icd_term->scanned_icd->interface_version >= - ICD_VER_SUPPORTS_ICD_SURFACE_KHR) { + for (struct loader_icd_term *icd_term = ptr_instance->icd_terms; icd_term != NULL; icd_term = icd_term->next, i++) { + if (icd_term->scanned_icd->interface_version >= ICD_VER_SUPPORTS_ICD_SURFACE_KHR) { if (NULL != icd_term->CreateWaylandSurfaceKHR) { - vkRes = icd_term->CreateWaylandSurfaceKHR( - icd_term->instance, pCreateInfo, pAllocator, - &pIcdSurface->real_icd_surfaces[i]); + vkRes = icd_term->CreateWaylandSurfaceKHR(icd_term->instance, pCreateInfo, pAllocator, + &pIcdSurface->real_icd_surfaces[i]); if (VK_SUCCESS != vkRes) { goto out; } @@ -880,17 +738,12 @@ out: if (VK_SUCCESS != vkRes && NULL != pIcdSurface) { if (NULL != pIcdSurface->real_icd_surfaces) { i = 0; - for (struct loader_icd_term *icd_term = ptr_instance->icd_terms; - icd_term != NULL; icd_term = icd_term->next, i++) { - if ((VkSurfaceKHR)NULL != pIcdSurface->real_icd_surfaces[i] && - NULL != icd_term->DestroySurfaceKHR) { - icd_term->DestroySurfaceKHR( - icd_term->instance, pIcdSurface->real_icd_surfaces[i], - pAllocator); + for (struct loader_icd_term *icd_term = ptr_instance->icd_terms; icd_term != NULL; icd_term = icd_term->next, i++) { + if ((VkSurfaceKHR)NULL != pIcdSurface->real_icd_surfaces[i] && NULL != icd_term->DestroySurfaceKHR) { + icd_term->DestroySurfaceKHR(icd_term->instance, pIcdSurface->real_icd_surfaces[i], pAllocator); } } - loader_instance_heap_free(ptr_instance, - pIcdSurface->real_icd_surfaces); + loader_instance_heap_free(ptr_instance, pIcdSurface->real_icd_surfaces); } loader_instance_heap_free(ptr_instance, pIcdSurface); } @@ -900,37 +753,30 @@ out: // This is the trampoline entrypoint for // GetPhysicalDeviceWaylandPresentationSupportKHR -LOADER_EXPORT VKAPI_ATTR VkBool32 VKAPI_CALL -vkGetPhysicalDeviceWaylandPresentationSupportKHR( - VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, - struct wl_display *display) { - VkPhysicalDevice unwrapped_phys_dev = - loader_unwrap_physical_device(physicalDevice); +LOADER_EXPORT VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceWaylandPresentationSupportKHR(VkPhysicalDevice physicalDevice, + uint32_t queueFamilyIndex, + struct wl_display *display) { + VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); const VkLayerInstanceDispatchTable *disp; disp = loader_get_instance_layer_dispatch(physicalDevice); - VkBool32 res = disp->GetPhysicalDeviceWaylandPresentationSupportKHR( - unwrapped_phys_dev, queueFamilyIndex, display); + VkBool32 res = disp->GetPhysicalDeviceWaylandPresentationSupportKHR(unwrapped_phys_dev, queueFamilyIndex, display); return res; } // This is the instance chain terminator function for // GetPhysicalDeviceWaylandPresentationSupportKHR -VKAPI_ATTR VkBool32 VKAPI_CALL -terminator_GetPhysicalDeviceWaylandPresentationSupportKHR( - VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, - struct wl_display *display) { +VKAPI_ATTR VkBool32 VKAPI_CALL terminator_GetPhysicalDeviceWaylandPresentationSupportKHR(VkPhysicalDevice physicalDevice, + uint32_t queueFamilyIndex, + struct wl_display *display) { // First, check to ensure the appropriate extension was enabled: - struct loader_physical_device_term *phys_dev_term = - (struct loader_physical_device_term *)physicalDevice; + struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; - struct loader_instance *ptr_instance = - (struct loader_instance *)icd_term->this_instance; + struct loader_instance *ptr_instance = (struct loader_instance *)icd_term->this_instance; if (!ptr_instance->wsi_wayland_surface_enabled) { - loader_log( - ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "VK_KHR_wayland_surface extension not enabled. " - "vkGetPhysicalDeviceWaylandPresentationSupportKHR not executed!\n"); + loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, + "VK_KHR_wayland_surface extension not enabled. " + "vkGetPhysicalDeviceWaylandPresentationSupportKHR not executed!\n"); return VK_SUCCESS; } @@ -939,8 +785,7 @@ terminator_GetPhysicalDeviceWaylandPresentationSupportKHR( "loader: null GetPhysicalDeviceWaylandPresentationSupportKHR ICD " "pointer"); - return icd_term->GetPhysicalDeviceWaylandPresentationSupportKHR( - phys_dev_term->phys_dev, queueFamilyIndex, display); + return icd_term->GetPhysicalDeviceWaylandPresentationSupportKHR(phys_dev_term->phys_dev, queueFamilyIndex, display); } #endif // VK_USE_PLATFORM_WAYLAND_KHR @@ -949,22 +794,21 @@ terminator_GetPhysicalDeviceWaylandPresentationSupportKHR( // Functions for the VK_KHR_xcb_surface extension: // This is the trampoline entrypoint for CreateXcbSurfaceKHR -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateXcbSurfaceKHR( - VkInstance instance, const VkXcbSurfaceCreateInfoKHR *pCreateInfo, - const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateXcbSurfaceKHR(VkInstance instance, + const VkXcbSurfaceCreateInfoKHR *pCreateInfo, + const VkAllocationCallbacks *pAllocator, + VkSurfaceKHR *pSurface) { const VkLayerInstanceDispatchTable *disp; disp = loader_get_instance_layer_dispatch(instance); VkResult res; - res = - disp->CreateXcbSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); + res = disp->CreateXcbSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); return res; } // This is the instance chain terminator function for CreateXcbSurfaceKHR -VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateXcbSurfaceKHR( - VkInstance instance, const VkXcbSurfaceCreateInfoKHR *pCreateInfo, - const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { +VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateXcbSurfaceKHR(VkInstance instance, const VkXcbSurfaceCreateInfoKHR *pCreateInfo, + const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { VkResult vkRes = VK_SUCCESS; VkIcdSurface *pIcdSurface = NULL; uint32_t i = 0; @@ -972,17 +816,14 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateXcbSurfaceKHR( // First, check to ensure the appropriate extension was enabled: struct loader_instance *ptr_instance = loader_get_instance(instance); if (!ptr_instance->wsi_xcb_surface_enabled) { - loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "VK_KHR_xcb_surface extension not enabled. " - "vkCreateXcbSurfaceKHR not executed!\n"); + loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "VK_KHR_xcb_surface extension not enabled. " + "vkCreateXcbSurfaceKHR not executed!\n"); vkRes = VK_ERROR_EXTENSION_NOT_PRESENT; goto out; } // Next, if so, proceed with the implementation of this function: - pIcdSurface = AllocateIcdSurfaceStruct(ptr_instance, - sizeof(pIcdSurface->xcb_surf.base), - sizeof(pIcdSurface->xcb_surf)); + pIcdSurface = AllocateIcdSurfaceStruct(ptr_instance, sizeof(pIcdSurface->xcb_surf.base), sizeof(pIcdSurface->xcb_surf)); if (pIcdSurface == NULL) { vkRes = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; @@ -993,14 +834,11 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateXcbSurfaceKHR( pIcdSurface->xcb_surf.window = pCreateInfo->window; // Loop through each ICD and determine if they need to create a surface - for (struct loader_icd_term *icd_term = ptr_instance->icd_terms; - icd_term != NULL; icd_term = icd_term->next, i++) { - if (icd_term->scanned_icd->interface_version >= - ICD_VER_SUPPORTS_ICD_SURFACE_KHR) { + for (struct loader_icd_term *icd_term = ptr_instance->icd_terms; icd_term != NULL; icd_term = icd_term->next, i++) { + if (icd_term->scanned_icd->interface_version >= ICD_VER_SUPPORTS_ICD_SURFACE_KHR) { if (NULL != icd_term->CreateXcbSurfaceKHR) { - vkRes = icd_term->CreateXcbSurfaceKHR( - icd_term->instance, pCreateInfo, pAllocator, - &pIcdSurface->real_icd_surfaces[i]); + vkRes = + icd_term->CreateXcbSurfaceKHR(icd_term->instance, pCreateInfo, pAllocator, &pIcdSurface->real_icd_surfaces[i]); if (VK_SUCCESS != vkRes) { goto out; } @@ -1015,17 +853,12 @@ out: if (VK_SUCCESS != vkRes && NULL != pIcdSurface) { if (NULL != pIcdSurface->real_icd_surfaces) { i = 0; - for (struct loader_icd_term *icd_term = ptr_instance->icd_terms; - icd_term != NULL; icd_term = icd_term->next, i++) { - if ((VkSurfaceKHR)NULL != pIcdSurface->real_icd_surfaces[i] && - NULL != icd_term->DestroySurfaceKHR) { - icd_term->DestroySurfaceKHR( - icd_term->instance, pIcdSurface->real_icd_surfaces[i], - pAllocator); + for (struct loader_icd_term *icd_term = ptr_instance->icd_terms; icd_term != NULL; icd_term = icd_term->next, i++) { + if ((VkSurfaceKHR)NULL != pIcdSurface->real_icd_surfaces[i] && NULL != icd_term->DestroySurfaceKHR) { + icd_term->DestroySurfaceKHR(icd_term->instance, pIcdSurface->real_icd_surfaces[i], pAllocator); } } - loader_instance_heap_free(ptr_instance, - pIcdSurface->real_icd_surfaces); + loader_instance_heap_free(ptr_instance, pIcdSurface->real_icd_surfaces); } loader_instance_heap_free(ptr_instance, pIcdSurface); } @@ -1035,48 +868,39 @@ out: // This is the trampoline entrypoint for // GetPhysicalDeviceXcbPresentationSupportKHR -LOADER_EXPORT VKAPI_ATTR VkBool32 VKAPI_CALL -vkGetPhysicalDeviceXcbPresentationSupportKHR(VkPhysicalDevice physicalDevice, - uint32_t queueFamilyIndex, - xcb_connection_t *connection, - xcb_visualid_t visual_id) { - VkPhysicalDevice unwrapped_phys_dev = - loader_unwrap_physical_device(physicalDevice); +LOADER_EXPORT VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceXcbPresentationSupportKHR(VkPhysicalDevice physicalDevice, + uint32_t queueFamilyIndex, + xcb_connection_t *connection, + xcb_visualid_t visual_id) { + VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); const VkLayerInstanceDispatchTable *disp; disp = loader_get_instance_layer_dispatch(physicalDevice); - VkBool32 res = disp->GetPhysicalDeviceXcbPresentationSupportKHR( - unwrapped_phys_dev, queueFamilyIndex, connection, visual_id); + VkBool32 res = disp->GetPhysicalDeviceXcbPresentationSupportKHR(unwrapped_phys_dev, queueFamilyIndex, connection, visual_id); return res; } // This is the instance chain terminator function for // GetPhysicalDeviceXcbPresentationSupportKHR -VKAPI_ATTR VkBool32 VKAPI_CALL -terminator_GetPhysicalDeviceXcbPresentationSupportKHR( - VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, - xcb_connection_t *connection, xcb_visualid_t visual_id) { +VKAPI_ATTR VkBool32 VKAPI_CALL terminator_GetPhysicalDeviceXcbPresentationSupportKHR(VkPhysicalDevice physicalDevice, + uint32_t queueFamilyIndex, + xcb_connection_t *connection, + xcb_visualid_t visual_id) { // First, check to ensure the appropriate extension was enabled: - struct loader_physical_device_term *phys_dev_term = - (struct loader_physical_device_term *)physicalDevice; + struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; - struct loader_instance *ptr_instance = - (struct loader_instance *)icd_term->this_instance; + struct loader_instance *ptr_instance = (struct loader_instance *)icd_term->this_instance; if (!ptr_instance->wsi_xcb_surface_enabled) { - loader_log( - ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "VK_KHR_xcb_surface extension not enabled. " - "vkGetPhysicalDeviceXcbPresentationSupportKHR not executed!\n"); + loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "VK_KHR_xcb_surface extension not enabled. " + "vkGetPhysicalDeviceXcbPresentationSupportKHR not executed!\n"); return VK_SUCCESS; } // Next, if so, proceed with the implementation of this function: - assert( - icd_term->GetPhysicalDeviceXcbPresentationSupportKHR && - "loader: null GetPhysicalDeviceXcbPresentationSupportKHR ICD pointer"); + assert(icd_term->GetPhysicalDeviceXcbPresentationSupportKHR && + "loader: null GetPhysicalDeviceXcbPresentationSupportKHR ICD pointer"); - return icd_term->GetPhysicalDeviceXcbPresentationSupportKHR( - phys_dev_term->phys_dev, queueFamilyIndex, connection, visual_id); + return icd_term->GetPhysicalDeviceXcbPresentationSupportKHR(phys_dev_term->phys_dev, queueFamilyIndex, connection, visual_id); } #endif // VK_USE_PLATFORM_XCB_KHR @@ -1085,22 +909,21 @@ terminator_GetPhysicalDeviceXcbPresentationSupportKHR( // Functions for the VK_KHR_xlib_surface extension: // This is the trampoline entrypoint for CreateXlibSurfaceKHR -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateXlibSurfaceKHR( - VkInstance instance, const VkXlibSurfaceCreateInfoKHR *pCreateInfo, - const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateXlibSurfaceKHR(VkInstance instance, + const VkXlibSurfaceCreateInfoKHR *pCreateInfo, + const VkAllocationCallbacks *pAllocator, + VkSurfaceKHR *pSurface) { const VkLayerInstanceDispatchTable *disp; disp = loader_get_instance_layer_dispatch(instance); VkResult res; - res = - disp->CreateXlibSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); + res = disp->CreateXlibSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); return res; } // This is the instance chain terminator function for CreateXlibSurfaceKHR -VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateXlibSurfaceKHR( - VkInstance instance, const VkXlibSurfaceCreateInfoKHR *pCreateInfo, - const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { +VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateXlibSurfaceKHR(VkInstance instance, const VkXlibSurfaceCreateInfoKHR *pCreateInfo, + const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { VkResult vkRes = VK_SUCCESS; VkIcdSurface *pIcdSurface = NULL; uint32_t i = 0; @@ -1108,17 +931,14 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateXlibSurfaceKHR( // First, check to ensure the appropriate extension was enabled: struct loader_instance *ptr_instance = loader_get_instance(instance); if (!ptr_instance->wsi_xlib_surface_enabled) { - loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "VK_KHR_xlib_surface extension not enabled. " - "vkCreateXlibSurfaceKHR not executed!\n"); + loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "VK_KHR_xlib_surface extension not enabled. " + "vkCreateXlibSurfaceKHR not executed!\n"); vkRes = VK_ERROR_EXTENSION_NOT_PRESENT; goto out; } // Next, if so, proceed with the implementation of this function: - pIcdSurface = AllocateIcdSurfaceStruct( - ptr_instance, sizeof(pIcdSurface->xlib_surf.base), - sizeof(pIcdSurface->xlib_surf)); + pIcdSurface = AllocateIcdSurfaceStruct(ptr_instance, sizeof(pIcdSurface->xlib_surf.base), sizeof(pIcdSurface->xlib_surf)); if (pIcdSurface == NULL) { vkRes = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; @@ -1129,14 +949,11 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateXlibSurfaceKHR( pIcdSurface->xlib_surf.window = pCreateInfo->window; // Loop through each ICD and determine if they need to create a surface - for (struct loader_icd_term *icd_term = ptr_instance->icd_terms; - icd_term != NULL; icd_term = icd_term->next, i++) { - if (icd_term->scanned_icd->interface_version >= - ICD_VER_SUPPORTS_ICD_SURFACE_KHR) { + for (struct loader_icd_term *icd_term = ptr_instance->icd_terms; icd_term != NULL; icd_term = icd_term->next, i++) { + if (icd_term->scanned_icd->interface_version >= ICD_VER_SUPPORTS_ICD_SURFACE_KHR) { if (NULL != icd_term->CreateXlibSurfaceKHR) { - vkRes = icd_term->CreateXlibSurfaceKHR( - icd_term->instance, pCreateInfo, pAllocator, - &pIcdSurface->real_icd_surfaces[i]); + vkRes = + icd_term->CreateXlibSurfaceKHR(icd_term->instance, pCreateInfo, pAllocator, &pIcdSurface->real_icd_surfaces[i]); if (VK_SUCCESS != vkRes) { goto out; } @@ -1151,17 +968,12 @@ out: if (VK_SUCCESS != vkRes && NULL != pIcdSurface) { if (NULL != pIcdSurface->real_icd_surfaces) { i = 0; - for (struct loader_icd_term *icd_term = ptr_instance->icd_terms; - icd_term != NULL; icd_term = icd_term->next, i++) { - if ((VkSurfaceKHR)NULL != pIcdSurface->real_icd_surfaces[i] && - NULL != icd_term->DestroySurfaceKHR) { - icd_term->DestroySurfaceKHR( - icd_term->instance, pIcdSurface->real_icd_surfaces[i], - pAllocator); + for (struct loader_icd_term *icd_term = ptr_instance->icd_terms; icd_term != NULL; icd_term = icd_term->next, i++) { + if ((VkSurfaceKHR)NULL != pIcdSurface->real_icd_surfaces[i] && NULL != icd_term->DestroySurfaceKHR) { + icd_term->DestroySurfaceKHR(icd_term->instance, pIcdSurface->real_icd_surfaces[i], pAllocator); } } - loader_instance_heap_free(ptr_instance, - pIcdSurface->real_icd_surfaces); + loader_instance_heap_free(ptr_instance, pIcdSurface->real_icd_surfaces); } loader_instance_heap_free(ptr_instance, pIcdSurface); } @@ -1171,47 +983,37 @@ out: // This is the trampoline entrypoint for // GetPhysicalDeviceXlibPresentationSupportKHR -LOADER_EXPORT VKAPI_ATTR VkBool32 VKAPI_CALL -vkGetPhysicalDeviceXlibPresentationSupportKHR(VkPhysicalDevice physicalDevice, - uint32_t queueFamilyIndex, - Display *dpy, VisualID visualID) { - VkPhysicalDevice unwrapped_phys_dev = - loader_unwrap_physical_device(physicalDevice); +LOADER_EXPORT VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceXlibPresentationSupportKHR(VkPhysicalDevice physicalDevice, + uint32_t queueFamilyIndex, Display *dpy, + VisualID visualID) { + VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); const VkLayerInstanceDispatchTable *disp; disp = loader_get_instance_layer_dispatch(physicalDevice); - VkBool32 res = disp->GetPhysicalDeviceXlibPresentationSupportKHR( - unwrapped_phys_dev, queueFamilyIndex, dpy, visualID); + VkBool32 res = disp->GetPhysicalDeviceXlibPresentationSupportKHR(unwrapped_phys_dev, queueFamilyIndex, dpy, visualID); return res; } // This is the instance chain terminator function for // GetPhysicalDeviceXlibPresentationSupportKHR -VKAPI_ATTR VkBool32 VKAPI_CALL -terminator_GetPhysicalDeviceXlibPresentationSupportKHR( - VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, Display *dpy, - VisualID visualID) { +VKAPI_ATTR VkBool32 VKAPI_CALL terminator_GetPhysicalDeviceXlibPresentationSupportKHR(VkPhysicalDevice physicalDevice, + uint32_t queueFamilyIndex, Display *dpy, + VisualID visualID) { // First, check to ensure the appropriate extension was enabled: - struct loader_physical_device_term *phys_dev_term = - (struct loader_physical_device_term *)physicalDevice; + struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; - struct loader_instance *ptr_instance = - (struct loader_instance *)icd_term->this_instance; + struct loader_instance *ptr_instance = (struct loader_instance *)icd_term->this_instance; if (!ptr_instance->wsi_xlib_surface_enabled) { - loader_log( - ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "VK_KHR_xlib_surface extension not enabled. " - "vkGetPhysicalDeviceXlibPresentationSupportKHR not executed!\n"); + loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "VK_KHR_xlib_surface extension not enabled. " + "vkGetPhysicalDeviceXlibPresentationSupportKHR not executed!\n"); return VK_SUCCESS; } // Next, if so, proceed with the implementation of this function: - assert( - icd_term->GetPhysicalDeviceXlibPresentationSupportKHR && - "loader: null GetPhysicalDeviceXlibPresentationSupportKHR ICD pointer"); + assert(icd_term->GetPhysicalDeviceXlibPresentationSupportKHR && + "loader: null GetPhysicalDeviceXlibPresentationSupportKHR ICD pointer"); - return icd_term->GetPhysicalDeviceXlibPresentationSupportKHR( - phys_dev_term->phys_dev, queueFamilyIndex, dpy, visualID); + return icd_term->GetPhysicalDeviceXlibPresentationSupportKHR(phys_dev_term->phys_dev, queueFamilyIndex, dpy, visualID); } #endif // VK_USE_PLATFORM_XLIB_KHR @@ -1220,9 +1022,9 @@ terminator_GetPhysicalDeviceXlibPresentationSupportKHR( // Functions for the VK_KHR_android_surface extension: // This is the trampoline entrypoint for CreateAndroidSurfaceKHR -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateAndroidSurfaceKHR( - VkInstance instance, ANativeWindow *window, - const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateAndroidSurfaceKHR(VkInstance instance, ANativeWindow *window, + const VkAllocationCallbacks *pAllocator, + VkSurfaceKHR *pSurface) { const VkLayerInstanceDispatchTable *disp; disp = loader_get_instance_layer_dispatch(instance); VkResult res; @@ -1232,22 +1034,19 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateAndroidSurfaceKHR( } // This is the instance chain terminator function for CreateAndroidSurfaceKHR -VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateAndroidSurfaceKHR( - VkInstance instance, Window window, const VkAllocationCallbacks *pAllocator, - VkSurfaceKHR *pSurface) { +VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateAndroidSurfaceKHR(VkInstance instance, Window window, + const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { // First, check to ensure the appropriate extension was enabled: struct loader_instance *ptr_instance = loader_get_instance(instance); if (!ptr_instance->wsi_display_enabled) { - loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "VK_KHR_display extension not enabled. " - "vkCreateAndroidSurfaceKHR not executed!\n"); + loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "VK_KHR_display extension not enabled. " + "vkCreateAndroidSurfaceKHR not executed!\n"); return VK_ERROR_EXTENSION_NOT_PRESENT; } // Next, if so, proceed with the implementation of this function: VkIcdSurfaceAndroid *pIcdSurface = - loader_instance_heap_alloc(ptr_instance, sizeof(VkIcdSurfaceAndroid), - VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); + loader_instance_heap_alloc(ptr_instance, sizeof(VkIcdSurfaceAndroid), VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); if (pIcdSurface == NULL) { return VK_ERROR_OUT_OF_HOST_MEMORY; } @@ -1264,269 +1063,216 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateAndroidSurfaceKHR( #endif // VK_USE_PLATFORM_ANDROID_KHR // Functions for the VK_KHR_display instance extension: -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL -vkGetPhysicalDeviceDisplayPropertiesKHR(VkPhysicalDevice physicalDevice, - uint32_t *pPropertyCount, - VkDisplayPropertiesKHR *pProperties) { - VkPhysicalDevice unwrapped_phys_dev = - loader_unwrap_physical_device(physicalDevice); +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceDisplayPropertiesKHR(VkPhysicalDevice physicalDevice, + uint32_t *pPropertyCount, + VkDisplayPropertiesKHR *pProperties) { + VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); const VkLayerInstanceDispatchTable *disp; disp = loader_get_instance_layer_dispatch(physicalDevice); - VkResult res = disp->GetPhysicalDeviceDisplayPropertiesKHR( - unwrapped_phys_dev, pPropertyCount, pProperties); + VkResult res = disp->GetPhysicalDeviceDisplayPropertiesKHR(unwrapped_phys_dev, pPropertyCount, pProperties); return res; } -VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceDisplayPropertiesKHR( - VkPhysicalDevice physicalDevice, uint32_t *pPropertyCount, - VkDisplayPropertiesKHR *pProperties) { +VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceDisplayPropertiesKHR(VkPhysicalDevice physicalDevice, + uint32_t *pPropertyCount, + VkDisplayPropertiesKHR *pProperties) { // First, check to ensure the appropriate extension was enabled: - struct loader_physical_device_term *phys_dev_term = - (struct loader_physical_device_term *)physicalDevice; + struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; - struct loader_instance *ptr_instance = - (struct loader_instance *)icd_term->this_instance; + struct loader_instance *ptr_instance = (struct loader_instance *)icd_term->this_instance; if (!ptr_instance->wsi_display_enabled) { - loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "VK_KHR_display extension not enabled. " - "vkGetPhysicalDeviceDisplayPropertiesKHR not executed!\n"); + loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "VK_KHR_display extension not enabled. " + "vkGetPhysicalDeviceDisplayPropertiesKHR not executed!\n"); return VK_SUCCESS; } // Next, if so, proceed with the implementation of this function: - assert(icd_term->GetPhysicalDeviceDisplayPropertiesKHR && - "loader: null GetPhysicalDeviceDisplayPropertiesKHR ICD pointer"); + assert(icd_term->GetPhysicalDeviceDisplayPropertiesKHR && "loader: null GetPhysicalDeviceDisplayPropertiesKHR ICD pointer"); - return icd_term->GetPhysicalDeviceDisplayPropertiesKHR( - phys_dev_term->phys_dev, pPropertyCount, pProperties); + return icd_term->GetPhysicalDeviceDisplayPropertiesKHR(phys_dev_term->phys_dev, pPropertyCount, pProperties); } -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL -vkGetPhysicalDeviceDisplayPlanePropertiesKHR( - VkPhysicalDevice physicalDevice, uint32_t *pPropertyCount, - VkDisplayPlanePropertiesKHR *pProperties) { - VkPhysicalDevice unwrapped_phys_dev = - loader_unwrap_physical_device(physicalDevice); +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceDisplayPlanePropertiesKHR( + VkPhysicalDevice physicalDevice, uint32_t *pPropertyCount, VkDisplayPlanePropertiesKHR *pProperties) { + VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); const VkLayerInstanceDispatchTable *disp; disp = loader_get_instance_layer_dispatch(physicalDevice); - VkResult res = disp->GetPhysicalDeviceDisplayPlanePropertiesKHR( - unwrapped_phys_dev, pPropertyCount, pProperties); + VkResult res = disp->GetPhysicalDeviceDisplayPlanePropertiesKHR(unwrapped_phys_dev, pPropertyCount, pProperties); return res; } -VKAPI_ATTR VkResult VKAPI_CALL -terminator_GetPhysicalDeviceDisplayPlanePropertiesKHR( - VkPhysicalDevice physicalDevice, uint32_t *pPropertyCount, - VkDisplayPlanePropertiesKHR *pProperties) { +VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceDisplayPlanePropertiesKHR(VkPhysicalDevice physicalDevice, + uint32_t *pPropertyCount, + VkDisplayPlanePropertiesKHR *pProperties) { // First, check to ensure the appropriate extension was enabled: - struct loader_physical_device_term *phys_dev_term = - (struct loader_physical_device_term *)physicalDevice; + struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; - struct loader_instance *ptr_instance = - (struct loader_instance *)icd_term->this_instance; + struct loader_instance *ptr_instance = (struct loader_instance *)icd_term->this_instance; if (!ptr_instance->wsi_display_enabled) { - loader_log( - ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "VK_KHR_display extension not enabled. " - "vkGetPhysicalDeviceDisplayPlanePropertiesKHR not executed!\n"); + loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "VK_KHR_display extension not enabled. " + "vkGetPhysicalDeviceDisplayPlanePropertiesKHR not executed!\n"); return VK_SUCCESS; } // Next, if so, proceed with the implementation of this function: - assert( - icd_term->GetPhysicalDeviceDisplayPlanePropertiesKHR && - "loader: null GetPhysicalDeviceDisplayPlanePropertiesKHR ICD pointer"); + assert(icd_term->GetPhysicalDeviceDisplayPlanePropertiesKHR && + "loader: null GetPhysicalDeviceDisplayPlanePropertiesKHR ICD pointer"); - return icd_term->GetPhysicalDeviceDisplayPlanePropertiesKHR( - phys_dev_term->phys_dev, pPropertyCount, pProperties); + return icd_term->GetPhysicalDeviceDisplayPlanePropertiesKHR(phys_dev_term->phys_dev, pPropertyCount, pProperties); } -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL -vkGetDisplayPlaneSupportedDisplaysKHR(VkPhysicalDevice physicalDevice, - uint32_t planeIndex, - uint32_t *pDisplayCount, - VkDisplayKHR *pDisplays) { - VkPhysicalDevice unwrapped_phys_dev = - loader_unwrap_physical_device(physicalDevice); +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetDisplayPlaneSupportedDisplaysKHR(VkPhysicalDevice physicalDevice, + uint32_t planeIndex, uint32_t *pDisplayCount, + VkDisplayKHR *pDisplays) { + VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); const VkLayerInstanceDispatchTable *disp; disp = loader_get_instance_layer_dispatch(physicalDevice); - VkResult res = disp->GetDisplayPlaneSupportedDisplaysKHR( - unwrapped_phys_dev, planeIndex, pDisplayCount, pDisplays); + VkResult res = disp->GetDisplayPlaneSupportedDisplaysKHR(unwrapped_phys_dev, planeIndex, pDisplayCount, pDisplays); return res; } -VKAPI_ATTR VkResult VKAPI_CALL terminator_GetDisplayPlaneSupportedDisplaysKHR( - VkPhysicalDevice physicalDevice, uint32_t planeIndex, - uint32_t *pDisplayCount, VkDisplayKHR *pDisplays) { +VKAPI_ATTR VkResult VKAPI_CALL terminator_GetDisplayPlaneSupportedDisplaysKHR(VkPhysicalDevice physicalDevice, uint32_t planeIndex, + uint32_t *pDisplayCount, VkDisplayKHR *pDisplays) { // First, check to ensure the appropriate extension was enabled: - struct loader_physical_device_term *phys_dev_term = - (struct loader_physical_device_term *)physicalDevice; + struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; - struct loader_instance *ptr_instance = - (struct loader_instance *)icd_term->this_instance; + struct loader_instance *ptr_instance = (struct loader_instance *)icd_term->this_instance; if (!ptr_instance->wsi_display_enabled) { - loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "VK_KHR_display extension not enabled. " - "vkGetDisplayPlaneSupportedDisplaysKHR not executed!\n"); + loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "VK_KHR_display extension not enabled. " + "vkGetDisplayPlaneSupportedDisplaysKHR not executed!\n"); return VK_SUCCESS; } // Next, if so, proceed with the implementation of this function: - assert(icd_term->GetDisplayPlaneSupportedDisplaysKHR && - "loader: null GetDisplayPlaneSupportedDisplaysKHR ICD pointer"); + assert(icd_term->GetDisplayPlaneSupportedDisplaysKHR && "loader: null GetDisplayPlaneSupportedDisplaysKHR ICD pointer"); - return icd_term->GetDisplayPlaneSupportedDisplaysKHR( - phys_dev_term->phys_dev, planeIndex, pDisplayCount, pDisplays); + return icd_term->GetDisplayPlaneSupportedDisplaysKHR(phys_dev_term->phys_dev, planeIndex, pDisplayCount, pDisplays); } -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetDisplayModePropertiesKHR( - VkPhysicalDevice physicalDevice, VkDisplayKHR display, - uint32_t *pPropertyCount, VkDisplayModePropertiesKHR *pProperties) { - VkPhysicalDevice unwrapped_phys_dev = - loader_unwrap_physical_device(physicalDevice); +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetDisplayModePropertiesKHR(VkPhysicalDevice physicalDevice, VkDisplayKHR display, + uint32_t *pPropertyCount, + VkDisplayModePropertiesKHR *pProperties) { + VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); const VkLayerInstanceDispatchTable *disp; disp = loader_get_instance_layer_dispatch(physicalDevice); - VkResult res = disp->GetDisplayModePropertiesKHR( - unwrapped_phys_dev, display, pPropertyCount, pProperties); + VkResult res = disp->GetDisplayModePropertiesKHR(unwrapped_phys_dev, display, pPropertyCount, pProperties); return res; } -VKAPI_ATTR VkResult VKAPI_CALL terminator_GetDisplayModePropertiesKHR( - VkPhysicalDevice physicalDevice, VkDisplayKHR display, - uint32_t *pPropertyCount, VkDisplayModePropertiesKHR *pProperties) { +VKAPI_ATTR VkResult VKAPI_CALL terminator_GetDisplayModePropertiesKHR(VkPhysicalDevice physicalDevice, VkDisplayKHR display, + uint32_t *pPropertyCount, + VkDisplayModePropertiesKHR *pProperties) { // First, check to ensure the appropriate extension was enabled: - struct loader_physical_device_term *phys_dev_term = - (struct loader_physical_device_term *)physicalDevice; + struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; - struct loader_instance *ptr_instance = - (struct loader_instance *)icd_term->this_instance; + struct loader_instance *ptr_instance = (struct loader_instance *)icd_term->this_instance; if (!ptr_instance->wsi_display_enabled) { - loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "VK_KHR_display extension not enabled. " - "vkGetDisplayModePropertiesKHR not executed!\n"); + loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "VK_KHR_display extension not enabled. " + "vkGetDisplayModePropertiesKHR not executed!\n"); return VK_SUCCESS; } // Next, if so, proceed with the implementation of this function: - assert(icd_term->GetDisplayModePropertiesKHR && - "loader: null GetDisplayModePropertiesKHR ICD pointer"); + assert(icd_term->GetDisplayModePropertiesKHR && "loader: null GetDisplayModePropertiesKHR ICD pointer"); - return icd_term->GetDisplayModePropertiesKHR( - phys_dev_term->phys_dev, display, pPropertyCount, pProperties); + return icd_term->GetDisplayModePropertiesKHR(phys_dev_term->phys_dev, display, pPropertyCount, pProperties); } -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateDisplayModeKHR( - VkPhysicalDevice physicalDevice, VkDisplayKHR display, - const VkDisplayModeCreateInfoKHR *pCreateInfo, - const VkAllocationCallbacks *pAllocator, VkDisplayModeKHR *pMode) { - VkPhysicalDevice unwrapped_phys_dev = - loader_unwrap_physical_device(physicalDevice); +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateDisplayModeKHR(VkPhysicalDevice physicalDevice, VkDisplayKHR display, + const VkDisplayModeCreateInfoKHR *pCreateInfo, + const VkAllocationCallbacks *pAllocator, + VkDisplayModeKHR *pMode) { + VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); const VkLayerInstanceDispatchTable *disp; disp = loader_get_instance_layer_dispatch(physicalDevice); - VkResult res = disp->CreateDisplayModeKHR(unwrapped_phys_dev, display, - pCreateInfo, pAllocator, pMode); + VkResult res = disp->CreateDisplayModeKHR(unwrapped_phys_dev, display, pCreateInfo, pAllocator, pMode); return res; } -VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDisplayModeKHR( - VkPhysicalDevice physicalDevice, VkDisplayKHR display, - const VkDisplayModeCreateInfoKHR *pCreateInfo, - const VkAllocationCallbacks *pAllocator, VkDisplayModeKHR *pMode) { +VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDisplayModeKHR(VkPhysicalDevice physicalDevice, VkDisplayKHR display, + const VkDisplayModeCreateInfoKHR *pCreateInfo, + const VkAllocationCallbacks *pAllocator, VkDisplayModeKHR *pMode) { // First, check to ensure the appropriate extension was enabled: - struct loader_physical_device_term *phys_dev_term = - (struct loader_physical_device_term *)physicalDevice; + struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; - struct loader_instance *ptr_instance = - (struct loader_instance *)icd_term->this_instance; + struct loader_instance *ptr_instance = (struct loader_instance *)icd_term->this_instance; if (!ptr_instance->wsi_display_enabled) { - loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "VK_KHR_display extension not enabled. " - "vkCreateDisplayModeKHR not executed!\n"); + loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "VK_KHR_display extension not enabled. " + "vkCreateDisplayModeKHR not executed!\n"); return VK_ERROR_EXTENSION_NOT_PRESENT; } // Next, if so, proceed with the implementation of this function: - assert(icd_term->CreateDisplayModeKHR && - "loader: null CreateDisplayModeKHR ICD pointer"); + assert(icd_term->CreateDisplayModeKHR && "loader: null CreateDisplayModeKHR ICD pointer"); - return icd_term->CreateDisplayModeKHR(phys_dev_term->phys_dev, display, - pCreateInfo, pAllocator, pMode); + return icd_term->CreateDisplayModeKHR(phys_dev_term->phys_dev, display, pCreateInfo, pAllocator, pMode); } -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetDisplayPlaneCapabilitiesKHR( - VkPhysicalDevice physicalDevice, VkDisplayModeKHR mode, uint32_t planeIndex, - VkDisplayPlaneCapabilitiesKHR *pCapabilities) { - VkPhysicalDevice unwrapped_phys_dev = - loader_unwrap_physical_device(physicalDevice); +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkGetDisplayPlaneCapabilitiesKHR(VkPhysicalDevice physicalDevice, + VkDisplayModeKHR mode, uint32_t planeIndex, + VkDisplayPlaneCapabilitiesKHR *pCapabilities) { + VkPhysicalDevice unwrapped_phys_dev = loader_unwrap_physical_device(physicalDevice); const VkLayerInstanceDispatchTable *disp; disp = loader_get_instance_layer_dispatch(physicalDevice); - VkResult res = disp->GetDisplayPlaneCapabilitiesKHR( - unwrapped_phys_dev, mode, planeIndex, pCapabilities); + VkResult res = disp->GetDisplayPlaneCapabilitiesKHR(unwrapped_phys_dev, mode, planeIndex, pCapabilities); return res; } -VKAPI_ATTR VkResult VKAPI_CALL terminator_GetDisplayPlaneCapabilitiesKHR( - VkPhysicalDevice physicalDevice, VkDisplayModeKHR mode, uint32_t planeIndex, - VkDisplayPlaneCapabilitiesKHR *pCapabilities) { +VKAPI_ATTR VkResult VKAPI_CALL terminator_GetDisplayPlaneCapabilitiesKHR(VkPhysicalDevice physicalDevice, VkDisplayModeKHR mode, + uint32_t planeIndex, + VkDisplayPlaneCapabilitiesKHR *pCapabilities) { // First, check to ensure the appropriate extension was enabled: - struct loader_physical_device_term *phys_dev_term = - (struct loader_physical_device_term *)physicalDevice; + struct loader_physical_device_term *phys_dev_term = (struct loader_physical_device_term *)physicalDevice; struct loader_icd_term *icd_term = phys_dev_term->this_icd_term; - struct loader_instance *ptr_instance = - (struct loader_instance *)icd_term->this_instance; + struct loader_instance *ptr_instance = (struct loader_instance *)icd_term->this_instance; if (!ptr_instance->wsi_display_enabled) { - loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "VK_KHR_display extension not enabled. " - "vkGetDisplayPlaneCapabilitiesKHR not executed!\n"); + loader_log(ptr_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "VK_KHR_display extension not enabled. " + "vkGetDisplayPlaneCapabilitiesKHR not executed!\n"); return VK_SUCCESS; } // Next, if so, proceed with the implementation of this function: - assert(icd_term->GetDisplayPlaneCapabilitiesKHR && - "loader: null GetDisplayPlaneCapabilitiesKHR ICD pointer"); + assert(icd_term->GetDisplayPlaneCapabilitiesKHR && "loader: null GetDisplayPlaneCapabilitiesKHR ICD pointer"); - return icd_term->GetDisplayPlaneCapabilitiesKHR( - phys_dev_term->phys_dev, mode, planeIndex, pCapabilities); + return icd_term->GetDisplayPlaneCapabilitiesKHR(phys_dev_term->phys_dev, mode, planeIndex, pCapabilities); } -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateDisplayPlaneSurfaceKHR( - VkInstance instance, const VkDisplaySurfaceCreateInfoKHR *pCreateInfo, - const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateDisplayPlaneSurfaceKHR(VkInstance instance, + const VkDisplaySurfaceCreateInfoKHR *pCreateInfo, + const VkAllocationCallbacks *pAllocator, + VkSurfaceKHR *pSurface) { const VkLayerInstanceDispatchTable *disp; disp = loader_get_instance_layer_dispatch(instance); VkResult res; - res = disp->CreateDisplayPlaneSurfaceKHR(instance, pCreateInfo, pAllocator, - pSurface); + res = disp->CreateDisplayPlaneSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); return res; } -VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDisplayPlaneSurfaceKHR( - VkInstance instance, const VkDisplaySurfaceCreateInfoKHR *pCreateInfo, - const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) { +VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDisplayPlaneSurfaceKHR(VkInstance instance, + const VkDisplaySurfaceCreateInfoKHR *pCreateInfo, + const VkAllocationCallbacks *pAllocator, + VkSurfaceKHR *pSurface) { struct loader_instance *inst = loader_get_instance(instance); VkIcdSurface *pIcdSurface = NULL; VkResult vkRes = VK_SUCCESS; uint32_t i = 0; if (!inst->wsi_display_enabled) { - loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, - "VK_KHR_surface extension not enabled. " - "vkCreateDisplayPlaneSurfaceKHR not executed!\n"); + loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0, "VK_KHR_surface extension not enabled. " + "vkCreateDisplayPlaneSurfaceKHR not executed!\n"); vkRes = VK_ERROR_EXTENSION_NOT_PRESENT; goto out; } // Next, if so, proceed with the implementation of this function: - pIcdSurface = - AllocateIcdSurfaceStruct(inst, sizeof(pIcdSurface->display_surf.base), - sizeof(pIcdSurface->display_surf)); + pIcdSurface = AllocateIcdSurfaceStruct(inst, sizeof(pIcdSurface->display_surf.base), sizeof(pIcdSurface->display_surf)); if (pIcdSurface == NULL) { vkRes = VK_ERROR_OUT_OF_HOST_MEMORY; goto out; @@ -1542,14 +1288,11 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDisplayPlaneSurfaceKHR( pIcdSurface->display_surf.imageExtent = pCreateInfo->imageExtent; // Loop through each ICD and determine if they need to create a surface - for (struct loader_icd_term *icd_term = inst->icd_terms; icd_term != NULL; - icd_term = icd_term->next, i++) { - if (icd_term->scanned_icd->interface_version >= - ICD_VER_SUPPORTS_ICD_SURFACE_KHR) { + for (struct loader_icd_term *icd_term = inst->icd_terms; icd_term != NULL; icd_term = icd_term->next, i++) { + if (icd_term->scanned_icd->interface_version >= ICD_VER_SUPPORTS_ICD_SURFACE_KHR) { if (NULL != icd_term->CreateDisplayPlaneSurfaceKHR) { - vkRes = icd_term->CreateDisplayPlaneSurfaceKHR( - icd_term->instance, pCreateInfo, pAllocator, - &pIcdSurface->real_icd_surfaces[i]); + vkRes = icd_term->CreateDisplayPlaneSurfaceKHR(icd_term->instance, pCreateInfo, pAllocator, + &pIcdSurface->real_icd_surfaces[i]); if (VK_SUCCESS != vkRes) { goto out; } @@ -1564,13 +1307,9 @@ out: if (VK_SUCCESS != vkRes && NULL != pIcdSurface) { if (NULL != pIcdSurface->real_icd_surfaces) { i = 0; - for (struct loader_icd_term *icd_term = inst->icd_terms; - icd_term != NULL; icd_term = icd_term->next, i++) { - if ((VkSurfaceKHR)NULL != pIcdSurface->real_icd_surfaces[i] && - NULL != icd_term->DestroySurfaceKHR) { - icd_term->DestroySurfaceKHR( - icd_term->instance, pIcdSurface->real_icd_surfaces[i], - pAllocator); + for (struct loader_icd_term *icd_term = inst->icd_terms; icd_term != NULL; icd_term = icd_term->next, i++) { + if ((VkSurfaceKHR)NULL != pIcdSurface->real_icd_surfaces[i] && NULL != icd_term->DestroySurfaceKHR) { + icd_term->DestroySurfaceKHR(icd_term->instance, pIcdSurface->real_icd_surfaces[i], pAllocator); } } loader_instance_heap_free(inst, pIcdSurface->real_icd_surfaces); @@ -1583,89 +1322,67 @@ out: // EXT_display_swapchain Extension command -LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateSharedSwapchainsKHR( - VkDevice device, uint32_t swapchainCount, - const VkSwapchainCreateInfoKHR *pCreateInfos, - const VkAllocationCallbacks *pAllocator, VkSwapchainKHR *pSwapchains) { +LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateSharedSwapchainsKHR(VkDevice device, uint32_t swapchainCount, + const VkSwapchainCreateInfoKHR *pCreateInfos, + const VkAllocationCallbacks *pAllocator, + VkSwapchainKHR *pSwapchains) { const VkLayerDispatchTable *disp; disp = loader_get_dispatch(device); - return disp->CreateSharedSwapchainsKHR(device, swapchainCount, pCreateInfos, - pAllocator, pSwapchains); + return disp->CreateSharedSwapchainsKHR(device, swapchainCount, pCreateInfos, pAllocator, pSwapchains); } -VKAPI_ATTR VkResult VKAPI_CALL terminator_vkCreateSharedSwapchainsKHR( - VkDevice device, uint32_t swapchainCount, - const VkSwapchainCreateInfoKHR *pCreateInfos, - const VkAllocationCallbacks *pAllocator, VkSwapchainKHR *pSwapchains) { +VKAPI_ATTR VkResult VKAPI_CALL terminator_vkCreateSharedSwapchainsKHR(VkDevice device, uint32_t swapchainCount, + const VkSwapchainCreateInfoKHR *pCreateInfos, + const VkAllocationCallbacks *pAllocator, + VkSwapchainKHR *pSwapchains) { uint32_t icd_index = 0; struct loader_device *dev; - struct loader_icd_term *icd_term = - loader_get_icd_and_device(device, &dev, &icd_index); + struct loader_icd_term *icd_term = loader_get_icd_and_device(device, &dev, &icd_index); if (NULL != icd_term && NULL != icd_term->CreateSharedSwapchainsKHR) { - VkIcdSurface *icd_surface = - (VkIcdSurface *)(uintptr_t)pCreateInfos->surface; + VkIcdSurface *icd_surface = (VkIcdSurface *)(uintptr_t)pCreateInfos->surface; if (NULL != icd_surface->real_icd_surfaces) { - if ((VkSurfaceKHR)NULL != - icd_surface->real_icd_surfaces[icd_index]) { + if ((VkSurfaceKHR)NULL != icd_surface->real_icd_surfaces[icd_index]) { // We found the ICD, and there is an ICD KHR surface // associated with it, so copy the CreateInfo struct // and point it at the ICD's surface. - VkSwapchainCreateInfoKHR *pCreateCopy = - loader_stack_alloc(sizeof(VkSwapchainCreateInfoKHR) * - swapchainCount); + VkSwapchainCreateInfoKHR *pCreateCopy = loader_stack_alloc(sizeof(VkSwapchainCreateInfoKHR) * swapchainCount); if (NULL == pCreateCopy) { return VK_ERROR_OUT_OF_HOST_MEMORY; } - memcpy(pCreateCopy, pCreateInfos, - sizeof(VkSwapchainCreateInfoKHR) * swapchainCount); + memcpy(pCreateCopy, pCreateInfos, sizeof(VkSwapchainCreateInfoKHR) * swapchainCount); for (uint32_t sc = 0; sc < swapchainCount; sc++) { - pCreateCopy[sc].surface = - icd_surface->real_icd_surfaces[icd_index]; + pCreateCopy[sc].surface = icd_surface->real_icd_surfaces[icd_index]; } - return icd_term->CreateSharedSwapchainsKHR( - device, swapchainCount, pCreateCopy, pAllocator, - pSwapchains); + return icd_term->CreateSharedSwapchainsKHR(device, swapchainCount, pCreateCopy, pAllocator, pSwapchains); } } - return icd_term->CreateSharedSwapchainsKHR(device, swapchainCount, - pCreateInfos, pAllocator, - pSwapchains); + return icd_term->CreateSharedSwapchainsKHR(device, swapchainCount, pCreateInfos, pAllocator, pSwapchains); } return VK_SUCCESS; } -bool wsi_swapchain_instance_gpa(struct loader_instance *ptr_instance, - const char *name, void **addr) { +bool wsi_swapchain_instance_gpa(struct loader_instance *ptr_instance, const char *name, void **addr) { *addr = NULL; // Functions for the VK_KHR_surface extension: if (!strcmp("vkDestroySurfaceKHR", name)) { - *addr = ptr_instance->wsi_surface_enabled ? (void *)vkDestroySurfaceKHR - : NULL; + *addr = ptr_instance->wsi_surface_enabled ? (void *)vkDestroySurfaceKHR : NULL; return true; } if (!strcmp("vkGetPhysicalDeviceSurfaceSupportKHR", name)) { - *addr = ptr_instance->wsi_surface_enabled - ? (void *)vkGetPhysicalDeviceSurfaceSupportKHR - : NULL; + *addr = ptr_instance->wsi_surface_enabled ? (void *)vkGetPhysicalDeviceSurfaceSupportKHR : NULL; return true; } if (!strcmp("vkGetPhysicalDeviceSurfaceCapabilitiesKHR", name)) { - *addr = ptr_instance->wsi_surface_enabled - ? (void *)vkGetPhysicalDeviceSurfaceCapabilitiesKHR - : NULL; + *addr = ptr_instance->wsi_surface_enabled ? (void *)vkGetPhysicalDeviceSurfaceCapabilitiesKHR : NULL; return true; } if (!strcmp("vkGetPhysicalDeviceSurfaceFormatsKHR", name)) { - *addr = ptr_instance->wsi_surface_enabled - ? (void *)vkGetPhysicalDeviceSurfaceFormatsKHR - : NULL; + *addr = ptr_instance->wsi_surface_enabled ? (void *)vkGetPhysicalDeviceSurfaceFormatsKHR : NULL; return true; } if (!strcmp("vkGetPhysicalDeviceSurfacePresentModesKHR", name)) { - *addr = ptr_instance->wsi_surface_enabled - ? (void *)vkGetPhysicalDeviceSurfacePresentModesKHR - : NULL; + *addr = ptr_instance->wsi_surface_enabled ? (void *)vkGetPhysicalDeviceSurfacePresentModesKHR : NULL; return true; } @@ -1700,15 +1417,11 @@ bool wsi_swapchain_instance_gpa(struct loader_instance *ptr_instance, // Functions for the VK_KHR_win32_surface extension: if (!strcmp("vkCreateWin32SurfaceKHR", name)) { - *addr = ptr_instance->wsi_win32_surface_enabled - ? (void *)vkCreateWin32SurfaceKHR - : NULL; + *addr = ptr_instance->wsi_win32_surface_enabled ? (void *)vkCreateWin32SurfaceKHR : NULL; return true; } if (!strcmp("vkGetPhysicalDeviceWin32PresentationSupportKHR", name)) { - *addr = ptr_instance->wsi_win32_surface_enabled - ? (void *)vkGetPhysicalDeviceWin32PresentationSupportKHR - : NULL; + *addr = ptr_instance->wsi_win32_surface_enabled ? (void *)vkGetPhysicalDeviceWin32PresentationSupportKHR : NULL; return true; } #endif // VK_USE_PLATFORM_WIN32_KHR @@ -1716,15 +1429,11 @@ bool wsi_swapchain_instance_gpa(struct loader_instance *ptr_instance, // Functions for the VK_KHR_mir_surface extension: if (!strcmp("vkCreateMirSurfaceKHR", name)) { - *addr = ptr_instance->wsi_mir_surface_enabled - ? (void *)vkCreateMirSurfaceKHR - : NULL; + *addr = ptr_instance->wsi_mir_surface_enabled ? (void *)vkCreateMirSurfaceKHR : NULL; return true; } if (!strcmp("vkGetPhysicalDeviceMirPresentationSupportKHR", name)) { - *addr = ptr_instance->wsi_mir_surface_enabled - ? (void *)vkGetPhysicalDeviceMirPresentationSupportKHR - : NULL; + *addr = ptr_instance->wsi_mir_surface_enabled ? (void *)vkGetPhysicalDeviceMirPresentationSupportKHR : NULL; return true; } #endif // VK_USE_PLATFORM_MIR_KHR @@ -1732,15 +1441,11 @@ bool wsi_swapchain_instance_gpa(struct loader_instance *ptr_instance, // Functions for the VK_KHR_wayland_surface extension: if (!strcmp("vkCreateWaylandSurfaceKHR", name)) { - *addr = ptr_instance->wsi_wayland_surface_enabled - ? (void *)vkCreateWaylandSurfaceKHR - : NULL; + *addr = ptr_instance->wsi_wayland_surface_enabled ? (void *)vkCreateWaylandSurfaceKHR : NULL; return true; } if (!strcmp("vkGetPhysicalDeviceWaylandPresentationSupportKHR", name)) { - *addr = ptr_instance->wsi_wayland_surface_enabled - ? (void *)vkGetPhysicalDeviceWaylandPresentationSupportKHR - : NULL; + *addr = ptr_instance->wsi_wayland_surface_enabled ? (void *)vkGetPhysicalDeviceWaylandPresentationSupportKHR : NULL; return true; } #endif // VK_USE_PLATFORM_WAYLAND_KHR @@ -1748,15 +1453,11 @@ bool wsi_swapchain_instance_gpa(struct loader_instance *ptr_instance, // Functions for the VK_KHR_xcb_surface extension: if (!strcmp("vkCreateXcbSurfaceKHR", name)) { - *addr = ptr_instance->wsi_xcb_surface_enabled - ? (void *)vkCreateXcbSurfaceKHR - : NULL; + *addr = ptr_instance->wsi_xcb_surface_enabled ? (void *)vkCreateXcbSurfaceKHR : NULL; return true; } if (!strcmp("vkGetPhysicalDeviceXcbPresentationSupportKHR", name)) { - *addr = ptr_instance->wsi_xcb_surface_enabled - ? (void *)vkGetPhysicalDeviceXcbPresentationSupportKHR - : NULL; + *addr = ptr_instance->wsi_xcb_surface_enabled ? (void *)vkGetPhysicalDeviceXcbPresentationSupportKHR : NULL; return true; } #endif // VK_USE_PLATFORM_XCB_KHR @@ -1764,15 +1465,11 @@ bool wsi_swapchain_instance_gpa(struct loader_instance *ptr_instance, // Functions for the VK_KHR_xlib_surface extension: if (!strcmp("vkCreateXlibSurfaceKHR", name)) { - *addr = ptr_instance->wsi_xlib_surface_enabled - ? (void *)vkCreateXlibSurfaceKHR - : NULL; + *addr = ptr_instance->wsi_xlib_surface_enabled ? (void *)vkCreateXlibSurfaceKHR : NULL; return true; } if (!strcmp("vkGetPhysicalDeviceXlibPresentationSupportKHR", name)) { - *addr = ptr_instance->wsi_xlib_surface_enabled - ? (void *)vkGetPhysicalDeviceXlibPresentationSupportKHR - : NULL; + *addr = ptr_instance->wsi_xlib_surface_enabled ? (void *)vkGetPhysicalDeviceXlibPresentationSupportKHR : NULL; return true; } #endif // VK_USE_PLATFORM_XLIB_KHR @@ -1780,54 +1477,38 @@ bool wsi_swapchain_instance_gpa(struct loader_instance *ptr_instance, // Functions for the VK_KHR_android_surface extension: if (!strcmp("vkCreateAndroidSurfaceKHR", name)) { - *addr = ptr_instance->wsi_xlib_surface_enabled - ? (void *)vkCreateAndroidSurfaceKHR - : NULL; + *addr = ptr_instance->wsi_xlib_surface_enabled ? (void *)vkCreateAndroidSurfaceKHR : NULL; return true; } #endif // VK_USE_PLATFORM_ANDROID_KHR // Functions for VK_KHR_display extension: if (!strcmp("vkGetPhysicalDeviceDisplayPropertiesKHR", name)) { - *addr = ptr_instance->wsi_display_enabled - ? (void *)vkGetPhysicalDeviceDisplayPropertiesKHR - : NULL; + *addr = ptr_instance->wsi_display_enabled ? (void *)vkGetPhysicalDeviceDisplayPropertiesKHR : NULL; return true; } if (!strcmp("vkGetPhysicalDeviceDisplayPlanePropertiesKHR", name)) { - *addr = ptr_instance->wsi_display_enabled - ? (void *)vkGetPhysicalDeviceDisplayPlanePropertiesKHR - : NULL; + *addr = ptr_instance->wsi_display_enabled ? (void *)vkGetPhysicalDeviceDisplayPlanePropertiesKHR : NULL; return true; } if (!strcmp("vkGetDisplayPlaneSupportedDisplaysKHR", name)) { - *addr = ptr_instance->wsi_display_enabled - ? (void *)vkGetDisplayPlaneSupportedDisplaysKHR - : NULL; + *addr = ptr_instance->wsi_display_enabled ? (void *)vkGetDisplayPlaneSupportedDisplaysKHR : NULL; return true; } if (!strcmp("vkGetDisplayModePropertiesKHR", name)) { - *addr = ptr_instance->wsi_display_enabled - ? (void *)vkGetDisplayModePropertiesKHR - : NULL; + *addr = ptr_instance->wsi_display_enabled ? (void *)vkGetDisplayModePropertiesKHR : NULL; return true; } if (!strcmp("vkCreateDisplayModeKHR", name)) { - *addr = ptr_instance->wsi_display_enabled - ? (void *)vkCreateDisplayModeKHR - : NULL; + *addr = ptr_instance->wsi_display_enabled ? (void *)vkCreateDisplayModeKHR : NULL; return true; } if (!strcmp("vkGetDisplayPlaneCapabilitiesKHR", name)) { - *addr = ptr_instance->wsi_display_enabled - ? (void *)vkGetDisplayPlaneCapabilitiesKHR - : NULL; + *addr = ptr_instance->wsi_display_enabled ? (void *)vkGetDisplayPlaneCapabilitiesKHR : NULL; return true; } if (!strcmp("vkCreateDisplayPlaneSurfaceKHR", name)) { - *addr = ptr_instance->wsi_display_enabled - ? (void *)vkCreateDisplayPlaneSurfaceKHR - : NULL; + *addr = ptr_instance->wsi_display_enabled ? (void *)vkCreateDisplayPlaneSurfaceKHR : NULL; return true; } diff --git a/loader/wsi.h b/loader/wsi.h index b93a53c7..c5cf8714 100644 --- a/loader/wsi.h +++ b/loader/wsi.h @@ -44,134 +44,102 @@ typedef struct { #endif // VK_USE_PLATFORM_XLIB_KHR VkIcdSurfaceDisplay display_surf; }; - uint32_t base_size; // Size of VkIcdSurfaceBase - uint32_t platform_size; // Size of corresponding VkIcdSurfaceXXX + uint32_t base_size; // Size of VkIcdSurfaceBase + uint32_t platform_size; // Size of corresponding VkIcdSurfaceXXX uint32_t non_platform_offset; // Start offset to base_size - uint32_t entire_size; // Size of entire VkIcdSurface + uint32_t entire_size; // Size of entire VkIcdSurface VkSurfaceKHR *real_icd_surfaces; } VkIcdSurface; -bool wsi_swapchain_instance_gpa(struct loader_instance *ptr_instance, - const char *name, void **addr); +bool wsi_swapchain_instance_gpa(struct loader_instance *ptr_instance, const char *name, void **addr); -void wsi_create_instance(struct loader_instance *ptr_instance, - const VkInstanceCreateInfo *pCreateInfo); +void wsi_create_instance(struct loader_instance *ptr_instance, const VkInstanceCreateInfo *pCreateInfo); bool wsi_unsupported_instance_extension(const VkExtensionProperties *ext_prop); -VKAPI_ATTR VkResult VKAPI_CALL terminator_vkCreateSwapchainKHR( - VkDevice device, const VkSwapchainCreateInfoKHR *pCreateInfo, - const VkAllocationCallbacks *pAllocator, VkSwapchainKHR *pSwapchain); +VKAPI_ATTR VkResult VKAPI_CALL terminator_vkCreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR *pCreateInfo, + const VkAllocationCallbacks *pAllocator, VkSwapchainKHR *pSwapchain); -VKAPI_ATTR void VKAPI_CALL -terminator_DestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface, - const VkAllocationCallbacks *pAllocator); +VKAPI_ATTR void VKAPI_CALL terminator_DestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface, + const VkAllocationCallbacks *pAllocator); -VKAPI_ATTR VkResult VKAPI_CALL -terminator_GetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevice physicalDevice, - uint32_t queueFamilyIndex, - VkSurfaceKHR surface, - VkBool32 *pSupported); +VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevice physicalDevice, + uint32_t queueFamilyIndex, VkSurfaceKHR surface, + VkBool32 *pSupported); -VKAPI_ATTR VkResult VKAPI_CALL -terminator_GetPhysicalDeviceSurfaceCapabilitiesKHR( - VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, - VkSurfaceCapabilitiesKHR *pSurfaceCapabilities); +VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice physicalDevice, + VkSurfaceKHR surface, + VkSurfaceCapabilitiesKHR *pSurfaceCapabilities); -VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSurfaceFormatsKHR( - VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, - uint32_t *pSurfaceFormatCount, VkSurfaceFormatKHR *pSurfaceFormats); +VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, + uint32_t *pSurfaceFormatCount, + VkSurfaceFormatKHR *pSurfaceFormats); -VKAPI_ATTR VkResult VKAPI_CALL -terminator_GetPhysicalDeviceSurfacePresentModesKHR( - VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, - uint32_t *pPresentModeCount, VkPresentModeKHR *pPresentModes); +VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSurfacePresentModesKHR(VkPhysicalDevice physicalDevice, + VkSurfaceKHR surface, uint32_t *pPresentModeCount, + VkPresentModeKHR *pPresentModes); #ifdef VK_USE_PLATFORM_WIN32_KHR -VKAPI_ATTR VkResult VKAPI_CALL -terminator_CreateWin32SurfaceKHR(VkInstance instance, - const VkWin32SurfaceCreateInfoKHR *pCreateInfo, - const VkAllocationCallbacks *pAllocator, - VkSurfaceKHR *pSurface); -VKAPI_ATTR VkBool32 VKAPI_CALL -terminator_GetPhysicalDeviceWin32PresentationSupportKHR( - VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex); +VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateWin32SurfaceKHR(VkInstance instance, const VkWin32SurfaceCreateInfoKHR *pCreateInfo, + const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface); +VKAPI_ATTR VkBool32 VKAPI_CALL terminator_GetPhysicalDeviceWin32PresentationSupportKHR(VkPhysicalDevice physicalDevice, + uint32_t queueFamilyIndex); #endif #ifdef VK_USE_PLATFORM_MIR_KHR -VKAPI_ATTR VkResult VKAPI_CALL -terminator_CreateMirSurfaceKHR(VkInstance instance, - const VkMirSurfaceCreateInfoKHR *pCreateInfo, - const VkAllocationCallbacks *pAllocator, - VkSurfaceKHR *pSurface); -VKAPI_ATTR VkBool32 VKAPI_CALL -terminator_GetPhysicalDeviceMirPresentationSupportKHR( - VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, - MirConnection *connection); +VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateMirSurfaceKHR(VkInstance instance, const VkMirSurfaceCreateInfoKHR *pCreateInfo, + const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface); +VKAPI_ATTR VkBool32 VKAPI_CALL terminator_GetPhysicalDeviceMirPresentationSupportKHR(VkPhysicalDevice physicalDevice, + uint32_t queueFamilyIndex, + MirConnection *connection); #endif #ifdef VK_USE_PLATFORM_WAYLAND_KHR -VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateWaylandSurfaceKHR( - VkInstance instance, const VkWaylandSurfaceCreateInfoKHR *pCreateInfo, - const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface); -VKAPI_ATTR VkBool32 VKAPI_CALL -terminator_GetPhysicalDeviceWaylandPresentationSupportKHR( - VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, - struct wl_display *display); +VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateWaylandSurfaceKHR(VkInstance instance, + const VkWaylandSurfaceCreateInfoKHR *pCreateInfo, + const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface); +VKAPI_ATTR VkBool32 VKAPI_CALL terminator_GetPhysicalDeviceWaylandPresentationSupportKHR(VkPhysicalDevice physicalDevice, + uint32_t queueFamilyIndex, + struct wl_display *display); #endif #ifdef VK_USE_PLATFORM_XCB_KHR -VKAPI_ATTR VkResult VKAPI_CALL -terminator_CreateXcbSurfaceKHR(VkInstance instance, - const VkXcbSurfaceCreateInfoKHR *pCreateInfo, - const VkAllocationCallbacks *pAllocator, - VkSurfaceKHR *pSurface); +VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateXcbSurfaceKHR(VkInstance instance, const VkXcbSurfaceCreateInfoKHR *pCreateInfo, + const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface); -VKAPI_ATTR VkBool32 VKAPI_CALL -terminator_GetPhysicalDeviceXcbPresentationSupportKHR( - VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, - xcb_connection_t *connection, xcb_visualid_t visual_id); +VKAPI_ATTR VkBool32 VKAPI_CALL terminator_GetPhysicalDeviceXcbPresentationSupportKHR(VkPhysicalDevice physicalDevice, + uint32_t queueFamilyIndex, + xcb_connection_t *connection, + xcb_visualid_t visual_id); #endif #ifdef VK_USE_PLATFORM_XLIB_KHR -VKAPI_ATTR VkResult VKAPI_CALL -terminator_CreateXlibSurfaceKHR(VkInstance instance, - const VkXlibSurfaceCreateInfoKHR *pCreateInfo, - const VkAllocationCallbacks *pAllocator, - VkSurfaceKHR *pSurface); -VKAPI_ATTR VkBool32 VKAPI_CALL -terminator_GetPhysicalDeviceXlibPresentationSupportKHR( - VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, Display *dpy, - VisualID visualID); +VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateXlibSurfaceKHR(VkInstance instance, const VkXlibSurfaceCreateInfoKHR *pCreateInfo, + const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface); +VKAPI_ATTR VkBool32 VKAPI_CALL terminator_GetPhysicalDeviceXlibPresentationSupportKHR(VkPhysicalDevice physicalDevice, + uint32_t queueFamilyIndex, Display *dpy, + VisualID visualID); #endif -VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceDisplayPropertiesKHR( - VkPhysicalDevice physicalDevice, uint32_t *pPropertyCount, - VkDisplayPropertiesKHR *pProperties); -VKAPI_ATTR VkResult VKAPI_CALL -terminator_GetPhysicalDeviceDisplayPlanePropertiesKHR( - VkPhysicalDevice physicalDevice, uint32_t *pPropertyCount, - VkDisplayPlanePropertiesKHR *pProperties); -VKAPI_ATTR VkResult VKAPI_CALL -terminator_GetDisplayPlaneSupportedDisplaysKHR(VkPhysicalDevice physicalDevice, - uint32_t planeIndex, - uint32_t *pDisplayCount, - VkDisplayKHR *pDisplays); -VKAPI_ATTR VkResult VKAPI_CALL -terminator_GetDisplayModePropertiesKHR(VkPhysicalDevice physicalDevice, - VkDisplayKHR display, - uint32_t *pPropertyCount, - VkDisplayModePropertiesKHR *pProperties); -VKAPI_ATTR VkResult VKAPI_CALL -terminator_CreateDisplayModeKHR(VkPhysicalDevice physicalDevice, - VkDisplayKHR display, - const VkDisplayModeCreateInfoKHR *pCreateInfo, - const VkAllocationCallbacks *pAllocator, - VkDisplayModeKHR *pMode); -VKAPI_ATTR VkResult VKAPI_CALL terminator_GetDisplayPlaneCapabilitiesKHR( - VkPhysicalDevice physicalDevice, VkDisplayModeKHR mode, uint32_t planeIndex, - VkDisplayPlaneCapabilitiesKHR *pCapabilities); -VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDisplayPlaneSurfaceKHR( - VkInstance instance, const VkDisplaySurfaceCreateInfoKHR *pCreateInfo, - const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface); +VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceDisplayPropertiesKHR(VkPhysicalDevice physicalDevice, + uint32_t *pPropertyCount, + VkDisplayPropertiesKHR *pProperties); +VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceDisplayPlanePropertiesKHR(VkPhysicalDevice physicalDevice, + uint32_t *pPropertyCount, + VkDisplayPlanePropertiesKHR *pProperties); +VKAPI_ATTR VkResult VKAPI_CALL terminator_GetDisplayPlaneSupportedDisplaysKHR(VkPhysicalDevice physicalDevice, uint32_t planeIndex, + uint32_t *pDisplayCount, VkDisplayKHR *pDisplays); +VKAPI_ATTR VkResult VKAPI_CALL terminator_GetDisplayModePropertiesKHR(VkPhysicalDevice physicalDevice, VkDisplayKHR display, + uint32_t *pPropertyCount, + VkDisplayModePropertiesKHR *pProperties); +VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDisplayModeKHR(VkPhysicalDevice physicalDevice, VkDisplayKHR display, + const VkDisplayModeCreateInfoKHR *pCreateInfo, + const VkAllocationCallbacks *pAllocator, VkDisplayModeKHR *pMode); +VKAPI_ATTR VkResult VKAPI_CALL terminator_GetDisplayPlaneCapabilitiesKHR(VkPhysicalDevice physicalDevice, VkDisplayModeKHR mode, + uint32_t planeIndex, + VkDisplayPlaneCapabilitiesKHR *pCapabilities); +VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDisplayPlaneSurfaceKHR(VkInstance instance, + const VkDisplaySurfaceCreateInfoKHR *pCreateInfo, + const VkAllocationCallbacks *pAllocator, + VkSurfaceKHR *pSurface); -VKAPI_ATTR VkResult VKAPI_CALL terminator_vkCreateSharedSwapchainsKHR( - VkDevice device, uint32_t swapchainCount, - const VkSwapchainCreateInfoKHR *pCreateInfos, - const VkAllocationCallbacks *pAllocator, VkSwapchainKHR *pSwapchains); +VKAPI_ATTR VkResult VKAPI_CALL terminator_vkCreateSharedSwapchainsKHR(VkDevice device, uint32_t swapchainCount, + const VkSwapchainCreateInfoKHR *pCreateInfos, + const VkAllocationCallbacks *pAllocator, + VkSwapchainKHR *pSwapchains); #endif /* WSI_H */ |