Update the Vulkan loader to SDK 1.0.46.0

This commit is contained in:
Dr. Chat 2017-05-11 20:09:31 -05:00
parent 599f21d5c6
commit 56d727a024
32 changed files with 19271 additions and 11702 deletions

131
third_party/vulkan/GLSL.std.450.h vendored Normal file
View File

@ -0,0 +1,131 @@
/*
** Copyright (c) 2014-2016 The Khronos Group Inc.
**
** Permission is hereby granted, free of charge, to any person obtaining a copy
** of this software and/or associated documentation files (the "Materials"),
** to deal in the Materials without restriction, including without limitation
** the rights to use, copy, modify, merge, publish, distribute, sublicense,
** and/or sell copies of the Materials, and to permit persons to whom the
** Materials are furnished to do so, subject to the following conditions:
**
** The above copyright notice and this permission notice shall be included in
** all copies or substantial portions of the Materials.
**
** MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS
** STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND
** HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/
**
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
** OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
** THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
** FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS
** IN THE MATERIALS.
*/
#ifndef GLSLstd450_H
#define GLSLstd450_H
static const int GLSLstd450Version = 100;
static const int GLSLstd450Revision = 3;
enum GLSLstd450 {
GLSLstd450Bad = 0, // Don't use
GLSLstd450Round = 1,
GLSLstd450RoundEven = 2,
GLSLstd450Trunc = 3,
GLSLstd450FAbs = 4,
GLSLstd450SAbs = 5,
GLSLstd450FSign = 6,
GLSLstd450SSign = 7,
GLSLstd450Floor = 8,
GLSLstd450Ceil = 9,
GLSLstd450Fract = 10,
GLSLstd450Radians = 11,
GLSLstd450Degrees = 12,
GLSLstd450Sin = 13,
GLSLstd450Cos = 14,
GLSLstd450Tan = 15,
GLSLstd450Asin = 16,
GLSLstd450Acos = 17,
GLSLstd450Atan = 18,
GLSLstd450Sinh = 19,
GLSLstd450Cosh = 20,
GLSLstd450Tanh = 21,
GLSLstd450Asinh = 22,
GLSLstd450Acosh = 23,
GLSLstd450Atanh = 24,
GLSLstd450Atan2 = 25,
GLSLstd450Pow = 26,
GLSLstd450Exp = 27,
GLSLstd450Log = 28,
GLSLstd450Exp2 = 29,
GLSLstd450Log2 = 30,
GLSLstd450Sqrt = 31,
GLSLstd450InverseSqrt = 32,
GLSLstd450Determinant = 33,
GLSLstd450MatrixInverse = 34,
GLSLstd450Modf = 35, // second operand needs an OpVariable to write to
GLSLstd450ModfStruct = 36, // no OpVariable operand
GLSLstd450FMin = 37,
GLSLstd450UMin = 38,
GLSLstd450SMin = 39,
GLSLstd450FMax = 40,
GLSLstd450UMax = 41,
GLSLstd450SMax = 42,
GLSLstd450FClamp = 43,
GLSLstd450UClamp = 44,
GLSLstd450SClamp = 45,
GLSLstd450FMix = 46,
GLSLstd450IMix = 47, // Reserved
GLSLstd450Step = 48,
GLSLstd450SmoothStep = 49,
GLSLstd450Fma = 50,
GLSLstd450Frexp = 51, // second operand needs an OpVariable to write to
GLSLstd450FrexpStruct = 52, // no OpVariable operand
GLSLstd450Ldexp = 53,
GLSLstd450PackSnorm4x8 = 54,
GLSLstd450PackUnorm4x8 = 55,
GLSLstd450PackSnorm2x16 = 56,
GLSLstd450PackUnorm2x16 = 57,
GLSLstd450PackHalf2x16 = 58,
GLSLstd450PackDouble2x32 = 59,
GLSLstd450UnpackSnorm2x16 = 60,
GLSLstd450UnpackUnorm2x16 = 61,
GLSLstd450UnpackHalf2x16 = 62,
GLSLstd450UnpackSnorm4x8 = 63,
GLSLstd450UnpackUnorm4x8 = 64,
GLSLstd450UnpackDouble2x32 = 65,
GLSLstd450Length = 66,
GLSLstd450Distance = 67,
GLSLstd450Cross = 68,
GLSLstd450Normalize = 69,
GLSLstd450FaceForward = 70,
GLSLstd450Reflect = 71,
GLSLstd450Refract = 72,
GLSLstd450FindILsb = 73,
GLSLstd450FindSMsb = 74,
GLSLstd450FindUMsb = 75,
GLSLstd450InterpolateAtCentroid = 76,
GLSLstd450InterpolateAtSample = 77,
GLSLstd450InterpolateAtOffset = 78,
GLSLstd450NMin = 79,
GLSLstd450NMax = 80,
GLSLstd450NClamp = 81,
GLSLstd450Count
};
#endif // #ifndef GLSLstd450_H

File diff suppressed because it is too large Load Diff

View File

@ -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
}

View File

@ -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;
@ -141,8 +120,7 @@ void util_DestroyDebugReportCallback(struct loader_instance *inst,
while (pTrav) {
if (pTrav->msgCallback == callback) {
pPrev->pNext = pTrav->pNext;
if (inst->DbgFunctionHead == pTrav)
inst->DbgFunctionHead = pTrav->pNext;
if (inst->DbgFunctionHead == pTrav) inst->DbgFunctionHead = pTrav->pNext;
#if (DEBUG_DISABLE_APP_ALLOCATORS == 1)
{
#else
@ -164,10 +142,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 +154,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 +168,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 +183,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 +202,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 +213,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 +228,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,50 +244,40 @@ 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);
}
/*
* This is the instance chain terminator function
* for CreateDebugReportCallback
*/
VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDebugReportCallback(
VkInstance instance, const VkDebugReportCallbackCreateInfoEXT *pCreateInfo,
const VkAllocationCallbacks *pAllocator,
VkDebugReportCallbackEXT *pCallback) {
// This is the instance chain terminator function
// for CreateDebugReportCallback
VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDebugReportCallbackEXT(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 +289,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;
@ -354,13 +306,11 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDebugReportCallback(
storage_idx = 0;
for (icd_term = inst->icd_terms; icd_term; icd_term = icd_term->next) {
if (!icd_term->CreateDebugReportCallbackEXT) {
if (!icd_term->dispatch.CreateDebugReportCallbackEXT) {
continue;
}
res = icd_term->CreateDebugReportCallbackEXT(icd_term->instance,
pCreateInfo, pAllocator,
&icd_info[storage_idx]);
res = icd_term->dispatch.CreateDebugReportCallbackEXT(icd_term->instance, pCreateInfo, pAllocator, &icd_info[storage_idx]);
if (res != VK_SUCCESS) {
goto out;
@ -368,23 +318,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;
@ -407,13 +353,12 @@ out:
if (VK_SUCCESS != res) {
storage_idx = 0;
for (icd_term = inst->icd_terms; icd_term; icd_term = icd_term->next) {
if (NULL == icd_term->DestroyDebugReportCallbackEXT) {
if (NULL == icd_term->dispatch.DestroyDebugReportCallbackEXT) {
continue;
}
if (icd_info && icd_info[storage_idx]) {
icd_term->DestroyDebugReportCallbackEXT(
icd_term->instance, icd_info[storage_idx], pAllocator);
icd_term->dispatch.DestroyDebugReportCallbackEXT(icd_term->instance, icd_info[storage_idx], pAllocator);
}
storage_idx++;
}
@ -442,13 +387,9 @@ out:
return res;
}
/*
* This is the instance chain terminator function
* for DestroyDebugReportCallback
*/
VKAPI_ATTR void VKAPI_CALL terminator_DestroyDebugReportCallback(
VkInstance instance, VkDebugReportCallbackEXT callback,
const VkAllocationCallbacks *pAllocator) {
// This is the instance chain terminator function for DestroyDebugReportCallback
VKAPI_ATTR void VKAPI_CALL terminator_DestroyDebugReportCallbackEXT(VkInstance instance, VkDebugReportCallbackEXT callback,
const VkAllocationCallbacks *pAllocator) {
uint32_t storage_idx;
VkDebugReportCallbackEXT *icd_info;
const struct loader_icd_term *icd_term;
@ -457,13 +398,12 @@ VKAPI_ATTR void VKAPI_CALL terminator_DestroyDebugReportCallback(
icd_info = *(VkDebugReportCallbackEXT **)&callback;
storage_idx = 0;
for (icd_term = inst->icd_terms; icd_term; icd_term = icd_term->next) {
if (NULL == icd_term->DestroyDebugReportCallbackEXT) {
if (NULL == icd_term->dispatch.DestroyDebugReportCallbackEXT) {
continue;
}
if (icd_info[storage_idx]) {
icd_term->DestroyDebugReportCallbackEXT(
icd_term->instance, icd_info[storage_idx], pAllocator);
icd_term->dispatch.DestroyDebugReportCallbackEXT(icd_term->instance, icd_info[storage_idx], pAllocator);
}
storage_idx++;
}
@ -479,61 +419,47 @@ 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) {
// This is the instance chain terminator function for DebugReportMessage
VKAPI_ATTR void VKAPI_CALL terminator_DebugReportMessageEXT(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;
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);
if (icd_term->dispatch.DebugReportMessageEXT != NULL) {
icd_term->dispatch.DebugReportMessageEXT(icd_term->instance, flags, objType, object, location, msgCode, pLayerPrefix,
pMsg);
}
}
/*
* Now that all ICDs have seen the message, call the necessary callbacks.
* Ignoring "bail" return value as there is nothing to bail from at this
* point.
*/
// Now that all ICDs have seen the message, call the necessary callbacks. Ignoring "bail" return value
// as there is nothing to bail from at this 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;

View File

@ -23,138 +23,116 @@
#include "vk_loader_platform.h"
#include "loader.h"
/*
* CreateMsgCallback is global and needs to be
* applied to all layers and ICDs.
* What happens if a layer is enabled on both the instance chain
* as well as the device chain and a call to CreateMsgCallback is made?
* Do we need to make sure that each layer / driver only gets called once?
* Should a layer implementing support for CreateMsgCallback only be allowed (?)
* to live on one chain? Or maybe make it the application's responsibility.
* If the app enables DRAW_STATE on at both CreateInstance time and CreateDevice
* time, CreateMsgCallback will call the DRAW_STATE layer twice. Once via
* the instance chain and once via the device chain.
* The loader should only return the DEBUG_REPORT extension as supported
* for the GetGlobalExtensionSupport call. That should help eliminate one
* duplication.
* Since the instance chain requires us iterating over the available ICDs
* and each ICD will have it's own unique MsgCallback object we need to
* track those objects to give back the right one.
* This also implies that the loader has to intercept vkDestroyObject and
* if the extension is enabled and the object type is a MsgCallback then
* we must translate the object into the proper ICD specific ones.
* DestroyObject works on a device chain. Should not be what's destroying
* the MsgCallback object. That needs to be an instance thing. So, since
* we used an instance to create it, we need a custom Destroy that also
* takes an instance. That way we can iterate over the ICDs properly.
* Example use:
* CreateInstance: DEBUG_REPORT
* Loader will create instance chain with enabled extensions.
* TODO: Should validation layers be enabled here? If not, they will not be in
* the instance chain.
* fn = GetProcAddr(INSTANCE, "vkCreateMsgCallback") -> point to loader's
* vkCreateMsgCallback
* App creates a callback object: fn(..., &MsgCallbackObject1)
* Have only established the instance chain so far. Loader will call the
* instance chain.
* Each layer in the instance chain will call down to the next layer,
* terminating with
* the CreateMsgCallback loader terminator function that creates the actual
* MsgCallbackObject1 object.
* The loader CreateMsgCallback terminator will iterate over the ICDs.
* Calling each ICD that supports vkCreateMsgCallback and collect answers in
* icd_msg_callback_map here.
* As result is sent back up the chain each layer has opportunity to record the
* callback operation and
* appropriate MsgCallback object.
* ...
* Any reports matching the flags set in MsgCallbackObject1 will generate the
* defined callback behavior
* in the layer / ICD that initiated that report.
* ...
* CreateDevice: MemTracker:...
* App does not include DEBUG_REPORT as that is a global extension.
* TODO: GetExtensionSupport must not report DEBUG_REPORT when using instance.
* App MUST include any desired validation layers or they will not participate
* in the device call chain.
* App creates a callback object: fn(..., &MsgCallbackObject2)
* Loader's vkCreateMsgCallback is called.
* Loader sends call down instance chain - this is a global extension - any
* validation layer that was
* enabled at CreateInstance will be able to register the callback. Loader will
* iterate over the ICDs and
* will record the ICD's version of the MsgCallback2 object here.
* ...
* Any report will go to the layer's report function and it will check the flags
* for MsgCallbackObject1
* and MsgCallbackObject2 and take the appropriate action as indicated by the
* app.
* ...
* App calls vkDestroyMsgCallback( MsgCallbackObject1 )
* Loader's DestroyMsgCallback is where call starts. DestroyMsgCallback will be
* sent down instance chain
* ending in the loader's DestroyMsgCallback terminator which will iterate over
* the ICD's destroying each
* ICD version of that MsgCallback object and then destroy the loader's version
* of the object.
* 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);
// CreateMsgCallback is global and needs to be
// applied to all layers and ICDs.
// What happens if a layer is enabled on both the instance chain
// as well as the device chain and a call to CreateMsgCallback is made?
// Do we need to make sure that each layer / driver only gets called once?
// Should a layer implementing support for CreateMsgCallback only be allowed (?)
// to live on one chain? Or maybe make it the application's responsibility.
// If the app enables DRAW_STATE on at both CreateInstance time and CreateDevice
// time, CreateMsgCallback will call the DRAW_STATE layer twice. Once via
// the instance chain and once via the device chain.
// The loader should only return the DEBUG_REPORT extension as supported
// for the GetGlobalExtensionSupport call. That should help eliminate one
// duplication.
// Since the instance chain requires us iterating over the available ICDs
// and each ICD will have it's own unique MsgCallback object we need to
// track those objects to give back the right one.
// This also implies that the loader has to intercept vkDestroyObject and
// if the extension is enabled and the object type is a MsgCallback then
// we must translate the object into the proper ICD specific ones.
// DestroyObject works on a device chain. Should not be what's destroying
// the MsgCallback object. That needs to be an instance thing. So, since
// we used an instance to create it, we need a custom Destroy that also
// takes an instance. That way we can iterate over the ICDs properly.
// Example use:
// CreateInstance: DEBUG_REPORT
// Loader will create instance chain with enabled extensions.
// TODO: Should validation layers be enabled here? If not, they will not be in
// the instance chain.
// fn = GetProcAddr(INSTANCE, "vkCreateMsgCallback") -> point to loader's
// vkCreateMsgCallback
// App creates a callback object: fn(..., &MsgCallbackObject1)
// Have only established the instance chain so far. Loader will call the
// instance chain.
// Each layer in the instance chain will call down to the next layer,
// terminating with
// the CreateMsgCallback loader terminator function that creates the actual
// MsgCallbackObject1 object.
// The loader CreateMsgCallback terminator will iterate over the ICDs.
// Calling each ICD that supports vkCreateMsgCallback and collect answers in
// icd_msg_callback_map here.
// As result is sent back up the chain each layer has opportunity to record the
// callback operation and
// appropriate MsgCallback object.
// ...
// Any reports matching the flags set in MsgCallbackObject1 will generate the
// defined callback behavior
// in the layer / ICD that initiated that report.
// ...
// CreateDevice: MemTracker:...
// App does not include DEBUG_REPORT as that is a global extension.
// TODO: GetExtensionSupport must not report DEBUG_REPORT when using instance.
// App MUST include any desired validation layers or they will not participate
// in the device call chain.
// App creates a callback object: fn(..., &MsgCallbackObject2)
// Loader's vkCreateMsgCallback is called.
// Loader sends call down instance chain - this is a global extension - any
// validation layer that was
// enabled at CreateInstance will be able to register the callback. Loader will
// iterate over the ICDs and
// will record the ICD's version of the MsgCallback2 object here.
// ...
// Any report will go to the layer's report function and it will check the flags
// for MsgCallbackObject1
// and MsgCallbackObject2 and take the appropriate action as indicated by the
// app.
// ...
// App calls vkDestroyMsgCallback( MsgCallbackObject1 )
// Loader's DestroyMsgCallback is where call starts. DestroyMsgCallback will be
// sent down instance chain
// ending in the loader's DestroyMsgCallback terminator which will iterate over
// the ICD's destroying each
// ICD version of that MsgCallback object and then destroy the loader's version
// of the object.
// Any reports generated after this will only have MsgCallbackObject2 available.
void debug_report_create_instance(struct loader_instance *ptr_instance,
const VkInstanceCreateInfo *pCreateInfo);
void debug_report_add_instance_extensions(const struct loader_instance *inst, struct loader_extension_list *ext_list);
bool debug_report_instance_gpa(struct loader_instance *ptr_instance,
const char *name, void **addr);
void debug_report_create_instance(struct loader_instance *ptr_instance, const VkInstanceCreateInfo *pCreateInfo);
VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDebugReportCallback(
VkInstance instance, const VkDebugReportCallbackCreateInfoEXT *pCreateInfo,
const VkAllocationCallbacks *pAllocator,
VkDebugReportCallbackEXT *pCallback);
bool debug_report_instance_gpa(struct loader_instance *ptr_instance, const char *name, void **addr);
VKAPI_ATTR void VKAPI_CALL
terminator_DestroyDebugReportCallback(VkInstance instance,
VkDebugReportCallbackEXT callback,
const VkAllocationCallbacks *pAllocator);
VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDebugReportCallbackEXT(VkInstance instance,
const VkDebugReportCallbackCreateInfoEXT *pCreateInfo,
const VkAllocationCallbacks *pAllocator,
VkDebugReportCallbackEXT *pCallback);
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_DestroyDebugReportCallbackEXT(VkInstance instance, VkDebugReportCallbackEXT callback,
const VkAllocationCallbacks *pAllocator);
VkResult
util_CreateDebugReportCallback(struct loader_instance *inst,
VkDebugReportCallbackCreateInfoEXT *pCreateInfo,
const VkAllocationCallbacks *pAllocator,
VkDebugReportCallbackEXT callback);
VKAPI_ATTR void VKAPI_CALL terminator_DebugReportMessageEXT(VkInstance instance, VkDebugReportFlagsEXT flags,
VkDebugReportObjectTypeEXT objType, uint64_t object, size_t location,
int32_t msgCode, const char *pLayerPrefix, const char *pMsg);
void util_DestroyDebugReportCallback(struct loader_instance *inst,
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,
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);

View File

@ -21,9 +21,12 @@
#include "vk_loader_platform.h"
#include "loader.h"
#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC optimize(3) // force gcc to use tail-calls
#pragma GCC optimize(3) // force gcc to use tail-calls
#endif
// Clang-format does not understand macros.
// clang-format off
// Trampoline function macro for unknown physical device extension command.
#define DevExtTramp(num) \
VKAPI_ATTR void VKAPI_CALL vkdev_ext##num(VkDevice device) { \

View File

@ -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 */
{

View File

@ -0,0 +1,586 @@
/*
* Copyright (c) 2015-2017 The Khronos Group Inc.
* Copyright (c) 2015-2017 Valve Corporation
* Copyright (c) 2015-2017 LunarG, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Author: Mark Young <marky@lunarg.com>
*/
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "vk_loader_platform.h"
#include "loader.h"
#include "vk_loader_extensions.h"
#include <vulkan/vk_icd.h>
#include "wsi.h"
#include "debug_report.h"
// ---- Manually added trampoline/terminator functions
// These functions, for whatever reason, require more complex changes than
// can easily be automatically generated.
VkResult setupLoaderTrampPhysDevGroups(VkInstance instance);
VkResult setupLoaderTermPhysDevGroups(struct loader_instance *inst);
VKAPI_ATTR VkResult VKAPI_CALL EnumeratePhysicalDeviceGroupsKHX(
VkInstance instance, uint32_t *pPhysicalDeviceGroupCount,
VkPhysicalDeviceGroupPropertiesKHX *pPhysicalDeviceGroupProperties) {
VkResult res = VK_SUCCESS;
uint32_t count;
uint32_t i;
struct loader_instance *inst = NULL;
loader_platform_thread_lock_mutex(&loader_lock);
inst = loader_get_instance(instance);
if (NULL == inst) {
res = VK_ERROR_INITIALIZATION_FAILED;
goto out;
}
if (NULL == pPhysicalDeviceGroupCount) {
loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0,
"vkEnumeratePhysicalDeviceGroupsKHX: Received NULL pointer for physical "
"device group count return value.");
res = VK_ERROR_INITIALIZATION_FAILED;
goto out;
}
VkResult setup_res = setupLoaderTrampPhysDevGroups(instance);
if (VK_SUCCESS != setup_res) {
res = setup_res;
goto out;
}
count = inst->phys_dev_group_count_tramp;
// Wrap the PhysDev object for loader usage, return wrapped objects
if (NULL != pPhysicalDeviceGroupProperties) {
if (inst->phys_dev_group_count_tramp > *pPhysicalDeviceGroupCount) {
loader_log(inst, VK_DEBUG_REPORT_INFORMATION_BIT_EXT, 0,
"vkEnumeratePhysicalDeviceGroupsKHX: Trimming device group count down"
" by application request from %d to %d physical device groups",
inst->phys_dev_group_count_tramp, *pPhysicalDeviceGroupCount);
count = *pPhysicalDeviceGroupCount;
res = VK_INCOMPLETE;
}
for (i = 0; i < count; i++) {
memcpy(&pPhysicalDeviceGroupProperties[i], inst->phys_dev_groups_tramp[i],
sizeof(VkPhysicalDeviceGroupPropertiesKHX));
}
}
*pPhysicalDeviceGroupCount = count;
out:
loader_platform_thread_unlock_mutex(&loader_lock);
return res;
}
VKAPI_ATTR VkResult VKAPI_CALL terminator_EnumeratePhysicalDeviceGroupsKHX(
VkInstance instance, uint32_t *pPhysicalDeviceGroupCount,
VkPhysicalDeviceGroupPropertiesKHX *pPhysicalDeviceGroupProperties) {
struct loader_instance *inst = (struct loader_instance *)instance;
VkResult res = VK_SUCCESS;
// Always call the setup loader terminator physical device groups because they may
// have changed at any point.
res = setupLoaderTermPhysDevGroups(inst);
if (VK_SUCCESS != res) {
goto out;
}
uint32_t copy_count = inst->phys_dev_group_count_term;
if (NULL != pPhysicalDeviceGroupProperties) {
if (copy_count > *pPhysicalDeviceGroupCount) {
copy_count = *pPhysicalDeviceGroupCount;
res = VK_INCOMPLETE;
}
for (uint32_t i = 0; i < copy_count; i++) {
memcpy(&pPhysicalDeviceGroupProperties[i], inst->phys_dev_groups_term[i],
sizeof(VkPhysicalDeviceGroupPropertiesKHX));
}
}
*pPhysicalDeviceGroupCount = copy_count;
out:
return res;
}
VKAPI_ATTR VkResult VKAPI_CALL
GetPhysicalDeviceExternalImageFormatPropertiesNV(
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);
disp = loader_get_instance_layer_dispatch(physicalDevice);
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,
VkExternalImageFormatPropertiesNV *pExternalImageFormatProperties) {
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->dispatch.GetPhysicalDeviceExternalImageFormatPropertiesNV) {
if (externalHandleType) {
return VK_ERROR_FORMAT_NOT_SUPPORTED;
}
if (!icd_term->dispatch.GetPhysicalDeviceImageFormatProperties) {
return VK_ERROR_INITIALIZATION_FAILED;
}
pExternalImageFormatProperties->externalMemoryFeatures = 0;
pExternalImageFormatProperties->exportFromImportedHandleTypes = 0;
pExternalImageFormatProperties->compatibleHandleTypes = 0;
return icd_term->dispatch.GetPhysicalDeviceImageFormatProperties(
phys_dev_term->phys_dev, format, type, tiling, usage, flags,
&pExternalImageFormatProperties->imageFormatProperties);
}
return icd_term->dispatch.GetPhysicalDeviceExternalImageFormatPropertiesNV(
phys_dev_term->phys_dev, format, type, tiling, usage, flags,
externalHandleType, pExternalImageFormatProperties);
}
VkResult setupLoaderTrampPhysDevGroups(VkInstance instance) {
VkResult res = VK_SUCCESS;
struct loader_instance *inst;
uint32_t total_count = 0;
VkPhysicalDeviceGroupPropertiesKHX **new_phys_dev_groups = NULL;
VkPhysicalDeviceGroupPropertiesKHX *local_phys_dev_groups = NULL;
inst = loader_get_instance(instance);
if (NULL == inst) {
res = VK_ERROR_INITIALIZATION_FAILED;
goto out;
}
// Setup the trampoline loader physical devices. This will actually
// call down and setup the terminator loader physical devices during the
// process.
VkResult setup_res = setupLoaderTrampPhysDevs(instance);
if (setup_res != VK_SUCCESS && setup_res != VK_INCOMPLETE) {
res = setup_res;
goto out;
}
// Query how many physical device groups there
res = inst->disp->layer_inst_disp.EnumeratePhysicalDeviceGroupsKHX(instance, &total_count, NULL);
if (res != VK_SUCCESS) {
loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0,
"setupLoaderTrampPhysDevGroups: Failed during dispatch call of "
"\'EnumeratePhysicalDeviceGroupsKHX\' to lower layers or "
"loader to get count.");
goto out;
}
// Create an array for the new physical device groups, which will be stored
// in the instance for the trampoline code.
new_phys_dev_groups = (VkPhysicalDeviceGroupPropertiesKHX **)loader_instance_heap_alloc(
inst, total_count * sizeof(VkPhysicalDeviceGroupPropertiesKHX *), VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
if (NULL == new_phys_dev_groups) {
loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0,
"setupLoaderTrampPhysDevGroups: Failed to allocate new physical device"
" group array of size %d",
total_count);
res = VK_ERROR_OUT_OF_HOST_MEMORY;
goto out;
}
memset(new_phys_dev_groups, 0, total_count * sizeof(VkPhysicalDeviceGroupPropertiesKHX *));
// Create a temporary array (on the stack) to keep track of the
// returned VkPhysicalDevice values.
local_phys_dev_groups = loader_stack_alloc(sizeof(VkPhysicalDeviceGroupPropertiesKHX) * total_count);
if (NULL == local_phys_dev_groups) {
loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0,
"setupLoaderTrampPhysDevGroups: Failed to allocate local "
"physical device group array of size %d",
total_count);
res = VK_ERROR_OUT_OF_HOST_MEMORY;
goto out;
}
// Initialize the memory to something valid
memset(local_phys_dev_groups, 0, sizeof(VkPhysicalDeviceGroupPropertiesKHX) * total_count);
for (uint32_t group = 0; group < total_count; group++) {
local_phys_dev_groups[group].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES_KHX;
local_phys_dev_groups[group].pNext = NULL;
local_phys_dev_groups[group].subsetAllocation = false;
}
// Call down and get the content
res = inst->disp->layer_inst_disp.EnumeratePhysicalDeviceGroupsKHX(instance, &total_count, local_phys_dev_groups);
if (VK_SUCCESS != res) {
loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0,
"setupLoaderTrampPhysDevGroups: Failed during dispatch call of "
"\'EnumeratePhysicalDeviceGroupsKHX\' to lower layers or "
"loader to get content.");
goto out;
}
// Replace all the physical device IDs with the proper loader values
for (uint32_t group = 0; group < total_count; group++) {
for (uint32_t group_gpu = 0; group_gpu < local_phys_dev_groups[group].physicalDeviceCount; group_gpu++) {
bool found = false;
for (uint32_t tramp_gpu = 0; tramp_gpu < inst->phys_dev_count_tramp; tramp_gpu++) {
if (local_phys_dev_groups[group].physicalDevices[group_gpu] == inst->phys_devs_tramp[tramp_gpu]->phys_dev) {
local_phys_dev_groups[group].physicalDevices[group_gpu] = (VkPhysicalDevice)inst->phys_devs_tramp[tramp_gpu];
found = true;
break;
}
}
if (!found) {
loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0,
"setupLoaderTrampPhysDevGroups: Failed to find GPU %d in group %d"
" returned by \'EnumeratePhysicalDeviceGroupsKHX\' in list returned"
" by \'EnumeratePhysicalDevices\'", group_gpu, group);
res = VK_ERROR_INITIALIZATION_FAILED;
goto out;
}
}
}
// Copy or create everything to fill the new array of physical device groups
for (uint32_t new_idx = 0; new_idx < total_count; new_idx++) {
// Check if this physical device group with the same contents is already in the old buffer
for (uint32_t old_idx = 0; old_idx < inst->phys_dev_group_count_tramp; old_idx++) {
if (local_phys_dev_groups[new_idx].physicalDeviceCount == inst->phys_dev_groups_tramp[old_idx]->physicalDeviceCount) {
bool found_all_gpus = true;
for (uint32_t old_gpu = 0; old_gpu < inst->phys_dev_groups_tramp[old_idx]->physicalDeviceCount; old_gpu++) {
bool found_gpu = false;
for (uint32_t new_gpu = 0; new_gpu < local_phys_dev_groups[new_idx].physicalDeviceCount; new_gpu++) {
if (local_phys_dev_groups[new_idx].physicalDevices[new_gpu] == inst->phys_dev_groups_tramp[old_idx]->physicalDevices[old_gpu]) {
found_gpu = true;
break;
}
}
if (!found_gpu) {
found_all_gpus = false;
break;
}
}
if (!found_all_gpus) {
continue;
} else {
new_phys_dev_groups[new_idx] = inst->phys_dev_groups_tramp[old_idx];
break;
}
}
}
// If this physical device group isn't in the old buffer, create it
if (NULL == new_phys_dev_groups[new_idx]) {
new_phys_dev_groups[new_idx] = (VkPhysicalDeviceGroupPropertiesKHX *)loader_instance_heap_alloc(
inst, sizeof(VkPhysicalDeviceGroupPropertiesKHX), VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
if (NULL == new_phys_dev_groups[new_idx]) {
loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0,
"setupLoaderTrampPhysDevGroups: Failed to allocate "
"physical device group trampoline object %d",
new_idx);
total_count = new_idx;
res = VK_ERROR_OUT_OF_HOST_MEMORY;
goto out;
}
memcpy(new_phys_dev_groups[new_idx], &local_phys_dev_groups[new_idx],
sizeof(VkPhysicalDeviceGroupPropertiesKHX));
}
}
out:
if (VK_SUCCESS != res) {
if (NULL != new_phys_dev_groups) {
for (uint32_t i = 0; i < total_count; i++) {
loader_instance_heap_free(inst, new_phys_dev_groups[i]);
}
loader_instance_heap_free(inst, new_phys_dev_groups);
}
total_count = 0;
} else {
// Free everything that didn't carry over to the new array of
// physical device groups
if (NULL != inst->phys_dev_groups_tramp) {
for (uint32_t i = 0; i < inst->phys_dev_group_count_tramp; i++) {
bool found = false;
for (uint32_t j = 0; j < total_count; j++) {
if (inst->phys_dev_groups_tramp[i] == new_phys_dev_groups[j]) {
found = true;
break;
}
}
if (!found) {
loader_instance_heap_free(inst, inst->phys_dev_groups_tramp[i]);
}
}
loader_instance_heap_free(inst, inst->phys_dev_groups_tramp);
}
// Swap in the new physical device group list
inst->phys_dev_group_count_tramp = total_count;
inst->phys_dev_groups_tramp = new_phys_dev_groups;
}
return res;
}
VkResult setupLoaderTermPhysDevGroups(struct loader_instance *inst) {
VkResult res = VK_SUCCESS;
struct loader_icd_term *icd_term;
uint32_t total_count = 0;
uint32_t cur_icd_group_count = 0;
VkPhysicalDeviceGroupPropertiesKHX **new_phys_dev_groups = NULL;
VkPhysicalDeviceGroupPropertiesKHX *local_phys_dev_groups = NULL;
if (0 == inst->phys_dev_count_term) {
loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0,
"setupLoaderTermPhysDevGroups: Loader failed to setup physical "
"device terminator info before calling \'EnumeratePhysicalDeviceGroupsKHX\'.");
assert(false);
res = VK_ERROR_INITIALIZATION_FAILED;
goto out;
}
// For each ICD, query the number of physical device groups, and then get an
// internal value for those physical devices.
icd_term = inst->icd_terms;
for (uint32_t icd_idx = 0; NULL != icd_term; icd_term = icd_term->next, icd_idx++) {
cur_icd_group_count = 0;
if (NULL == icd_term->dispatch.EnumeratePhysicalDeviceGroupsKHX) {
// Treat each ICD's GPU as it's own group if the extension isn't supported
res = icd_term->dispatch.EnumeratePhysicalDevices(icd_term->instance, &cur_icd_group_count, NULL);
if (res != VK_SUCCESS) {
loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0,
"setupLoaderTermPhysDevGroups: Failed during dispatch call of "
"\'EnumeratePhysicalDevices\' to ICD %d to get plain phys dev count.",
icd_idx);
goto out;
}
} else {
// Query the actual group info
res = icd_term->dispatch.EnumeratePhysicalDeviceGroupsKHX(icd_term->instance, &cur_icd_group_count, NULL);
if (res != VK_SUCCESS) {
loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0,
"setupLoaderTermPhysDevGroups: Failed during dispatch call of "
"\'EnumeratePhysicalDeviceGroupsKHX\' to ICD %d to get count.",
icd_idx);
goto out;
}
}
total_count += cur_icd_group_count;
}
// Create an array for the new physical device groups, which will be stored
// in the instance for the Terminator code.
new_phys_dev_groups = (VkPhysicalDeviceGroupPropertiesKHX **)loader_instance_heap_alloc(
inst, total_count * sizeof(VkPhysicalDeviceGroupPropertiesKHX *), VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
if (NULL == new_phys_dev_groups) {
loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0,
"setupLoaderTermPhysDevGroups: Failed to allocate new physical device"
" group array of size %d",
total_count);
res = VK_ERROR_OUT_OF_HOST_MEMORY;
goto out;
}
memset(new_phys_dev_groups, 0, total_count * sizeof(VkPhysicalDeviceGroupPropertiesKHX *));
// Create a temporary array (on the stack) to keep track of the
// returned VkPhysicalDevice values.
local_phys_dev_groups = loader_stack_alloc(sizeof(VkPhysicalDeviceGroupPropertiesKHX) * total_count);
if (NULL == local_phys_dev_groups) {
loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0,
"setupLoaderTermPhysDevGroups: Failed to allocate local "
"physical device group array of size %d",
total_count);
res = VK_ERROR_OUT_OF_HOST_MEMORY;
goto out;
}
// Initialize the memory to something valid
memset(local_phys_dev_groups, 0, sizeof(VkPhysicalDeviceGroupPropertiesKHX) * total_count);
for (uint32_t group = 0; group < total_count; group++) {
local_phys_dev_groups[group].sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES_KHX;
local_phys_dev_groups[group].pNext = NULL;
local_phys_dev_groups[group].subsetAllocation = false;
}
cur_icd_group_count = 0;
icd_term = inst->icd_terms;
for (uint32_t icd_idx = 0; NULL != icd_term; icd_term = icd_term->next, icd_idx++) {
uint32_t count_this_time = total_count - cur_icd_group_count;
if (NULL == icd_term->dispatch.EnumeratePhysicalDeviceGroupsKHX) {
VkPhysicalDevice* phys_dev_array = loader_stack_alloc(sizeof(VkPhysicalDevice) * count_this_time);
if (NULL == phys_dev_array) {
loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0,
"setupLoaderTermPhysDevGroups: Failed to allocate local "
"physical device array of size %d",
count_this_time);
res = VK_ERROR_OUT_OF_HOST_MEMORY;
goto out;
}
res = icd_term->dispatch.EnumeratePhysicalDevices(icd_term->instance, &count_this_time, phys_dev_array);
if (res != VK_SUCCESS) {
loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0,
"setupLoaderTermPhysDevGroups: Failed during dispatch call of "
"\'EnumeratePhysicalDevices\' to ICD %d to get plain phys dev count.",
icd_idx);
goto out;
}
// Add each GPU as it's own group
for (uint32_t indiv_gpu = 0; indiv_gpu < count_this_time; indiv_gpu++) {
local_phys_dev_groups[indiv_gpu + cur_icd_group_count].physicalDeviceCount = 1;
local_phys_dev_groups[indiv_gpu + cur_icd_group_count].physicalDevices[0] = phys_dev_array[indiv_gpu];
}
} else {
res = icd_term->dispatch.EnumeratePhysicalDeviceGroupsKHX(icd_term->instance, &count_this_time, &local_phys_dev_groups[cur_icd_group_count]);
if (VK_SUCCESS != res) {
loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0,
"setupLoaderTermPhysDevGroups: Failed during dispatch call of "
"\'EnumeratePhysicalDeviceGroupsKHX\' to ICD %d to get content.",
icd_idx);
goto out;
}
}
cur_icd_group_count += count_this_time;
}
// Replace all the physical device IDs with the proper loader values
for (uint32_t group = 0; group < total_count; group++) {
for (uint32_t group_gpu = 0; group_gpu < local_phys_dev_groups[group].physicalDeviceCount; group_gpu++) {
bool found = false;
for (uint32_t term_gpu = 0; term_gpu < inst->phys_dev_count_term; term_gpu++) {
if (local_phys_dev_groups[group].physicalDevices[group_gpu] == inst->phys_devs_term[term_gpu]->phys_dev) {
local_phys_dev_groups[group].physicalDevices[group_gpu] = (VkPhysicalDevice)inst->phys_devs_term[term_gpu];
found = true;
break;
}
}
if (!found) {
loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0,
"setupLoaderTermPhysDevGroups: Failed to find GPU %d in group %d"
" returned by \'EnumeratePhysicalDeviceGroupsKHX\' in list returned"
" by \'EnumeratePhysicalDevices\'", group_gpu, group);
res = VK_ERROR_INITIALIZATION_FAILED;
goto out;
}
}
}
// Copy or create everything to fill the new array of physical device groups
for (uint32_t new_idx = 0; new_idx < total_count; new_idx++) {
// Check if this physical device group with the same contents is already in the old buffer
for (uint32_t old_idx = 0; old_idx < inst->phys_dev_group_count_term; old_idx++) {
if (local_phys_dev_groups[new_idx].physicalDeviceCount == inst->phys_dev_groups_term[old_idx]->physicalDeviceCount) {
bool found_all_gpus = true;
for (uint32_t old_gpu = 0; old_gpu < inst->phys_dev_groups_term[old_idx]->physicalDeviceCount; old_gpu++) {
bool found_gpu = false;
for (uint32_t new_gpu = 0; new_gpu < local_phys_dev_groups[new_idx].physicalDeviceCount; new_gpu++) {
if (local_phys_dev_groups[new_idx].physicalDevices[new_gpu] == inst->phys_dev_groups_term[old_idx]->physicalDevices[old_gpu]) {
found_gpu = true;
break;
}
}
if (!found_gpu) {
found_all_gpus = false;
break;
}
}
if (!found_all_gpus) {
continue;
} else {
new_phys_dev_groups[new_idx] = inst->phys_dev_groups_term[old_idx];
break;
}
}
}
// If this physical device group isn't in the old buffer, create it
if (NULL == new_phys_dev_groups[new_idx]) {
new_phys_dev_groups[new_idx] = (VkPhysicalDeviceGroupPropertiesKHX *)loader_instance_heap_alloc(
inst, sizeof(VkPhysicalDeviceGroupPropertiesKHX), VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
if (NULL == new_phys_dev_groups[new_idx]) {
loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0,
"setupLoaderTermPhysDevGroups: Failed to allocate "
"physical device group Terminator object %d",
new_idx);
total_count = new_idx;
res = VK_ERROR_OUT_OF_HOST_MEMORY;
goto out;
}
memcpy(new_phys_dev_groups[new_idx], &local_phys_dev_groups[new_idx],
sizeof(VkPhysicalDeviceGroupPropertiesKHX));
}
}
out:
if (VK_SUCCESS != res) {
if (NULL != new_phys_dev_groups) {
for (uint32_t i = 0; i < total_count; i++) {
loader_instance_heap_free(inst, new_phys_dev_groups[i]);
}
loader_instance_heap_free(inst, new_phys_dev_groups);
}
total_count = 0;
} else {
// Free everything that didn't carry over to the new array of
// physical device groups
if (NULL != inst->phys_dev_groups_term) {
for (uint32_t i = 0; i < inst->phys_dev_group_count_term; i++) {
bool found = false;
for (uint32_t j = 0; j < total_count; j++) {
if (inst->phys_dev_groups_term[i] == new_phys_dev_groups[j]) {
found = true;
break;
}
}
if (!found) {
loader_instance_heap_free(inst, inst->phys_dev_groups_term[i]);
}
}
loader_instance_heap_free(inst, inst->phys_dev_groups_term);
}
// Swap in the new physical device group list
inst->phys_dev_group_count_term = total_count;
inst->phys_dev_groups_term = new_phys_dev_groups;
}
return res;
}

View File

@ -0,0 +1,49 @@
/*
* Copyright (c) 2015-2017 The Khronos Group Inc.
* Copyright (c) 2015-2017 Valve Corporation
* Copyright (c) 2015-2017 LunarG, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Author: Mark Young <marky@lunarg.com>
*/
#pragma once
// ---- Manually added trampoline/terminator functions
// These functions, for whatever reason, require more complex changes than
// can easily be automatically generated.
VKAPI_ATTR VkResult VKAPI_CALL EnumeratePhysicalDeviceGroupsKHX(
VkInstance instance, uint32_t *pPhysicalDeviceGroupCount,
VkPhysicalDeviceGroupPropertiesKHX *pPhysicalDeviceGroupProperties);
VKAPI_ATTR VkResult VKAPI_CALL terminator_EnumeratePhysicalDeviceGroupsKHX(
VkInstance instance, uint32_t *pPhysicalDeviceGroupCount,
VkPhysicalDeviceGroupPropertiesKHX *pPhysicalDeviceGroupProperties);
VKAPI_ATTR VkResult VKAPI_CALL
GetPhysicalDeviceExternalImageFormatPropertiesNV(
VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type,
VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags,
VkExternalMemoryHandleTypeFlagsNV externalHandleType,
VkExternalImageFormatPropertiesNV *pExternalImageFormatProperties);
VKAPI_ATTR VkResult VKAPI_CALL
terminator_GetPhysicalDeviceExternalImageFormatPropertiesNV(
VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type,
VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags,
VkExternalMemoryHandleTypeFlagsNV externalHandleType,
VkExternalImageFormatPropertiesNV *pExternalImageFormatProperties);

View File

@ -1,850 +0,0 @@
/*
* Copyright (c) 2015-2016 The Khronos Group Inc.
* Copyright (c) 2015-2016 Valve Corporation
* Copyright (c) 2015-2016 LunarG, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Author: Mark Lobodzinski <mark@lunarg.com>
*/
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "vk_loader_platform.h"
#include "loader.h"
#include "extensions.h"
#include "table_ops.h"
#include <vulkan/vk_icd.h>
#include "wsi.h"
// Definitions for the VK_KHR_get_physical_device_properties2 extension
VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFeatures2KHR(
VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures2KHR *pFeatures) {
const VkLayerInstanceDispatchTable *disp;
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;
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,
"ICD associated with VkPhysicalDevice does not support "
"vkGetPhysicalDeviceFeatures2KHR");
}
icd_term->GetPhysicalDeviceFeatures2KHR(phys_dev_term->phys_dev, pFeatures);
}
VKAPI_ATTR void VKAPI_CALL
vkGetPhysicalDeviceProperties2KHR(VkPhysicalDevice physicalDevice,
VkPhysicalDeviceProperties2KHR *pProperties) {
const VkLayerInstanceDispatchTable *disp;
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;
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);
}
VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFormatProperties2KHR(
VkPhysicalDevice physicalDevice, VkFormat format,
VkFormatProperties2KHR *pFormatProperties) {
const VkLayerInstanceDispatchTable *disp;
VkPhysicalDevice unwrapped_phys_dev =
loader_unwrap_physical_device(physicalDevice);
disp = loader_get_instance_layer_dispatch(physicalDevice);
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;
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);
}
VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceImageFormatProperties2KHR(
VkPhysicalDevice physicalDevice,
const VkPhysicalDeviceImageFormatInfo2KHR *pImageFormatInfo,
VkImageFormatProperties2KHR *pImageFormatProperties) {
const VkLayerInstanceDispatchTable *disp;
VkPhysicalDevice unwrapped_phys_dev =
loader_unwrap_physical_device(physicalDevice);
disp = loader_get_instance_layer_dispatch(physicalDevice);
return disp->GetPhysicalDeviceImageFormatProperties2KHR(
unwrapped_phys_dev, pImageFormatInfo, pImageFormatProperties);
}
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_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);
}
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);
disp = loader_get_instance_layer_dispatch(physicalDevice);
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;
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);
}
VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceMemoryProperties2KHR(
VkPhysicalDevice physicalDevice,
VkPhysicalDeviceMemoryProperties2KHR *pMemoryProperties) {
const VkLayerInstanceDispatchTable *disp;
VkPhysicalDevice unwrapped_phys_dev =
loader_unwrap_physical_device(physicalDevice);
disp = loader_get_instance_layer_dispatch(physicalDevice);
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;
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);
}
VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceSparseImageFormatProperties2KHR(
VkPhysicalDevice physicalDevice,
const VkPhysicalDeviceSparseImageFormatInfo2KHR *pFormatInfo,
uint32_t *pPropertyCount, VkSparseImageFormatProperties2KHR *pProperties) {
const VkLayerInstanceDispatchTable *disp;
VkPhysicalDevice unwrapped_phys_dev =
loader_unwrap_physical_device(physicalDevice);
disp = loader_get_instance_layer_dispatch(physicalDevice);
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;
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);
}
// Definitions for the VK_KHR_maintenance1 extension
VKAPI_ATTR void VKAPI_CALL
vkTrimCommandPoolKHR(VkDevice device, VkCommandPool commandPool,
VkCommandPoolTrimFlagsKHR flags) {
const VkLayerDispatchTable *disp = loader_get_dispatch(device);
disp->TrimCommandPoolKHR(device, commandPool, flags);
}
// 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) {
const VkLayerInstanceDispatchTable *disp;
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;
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);
}
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);
disp = loader_get_instance_layer_dispatch(physicalDevice);
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;
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);
}
#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) {
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;
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) {
uint32_t icd_index = 0;
struct loader_device *dev;
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;
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) {
if (NULL != icd_term && NULL != icd_term->CreateSwapchainKHR) {
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];
}
}
}
return icd_term->DebugMarkerSetObjectTagEXT(device, pTagInfo);
} else {
return VK_SUCCESS;
}
}
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;
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) {
uint32_t icd_index = 0;
struct loader_device *dev;
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;
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) {
if (NULL != icd_term && NULL != icd_term->CreateSwapchainKHR) {
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];
}
}
}
return icd_term->DebugMarkerSetObjectNameEXT(device, pNameInfo);
} else {
return VK_SUCCESS;
}
}
// Definitions for the VK_EXT_direct_mode_display extension
VKAPI_ATTR VkResult VKAPI_CALL
vkReleaseDisplayEXT(VkPhysicalDevice physicalDevice, VkDisplayKHR display) {
const VkLayerInstanceDispatchTable *disp;
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;
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,
"ICD associated with VkPhysicalDevice does not support "
"vkReleaseDisplayEXT");
}
return icd_term->ReleaseDisplayEXT(phys_dev_term->phys_dev, display);
}
// Definitions for the VK_EXT_display_surface_counter extension
VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceCapabilities2EXT(
VkPhysicalDevice physicalDevice, VkSurfaceKHR surface,
VkSurfaceCapabilities2EXT *pSurfaceCapabilities) {
const VkLayerInstanceDispatchTable *disp;
VkPhysicalDevice unwrapped_phys_dev =
loader_unwrap_physical_device(physicalDevice);
disp = loader_get_instance_layer_dispatch(physicalDevice);
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;
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,
"ICD associated with VkPhysicalDevice does not support "
"vkGetPhysicalDeviceSurfaceCapabilities2EXT");
}
VkIcdSurface *icd_surface = (VkIcdSurface *)(surface);
uint8_t icd_index = phys_dev_term->icd_index;
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);
}
}
}
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) {
const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
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) {
const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
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,
VkExternalImageFormatPropertiesNV *pExternalImageFormatProperties) {
const VkLayerInstanceDispatchTable *disp;
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);
}
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_icd_term *icd_term = phys_dev_term->this_icd_term;
if (!icd_term->GetPhysicalDeviceExternalImageFormatPropertiesNV) {
if (externalHandleType) {
return VK_ERROR_FORMAT_NOT_SUPPORTED;
}
if (!icd_term->GetPhysicalDeviceImageFormatProperties) {
return VK_ERROR_INITIALIZATION_FAILED;
}
pExternalImageFormatProperties->externalMemoryFeatures = 0;
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->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) {
const VkLayerDispatchTable *disp = loader_get_dispatch(device);
return disp->GetMemoryWin32HandleNV(device, memory, handleType, pHandle);
}
#endif // VK_USE_PLATFORM_WIN32_KHR
// Definitions for the VK_NVX_device_generated_commands
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) {
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) {
const VkLayerDispatchTable *disp = loader_get_dispatch(device);
return disp->CreateIndirectCommandsLayoutNVX(
device, pCreateInfo, pAllocator, pIndirectCommandsLayout);
}
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);
}
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);
}
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) {
const VkLayerDispatchTable *disp = loader_get_dispatch(device);
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) {
const VkLayerDispatchTable *disp = loader_get_dispatch(device);
return disp->UnregisterObjectsNVX(device, objectTable, objectCount,
pObjectEntryTypes, pObjectIndices);
}
VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceGeneratedCommandsPropertiesNVX(
VkPhysicalDevice physicalDevice,
VkDeviceGeneratedCommandsFeaturesNVX *pFeatures,
VkDeviceGeneratedCommandsLimitsNVX *pLimits) {
const VkLayerInstanceDispatchTable *disp;
VkPhysicalDevice unwrapped_phys_dev =
loader_unwrap_physical_device(physicalDevice);
disp = loader_get_instance_layer_dispatch(physicalDevice);
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;
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);
}
}
// GPA helpers for extensions
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)
? (void *)vkGetPhysicalDeviceFeatures2KHR
: NULL;
return true;
}
if (!strcmp("vkGetPhysicalDeviceProperties2KHR", name)) {
*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)
? (void *)vkGetPhysicalDeviceFormatProperties2KHR
: NULL;
return true;
}
if (!strcmp("vkGetPhysicalDeviceImageFormatProperties2KHR", name)) {
*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)
? (void *)vkGetPhysicalDeviceQueueFamilyProperties2KHR
: NULL;
return true;
}
if (!strcmp("vkGetPhysicalDeviceMemoryProperties2KHR", name)) {
*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)
? (void *)vkGetPhysicalDeviceSparseImageFormatProperties2KHR
: NULL;
return true;
}
// Functions for the VK_KHR_maintenance1 extension
if (!strcmp("vkTrimCommandPoolKHR", name)) {
*addr = (void *)vkTrimCommandPoolKHR;
return true;
}
// Functions for the VK_EXT_acquire_xlib_display extension
#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;
return true;
}
if (!strcmp("vkGetRandROutputDisplayEXT", name)) {
*addr =
(ptr_instance->enabled_known_extensions.ext_acquire_xlib_display ==
1)
? (void *)vkGetRandROutputDisplayEXT
: NULL;
return true;
}
#endif // VK_USE_PLATFORM_XLIB_XRANDR_EXT
// Definitions for the VK_EXT_debug_marker extension commands which
// need to have a terminator function. Since these are device
// commands, we always need to return a valid value for them.
if (!strcmp("vkDebugMarkerSetObjectTagEXT", name)) {
*addr = (void *)vkDebugMarkerSetObjectTagEXT;
return true;
}
if (!strcmp("vkDebugMarkerSetObjectNameEXT", name)) {
*addr = (void *)vkDebugMarkerSetObjectNameEXT;
return true;
}
// 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;
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)
? (void *)vkGetPhysicalDeviceSurfaceCapabilities2EXT
: NULL;
return true;
}
// Functions for the VK_AMD_draw_indirect_count extension
if (!strcmp("vkCmdDrawIndirectCountAMD", name)) {
*addr = (void *)vkCmdDrawIndirectCountAMD;
return true;
}
if (!strcmp("vkCmdDrawIndexedIndirectCountAMD", name)) {
*addr = (void *)vkCmdDrawIndexedIndirectCountAMD;
return true;
}
// Functions for the VK_NV_external_memory_capabilities extension
if (!strcmp("vkGetPhysicalDeviceExternalImageFormatPropertiesNV", name)) {
*addr = (ptr_instance->enabled_known_extensions
.nv_external_memory_capabilities == 1)
? (void *)vkGetPhysicalDeviceExternalImageFormatPropertiesNV
: NULL;
return true;
}
#ifdef VK_USE_PLATFORM_WIN32_KHR
// Functions for the VK_NV_external_memory_win32 extension
if (!strcmp("vkGetMemoryWin32HandleNV", name)) {
*addr = (void *)vkGetMemoryWin32HandleNV;
return true;
}
#endif // VK_USE_PLATFORM_WIN32_KHR
// Functions for the VK_NVX_device_generated_commands extension
if (!strcmp("vkCmdProcessCommandsNVX", name)) {
*addr = (void *)vkCmdProcessCommandsNVX;
return true;
}
if (!strcmp("vkCmdReserveSpaceForCommandsNVX", name)) {
*addr = (void *)vkCmdReserveSpaceForCommandsNVX;
return true;
}
if (!strcmp("vkCreateIndirectCommandsLayoutNVX", name)) {
*addr = (void *)vkCreateIndirectCommandsLayoutNVX;
return true;
}
if (!strcmp("vkDestroyIndirectCommandsLayoutNVX", name)) {
*addr = (void *)vkDestroyIndirectCommandsLayoutNVX;
return true;
}
if (!strcmp("vkCreateObjectTableNVX", name)) {
*addr = (void *)vkCreateObjectTableNVX;
return true;
}
if (!strcmp("vkDestroyObjectTableNVX", name)) {
*addr = (void *)vkDestroyObjectTableNVX;
return true;
}
if (!strcmp("vkRegisterObjectsNVX", name)) {
*addr = (void *)vkRegisterObjectsNVX;
return true;
}
if (!strcmp("vkUnregisterObjectsNVX", name)) {
*addr = (void *)vkUnregisterObjectsNVX;
return true;
}
if (!strcmp("vkGetPhysicalDeviceGeneratedCommandsPropertiesNVX", name)) {
*addr = (void *)vkGetPhysicalDeviceGeneratedCommandsPropertiesNVX;
return true;
}
return false;
}
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;
#ifdef VK_USE_PLATFORM_XLIB_KHR
} 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)) {
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;
}
}
}

View File

@ -1,117 +0,0 @@
/*
* Copyright (c) 2015-2016 The Khronos Group Inc.
* Copyright (c) 2015-2016 Valve Corporation
* Copyright (c) 2015-2016 LunarG, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Author: Mark Lobodzinski <mark@lunarg.com>
*
*/
#include "vk_loader_platform.h"
#include "loader.h"
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);
// 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_GetPhysicalDeviceProperties2KHR(
VkPhysicalDevice physicalDevice,
VkPhysicalDeviceProperties2KHR *pProperties);
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,
VkImageFormatProperties2KHR *pImageFormatProperties);
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);
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_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);
// Instance extension terminators for the VK_EXT_display_surface_counter
// extension
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_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,
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);

View File

@ -22,295 +22,157 @@
#include <string.h>
#include "debug_report.h"
#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;
if (!strcmp(funcName, "vkDestroyInstance"))
return (PFN_vkVoidFunction)vkDestroyInstance;
if (!strcmp(funcName, "vkEnumeratePhysicalDevices"))
return (PFN_vkVoidFunction)vkEnumeratePhysicalDevices;
if (!strcmp(funcName, "vkGetPhysicalDeviceFeatures"))
return (PFN_vkVoidFunction)vkGetPhysicalDeviceFeatures;
if (!strcmp(funcName, "vkGetPhysicalDeviceFormatProperties"))
return (PFN_vkVoidFunction)vkGetPhysicalDeviceFormatProperties;
if (!strcmp(funcName, "vkGetInstanceProcAddr")) return (PFN_vkVoidFunction)vkGetInstanceProcAddr;
if (!strcmp(funcName, "vkDestroyInstance")) return (PFN_vkVoidFunction)vkDestroyInstance;
if (!strcmp(funcName, "vkEnumeratePhysicalDevices")) return (PFN_vkVoidFunction)vkEnumeratePhysicalDevices;
if (!strcmp(funcName, "vkGetPhysicalDeviceFeatures")) return (PFN_vkVoidFunction)vkGetPhysicalDeviceFeatures;
if (!strcmp(funcName, "vkGetPhysicalDeviceFormatProperties")) return (PFN_vkVoidFunction)vkGetPhysicalDeviceFormatProperties;
if (!strcmp(funcName, "vkGetPhysicalDeviceImageFormatProperties"))
return (PFN_vkVoidFunction)vkGetPhysicalDeviceImageFormatProperties;
if (!strcmp(funcName, "vkGetPhysicalDeviceSparseImageFormatProperties"))
return (
PFN_vkVoidFunction)vkGetPhysicalDeviceSparseImageFormatProperties;
if (!strcmp(funcName, "vkGetPhysicalDeviceProperties"))
return (PFN_vkVoidFunction)vkGetPhysicalDeviceProperties;
return (PFN_vkVoidFunction)vkGetPhysicalDeviceSparseImageFormatProperties;
if (!strcmp(funcName, "vkGetPhysicalDeviceProperties")) return (PFN_vkVoidFunction)vkGetPhysicalDeviceProperties;
if (!strcmp(funcName, "vkGetPhysicalDeviceQueueFamilyProperties"))
return (PFN_vkVoidFunction)vkGetPhysicalDeviceQueueFamilyProperties;
if (!strcmp(funcName, "vkGetPhysicalDeviceMemoryProperties"))
return (PFN_vkVoidFunction)vkGetPhysicalDeviceMemoryProperties;
if (!strcmp(funcName, "vkEnumerateDeviceLayerProperties"))
return (PFN_vkVoidFunction)vkEnumerateDeviceLayerProperties;
if (!strcmp(funcName, "vkEnumerateDeviceExtensionProperties"))
return (PFN_vkVoidFunction)vkEnumerateDeviceExtensionProperties;
if (!strcmp(funcName, "vkCreateDevice"))
return (PFN_vkVoidFunction)vkCreateDevice;
if (!strcmp(funcName, "vkGetDeviceProcAddr"))
return (PFN_vkVoidFunction)vkGetDeviceProcAddr;
if (!strcmp(funcName, "vkDestroyDevice"))
return (PFN_vkVoidFunction)vkDestroyDevice;
if (!strcmp(funcName, "vkGetDeviceQueue"))
return (PFN_vkVoidFunction)vkGetDeviceQueue;
if (!strcmp(funcName, "vkQueueSubmit"))
return (PFN_vkVoidFunction)vkQueueSubmit;
if (!strcmp(funcName, "vkQueueWaitIdle"))
return (PFN_vkVoidFunction)vkQueueWaitIdle;
if (!strcmp(funcName, "vkDeviceWaitIdle"))
return (PFN_vkVoidFunction)vkDeviceWaitIdle;
if (!strcmp(funcName, "vkAllocateMemory"))
return (PFN_vkVoidFunction)vkAllocateMemory;
if (!strcmp(funcName, "vkFreeMemory"))
return (PFN_vkVoidFunction)vkFreeMemory;
if (!strcmp(funcName, "vkMapMemory"))
return (PFN_vkVoidFunction)vkMapMemory;
if (!strcmp(funcName, "vkUnmapMemory"))
return (PFN_vkVoidFunction)vkUnmapMemory;
if (!strcmp(funcName, "vkFlushMappedMemoryRanges"))
return (PFN_vkVoidFunction)vkFlushMappedMemoryRanges;
if (!strcmp(funcName, "vkInvalidateMappedMemoryRanges"))
return (PFN_vkVoidFunction)vkInvalidateMappedMemoryRanges;
if (!strcmp(funcName, "vkGetDeviceMemoryCommitment"))
return (PFN_vkVoidFunction)vkGetDeviceMemoryCommitment;
if (!strcmp(funcName, "vkGetImageSparseMemoryRequirements"))
return (PFN_vkVoidFunction)vkGetImageSparseMemoryRequirements;
if (!strcmp(funcName, "vkGetImageMemoryRequirements"))
return (PFN_vkVoidFunction)vkGetImageMemoryRequirements;
if (!strcmp(funcName, "vkGetBufferMemoryRequirements"))
return (PFN_vkVoidFunction)vkGetBufferMemoryRequirements;
if (!strcmp(funcName, "vkBindImageMemory"))
return (PFN_vkVoidFunction)vkBindImageMemory;
if (!strcmp(funcName, "vkBindBufferMemory"))
return (PFN_vkVoidFunction)vkBindBufferMemory;
if (!strcmp(funcName, "vkQueueBindSparse"))
return (PFN_vkVoidFunction)vkQueueBindSparse;
if (!strcmp(funcName, "vkCreateFence"))
return (PFN_vkVoidFunction)vkCreateFence;
if (!strcmp(funcName, "vkDestroyFence"))
return (PFN_vkVoidFunction)vkDestroyFence;
if (!strcmp(funcName, "vkGetFenceStatus"))
return (PFN_vkVoidFunction)vkGetFenceStatus;
if (!strcmp(funcName, "vkResetFences"))
return (PFN_vkVoidFunction)vkResetFences;
if (!strcmp(funcName, "vkWaitForFences"))
return (PFN_vkVoidFunction)vkWaitForFences;
if (!strcmp(funcName, "vkCreateSemaphore"))
return (PFN_vkVoidFunction)vkCreateSemaphore;
if (!strcmp(funcName, "vkDestroySemaphore"))
return (PFN_vkVoidFunction)vkDestroySemaphore;
if (!strcmp(funcName, "vkCreateEvent"))
return (PFN_vkVoidFunction)vkCreateEvent;
if (!strcmp(funcName, "vkDestroyEvent"))
return (PFN_vkVoidFunction)vkDestroyEvent;
if (!strcmp(funcName, "vkGetEventStatus"))
return (PFN_vkVoidFunction)vkGetEventStatus;
if (!strcmp(funcName, "vkSetEvent"))
return (PFN_vkVoidFunction)vkSetEvent;
if (!strcmp(funcName, "vkResetEvent"))
return (PFN_vkVoidFunction)vkResetEvent;
if (!strcmp(funcName, "vkCreateQueryPool"))
return (PFN_vkVoidFunction)vkCreateQueryPool;
if (!strcmp(funcName, "vkDestroyQueryPool"))
return (PFN_vkVoidFunction)vkDestroyQueryPool;
if (!strcmp(funcName, "vkGetQueryPoolResults"))
return (PFN_vkVoidFunction)vkGetQueryPoolResults;
if (!strcmp(funcName, "vkCreateBuffer"))
return (PFN_vkVoidFunction)vkCreateBuffer;
if (!strcmp(funcName, "vkDestroyBuffer"))
return (PFN_vkVoidFunction)vkDestroyBuffer;
if (!strcmp(funcName, "vkCreateBufferView"))
return (PFN_vkVoidFunction)vkCreateBufferView;
if (!strcmp(funcName, "vkDestroyBufferView"))
return (PFN_vkVoidFunction)vkDestroyBufferView;
if (!strcmp(funcName, "vkCreateImage"))
return (PFN_vkVoidFunction)vkCreateImage;
if (!strcmp(funcName, "vkDestroyImage"))
return (PFN_vkVoidFunction)vkDestroyImage;
if (!strcmp(funcName, "vkGetImageSubresourceLayout"))
return (PFN_vkVoidFunction)vkGetImageSubresourceLayout;
if (!strcmp(funcName, "vkCreateImageView"))
return (PFN_vkVoidFunction)vkCreateImageView;
if (!strcmp(funcName, "vkDestroyImageView"))
return (PFN_vkVoidFunction)vkDestroyImageView;
if (!strcmp(funcName, "vkCreateShaderModule"))
return (PFN_vkVoidFunction)vkCreateShaderModule;
if (!strcmp(funcName, "vkDestroyShaderModule"))
return (PFN_vkVoidFunction)vkDestroyShaderModule;
if (!strcmp(funcName, "vkCreatePipelineCache"))
return (PFN_vkVoidFunction)vkCreatePipelineCache;
if (!strcmp(funcName, "vkDestroyPipelineCache"))
return (PFN_vkVoidFunction)vkDestroyPipelineCache;
if (!strcmp(funcName, "vkGetPipelineCacheData"))
return (PFN_vkVoidFunction)vkGetPipelineCacheData;
if (!strcmp(funcName, "vkMergePipelineCaches"))
return (PFN_vkVoidFunction)vkMergePipelineCaches;
if (!strcmp(funcName, "vkCreateGraphicsPipelines"))
return (PFN_vkVoidFunction)vkCreateGraphicsPipelines;
if (!strcmp(funcName, "vkCreateComputePipelines"))
return (PFN_vkVoidFunction)vkCreateComputePipelines;
if (!strcmp(funcName, "vkDestroyPipeline"))
return (PFN_vkVoidFunction)vkDestroyPipeline;
if (!strcmp(funcName, "vkCreatePipelineLayout"))
return (PFN_vkVoidFunction)vkCreatePipelineLayout;
if (!strcmp(funcName, "vkDestroyPipelineLayout"))
return (PFN_vkVoidFunction)vkDestroyPipelineLayout;
if (!strcmp(funcName, "vkCreateSampler"))
return (PFN_vkVoidFunction)vkCreateSampler;
if (!strcmp(funcName, "vkDestroySampler"))
return (PFN_vkVoidFunction)vkDestroySampler;
if (!strcmp(funcName, "vkCreateDescriptorSetLayout"))
return (PFN_vkVoidFunction)vkCreateDescriptorSetLayout;
if (!strcmp(funcName, "vkDestroyDescriptorSetLayout"))
return (PFN_vkVoidFunction)vkDestroyDescriptorSetLayout;
if (!strcmp(funcName, "vkCreateDescriptorPool"))
return (PFN_vkVoidFunction)vkCreateDescriptorPool;
if (!strcmp(funcName, "vkDestroyDescriptorPool"))
return (PFN_vkVoidFunction)vkDestroyDescriptorPool;
if (!strcmp(funcName, "vkResetDescriptorPool"))
return (PFN_vkVoidFunction)vkResetDescriptorPool;
if (!strcmp(funcName, "vkAllocateDescriptorSets"))
return (PFN_vkVoidFunction)vkAllocateDescriptorSets;
if (!strcmp(funcName, "vkFreeDescriptorSets"))
return (PFN_vkVoidFunction)vkFreeDescriptorSets;
if (!strcmp(funcName, "vkUpdateDescriptorSets"))
return (PFN_vkVoidFunction)vkUpdateDescriptorSets;
if (!strcmp(funcName, "vkCreateFramebuffer"))
return (PFN_vkVoidFunction)vkCreateFramebuffer;
if (!strcmp(funcName, "vkDestroyFramebuffer"))
return (PFN_vkVoidFunction)vkDestroyFramebuffer;
if (!strcmp(funcName, "vkCreateRenderPass"))
return (PFN_vkVoidFunction)vkCreateRenderPass;
if (!strcmp(funcName, "vkDestroyRenderPass"))
return (PFN_vkVoidFunction)vkDestroyRenderPass;
if (!strcmp(funcName, "vkGetRenderAreaGranularity"))
return (PFN_vkVoidFunction)vkGetRenderAreaGranularity;
if (!strcmp(funcName, "vkCreateCommandPool"))
return (PFN_vkVoidFunction)vkCreateCommandPool;
if (!strcmp(funcName, "vkDestroyCommandPool"))
return (PFN_vkVoidFunction)vkDestroyCommandPool;
if (!strcmp(funcName, "vkResetCommandPool"))
return (PFN_vkVoidFunction)vkResetCommandPool;
if (!strcmp(funcName, "vkAllocateCommandBuffers"))
return (PFN_vkVoidFunction)vkAllocateCommandBuffers;
if (!strcmp(funcName, "vkFreeCommandBuffers"))
return (PFN_vkVoidFunction)vkFreeCommandBuffers;
if (!strcmp(funcName, "vkBeginCommandBuffer"))
return (PFN_vkVoidFunction)vkBeginCommandBuffer;
if (!strcmp(funcName, "vkEndCommandBuffer"))
return (PFN_vkVoidFunction)vkEndCommandBuffer;
if (!strcmp(funcName, "vkResetCommandBuffer"))
return (PFN_vkVoidFunction)vkResetCommandBuffer;
if (!strcmp(funcName, "vkCmdBindPipeline"))
return (PFN_vkVoidFunction)vkCmdBindPipeline;
if (!strcmp(funcName, "vkCmdBindDescriptorSets"))
return (PFN_vkVoidFunction)vkCmdBindDescriptorSets;
if (!strcmp(funcName, "vkCmdBindVertexBuffers"))
return (PFN_vkVoidFunction)vkCmdBindVertexBuffers;
if (!strcmp(funcName, "vkCmdBindIndexBuffer"))
return (PFN_vkVoidFunction)vkCmdBindIndexBuffer;
if (!strcmp(funcName, "vkCmdSetViewport"))
return (PFN_vkVoidFunction)vkCmdSetViewport;
if (!strcmp(funcName, "vkCmdSetScissor"))
return (PFN_vkVoidFunction)vkCmdSetScissor;
if (!strcmp(funcName, "vkCmdSetLineWidth"))
return (PFN_vkVoidFunction)vkCmdSetLineWidth;
if (!strcmp(funcName, "vkCmdSetDepthBias"))
return (PFN_vkVoidFunction)vkCmdSetDepthBias;
if (!strcmp(funcName, "vkCmdSetBlendConstants"))
return (PFN_vkVoidFunction)vkCmdSetBlendConstants;
if (!strcmp(funcName, "vkCmdSetDepthBounds"))
return (PFN_vkVoidFunction)vkCmdSetDepthBounds;
if (!strcmp(funcName, "vkCmdSetStencilCompareMask"))
return (PFN_vkVoidFunction)vkCmdSetStencilCompareMask;
if (!strcmp(funcName, "vkCmdSetStencilWriteMask"))
return (PFN_vkVoidFunction)vkCmdSetStencilWriteMask;
if (!strcmp(funcName, "vkCmdSetStencilReference"))
return (PFN_vkVoidFunction)vkCmdSetStencilReference;
if (!strcmp(funcName, "vkCmdDraw"))
return (PFN_vkVoidFunction)vkCmdDraw;
if (!strcmp(funcName, "vkCmdDrawIndexed"))
return (PFN_vkVoidFunction)vkCmdDrawIndexed;
if (!strcmp(funcName, "vkCmdDrawIndirect"))
return (PFN_vkVoidFunction)vkCmdDrawIndirect;
if (!strcmp(funcName, "vkCmdDrawIndexedIndirect"))
return (PFN_vkVoidFunction)vkCmdDrawIndexedIndirect;
if (!strcmp(funcName, "vkCmdDispatch"))
return (PFN_vkVoidFunction)vkCmdDispatch;
if (!strcmp(funcName, "vkCmdDispatchIndirect"))
return (PFN_vkVoidFunction)vkCmdDispatchIndirect;
if (!strcmp(funcName, "vkCmdCopyBuffer"))
return (PFN_vkVoidFunction)vkCmdCopyBuffer;
if (!strcmp(funcName, "vkCmdCopyImage"))
return (PFN_vkVoidFunction)vkCmdCopyImage;
if (!strcmp(funcName, "vkCmdBlitImage"))
return (PFN_vkVoidFunction)vkCmdBlitImage;
if (!strcmp(funcName, "vkCmdCopyBufferToImage"))
return (PFN_vkVoidFunction)vkCmdCopyBufferToImage;
if (!strcmp(funcName, "vkCmdCopyImageToBuffer"))
return (PFN_vkVoidFunction)vkCmdCopyImageToBuffer;
if (!strcmp(funcName, "vkCmdUpdateBuffer"))
return (PFN_vkVoidFunction)vkCmdUpdateBuffer;
if (!strcmp(funcName, "vkCmdFillBuffer"))
return (PFN_vkVoidFunction)vkCmdFillBuffer;
if (!strcmp(funcName, "vkCmdClearColorImage"))
return (PFN_vkVoidFunction)vkCmdClearColorImage;
if (!strcmp(funcName, "vkCmdClearDepthStencilImage"))
return (PFN_vkVoidFunction)vkCmdClearDepthStencilImage;
if (!strcmp(funcName, "vkCmdClearAttachments"))
return (PFN_vkVoidFunction)vkCmdClearAttachments;
if (!strcmp(funcName, "vkCmdResolveImage"))
return (PFN_vkVoidFunction)vkCmdResolveImage;
if (!strcmp(funcName, "vkCmdSetEvent"))
return (PFN_vkVoidFunction)vkCmdSetEvent;
if (!strcmp(funcName, "vkCmdResetEvent"))
return (PFN_vkVoidFunction)vkCmdResetEvent;
if (!strcmp(funcName, "vkCmdWaitEvents"))
return (PFN_vkVoidFunction)vkCmdWaitEvents;
if (!strcmp(funcName, "vkCmdPipelineBarrier"))
return (PFN_vkVoidFunction)vkCmdPipelineBarrier;
if (!strcmp(funcName, "vkCmdBeginQuery"))
return (PFN_vkVoidFunction)vkCmdBeginQuery;
if (!strcmp(funcName, "vkCmdEndQuery"))
return (PFN_vkVoidFunction)vkCmdEndQuery;
if (!strcmp(funcName, "vkCmdResetQueryPool"))
return (PFN_vkVoidFunction)vkCmdResetQueryPool;
if (!strcmp(funcName, "vkCmdWriteTimestamp"))
return (PFN_vkVoidFunction)vkCmdWriteTimestamp;
if (!strcmp(funcName, "vkCmdCopyQueryPoolResults"))
return (PFN_vkVoidFunction)vkCmdCopyQueryPoolResults;
if (!strcmp(funcName, "vkCmdPushConstants"))
return (PFN_vkVoidFunction)vkCmdPushConstants;
if (!strcmp(funcName, "vkCmdBeginRenderPass"))
return (PFN_vkVoidFunction)vkCmdBeginRenderPass;
if (!strcmp(funcName, "vkCmdNextSubpass"))
return (PFN_vkVoidFunction)vkCmdNextSubpass;
if (!strcmp(funcName, "vkCmdEndRenderPass"))
return (PFN_vkVoidFunction)vkCmdEndRenderPass;
if (!strcmp(funcName, "vkCmdExecuteCommands"))
return (PFN_vkVoidFunction)vkCmdExecuteCommands;
if (!strcmp(funcName, "vkGetPhysicalDeviceMemoryProperties")) return (PFN_vkVoidFunction)vkGetPhysicalDeviceMemoryProperties;
if (!strcmp(funcName, "vkEnumerateDeviceLayerProperties")) return (PFN_vkVoidFunction)vkEnumerateDeviceLayerProperties;
if (!strcmp(funcName, "vkEnumerateDeviceExtensionProperties")) return (PFN_vkVoidFunction)vkEnumerateDeviceExtensionProperties;
if (!strcmp(funcName, "vkCreateDevice")) return (PFN_vkVoidFunction)vkCreateDevice;
if (!strcmp(funcName, "vkGetDeviceProcAddr")) return (PFN_vkVoidFunction)vkGetDeviceProcAddr;
if (!strcmp(funcName, "vkDestroyDevice")) return (PFN_vkVoidFunction)vkDestroyDevice;
if (!strcmp(funcName, "vkGetDeviceQueue")) return (PFN_vkVoidFunction)vkGetDeviceQueue;
if (!strcmp(funcName, "vkQueueSubmit")) return (PFN_vkVoidFunction)vkQueueSubmit;
if (!strcmp(funcName, "vkQueueWaitIdle")) return (PFN_vkVoidFunction)vkQueueWaitIdle;
if (!strcmp(funcName, "vkDeviceWaitIdle")) return (PFN_vkVoidFunction)vkDeviceWaitIdle;
if (!strcmp(funcName, "vkAllocateMemory")) return (PFN_vkVoidFunction)vkAllocateMemory;
if (!strcmp(funcName, "vkFreeMemory")) return (PFN_vkVoidFunction)vkFreeMemory;
if (!strcmp(funcName, "vkMapMemory")) return (PFN_vkVoidFunction)vkMapMemory;
if (!strcmp(funcName, "vkUnmapMemory")) return (PFN_vkVoidFunction)vkUnmapMemory;
if (!strcmp(funcName, "vkFlushMappedMemoryRanges")) return (PFN_vkVoidFunction)vkFlushMappedMemoryRanges;
if (!strcmp(funcName, "vkInvalidateMappedMemoryRanges")) return (PFN_vkVoidFunction)vkInvalidateMappedMemoryRanges;
if (!strcmp(funcName, "vkGetDeviceMemoryCommitment")) return (PFN_vkVoidFunction)vkGetDeviceMemoryCommitment;
if (!strcmp(funcName, "vkGetImageSparseMemoryRequirements")) return (PFN_vkVoidFunction)vkGetImageSparseMemoryRequirements;
if (!strcmp(funcName, "vkGetImageMemoryRequirements")) return (PFN_vkVoidFunction)vkGetImageMemoryRequirements;
if (!strcmp(funcName, "vkGetBufferMemoryRequirements")) return (PFN_vkVoidFunction)vkGetBufferMemoryRequirements;
if (!strcmp(funcName, "vkBindImageMemory")) return (PFN_vkVoidFunction)vkBindImageMemory;
if (!strcmp(funcName, "vkBindBufferMemory")) return (PFN_vkVoidFunction)vkBindBufferMemory;
if (!strcmp(funcName, "vkQueueBindSparse")) return (PFN_vkVoidFunction)vkQueueBindSparse;
if (!strcmp(funcName, "vkCreateFence")) return (PFN_vkVoidFunction)vkCreateFence;
if (!strcmp(funcName, "vkDestroyFence")) return (PFN_vkVoidFunction)vkDestroyFence;
if (!strcmp(funcName, "vkGetFenceStatus")) return (PFN_vkVoidFunction)vkGetFenceStatus;
if (!strcmp(funcName, "vkResetFences")) return (PFN_vkVoidFunction)vkResetFences;
if (!strcmp(funcName, "vkWaitForFences")) return (PFN_vkVoidFunction)vkWaitForFences;
if (!strcmp(funcName, "vkCreateSemaphore")) return (PFN_vkVoidFunction)vkCreateSemaphore;
if (!strcmp(funcName, "vkDestroySemaphore")) return (PFN_vkVoidFunction)vkDestroySemaphore;
if (!strcmp(funcName, "vkCreateEvent")) return (PFN_vkVoidFunction)vkCreateEvent;
if (!strcmp(funcName, "vkDestroyEvent")) return (PFN_vkVoidFunction)vkDestroyEvent;
if (!strcmp(funcName, "vkGetEventStatus")) return (PFN_vkVoidFunction)vkGetEventStatus;
if (!strcmp(funcName, "vkSetEvent")) return (PFN_vkVoidFunction)vkSetEvent;
if (!strcmp(funcName, "vkResetEvent")) return (PFN_vkVoidFunction)vkResetEvent;
if (!strcmp(funcName, "vkCreateQueryPool")) return (PFN_vkVoidFunction)vkCreateQueryPool;
if (!strcmp(funcName, "vkDestroyQueryPool")) return (PFN_vkVoidFunction)vkDestroyQueryPool;
if (!strcmp(funcName, "vkGetQueryPoolResults")) return (PFN_vkVoidFunction)vkGetQueryPoolResults;
if (!strcmp(funcName, "vkCreateBuffer")) return (PFN_vkVoidFunction)vkCreateBuffer;
if (!strcmp(funcName, "vkDestroyBuffer")) return (PFN_vkVoidFunction)vkDestroyBuffer;
if (!strcmp(funcName, "vkCreateBufferView")) return (PFN_vkVoidFunction)vkCreateBufferView;
if (!strcmp(funcName, "vkDestroyBufferView")) return (PFN_vkVoidFunction)vkDestroyBufferView;
if (!strcmp(funcName, "vkCreateImage")) return (PFN_vkVoidFunction)vkCreateImage;
if (!strcmp(funcName, "vkDestroyImage")) return (PFN_vkVoidFunction)vkDestroyImage;
if (!strcmp(funcName, "vkGetImageSubresourceLayout")) return (PFN_vkVoidFunction)vkGetImageSubresourceLayout;
if (!strcmp(funcName, "vkCreateImageView")) return (PFN_vkVoidFunction)vkCreateImageView;
if (!strcmp(funcName, "vkDestroyImageView")) return (PFN_vkVoidFunction)vkDestroyImageView;
if (!strcmp(funcName, "vkCreateShaderModule")) return (PFN_vkVoidFunction)vkCreateShaderModule;
if (!strcmp(funcName, "vkDestroyShaderModule")) return (PFN_vkVoidFunction)vkDestroyShaderModule;
if (!strcmp(funcName, "vkCreatePipelineCache")) return (PFN_vkVoidFunction)vkCreatePipelineCache;
if (!strcmp(funcName, "vkDestroyPipelineCache")) return (PFN_vkVoidFunction)vkDestroyPipelineCache;
if (!strcmp(funcName, "vkGetPipelineCacheData")) return (PFN_vkVoidFunction)vkGetPipelineCacheData;
if (!strcmp(funcName, "vkMergePipelineCaches")) return (PFN_vkVoidFunction)vkMergePipelineCaches;
if (!strcmp(funcName, "vkCreateGraphicsPipelines")) return (PFN_vkVoidFunction)vkCreateGraphicsPipelines;
if (!strcmp(funcName, "vkCreateComputePipelines")) return (PFN_vkVoidFunction)vkCreateComputePipelines;
if (!strcmp(funcName, "vkDestroyPipeline")) return (PFN_vkVoidFunction)vkDestroyPipeline;
if (!strcmp(funcName, "vkCreatePipelineLayout")) return (PFN_vkVoidFunction)vkCreatePipelineLayout;
if (!strcmp(funcName, "vkDestroyPipelineLayout")) return (PFN_vkVoidFunction)vkDestroyPipelineLayout;
if (!strcmp(funcName, "vkCreateSampler")) return (PFN_vkVoidFunction)vkCreateSampler;
if (!strcmp(funcName, "vkDestroySampler")) return (PFN_vkVoidFunction)vkDestroySampler;
if (!strcmp(funcName, "vkCreateDescriptorSetLayout")) return (PFN_vkVoidFunction)vkCreateDescriptorSetLayout;
if (!strcmp(funcName, "vkDestroyDescriptorSetLayout")) return (PFN_vkVoidFunction)vkDestroyDescriptorSetLayout;
if (!strcmp(funcName, "vkCreateDescriptorPool")) return (PFN_vkVoidFunction)vkCreateDescriptorPool;
if (!strcmp(funcName, "vkDestroyDescriptorPool")) return (PFN_vkVoidFunction)vkDestroyDescriptorPool;
if (!strcmp(funcName, "vkResetDescriptorPool")) return (PFN_vkVoidFunction)vkResetDescriptorPool;
if (!strcmp(funcName, "vkAllocateDescriptorSets")) return (PFN_vkVoidFunction)vkAllocateDescriptorSets;
if (!strcmp(funcName, "vkFreeDescriptorSets")) return (PFN_vkVoidFunction)vkFreeDescriptorSets;
if (!strcmp(funcName, "vkUpdateDescriptorSets")) return (PFN_vkVoidFunction)vkUpdateDescriptorSets;
if (!strcmp(funcName, "vkCreateFramebuffer")) return (PFN_vkVoidFunction)vkCreateFramebuffer;
if (!strcmp(funcName, "vkDestroyFramebuffer")) return (PFN_vkVoidFunction)vkDestroyFramebuffer;
if (!strcmp(funcName, "vkCreateRenderPass")) return (PFN_vkVoidFunction)vkCreateRenderPass;
if (!strcmp(funcName, "vkDestroyRenderPass")) return (PFN_vkVoidFunction)vkDestroyRenderPass;
if (!strcmp(funcName, "vkGetRenderAreaGranularity")) return (PFN_vkVoidFunction)vkGetRenderAreaGranularity;
if (!strcmp(funcName, "vkCreateCommandPool")) return (PFN_vkVoidFunction)vkCreateCommandPool;
if (!strcmp(funcName, "vkDestroyCommandPool")) return (PFN_vkVoidFunction)vkDestroyCommandPool;
if (!strcmp(funcName, "vkResetCommandPool")) return (PFN_vkVoidFunction)vkResetCommandPool;
if (!strcmp(funcName, "vkAllocateCommandBuffers")) return (PFN_vkVoidFunction)vkAllocateCommandBuffers;
if (!strcmp(funcName, "vkFreeCommandBuffers")) return (PFN_vkVoidFunction)vkFreeCommandBuffers;
if (!strcmp(funcName, "vkBeginCommandBuffer")) return (PFN_vkVoidFunction)vkBeginCommandBuffer;
if (!strcmp(funcName, "vkEndCommandBuffer")) return (PFN_vkVoidFunction)vkEndCommandBuffer;
if (!strcmp(funcName, "vkResetCommandBuffer")) return (PFN_vkVoidFunction)vkResetCommandBuffer;
if (!strcmp(funcName, "vkCmdBindPipeline")) return (PFN_vkVoidFunction)vkCmdBindPipeline;
if (!strcmp(funcName, "vkCmdBindDescriptorSets")) return (PFN_vkVoidFunction)vkCmdBindDescriptorSets;
if (!strcmp(funcName, "vkCmdBindVertexBuffers")) return (PFN_vkVoidFunction)vkCmdBindVertexBuffers;
if (!strcmp(funcName, "vkCmdBindIndexBuffer")) return (PFN_vkVoidFunction)vkCmdBindIndexBuffer;
if (!strcmp(funcName, "vkCmdSetViewport")) return (PFN_vkVoidFunction)vkCmdSetViewport;
if (!strcmp(funcName, "vkCmdSetScissor")) return (PFN_vkVoidFunction)vkCmdSetScissor;
if (!strcmp(funcName, "vkCmdSetLineWidth")) return (PFN_vkVoidFunction)vkCmdSetLineWidth;
if (!strcmp(funcName, "vkCmdSetDepthBias")) return (PFN_vkVoidFunction)vkCmdSetDepthBias;
if (!strcmp(funcName, "vkCmdSetBlendConstants")) return (PFN_vkVoidFunction)vkCmdSetBlendConstants;
if (!strcmp(funcName, "vkCmdSetDepthBounds")) return (PFN_vkVoidFunction)vkCmdSetDepthBounds;
if (!strcmp(funcName, "vkCmdSetStencilCompareMask")) return (PFN_vkVoidFunction)vkCmdSetStencilCompareMask;
if (!strcmp(funcName, "vkCmdSetStencilWriteMask")) return (PFN_vkVoidFunction)vkCmdSetStencilWriteMask;
if (!strcmp(funcName, "vkCmdSetStencilReference")) return (PFN_vkVoidFunction)vkCmdSetStencilReference;
if (!strcmp(funcName, "vkCmdDraw")) return (PFN_vkVoidFunction)vkCmdDraw;
if (!strcmp(funcName, "vkCmdDrawIndexed")) return (PFN_vkVoidFunction)vkCmdDrawIndexed;
if (!strcmp(funcName, "vkCmdDrawIndirect")) return (PFN_vkVoidFunction)vkCmdDrawIndirect;
if (!strcmp(funcName, "vkCmdDrawIndexedIndirect")) return (PFN_vkVoidFunction)vkCmdDrawIndexedIndirect;
if (!strcmp(funcName, "vkCmdDispatch")) return (PFN_vkVoidFunction)vkCmdDispatch;
if (!strcmp(funcName, "vkCmdDispatchIndirect")) return (PFN_vkVoidFunction)vkCmdDispatchIndirect;
if (!strcmp(funcName, "vkCmdCopyBuffer")) return (PFN_vkVoidFunction)vkCmdCopyBuffer;
if (!strcmp(funcName, "vkCmdCopyImage")) return (PFN_vkVoidFunction)vkCmdCopyImage;
if (!strcmp(funcName, "vkCmdBlitImage")) return (PFN_vkVoidFunction)vkCmdBlitImage;
if (!strcmp(funcName, "vkCmdCopyBufferToImage")) return (PFN_vkVoidFunction)vkCmdCopyBufferToImage;
if (!strcmp(funcName, "vkCmdCopyImageToBuffer")) return (PFN_vkVoidFunction)vkCmdCopyImageToBuffer;
if (!strcmp(funcName, "vkCmdUpdateBuffer")) return (PFN_vkVoidFunction)vkCmdUpdateBuffer;
if (!strcmp(funcName, "vkCmdFillBuffer")) return (PFN_vkVoidFunction)vkCmdFillBuffer;
if (!strcmp(funcName, "vkCmdClearColorImage")) return (PFN_vkVoidFunction)vkCmdClearColorImage;
if (!strcmp(funcName, "vkCmdClearDepthStencilImage")) return (PFN_vkVoidFunction)vkCmdClearDepthStencilImage;
if (!strcmp(funcName, "vkCmdClearAttachments")) return (PFN_vkVoidFunction)vkCmdClearAttachments;
if (!strcmp(funcName, "vkCmdResolveImage")) return (PFN_vkVoidFunction)vkCmdResolveImage;
if (!strcmp(funcName, "vkCmdSetEvent")) return (PFN_vkVoidFunction)vkCmdSetEvent;
if (!strcmp(funcName, "vkCmdResetEvent")) return (PFN_vkVoidFunction)vkCmdResetEvent;
if (!strcmp(funcName, "vkCmdWaitEvents")) return (PFN_vkVoidFunction)vkCmdWaitEvents;
if (!strcmp(funcName, "vkCmdPipelineBarrier")) return (PFN_vkVoidFunction)vkCmdPipelineBarrier;
if (!strcmp(funcName, "vkCmdBeginQuery")) return (PFN_vkVoidFunction)vkCmdBeginQuery;
if (!strcmp(funcName, "vkCmdEndQuery")) return (PFN_vkVoidFunction)vkCmdEndQuery;
if (!strcmp(funcName, "vkCmdResetQueryPool")) return (PFN_vkVoidFunction)vkCmdResetQueryPool;
if (!strcmp(funcName, "vkCmdWriteTimestamp")) return (PFN_vkVoidFunction)vkCmdWriteTimestamp;
if (!strcmp(funcName, "vkCmdCopyQueryPoolResults")) return (PFN_vkVoidFunction)vkCmdCopyQueryPoolResults;
if (!strcmp(funcName, "vkCmdPushConstants")) return (PFN_vkVoidFunction)vkCmdPushConstants;
if (!strcmp(funcName, "vkCmdBeginRenderPass")) return (PFN_vkVoidFunction)vkCmdBeginRenderPass;
if (!strcmp(funcName, "vkCmdNextSubpass")) return (PFN_vkVoidFunction)vkCmdNextSubpass;
if (!strcmp(funcName, "vkCmdEndRenderPass")) return (PFN_vkVoidFunction)vkCmdEndRenderPass;
if (!strcmp(funcName, "vkCmdExecuteCommands")) return (PFN_vkVoidFunction)vkCmdExecuteCommands;
// Instance extensions
void *addr;
if (debug_report_instance_gpa(inst, funcName, &addr))
return addr;
if (debug_report_instance_gpa(inst, funcName, &addr)) return addr;
if (wsi_swapchain_instance_gpa(inst, funcName, &addr))
return addr;
if (wsi_swapchain_instance_gpa(inst, funcName, &addr)) return addr;
if (extension_instance_gpa(inst, funcName, &addr))
return addr;
if (extension_instance_gpa(inst, funcName, &addr)) return addr;
// Unknown physical device extensions
if (loader_phys_dev_ext_gpa(inst, funcName, true, &addr, NULL))
return addr;
if (loader_phys_dev_ext_gpa(inst, funcName, true, &addr, NULL)) return addr;
// Unknown device extensions
addr = loader_dev_ext_gpa(inst, funcName);
@ -318,34 +180,25 @@ static inline void *trampolineGetProcAddr(struct loader_instance *inst,
}
static inline void *globalGetProcAddr(const char *name) {
if (!name || name[0] != 'v' || name[1] != 'k')
return NULL;
if (!name || name[0] != 'v' || name[1] != 'k') return NULL;
name += 2;
if (!strcmp(name, "CreateInstance"))
return (void *)vkCreateInstance;
if (!strcmp(name, "EnumerateInstanceExtensionProperties"))
return (void *)vkEnumerateInstanceExtensionProperties;
if (!strcmp(name, "EnumerateInstanceLayerProperties"))
return (void *)vkEnumerateInstanceLayerProperties;
if (!strcmp(name, "CreateInstance")) return (void *)vkCreateInstance;
if (!strcmp(name, "EnumerateInstanceExtensionProperties")) return (void *)vkEnumerateInstanceExtensionProperties;
if (!strcmp(name, "EnumerateInstanceLayerProperties")) return (void *)vkEnumerateInstanceLayerProperties;
return NULL;
}
static inline void *loader_non_passthrough_gdpa(const char *name) {
if (!name || name[0] != 'v' || name[1] != 'k')
return NULL;
if (!name || name[0] != 'v' || name[1] != 'k') return NULL;
name += 2;
if (!strcmp(name, "GetDeviceProcAddr"))
return (void *)vkGetDeviceProcAddr;
if (!strcmp(name, "DestroyDevice"))
return (void *)vkDestroyDevice;
if (!strcmp(name, "GetDeviceQueue"))
return (void *)vkGetDeviceQueue;
if (!strcmp(name, "AllocateCommandBuffers"))
return (void *)vkAllocateCommandBuffers;
if (!strcmp(name, "GetDeviceProcAddr")) return (void *)vkGetDeviceProcAddr;
if (!strcmp(name, "DestroyDevice")) return (void *)vkDestroyDevice;
if (!strcmp(name, "GetDeviceQueue")) return (void *)vkGetDeviceQueue;
if (!strcmp(name, "AllocateCommandBuffers")) return (void *)vkAllocateCommandBuffers;
return NULL;
}

File diff suppressed because it is too large Load Diff

View File

@ -32,9 +32,9 @@
#include "vk_loader_platform.h"
#include "vk_loader_layer.h"
#include <vulkan/vk_layer.h>
#include <vulkan/vk_icd.h>
#include <assert.h>
#include "vk_loader_extensions.h"
#if defined(__GNUC__) && __GNUC__ >= 4
#define LOADER_EXPORT __attribute__((visibility("default")))
@ -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,
@ -82,15 +81,13 @@ static const char UTF8_THREE_BYTE_MASK = 0xF8;
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"};
static const char std_validation_names[6][VK_MAX_EXTENSION_NAME_SIZE] = {
"VK_LAYER_GOOGLE_threading", "VK_LAYER_LUNARG_parameter_validation", "VK_LAYER_LUNARG_object_tracker",
"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
@ -137,7 +134,7 @@ struct loader_layer_functions {
struct loader_layer_properties {
VkLayerProperties info;
enum layer_type type;
uint32_t interface_version; // PFN_vkNegotiateLoaderLayerInterfaceVersion
uint32_t interface_version; // PFN_vkNegotiateLoaderLayerInterfaceVersion
char lib_name[MAX_STRING_SIZE];
loader_platform_dl_handle lib_handle;
struct loader_layer_functions functions;
@ -156,17 +153,16 @@ struct loader_layer_list {
struct loader_dispatch_hash_list {
size_t capacity;
uint32_t count;
uint32_t *index; // index into the dev_ext dispatch table
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.
// Also have a one to one correspondence with functions in dev_ext_trampoline.c
struct loader_dispatch_hash_entry {
char *func_name;
struct loader_dispatch_hash_list list; // to handle hashing collisions
struct loader_dispatch_hash_list list; // to handle hashing collisions
};
typedef void(VKAPI_PTR *PFN_vkDevExt)(VkDevice device);
@ -182,8 +178,8 @@ struct loader_dev_dispatch_table {
// per CreateDevice structure
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 chain_device; // device object from the dispatch chain
VkDevice icd_device; // device object from the icd
struct loader_physical_device_term *phys_dev_term;
struct loader_layer_list activated_layer_list;
@ -193,159 +189,57 @@ struct loader_device {
struct loader_device *next;
};
/* per ICD structure */
// Per ICD information
// Per ICD structure
struct loader_icd_term {
// pointers to find other structs
const struct loader_scanned_icd *scanned_icd;
const struct loader_instance *this_instance;
struct loader_device *logical_device_list;
VkInstance instance; // instance object from the icd
PFN_vkGetDeviceProcAddr GetDeviceProcAddr;
PFN_vkDestroyInstance DestroyInstance;
PFN_vkEnumeratePhysicalDevices EnumeratePhysicalDevices;
PFN_vkGetPhysicalDeviceFeatures GetPhysicalDeviceFeatures;
PFN_vkGetPhysicalDeviceFormatProperties GetPhysicalDeviceFormatProperties;
PFN_vkGetPhysicalDeviceImageFormatProperties
GetPhysicalDeviceImageFormatProperties;
PFN_vkCreateDevice CreateDevice;
PFN_vkGetPhysicalDeviceProperties GetPhysicalDeviceProperties;
PFN_vkGetPhysicalDeviceQueueFamilyProperties
GetPhysicalDeviceQueueFamilyProperties;
PFN_vkGetPhysicalDeviceMemoryProperties GetPhysicalDeviceMemoryProperties;
PFN_vkEnumerateDeviceExtensionProperties EnumerateDeviceExtensionProperties;
PFN_vkGetPhysicalDeviceSparseImageFormatProperties
GetPhysicalDeviceSparseImageFormatProperties;
// WSI extensions
PFN_vkGetPhysicalDeviceSurfaceSupportKHR GetPhysicalDeviceSurfaceSupportKHR;
PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR
GetPhysicalDeviceSurfaceCapabilitiesKHR;
PFN_vkGetPhysicalDeviceSurfaceFormatsKHR GetPhysicalDeviceSurfaceFormatsKHR;
PFN_vkGetPhysicalDeviceSurfacePresentModesKHR
GetPhysicalDeviceSurfacePresentModesKHR;
#ifdef VK_USE_PLATFORM_WIN32_KHR
PFN_vkCreateWin32SurfaceKHR CreateWin32SurfaceKHR;
PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR
GetPhysicalDeviceWin32PresentationSupportKHR;
#endif
#ifdef VK_USE_PLATFORM_MIR_KHR
PFN_vkCreateMirSurfaceKHR CreateMirSurfaceKHR;
PFN_vkGetPhysicalDeviceMirPresentationSupportKHR
GetPhysicalDeviceMirPresentationSupportKHR;
#endif
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
PFN_vkCreateWaylandSurfaceKHR CreateWaylandSurfaceKHR;
PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR
GetPhysicalDeviceWaylandPresentationSupportKHR;
#endif
#ifdef VK_USE_PLATFORM_XCB_KHR
PFN_vkCreateXcbSurfaceKHR CreateXcbSurfaceKHR;
PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR
GetPhysicalDeviceXcbPresentationSupportKHR;
#endif
#ifdef VK_USE_PLATFORM_XLIB_KHR
PFN_vkCreateXlibSurfaceKHR CreateXlibSurfaceKHR;
PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR
GetPhysicalDeviceXlibPresentationSupportKHR;
#endif
PFN_vkGetPhysicalDeviceDisplayPropertiesKHR
GetPhysicalDeviceDisplayPropertiesKHR;
PFN_vkGetPhysicalDeviceDisplayPlanePropertiesKHR
GetPhysicalDeviceDisplayPlanePropertiesKHR;
PFN_vkGetDisplayPlaneSupportedDisplaysKHR
GetDisplayPlaneSupportedDisplaysKHR;
PFN_vkGetDisplayModePropertiesKHR GetDisplayModePropertiesKHR;
PFN_vkCreateDisplayModeKHR CreateDisplayModeKHR;
PFN_vkGetDisplayPlaneCapabilitiesKHR GetDisplayPlaneCapabilitiesKHR;
PFN_vkCreateDisplayPlaneSurfaceKHR CreateDisplayPlaneSurfaceKHR;
PFN_vkDestroySurfaceKHR DestroySurfaceKHR;
PFN_vkCreateSwapchainKHR CreateSwapchainKHR;
PFN_vkCreateSharedSwapchainsKHR CreateSharedSwapchainsKHR;
// 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;
#ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT
// EXT_acquire_xlib_display
PFN_vkAcquireXlibDisplayEXT AcquireXlibDisplayEXT;
PFN_vkGetRandROutputDisplayEXT GetRandROutputDisplayEXT;
#endif
// EXT_debug_report
PFN_vkCreateDebugReportCallbackEXT CreateDebugReportCallbackEXT;
PFN_vkDestroyDebugReportCallbackEXT DestroyDebugReportCallbackEXT;
PFN_vkDebugReportMessageEXT DebugReportMessageEXT;
// EXT_debug_marker (items needing a trampoline/terminator)
PFN_vkDebugMarkerSetObjectTagEXT DebugMarkerSetObjectTagEXT;
PFN_vkDebugMarkerSetObjectNameEXT DebugMarkerSetObjectNameEXT;
// EXT_direct_mode_display
PFN_vkReleaseDisplayEXT ReleaseDisplayEXT;
// EXT_display_surface_counter
PFN_vkGetPhysicalDeviceSurfaceCapabilities2EXT
GetPhysicalDeviceSurfaceCapabilities2EXT;
// NV_external_memory_capabilities
PFN_vkGetPhysicalDeviceExternalImageFormatPropertiesNV
GetPhysicalDeviceExternalImageFormatPropertiesNV;
// NVX_device_generated_commands
PFN_vkGetPhysicalDeviceGeneratedCommandsPropertiesNVX
GetPhysicalDeviceGeneratedCommandsPropertiesNVX;
VkInstance instance; // instance object from the icd
struct loader_icd_term_dispatch dispatch;
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
// Per ICD library structure
struct loader_icd_tramp_list {
size_t capacity;
uint32_t count;
struct loader_scanned_icd *scanned_list;
};
union loader_instance_extension_enables {
struct {
uint8_t khr_get_physical_device_properties2 : 1;
uint8_t ext_acquire_xlib_display : 1;
uint8_t ext_debug_report : 1;
uint8_t ext_direct_mode_display : 1;
uint8_t ext_display_surface_counter : 1;
uint8_t nv_external_memory_capabilities : 1;
};
uint64_t padding[4];
};
struct loader_instance_dispatch_table {
VkLayerInstanceDispatchTable layer_inst_disp; // must be first entry in structure
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
// Per instance structure
struct loader_instance {
struct loader_instance_dispatch_table *disp; // must be first entry in structure
struct loader_instance_dispatch_table *disp; // must be first entry in structure
// We need to manually track physical devices over time. If the user
// re-queries the information, we don't want to delete old data or
// create new data unless necessary.
uint32_t total_gpu_count;
uint32_t phys_dev_count_term;
struct loader_physical_device_term **phys_devs_term;
uint32_t phys_dev_count_tramp;
struct loader_physical_device_tramp **phys_devs_tramp;
// We also need to manually track physical device groups, but we don't need
// loader specific structures since we have that content in the physical
// device stored internal to the public structures.
uint32_t phys_dev_group_count_term;
struct VkPhysicalDeviceGroupPropertiesKHX **phys_dev_groups_term;
uint32_t phys_dev_group_count_tramp;
struct VkPhysicalDeviceGroupPropertiesKHX **phys_dev_groups_tramp;
struct loader_instance *next;
uint32_t total_icd_count;
@ -360,9 +254,9 @@ struct loader_instance {
struct loader_layer_list instance_layer_list;
struct loader_layer_list activated_layer_list;
bool activated_layers_are_std_val;
VkInstance instance; // layers/ICD instance returned to trampoline
VkInstance instance; // layers/ICD instance returned to trampoline
struct loader_extension_list ext_list; // icds and loaders extensions
struct loader_extension_list ext_list; // icds and loaders extensions
union loader_instance_extension_enables enabled_known_extensions;
VkLayerDbgFunctionNode *DbgFunctionHead;
@ -394,32 +288,32 @@ struct loader_instance {
bool wsi_display_enabled;
};
/* VkPhysicalDevice requires special treatment by loader. Firstly, terminator
* code must be able to get the struct loader_icd_term to call into the proper
* driver (multiple ICD/gpu case). This can be accomplished by wrapping the
* created VkPhysicalDevice in loader terminate_EnumeratePhysicalDevices().
* Secondly, the loader must be able to handle wrapped by layer VkPhysicalDevice
* in trampoline code. This implies, that the loader trampoline code must also
* wrap the VkPhysicalDevice object in trampoline code. Thus, loader has to
* wrap the VkPhysicalDevice created object twice. In trampoline code it can't
* rely on the terminator object wrapping since a layer may also wrap. Since
* trampoline code wraps the VkPhysicalDevice this means all loader trampoline
* code that passes a VkPhysicalDevice should unwrap it. */
// VkPhysicalDevice requires special treatment by loader. Firstly, terminator
// code must be able to get the struct loader_icd_term to call into the proper
// driver (multiple ICD/gpu case). This can be accomplished by wrapping the
// created VkPhysicalDevice in loader terminate_EnumeratePhysicalDevices().
// Secondly, the loader must be able to handle wrapped by layer VkPhysicalDevice
// in trampoline code. This implies, that the loader trampoline code must also
// wrap the VkPhysicalDevice object in trampoline code. Thus, loader has to
// wrap the VkPhysicalDevice created object twice. In trampoline code it can't
// rely on the terminator object wrapping since a layer may also wrap. Since
// trampoline code wraps the VkPhysicalDevice this means all loader trampoline
// code that passes a VkPhysicalDevice should unwrap it.
/* per enumerated PhysicalDevice structure, used to wrap in trampoline code and
also same structure used to wrap in terminator code */
// Per enumerated PhysicalDevice structure, used to wrap in trampoline code and
// also same structure used to wrap in terminator code
struct loader_physical_device_tramp {
struct loader_instance_dispatch_table *disp; // must be first entry in structure
struct loader_instance_dispatch_table *disp; // must be first entry in structure
struct loader_instance *this_instance;
VkPhysicalDevice phys_dev; // object from layers/loader terminator
VkPhysicalDevice phys_dev; // object from layers/loader terminator
};
/* per enumerated PhysicalDevice structure, used to wrap in terminator code */
// Per enumerated PhysicalDevice structure, used to wrap in terminator code
struct loader_physical_device_term {
struct loader_instance_dispatch_table *disp; // must be first entry in structure
struct loader_instance_dispatch_table *disp; // must be first entry in structure
struct loader_icd_term *this_icd_term;
uint8_t icd_index;
VkPhysicalDevice phys_dev; // object from ICD
VkPhysicalDevice phys_dev; // object from ICD
};
struct loader_struct {
@ -434,41 +328,29 @@ 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);
}
@ -482,13 +364,12 @@ static inline void loader_init_dispatch(void *obj, const void *data) {
loader_set_dispatch(obj, data);
}
/* global variables used across files */
// Global variables used across files
extern struct loader_struct loader;
extern THREAD_LOCAL_DECL struct loader_instance *tls_instance;
extern LOADER_PLATFORM_THREAD_ONCE_DEFINITION(once_init);
extern loader_platform_thread_mutex loader_lock;
extern loader_platform_thread_mutex loader_json_lock;
extern const VkLayerInstanceDispatchTable instance_disp;
extern const char *std_validation_str;
struct loader_msg_callback_map_entry {
@ -496,242 +377,105 @@ struct loader_msg_callback_map_entry {
VkDebugReportCallbackEXT loader_obj;
};
/* 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,
// 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,
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);
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_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,
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);
// NOTE: Outside of loader, this entry-point is only proivided for error
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 provided 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);
void loader_deactivate_instance_layers(struct loader_instance *instance);
VkResult loader_enable_instance_layers(struct loader_instance *inst, const VkInstanceCreateInfo *pCreateInfo,
const struct loader_layer_list *instance_layers);
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);
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);
void loader_activate_instance_layer_extensions(struct loader_instance *inst, VkInstance 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);
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);
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);
VkStringErrorFlags vk_string_validate(const int max_length, const char *char_array);
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 */
#endif // LOADER_H

View File

@ -0,0 +1,2 @@
/* #undef HAVE_SECURE_GETENV */
/* #undef HAVE___SECURE_GETENV */

View File

@ -41,16 +41,16 @@ uint32_t murmurhash(const char *key, size_t len, uint32_t seed) {
uint32_t n = 0xe6546b64;
uint32_t h = 0;
uint32_t k = 0;
uint8_t *d = (uint8_t *)key; // 32 bit extract from `key'
uint8_t *d = (uint8_t *)key; // 32 bit extract from `key'
const uint32_t *chunks = NULL;
const uint8_t *tail = NULL; // tail - last 8 bytes
const uint8_t *tail = NULL; // tail - last 8 bytes
int i = 0;
int l = (int)len / 4; // chunk length
int l = (int)len / 4; // chunk length
h = seed;
chunks = (const uint32_t *)(d + l * 4); // body
tail = (const uint8_t *)(d + l * 4); // last 8 byte chunk of `key'
chunks = (const uint32_t *)(d + l * 4); // body
tail = (const uint8_t *)(d + l * 4); // last 8 byte chunk of `key'
// for each 4 byte chunk of `key'
for (i = -l; i != 0; ++i) {
@ -71,18 +71,18 @@ uint32_t murmurhash(const char *key, size_t len, uint32_t seed) {
k = 0;
// remainder
switch (len & 3) { // `len % 4'
case 3:
k ^= (tail[2] << 16);
case 2:
k ^= (tail[1] << 8);
switch (len & 3) { // `len % 4'
case 3:
k ^= (tail[2] << 16);
case 2:
k ^= (tail[1] << 8);
case 1:
k ^= tail[0];
k *= c1;
k = (k << r1) | (k >> (32 - r1));
k *= c2;
h ^= k;
case 1:
k ^= tail[0];
k *= c1;
k = (k << r1) | (k >> (32 - r1));
k *= c2;
h ^= k;
}
h ^= len;

View File

@ -30,36 +30,33 @@
#include "loader.h"
#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC optimize(3) // force gcc to use tail-calls
#pragma GCC optimize(3) // force gcc to use tail-calls
#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
// clang-format off
// Instantiations of the trampoline and terminator
PhysDevExtTramp(0) PhysDevExtTermin(0)
PhysDevExtTramp(1) PhysDevExtTermin(1)

View File

@ -17,6 +17,9 @@ project("vulkan-loader")
})
recursive_platform_files()
-- Included elsewhere
removefiles("vk_loader_extensions.c")
filter("platforms:Windows")
warnings("Off") -- Too many warnings.
characterset("MBCS")

View File

@ -1,935 +0,0 @@
/*
*
* Copyright (c) 2015-2016 The Khronos Group Inc.
* Copyright (c) 2015-2016 Valve Corporation
* Copyright (c) 2015-2016 LunarG, Inc.
* Copyright (C) 2016 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Author: Courtney Goeltzenleuchter <courtney@lunarg.com>
* Author: Jon Ashburn <jon@lunarg.com>
* Author: Ian Elliott <ian@LunarG.com>
* Author: Tony Barbour <tony@LunarG.com>
*/
#include <vulkan/vulkan.h>
#include <vulkan/vk_layer.h>
#include <string.h>
#include "loader.h"
#include "vk_loader_platform.h"
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);
if (icd_term)
loader_log(icd_term->this_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0,
"Bad destination in loader trampoline dispatch,"
"Are layers and extensions that you are calling enabled?");
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) {
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->DestroyDevice = (PFN_vkDestroyDevice)gpa(dev, "vkDestroyDevice");
table->GetDeviceQueue = (PFN_vkGetDeviceQueue)gpa(dev, "vkGetDeviceQueue");
table->QueueSubmit = (PFN_vkQueueSubmit)gpa(dev, "vkQueueSubmit");
table->QueueWaitIdle = (PFN_vkQueueWaitIdle)gpa(dev, "vkQueueWaitIdle");
table->DeviceWaitIdle = (PFN_vkDeviceWaitIdle)gpa(dev, "vkDeviceWaitIdle");
table->AllocateMemory = (PFN_vkAllocateMemory)gpa(dev, "vkAllocateMemory");
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->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");
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->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->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->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->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->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->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->CmdDispatch = (PFN_vkCmdDispatch)gpa(dev, "vkCmdDispatch");
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->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->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->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->CmdNextSubpass = (PFN_vkCmdNextSubpass)gpa(dev, "vkCmdNextSubpass");
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) {
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");
// KHR_display_swapchain
table->CreateSharedSwapchainsKHR = (PFN_vkCreateSharedSwapchainsKHR)gpa(
dev, "vkCreateSharedSwapchainsKHR");
// KHR_maintenance1
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");
// 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");
// AMD_draw_indirect_count
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");
#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->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");
}
static inline void *
loader_lookup_device_dispatch_table(const VkLayerDispatchTable *table,
const char *name) {
if (!name || name[0] != 'v' || name[1] != 'k')
return NULL;
name += 2;
if (!strcmp(name, "GetDeviceProcAddr"))
return (void *)table->GetDeviceProcAddr;
if (!strcmp(name, "DestroyDevice"))
return (void *)table->DestroyDevice;
if (!strcmp(name, "GetDeviceQueue"))
return (void *)table->GetDeviceQueue;
if (!strcmp(name, "QueueSubmit"))
return (void *)table->QueueSubmit;
if (!strcmp(name, "QueueWaitIdle"))
return (void *)table->QueueWaitIdle;
if (!strcmp(name, "DeviceWaitIdle"))
return (void *)table->DeviceWaitIdle;
if (!strcmp(name, "AllocateMemory"))
return (void *)table->AllocateMemory;
if (!strcmp(name, "FreeMemory"))
return (void *)table->FreeMemory;
if (!strcmp(name, "MapMemory"))
return (void *)table->MapMemory;
if (!strcmp(name, "UnmapMemory"))
return (void *)table->UnmapMemory;
if (!strcmp(name, "FlushMappedMemoryRanges"))
return (void *)table->FlushMappedMemoryRanges;
if (!strcmp(name, "InvalidateMappedMemoryRanges"))
return (void *)table->InvalidateMappedMemoryRanges;
if (!strcmp(name, "GetDeviceMemoryCommitment"))
return (void *)table->GetDeviceMemoryCommitment;
if (!strcmp(name, "GetImageSparseMemoryRequirements"))
return (void *)table->GetImageSparseMemoryRequirements;
if (!strcmp(name, "GetBufferMemoryRequirements"))
return (void *)table->GetBufferMemoryRequirements;
if (!strcmp(name, "GetImageMemoryRequirements"))
return (void *)table->GetImageMemoryRequirements;
if (!strcmp(name, "BindBufferMemory"))
return (void *)table->BindBufferMemory;
if (!strcmp(name, "BindImageMemory"))
return (void *)table->BindImageMemory;
if (!strcmp(name, "QueueBindSparse"))
return (void *)table->QueueBindSparse;
if (!strcmp(name, "CreateFence"))
return (void *)table->CreateFence;
if (!strcmp(name, "DestroyFence"))
return (void *)table->DestroyFence;
if (!strcmp(name, "ResetFences"))
return (void *)table->ResetFences;
if (!strcmp(name, "GetFenceStatus"))
return (void *)table->GetFenceStatus;
if (!strcmp(name, "WaitForFences"))
return (void *)table->WaitForFences;
if (!strcmp(name, "CreateSemaphore"))
return (void *)table->CreateSemaphore;
if (!strcmp(name, "DestroySemaphore"))
return (void *)table->DestroySemaphore;
if (!strcmp(name, "CreateEvent"))
return (void *)table->CreateEvent;
if (!strcmp(name, "DestroyEvent"))
return (void *)table->DestroyEvent;
if (!strcmp(name, "GetEventStatus"))
return (void *)table->GetEventStatus;
if (!strcmp(name, "SetEvent"))
return (void *)table->SetEvent;
if (!strcmp(name, "ResetEvent"))
return (void *)table->ResetEvent;
if (!strcmp(name, "CreateQueryPool"))
return (void *)table->CreateQueryPool;
if (!strcmp(name, "DestroyQueryPool"))
return (void *)table->DestroyQueryPool;
if (!strcmp(name, "GetQueryPoolResults"))
return (void *)table->GetQueryPoolResults;
if (!strcmp(name, "CreateBuffer"))
return (void *)table->CreateBuffer;
if (!strcmp(name, "DestroyBuffer"))
return (void *)table->DestroyBuffer;
if (!strcmp(name, "CreateBufferView"))
return (void *)table->CreateBufferView;
if (!strcmp(name, "DestroyBufferView"))
return (void *)table->DestroyBufferView;
if (!strcmp(name, "CreateImage"))
return (void *)table->CreateImage;
if (!strcmp(name, "DestroyImage"))
return (void *)table->DestroyImage;
if (!strcmp(name, "GetImageSubresourceLayout"))
return (void *)table->GetImageSubresourceLayout;
if (!strcmp(name, "CreateImageView"))
return (void *)table->CreateImageView;
if (!strcmp(name, "DestroyImageView"))
return (void *)table->DestroyImageView;
if (!strcmp(name, "CreateShaderModule"))
return (void *)table->CreateShaderModule;
if (!strcmp(name, "DestroyShaderModule"))
return (void *)table->DestroyShaderModule;
if (!strcmp(name, "CreatePipelineCache"))
return (void *)vkCreatePipelineCache;
if (!strcmp(name, "DestroyPipelineCache"))
return (void *)vkDestroyPipelineCache;
if (!strcmp(name, "GetPipelineCacheData"))
return (void *)vkGetPipelineCacheData;
if (!strcmp(name, "MergePipelineCaches"))
return (void *)vkMergePipelineCaches;
if (!strcmp(name, "CreateGraphicsPipelines"))
return (void *)vkCreateGraphicsPipelines;
if (!strcmp(name, "CreateComputePipelines"))
return (void *)vkCreateComputePipelines;
if (!strcmp(name, "DestroyPipeline"))
return (void *)table->DestroyPipeline;
if (!strcmp(name, "CreatePipelineLayout"))
return (void *)table->CreatePipelineLayout;
if (!strcmp(name, "DestroyPipelineLayout"))
return (void *)table->DestroyPipelineLayout;
if (!strcmp(name, "CreateSampler"))
return (void *)table->CreateSampler;
if (!strcmp(name, "DestroySampler"))
return (void *)table->DestroySampler;
if (!strcmp(name, "CreateDescriptorSetLayout"))
return (void *)table->CreateDescriptorSetLayout;
if (!strcmp(name, "DestroyDescriptorSetLayout"))
return (void *)table->DestroyDescriptorSetLayout;
if (!strcmp(name, "CreateDescriptorPool"))
return (void *)table->CreateDescriptorPool;
if (!strcmp(name, "DestroyDescriptorPool"))
return (void *)table->DestroyDescriptorPool;
if (!strcmp(name, "ResetDescriptorPool"))
return (void *)table->ResetDescriptorPool;
if (!strcmp(name, "AllocateDescriptorSets"))
return (void *)table->AllocateDescriptorSets;
if (!strcmp(name, "FreeDescriptorSets"))
return (void *)table->FreeDescriptorSets;
if (!strcmp(name, "UpdateDescriptorSets"))
return (void *)table->UpdateDescriptorSets;
if (!strcmp(name, "CreateFramebuffer"))
return (void *)table->CreateFramebuffer;
if (!strcmp(name, "DestroyFramebuffer"))
return (void *)table->DestroyFramebuffer;
if (!strcmp(name, "CreateRenderPass"))
return (void *)table->CreateRenderPass;
if (!strcmp(name, "DestroyRenderPass"))
return (void *)table->DestroyRenderPass;
if (!strcmp(name, "GetRenderAreaGranularity"))
return (void *)table->GetRenderAreaGranularity;
if (!strcmp(name, "CreateCommandPool"))
return (void *)table->CreateCommandPool;
if (!strcmp(name, "DestroyCommandPool"))
return (void *)table->DestroyCommandPool;
if (!strcmp(name, "ResetCommandPool"))
return (void *)table->ResetCommandPool;
if (!strcmp(name, "AllocateCommandBuffers"))
return (void *)table->AllocateCommandBuffers;
if (!strcmp(name, "FreeCommandBuffers"))
return (void *)table->FreeCommandBuffers;
if (!strcmp(name, "BeginCommandBuffer"))
return (void *)table->BeginCommandBuffer;
if (!strcmp(name, "EndCommandBuffer"))
return (void *)table->EndCommandBuffer;
if (!strcmp(name, "ResetCommandBuffer"))
return (void *)table->ResetCommandBuffer;
if (!strcmp(name, "CmdBindPipeline"))
return (void *)table->CmdBindPipeline;
if (!strcmp(name, "CmdSetViewport"))
return (void *)table->CmdSetViewport;
if (!strcmp(name, "CmdSetScissor"))
return (void *)table->CmdSetScissor;
if (!strcmp(name, "CmdSetLineWidth"))
return (void *)table->CmdSetLineWidth;
if (!strcmp(name, "CmdSetDepthBias"))
return (void *)table->CmdSetDepthBias;
if (!strcmp(name, "CmdSetBlendConstants"))
return (void *)table->CmdSetBlendConstants;
if (!strcmp(name, "CmdSetDepthBounds"))
return (void *)table->CmdSetDepthBounds;
if (!strcmp(name, "CmdSetStencilCompareMask"))
return (void *)table->CmdSetStencilCompareMask;
if (!strcmp(name, "CmdSetStencilwriteMask"))
return (void *)table->CmdSetStencilWriteMask;
if (!strcmp(name, "CmdSetStencilReference"))
return (void *)table->CmdSetStencilReference;
if (!strcmp(name, "CmdBindDescriptorSets"))
return (void *)table->CmdBindDescriptorSets;
if (!strcmp(name, "CmdBindVertexBuffers"))
return (void *)table->CmdBindVertexBuffers;
if (!strcmp(name, "CmdBindIndexBuffer"))
return (void *)table->CmdBindIndexBuffer;
if (!strcmp(name, "CmdDraw"))
return (void *)table->CmdDraw;
if (!strcmp(name, "CmdDrawIndexed"))
return (void *)table->CmdDrawIndexed;
if (!strcmp(name, "CmdDrawIndirect"))
return (void *)table->CmdDrawIndirect;
if (!strcmp(name, "CmdDrawIndexedIndirect"))
return (void *)table->CmdDrawIndexedIndirect;
if (!strcmp(name, "CmdDispatch"))
return (void *)table->CmdDispatch;
if (!strcmp(name, "CmdDispatchIndirect"))
return (void *)table->CmdDispatchIndirect;
if (!strcmp(name, "CmdCopyBuffer"))
return (void *)table->CmdCopyBuffer;
if (!strcmp(name, "CmdCopyImage"))
return (void *)table->CmdCopyImage;
if (!strcmp(name, "CmdBlitImage"))
return (void *)table->CmdBlitImage;
if (!strcmp(name, "CmdCopyBufferToImage"))
return (void *)table->CmdCopyBufferToImage;
if (!strcmp(name, "CmdCopyImageToBuffer"))
return (void *)table->CmdCopyImageToBuffer;
if (!strcmp(name, "CmdUpdateBuffer"))
return (void *)table->CmdUpdateBuffer;
if (!strcmp(name, "CmdFillBuffer"))
return (void *)table->CmdFillBuffer;
if (!strcmp(name, "CmdClearColorImage"))
return (void *)table->CmdClearColorImage;
if (!strcmp(name, "CmdClearDepthStencilImage"))
return (void *)table->CmdClearDepthStencilImage;
if (!strcmp(name, "CmdClearAttachments"))
return (void *)table->CmdClearAttachments;
if (!strcmp(name, "CmdResolveImage"))
return (void *)table->CmdResolveImage;
if (!strcmp(name, "CmdSetEvent"))
return (void *)table->CmdSetEvent;
if (!strcmp(name, "CmdResetEvent"))
return (void *)table->CmdResetEvent;
if (!strcmp(name, "CmdWaitEvents"))
return (void *)table->CmdWaitEvents;
if (!strcmp(name, "CmdPipelineBarrier"))
return (void *)table->CmdPipelineBarrier;
if (!strcmp(name, "CmdBeginQuery"))
return (void *)table->CmdBeginQuery;
if (!strcmp(name, "CmdEndQuery"))
return (void *)table->CmdEndQuery;
if (!strcmp(name, "CmdResetQueryPool"))
return (void *)table->CmdResetQueryPool;
if (!strcmp(name, "CmdWriteTimestamp"))
return (void *)table->CmdWriteTimestamp;
if (!strcmp(name, "CmdCopyQueryPoolResults"))
return (void *)table->CmdCopyQueryPoolResults;
if (!strcmp(name, "CmdPushConstants"))
return (void *)table->CmdPushConstants;
if (!strcmp(name, "CmdBeginRenderPass"))
return (void *)table->CmdBeginRenderPass;
if (!strcmp(name, "CmdNextSubpass"))
return (void *)table->CmdNextSubpass;
if (!strcmp(name, "CmdEndRenderPass"))
return (void *)table->CmdEndRenderPass;
if (!strcmp(name, "CmdExecuteCommands"))
return (void *)table->CmdExecuteCommands;
if (!strcmp(name, "DestroySwapchainKHR"))
return (void *)table->DestroySwapchainKHR;
if (!strcmp(name, "GetSwapchainImagesKHR"))
return (void *)table->GetSwapchainImagesKHR;
if (!strcmp(name, "AcquireNextImageKHR"))
return (void *)table->AcquireNextImageKHR;
if (!strcmp(name, "QueuePresentKHR"))
return (void *)table->QueuePresentKHR;
// NOTE: Device Funcs needing Trampoline/Terminator.
// Overrides for device functions needing a trampoline and
// a terminator because certain device entry-points still need to go
// through a terminator before hitting the ICD. This could be for
// several reasons, but the main one is currently unwrapping an
// object before passing the appropriate info along to the ICD.
if (!strcmp(name, "CreateSwapchainKHR")) {
return (void *)vkCreateSwapchainKHR;
} else if (!strcmp(name, "CreateSharedSwapchainsKHR")) {
return (void *)vkCreateSharedSwapchainsKHR;
} else if (!strcmp(name, "DebugMarkerSetObjectTagEXT")) {
return (void *)vkDebugMarkerSetObjectTagEXT;
} else if (!strcmp(name, "DebugMarkerSetObjectNameEXT")) {
return (void *)vkDebugMarkerSetObjectNameEXT;
}
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");
table->GetPhysicalDeviceImageFormatProperties =
(PFN_vkGetPhysicalDeviceImageFormatProperties)gpa(
inst, "vkGetPhysicalDeviceImageFormatProperties");
table->GetPhysicalDeviceFormatProperties =
(PFN_vkGetPhysicalDeviceFormatProperties)gpa(
inst, "vkGetPhysicalDeviceFormatProperties");
table->GetPhysicalDeviceSparseImageFormatProperties =
(PFN_vkGetPhysicalDeviceSparseImageFormatProperties)gpa(
inst, "vkGetPhysicalDeviceSparseImageFormatProperties");
table->GetPhysicalDeviceProperties = (PFN_vkGetPhysicalDeviceProperties)gpa(
inst, "vkGetPhysicalDeviceProperties");
table->GetPhysicalDeviceQueueFamilyProperties =
(PFN_vkGetPhysicalDeviceQueueFamilyProperties)gpa(
inst, "vkGetPhysicalDeviceQueueFamilyProperties");
table->GetPhysicalDeviceMemoryProperties =
(PFN_vkGetPhysicalDeviceMemoryProperties)gpa(
inst, "vkGetPhysicalDeviceMemoryProperties");
table->EnumerateDeviceExtensionProperties =
(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) {
// WSI extensions
table->DestroySurfaceKHR =
(PFN_vkDestroySurfaceKHR)gpa(inst, "vkDestroySurfaceKHR");
table->GetPhysicalDeviceSurfaceSupportKHR =
(PFN_vkGetPhysicalDeviceSurfaceSupportKHR)gpa(
inst, "vkGetPhysicalDeviceSurfaceSupportKHR");
table->GetPhysicalDeviceSurfaceCapabilitiesKHR =
(PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR)gpa(
inst, "vkGetPhysicalDeviceSurfaceCapabilitiesKHR");
table->GetPhysicalDeviceSurfaceFormatsKHR =
(PFN_vkGetPhysicalDeviceSurfaceFormatsKHR)gpa(
inst, "vkGetPhysicalDeviceSurfaceFormatsKHR");
table->GetPhysicalDeviceSurfacePresentModesKHR =
(PFN_vkGetPhysicalDeviceSurfacePresentModesKHR)gpa(
inst, "vkGetPhysicalDeviceSurfacePresentModesKHR");
#ifdef VK_USE_PLATFORM_MIR_KHR
table->CreateMirSurfaceKHR =
(PFN_vkCreateMirSurfaceKHR)gpa(inst, "vkCreateMirSurfaceKHR");
table->GetPhysicalDeviceMirPresentationSupportKHR =
(PFN_vkGetPhysicalDeviceMirPresentationSupportKHR)gpa(
inst, "vkGetPhysicalDeviceMirPresentationSupportKHR");
#endif
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
table->CreateWaylandSurfaceKHR =
(PFN_vkCreateWaylandSurfaceKHR)gpa(inst, "vkCreateWaylandSurfaceKHR");
table->GetPhysicalDeviceWaylandPresentationSupportKHR =
(PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR)gpa(
inst, "vkGetPhysicalDeviceWaylandPresentationSupportKHR");
#endif
#ifdef VK_USE_PLATFORM_WIN32_KHR
table->CreateWin32SurfaceKHR =
(PFN_vkCreateWin32SurfaceKHR)gpa(inst, "vkCreateWin32SurfaceKHR");
table->GetPhysicalDeviceWin32PresentationSupportKHR =
(PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR)gpa(
inst, "vkGetPhysicalDeviceWin32PresentationSupportKHR");
#endif
#ifdef VK_USE_PLATFORM_XCB_KHR
table->CreateXcbSurfaceKHR =
(PFN_vkCreateXcbSurfaceKHR)gpa(inst, "vkCreateXcbSurfaceKHR");
table->GetPhysicalDeviceXcbPresentationSupportKHR =
(PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR)gpa(
inst, "vkGetPhysicalDeviceXcbPresentationSupportKHR");
#endif
#ifdef VK_USE_PLATFORM_XLIB_KHR
table->CreateXlibSurfaceKHR =
(PFN_vkCreateXlibSurfaceKHR)gpa(inst, "vkCreateXlibSurfaceKHR");
table->GetPhysicalDeviceXlibPresentationSupportKHR =
(PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR)gpa(
inst, "vkGetPhysicalDeviceXlibPresentationSupportKHR");
#endif
table->GetPhysicalDeviceDisplayPropertiesKHR =
(PFN_vkGetPhysicalDeviceDisplayPropertiesKHR)gpa(
inst, "vkGetPhysicalDeviceDisplayPropertiesKHR");
table->GetPhysicalDeviceDisplayPlanePropertiesKHR =
(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");
// KHR_get_physical_device_properties2
table->GetPhysicalDeviceFeatures2KHR =
(PFN_vkGetPhysicalDeviceFeatures2KHR)gpa(
inst, "vkGetPhysicalDeviceFeatures2KHR");
table->GetPhysicalDeviceProperties2KHR =
(PFN_vkGetPhysicalDeviceProperties2KHR)gpa(
inst, "vkGetPhysicalDeviceProperties2KHR");
table->GetPhysicalDeviceFormatProperties2KHR =
(PFN_vkGetPhysicalDeviceFormatProperties2KHR)gpa(
inst, "vkGetPhysicalDeviceFormatProperties2KHR");
table->GetPhysicalDeviceImageFormatProperties2KHR =
(PFN_vkGetPhysicalDeviceImageFormatProperties2KHR)gpa(
inst, "vkGetPhysicalDeviceImageFormatProperties2KHR");
table->GetPhysicalDeviceQueueFamilyProperties2KHR =
(PFN_vkGetPhysicalDeviceQueueFamilyProperties2KHR)gpa(
inst, "vkGetPhysicalDeviceQueueFamilyProperties2KHR");
table->GetPhysicalDeviceMemoryProperties2KHR =
(PFN_vkGetPhysicalDeviceMemoryProperties2KHR)gpa(
inst, "vkGetPhysicalDeviceMemoryProperties2KHR");
table->GetPhysicalDeviceSparseImageFormatProperties2KHR =
(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");
#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");
// EXT_direct_mode_display
table->ReleaseDisplayEXT =
(PFN_vkReleaseDisplayEXT)gpa(inst, "vkReleaseDisplayEXT");
// EXT_display_surface_counter
table->GetPhysicalDeviceSurfaceCapabilities2EXT =
(PFN_vkGetPhysicalDeviceSurfaceCapabilities2EXT)gpa(
inst, "vkGetPhysicalDeviceSurfaceCapabilities2EXT");
// NV_external_memory_capabilities
table->GetPhysicalDeviceExternalImageFormatPropertiesNV =
(PFN_vkGetPhysicalDeviceExternalImageFormatPropertiesNV)gpa(
inst, "vkGetPhysicalDeviceExternalImageFormatPropertiesNV");
// NVX_device_generated_commands (physical device command)
table->GetPhysicalDeviceGeneratedCommandsPropertiesNVX =
(PFN_vkGetPhysicalDeviceGeneratedCommandsPropertiesNVX)gpa(
inst, "vkGetPhysicalDeviceGeneratedCommandsPropertiesNVX");
}
static inline void *loader_lookup_instance_extension_dispatch_table(
const VkLayerInstanceDispatchTable *table, const char *name,
bool *found_name) {
*found_name = true;
// KHR_get_physical_device_properties2
if (!strcmp(name, "GetPhysicalDeviceFeatures2KHR"))
return (void *)table->GetPhysicalDeviceFeatures2KHR;
if (!strcmp(name, "GetPhysicalDeviceProperties2KHR"))
return (void *)table->GetPhysicalDeviceProperties2KHR;
if (!strcmp(name, "GetPhysicalDeviceFormatProperties2KHR"))
return (void *)table->GetPhysicalDeviceFormatProperties2KHR;
if (!strcmp(name, "GetPhysicalDeviceImageFormatProperties2KHR"))
return (void *)table->GetPhysicalDeviceImageFormatProperties2KHR;
if (!strcmp(name, "GetPhysicalDeviceQueueFamilyProperties2KHR"))
return (void *)table->GetPhysicalDeviceQueueFamilyProperties2KHR;
if (!strcmp(name, "GetPhysicalDeviceMemoryProperties2KHR"))
return (void *)table->GetPhysicalDeviceMemoryProperties2KHR;
if (!strcmp(name, "GetPhysicalDeviceSparseImageFormatProperties2KHR"))
return (void *)table->GetPhysicalDeviceSparseImageFormatProperties2KHR;
// EXT_acquire_xlib_display
#ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT
if (!strcmp(name, "AcquireXlibDisplayEXT"))
return (void *)table->AcquireXlibDisplayEXT;
if (!strcmp(name, "GetRandROutputDisplayEXT"))
return (void *)table->GetRandROutputDisplayEXT;
#endif
// EXT_debug_report
if (!strcmp(name, "CreateDebugReportCallbackEXT"))
return (void *)table->CreateDebugReportCallbackEXT;
if (!strcmp(name, "DestroyDebugReportCallbackEXT"))
return (void *)table->DestroyDebugReportCallbackEXT;
if (!strcmp(name, "DebugReportMessageEXT"))
return (void *)table->DebugReportMessageEXT;
// EXT_direct_mode_display
if (!strcmp(name, "ReleaseDisplayEXT"))
return (void *)table->ReleaseDisplayEXT;
// EXT_display_surface_counter
if (!strcmp(name, "GetPhysicalDeviceSurfaceCapabilities2EXT"))
return (void *)table->GetPhysicalDeviceSurfaceCapabilities2EXT;
// NV_external_memory_capabilities
if (!strcmp(name, "GetPhysicalDeviceExternalImageFormatPropertiesNV"))
return (void *)table->GetPhysicalDeviceExternalImageFormatPropertiesNV;
// NVX_device_generated_commands
if (!strcmp(name, "GetPhysicalDeviceGeneratedCommandsPropertiesNVX"))
return (void *)table->GetPhysicalDeviceGeneratedCommandsPropertiesNVX;
*found_name = false;
return NULL;
}
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;
}
*found_name = true;
name += 2;
if (!strcmp(name, "DestroyInstance"))
return (void *)table->DestroyInstance;
if (!strcmp(name, "EnumeratePhysicalDevices"))
return (void *)table->EnumeratePhysicalDevices;
if (!strcmp(name, "GetPhysicalDeviceFeatures"))
return (void *)table->GetPhysicalDeviceFeatures;
if (!strcmp(name, "GetPhysicalDeviceImageFormatProperties"))
return (void *)table->GetPhysicalDeviceImageFormatProperties;
if (!strcmp(name, "GetPhysicalDeviceFormatProperties"))
return (void *)table->GetPhysicalDeviceFormatProperties;
if (!strcmp(name, "GetPhysicalDeviceSparseImageFormatProperties"))
return (void *)table->GetPhysicalDeviceSparseImageFormatProperties;
if (!strcmp(name, "GetPhysicalDeviceProperties"))
return (void *)table->GetPhysicalDeviceProperties;
if (!strcmp(name, "GetPhysicalDeviceQueueFamilyProperties"))
return (void *)table->GetPhysicalDeviceQueueFamilyProperties;
if (!strcmp(name, "GetPhysicalDeviceMemoryProperties"))
return (void *)table->GetPhysicalDeviceMemoryProperties;
if (!strcmp(name, "GetInstanceProcAddr"))
return (void *)table->GetInstanceProcAddr;
if (!strcmp(name, "EnumerateDeviceExtensionProperties"))
return (void *)table->EnumerateDeviceExtensionProperties;
if (!strcmp(name, "EnumerateDeviceLayerProperties"))
return (void *)table->EnumerateDeviceLayerProperties;
if (!strcmp(name, "DestroySurfaceKHR"))
return (void *)table->DestroySurfaceKHR;
if (!strcmp(name, "GetPhysicalDeviceSurfaceSupportKHR"))
return (void *)table->GetPhysicalDeviceSurfaceSupportKHR;
if (!strcmp(name, "GetPhysicalDeviceSurfaceCapabilitiesKHR"))
return (void *)table->GetPhysicalDeviceSurfaceCapabilitiesKHR;
if (!strcmp(name, "GetPhysicalDeviceSurfaceFormatsKHR"))
return (void *)table->GetPhysicalDeviceSurfaceFormatsKHR;
if (!strcmp(name, "GetPhysicalDeviceSurfacePresentModesKHR"))
return (void *)table->GetPhysicalDeviceSurfacePresentModesKHR;
#ifdef VK_USE_PLATFORM_MIR_KHR
if (!strcmp(name, "CreateMirSurfaceKHR"))
return (void *)table->CreateMirSurfaceKHR;
if (!strcmp(name, "GetPhysicalDeviceMirPresentationSupportKHR"))
return (void *)table->GetPhysicalDeviceMirPresentationSupportKHR;
#endif
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
if (!strcmp(name, "CreateWaylandSurfaceKHR"))
return (void *)table->CreateWaylandSurfaceKHR;
if (!strcmp(name, "GetPhysicalDeviceWaylandPresentationSupportKHR"))
return (void *)table->GetPhysicalDeviceWaylandPresentationSupportKHR;
#endif
#ifdef VK_USE_PLATFORM_WIN32_KHR
if (!strcmp(name, "CreateWin32SurfaceKHR"))
return (void *)table->CreateWin32SurfaceKHR;
if (!strcmp(name, "GetPhysicalDeviceWin32PresentationSupportKHR"))
return (void *)table->GetPhysicalDeviceWin32PresentationSupportKHR;
#endif
#ifdef VK_USE_PLATFORM_XCB_KHR
if (!strcmp(name, "CreateXcbSurfaceKHR"))
return (void *)table->CreateXcbSurfaceKHR;
if (!strcmp(name, "GetPhysicalDeviceXcbPresentationSupportKHR"))
return (void *)table->GetPhysicalDeviceXcbPresentationSupportKHR;
#endif
#ifdef VK_USE_PLATFORM_XLIB_KHR
if (!strcmp(name, "CreateXlibSurfaceKHR"))
return (void *)table->CreateXlibSurfaceKHR;
if (!strcmp(name, "GetPhysicalDeviceXlibPresentationSupportKHR"))
return (void *)table->GetPhysicalDeviceXlibPresentationSupportKHR;
#endif
if (!strcmp(name, "GetPhysicalDeviceDisplayPropertiesKHR"))
return (void *)table->GetPhysicalDeviceDisplayPropertiesKHR;
if (!strcmp(name, "GetPhysicalDeviceDisplayPlanePropertiesKHR"))
return (void *)table->GetPhysicalDeviceDisplayPlanePropertiesKHR;
if (!strcmp(name, "GetDisplayPlaneSupportedDisplaysKHR"))
return (void *)table->GetDisplayPlaneSupportedDisplaysKHR;
if (!strcmp(name, "GetDisplayModePropertiesKHR"))
return (void *)table->GetDisplayModePropertiesKHR;
if (!strcmp(name, "CreateDisplayModeKHR"))
return (void *)table->CreateDisplayModeKHR;
if (!strcmp(name, "GetDisplayPlaneCapabilitiesKHR"))
return (void *)table->GetDisplayPlaneCapabilitiesKHR;
if (!strcmp(name, "CreateDisplayPlaneSurfaceKHR"))
return (void *)table->CreateDisplayPlaneSurfaceKHR;
return loader_lookup_instance_extension_dispatch_table(table, name,
found_name);
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,328 @@
// *** THIS FILE IS GENERATED - DO NOT EDIT ***
// See loader_extension_generator.py for modifications
/*
* Copyright (c) 2015-2017 The Khronos Group Inc.
* Copyright (c) 2015-2017 Valve Corporation
* Copyright (c) 2015-2017 LunarG, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Author: Mark Lobodzinski <mark@lunarg.com>
* Author: Mark Young <marky@lunarg.com>
*/
#pragma once
// Structures defined externally, but used here
struct loader_instance;
struct loader_icd_term;
struct loader_dev_dispatch_table;
// Device extension error function
VKAPI_ATTR VkResult VKAPI_CALL vkDevExtError(VkDevice dev);
// Extension interception for vkGetInstanceProcAddr function, so we can return
// the appropriate information for any instance extensions we know about.
bool extension_instance_gpa(struct loader_instance *ptr_instance, const char *name, void **addr);
// Extension interception for vkCreateInstance function, so we can properly
// detect and enable any instance extension information for extensions we know
// about.
void extensions_create_instance(struct loader_instance *ptr_instance, const VkInstanceCreateInfo *pCreateInfo);
// Extension interception for vkGetDeviceProcAddr function, so we can return
// an appropriate terminator if this is one of those few device commands requiring
// a terminator.
PFN_vkVoidFunction get_extension_device_proc_terminator(const char *pName);
// Dispatch table properly filled in with appropriate terminators for the
// supported extensions.
extern const VkLayerInstanceDispatchTable instance_disp;
// Array of extension strings for instance extensions we support.
extern const char *const LOADER_INSTANCE_EXTENSIONS[];
VKAPI_ATTR bool VKAPI_CALL loader_icd_init_entries(struct loader_icd_term *icd_term, VkInstance inst,
const PFN_vkGetInstanceProcAddr fp_gipa);
// Init Device function pointer dispatch table with core commands
VKAPI_ATTR void VKAPI_CALL loader_init_device_dispatch_table(struct loader_dev_dispatch_table *dev_table, PFN_vkGetDeviceProcAddr gpa,
VkDevice dev);
// Init Device function pointer dispatch table with extension commands
VKAPI_ATTR void VKAPI_CALL loader_init_device_extension_dispatch_table(struct loader_dev_dispatch_table *dev_table,
PFN_vkGetDeviceProcAddr gpa, VkDevice dev);
// Init Instance function pointer dispatch table with core commands
VKAPI_ATTR void VKAPI_CALL loader_init_instance_core_dispatch_table(VkLayerInstanceDispatchTable *table, PFN_vkGetInstanceProcAddr gpa,
VkInstance inst);
// Init Instance function pointer dispatch table with core commands
VKAPI_ATTR void VKAPI_CALL loader_init_instance_extension_dispatch_table(VkLayerInstanceDispatchTable *table, PFN_vkGetInstanceProcAddr gpa,
VkInstance inst);
// Device command lookup function
VKAPI_ATTR void* VKAPI_CALL loader_lookup_device_dispatch_table(const VkLayerDispatchTable *table, const char *name);
// Instance command lookup function
VKAPI_ATTR void* VKAPI_CALL loader_lookup_instance_dispatch_table(const VkLayerInstanceDispatchTable *table, const char *name,
bool *found_name);
VKAPI_ATTR bool VKAPI_CALL loader_icd_init_entries(struct loader_icd_term *icd_term, VkInstance inst,
const PFN_vkGetInstanceProcAddr fp_gipa);
// Loader core instance terminators
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* pFormatProperties);
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_GetPhysicalDeviceProperties(
VkPhysicalDevice physicalDevice,
VkPhysicalDeviceProperties* pProperties);
VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceQueueFamilyProperties(
VkPhysicalDevice physicalDevice,
uint32_t* pQueueFamilyPropertyCount,
VkQueueFamilyProperties* pQueueFamilyProperties);
VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceMemoryProperties(
VkPhysicalDevice physicalDevice,
VkPhysicalDeviceMemoryProperties* pMemoryProperties);
VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL terminator_GetInstanceProcAddr(
VkInstance instance,
const char* pName);
VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDevice(
VkPhysicalDevice physicalDevice,
const VkDeviceCreateInfo* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
VkDevice* pDevice);
VKAPI_ATTR VkResult VKAPI_CALL terminator_EnumerateInstanceExtensionProperties(
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);
VKAPI_ATTR VkResult VKAPI_CALL terminator_EnumerateInstanceLayerProperties(
uint32_t* pPropertyCount,
VkLayerProperties* pProperties);
VKAPI_ATTR VkResult VKAPI_CALL terminator_EnumerateDeviceLayerProperties(
VkPhysicalDevice physicalDevice,
uint32_t* pPropertyCount,
VkLayerProperties* pProperties);
VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceSparseImageFormatProperties(
VkPhysicalDevice physicalDevice,
VkFormat format,
VkImageType type,
VkSampleCountFlagBits samples,
VkImageUsageFlags usage,
VkImageTiling tiling,
uint32_t* pPropertyCount,
VkSparseImageFormatProperties* pProperties);
// ICD function pointer dispatch table
struct loader_icd_term_dispatch {
// ---- Core 1_0 commands
PFN_vkCreateInstance CreateInstance;
PFN_vkDestroyInstance DestroyInstance;
PFN_vkEnumeratePhysicalDevices EnumeratePhysicalDevices;
PFN_vkGetPhysicalDeviceFeatures GetPhysicalDeviceFeatures;
PFN_vkGetPhysicalDeviceFormatProperties GetPhysicalDeviceFormatProperties;
PFN_vkGetPhysicalDeviceImageFormatProperties GetPhysicalDeviceImageFormatProperties;
PFN_vkGetPhysicalDeviceProperties GetPhysicalDeviceProperties;
PFN_vkGetPhysicalDeviceQueueFamilyProperties GetPhysicalDeviceQueueFamilyProperties;
PFN_vkGetPhysicalDeviceMemoryProperties GetPhysicalDeviceMemoryProperties;
PFN_vkGetDeviceProcAddr GetDeviceProcAddr;
PFN_vkCreateDevice CreateDevice;
PFN_vkEnumerateInstanceExtensionProperties EnumerateInstanceExtensionProperties;
PFN_vkEnumerateDeviceExtensionProperties EnumerateDeviceExtensionProperties;
PFN_vkEnumerateInstanceLayerProperties EnumerateInstanceLayerProperties;
PFN_vkGetPhysicalDeviceSparseImageFormatProperties GetPhysicalDeviceSparseImageFormatProperties;
// ---- VK_KHR_surface extension commands
PFN_vkDestroySurfaceKHR DestroySurfaceKHR;
PFN_vkGetPhysicalDeviceSurfaceSupportKHR GetPhysicalDeviceSurfaceSupportKHR;
PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR GetPhysicalDeviceSurfaceCapabilitiesKHR;
PFN_vkGetPhysicalDeviceSurfaceFormatsKHR GetPhysicalDeviceSurfaceFormatsKHR;
PFN_vkGetPhysicalDeviceSurfacePresentModesKHR GetPhysicalDeviceSurfacePresentModesKHR;
// ---- VK_KHR_swapchain extension commands
PFN_vkCreateSwapchainKHR CreateSwapchainKHR;
// ---- VK_KHR_display extension commands
PFN_vkGetPhysicalDeviceDisplayPropertiesKHR GetPhysicalDeviceDisplayPropertiesKHR;
PFN_vkGetPhysicalDeviceDisplayPlanePropertiesKHR GetPhysicalDeviceDisplayPlanePropertiesKHR;
PFN_vkGetDisplayPlaneSupportedDisplaysKHR GetDisplayPlaneSupportedDisplaysKHR;
PFN_vkGetDisplayModePropertiesKHR GetDisplayModePropertiesKHR;
PFN_vkCreateDisplayModeKHR CreateDisplayModeKHR;
PFN_vkGetDisplayPlaneCapabilitiesKHR GetDisplayPlaneCapabilitiesKHR;
PFN_vkCreateDisplayPlaneSurfaceKHR CreateDisplayPlaneSurfaceKHR;
// ---- VK_KHR_display_swapchain extension commands
PFN_vkCreateSharedSwapchainsKHR CreateSharedSwapchainsKHR;
// ---- VK_KHR_xlib_surface extension commands
#ifdef VK_USE_PLATFORM_XLIB_KHR
PFN_vkCreateXlibSurfaceKHR CreateXlibSurfaceKHR;
#endif // VK_USE_PLATFORM_XLIB_KHR
#ifdef VK_USE_PLATFORM_XLIB_KHR
PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR GetPhysicalDeviceXlibPresentationSupportKHR;
#endif // VK_USE_PLATFORM_XLIB_KHR
// ---- VK_KHR_xcb_surface extension commands
#ifdef VK_USE_PLATFORM_XCB_KHR
PFN_vkCreateXcbSurfaceKHR CreateXcbSurfaceKHR;
#endif // VK_USE_PLATFORM_XCB_KHR
#ifdef VK_USE_PLATFORM_XCB_KHR
PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR GetPhysicalDeviceXcbPresentationSupportKHR;
#endif // VK_USE_PLATFORM_XCB_KHR
// ---- VK_KHR_wayland_surface extension commands
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
PFN_vkCreateWaylandSurfaceKHR CreateWaylandSurfaceKHR;
#endif // VK_USE_PLATFORM_WAYLAND_KHR
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR GetPhysicalDeviceWaylandPresentationSupportKHR;
#endif // VK_USE_PLATFORM_WAYLAND_KHR
// ---- VK_KHR_mir_surface extension commands
#ifdef VK_USE_PLATFORM_MIR_KHR
PFN_vkCreateMirSurfaceKHR CreateMirSurfaceKHR;
#endif // VK_USE_PLATFORM_MIR_KHR
#ifdef VK_USE_PLATFORM_MIR_KHR
PFN_vkGetPhysicalDeviceMirPresentationSupportKHR GetPhysicalDeviceMirPresentationSupportKHR;
#endif // VK_USE_PLATFORM_MIR_KHR
// ---- VK_KHR_android_surface extension commands
#ifdef VK_USE_PLATFORM_ANDROID_KHR
PFN_vkCreateAndroidSurfaceKHR CreateAndroidSurfaceKHR;
#endif // VK_USE_PLATFORM_ANDROID_KHR
// ---- VK_KHR_win32_surface extension commands
#ifdef VK_USE_PLATFORM_WIN32_KHR
PFN_vkCreateWin32SurfaceKHR CreateWin32SurfaceKHR;
#endif // VK_USE_PLATFORM_WIN32_KHR
#ifdef VK_USE_PLATFORM_WIN32_KHR
PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR GetPhysicalDeviceWin32PresentationSupportKHR;
#endif // VK_USE_PLATFORM_WIN32_KHR
// ---- VK_KHR_get_physical_device_properties2 extension commands
PFN_vkGetPhysicalDeviceFeatures2KHR GetPhysicalDeviceFeatures2KHR;
PFN_vkGetPhysicalDeviceProperties2KHR GetPhysicalDeviceProperties2KHR;
PFN_vkGetPhysicalDeviceFormatProperties2KHR GetPhysicalDeviceFormatProperties2KHR;
PFN_vkGetPhysicalDeviceImageFormatProperties2KHR GetPhysicalDeviceImageFormatProperties2KHR;
PFN_vkGetPhysicalDeviceQueueFamilyProperties2KHR GetPhysicalDeviceQueueFamilyProperties2KHR;
PFN_vkGetPhysicalDeviceMemoryProperties2KHR GetPhysicalDeviceMemoryProperties2KHR;
PFN_vkGetPhysicalDeviceSparseImageFormatProperties2KHR GetPhysicalDeviceSparseImageFormatProperties2KHR;
// ---- VK_EXT_debug_report extension commands
PFN_vkCreateDebugReportCallbackEXT CreateDebugReportCallbackEXT;
PFN_vkDestroyDebugReportCallbackEXT DestroyDebugReportCallbackEXT;
PFN_vkDebugReportMessageEXT DebugReportMessageEXT;
// ---- VK_EXT_debug_marker extension commands
PFN_vkDebugMarkerSetObjectTagEXT DebugMarkerSetObjectTagEXT;
PFN_vkDebugMarkerSetObjectNameEXT DebugMarkerSetObjectNameEXT;
// ---- VK_NV_external_memory_capabilities extension commands
PFN_vkGetPhysicalDeviceExternalImageFormatPropertiesNV GetPhysicalDeviceExternalImageFormatPropertiesNV;
// ---- VK_KHX_device_group extension commands
PFN_vkGetDeviceGroupSurfacePresentModesKHX GetDeviceGroupSurfacePresentModesKHX;
PFN_vkGetPhysicalDevicePresentRectanglesKHX GetPhysicalDevicePresentRectanglesKHX;
// ---- VK_NN_vi_surface extension commands
#ifdef VK_USE_PLATFORM_VI_NN
PFN_vkCreateViSurfaceNN CreateViSurfaceNN;
#endif // VK_USE_PLATFORM_VI_NN
// ---- VK_KHX_device_group_creation extension commands
PFN_vkEnumeratePhysicalDeviceGroupsKHX EnumeratePhysicalDeviceGroupsKHX;
// ---- VK_KHX_external_memory_capabilities extension commands
PFN_vkGetPhysicalDeviceExternalBufferPropertiesKHX GetPhysicalDeviceExternalBufferPropertiesKHX;
// ---- VK_KHX_external_semaphore_capabilities extension commands
PFN_vkGetPhysicalDeviceExternalSemaphorePropertiesKHX GetPhysicalDeviceExternalSemaphorePropertiesKHX;
// ---- VK_NVX_device_generated_commands extension commands
PFN_vkGetPhysicalDeviceGeneratedCommandsPropertiesNVX GetPhysicalDeviceGeneratedCommandsPropertiesNVX;
// ---- VK_EXT_direct_mode_display extension commands
PFN_vkReleaseDisplayEXT ReleaseDisplayEXT;
// ---- VK_EXT_acquire_xlib_display extension commands
#ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT
PFN_vkAcquireXlibDisplayEXT AcquireXlibDisplayEXT;
#endif // VK_USE_PLATFORM_XLIB_XRANDR_EXT
#ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT
PFN_vkGetRandROutputDisplayEXT GetRandROutputDisplayEXT;
#endif // VK_USE_PLATFORM_XLIB_XRANDR_EXT
// ---- VK_EXT_display_surface_counter extension commands
PFN_vkGetPhysicalDeviceSurfaceCapabilities2EXT GetPhysicalDeviceSurfaceCapabilities2EXT;
// ---- VK_MVK_ios_surface extension commands
#ifdef VK_USE_PLATFORM_IOS_MVK
PFN_vkCreateIOSSurfaceMVK CreateIOSSurfaceMVK;
#endif // VK_USE_PLATFORM_IOS_MVK
// ---- VK_MVK_macos_surface extension commands
#ifdef VK_USE_PLATFORM_MACOS_MVK
PFN_vkCreateMacOSSurfaceMVK CreateMacOSSurfaceMVK;
#endif // VK_USE_PLATFORM_MACOS_MVK
};
union loader_instance_extension_enables {
struct {
uint8_t khr_get_physical_device_properties2 : 1;
uint8_t ext_debug_report : 1;
uint8_t nv_external_memory_capabilities : 1;
uint8_t nn_vi_surface : 1;
uint8_t khx_device_group_creation : 1;
uint8_t khx_external_memory_capabilities : 1;
uint8_t khx_external_semaphore_capabilities : 1;
uint8_t ext_direct_mode_display : 1;
uint8_t ext_acquire_xlib_display : 1;
uint8_t ext_display_surface_counter : 1;
uint8_t mvk_ios_surface : 1;
uint8_t mvk_macos_surface : 1;
};
uint64_t padding[4];
};

View File

@ -29,4 +29,3 @@ typedef struct VkLayerDbgFunctionNode_ {
void *pUserData;
struct VkLayerDbgFunctionNode_ *pNext;
} VkLayerDbgFunctionNode;

View File

@ -25,7 +25,7 @@
#if defined(_WIN32)
// WinSock2.h must be included *BEFORE* windows.h
#include <WinSock2.h>
#endif // _WIN32
#endif // _WIN32
#include "vulkan/vk_platform.h"
#include "vulkan/vk_sdk_platform.h"
@ -50,54 +50,16 @@
#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
#else
#define EXTRA_DRIVERS_SYSCONFDIR_INFO
#define EXTRA_ELAYERS_SYSCONFDIR_INFO
#define EXTRA_ILAYERS_SYSCONFDIR_INFO
#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
#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 ""
#define DEFAULT_VK_ELAYERS_INFO ""
#define DEFAULT_VK_ILAYERS_INFO ""
#define DEFAULT_VK_DRIVERS_PATH ""
#if !defined(DEFAULT_VK_LAYERS_PATH)
@ -109,9 +71,9 @@
#endif
#define LAYERS_PATH_ENV "VK_LAYER_PATH"
#define HOME_VK_DRIVERS_INFO VULKAN_DIR VULKAN_ICDCONF_DIR
#define HOME_VK_ELAYERS_INFO VULKAN_DIR VULKAN_ELAYERCONF_DIR
#define HOME_VK_ILAYERS_INFO VULKAN_DIR VULKAN_ILAYERCONF_DIR
#define RELATIVE_VK_DRIVERS_INFO VULKAN_DIR VULKAN_ICDCONF_DIR
#define RELATIVE_VK_ELAYERS_INFO VULKAN_DIR VULKAN_ELAYERCONF_DIR
#define RELATIVE_VK_ILAYERS_INFO VULKAN_DIR VULKAN_ILAYERCONF_DIR
// C99:
#define PRINTF_SIZE_T_SPECIFIER "%zu"
@ -131,44 +93,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,46 +122,24 @@ 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)
#elif defined(_WIN32) // defined(__linux__)
#elif defined(_WIN32) // defined(__linux__)
/* Windows-specific common code: */
// WinBase.h defines CreateSemaphore and synchapi.h defines CreateEvent
// undefine them to avoid conflicts with VkLayerDispatchTable struct members.
@ -234,12 +158,15 @@ loader_platform_thread_cond_broadcast(loader_platform_thread_cond *pCond) {
#ifdef __cplusplus
#include <iostream>
#include <string>
#endif // __cplusplus
#endif // __cplusplus
// VK Library Filenames, Paths, etc.:
#define PATH_SEPARATOR ';'
#define DIRECTORY_SYMBOL '\\'
#define DEFAULT_VK_REGISTRY_HIVE HKEY_LOCAL_MACHINE
#define DEFAULT_VK_REGISTRY_HIVE_STR "HKEY_LOCAL_MACHINE"
#define SECONDARY_VK_REGISTRY_HIVE HKEY_CURRENT_USER
#define SECONDARY_VK_REGISTRY_HIVE_STR "HKEY_CURRENT_USER"
#define DEFAULT_VK_DRIVERS_INFO "SOFTWARE\\Khronos\\" API_NAME "\\Drivers"
#define DEFAULT_VK_DRIVERS_PATH ""
#define DEFAULT_VK_ELAYERS_INFO "SOFTWARE\\Khronos\\" API_NAME "\\ExplicitLayers"
@ -251,9 +178,9 @@ loader_platform_thread_cond_broadcast(loader_platform_thread_cond *pCond) {
#define LAYERS_SOURCE_PATH NULL
#endif
#define LAYERS_PATH_ENV "VK_LAYER_PATH"
#define HOME_VK_DRIVERS_INFO ""
#define HOME_VK_ELAYERS_INFO ""
#define HOME_VK_ILAYERS_INFO ""
#define RELATIVE_VK_DRIVERS_INFO ""
#define RELATIVE_VK_ELAYERS_INFO ""
#define RELATIVE_VK_ILAYERS_INFO ""
#define PRINTF_SIZE_T_SPECIFIER "%Iu"
// File IO
@ -264,9 +191,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) {
@ -277,8 +202,7 @@ static inline char *loader_platform_dirname(char *path) {
for (current = path; *current != '\0'; current = next) {
next = strchr(current, DIRECTORY_SYMBOL);
if (next == NULL) {
if (current != path)
*(current - 1) = '\0';
if (current != path) *(current - 1) = '\0';
return path;
} else {
// Point one character past the DIRECTORY_SYMBOL:
@ -315,40 +239,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,49 +276,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);
}
// Windows Registry:
char *loader_get_registry_string(const HKEY hive, const LPCTSTR sub_key,
const char *value);
static void loader_platform_thread_cond_broadcast(loader_platform_thread_cond *pCond) { WakeAllConditionVariable(pCond); }
#define loader_stack_alloc(size) _alloca(size)
#else // defined(_WIN32)
#else // defined(_WIN32)
#error The "loader_platform.h" file must be modified for this OS.
@ -415,10 +303,8 @@ char *loader_get_registry_string(const HKEY hive, const LPCTSTR sub_key,
// NOTE: Other OS-specific changes are also needed for this OS. Search for
// files with "WIN32" in it, as a quick way to find files that must be changed.
#endif // defined(_WIN32)
#endif // defined(_WIN32)
// 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; }

File diff suppressed because it is too large Load Diff

View File

@ -29,149 +29,117 @@ typedef struct {
union {
#ifdef VK_USE_PLATFORM_MIR_KHR
VkIcdSurfaceMir mir_surf;
#endif // VK_USE_PLATFORM_MIR_KHR
#endif // VK_USE_PLATFORM_MIR_KHR
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
VkIcdSurfaceWayland wayland_surf;
#endif // VK_USE_PLATFORM_WAYLAND_KHR
#endif // VK_USE_PLATFORM_WAYLAND_KHR
#ifdef VK_USE_PLATFORM_WIN32_KHR
VkIcdSurfaceWin32 win_surf;
#endif // VK_USE_PLATFORM_WIN32_KHR
#endif // VK_USE_PLATFORM_WIN32_KHR
#ifdef VK_USE_PLATFORM_XCB_KHR
VkIcdSurfaceXcb xcb_surf;
#endif // VK_USE_PLATFORM_XCB_KHR
#endif // VK_USE_PLATFORM_XCB_KHR
#ifdef VK_USE_PLATFORM_XLIB_KHR
VkIcdSurfaceXlib xlib_surf;
#endif // VK_USE_PLATFORM_XLIB_KHR
#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 non_platform_offset; // Start offset to base_size
uint32_t entire_size; // Size of entire VkIcdSurface
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
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_CreateSwapchainKHR(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_CreateSharedSwapchainsKHR(VkDevice device, uint32_t swapchainCount,
const VkSwapchainCreateInfoKHR *pCreateInfos,
const VkAllocationCallbacks *pAllocator,
VkSwapchainKHR *pSwapchains);
#endif /* WSI_H */
#endif // WSI_H

View File

@ -24,6 +24,7 @@
#define VKICD_H
#include "vulkan.h"
#include <stdbool.h>
// Loader-ICD version negotiation API. Versions add the following features:
// Version 0 - Initial. Doesn't support vk_icdGetInstanceProcAddr

View File

@ -2,9 +2,9 @@
// File: vk_layer.h
//
/*
* Copyright (c) 2015-2016 The Khronos Group Inc.
* Copyright (c) 2015-2016 Valve Corporation
* Copyright (c) 2015-2016 LunarG, Inc.
* Copyright (c) 2015-2017 The Khronos Group Inc.
* Copyright (c) 2015-2017 Valve Corporation
* Copyright (c) 2015-2017 LunarG, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -35,6 +35,9 @@
#define VK_LAYER_EXPORT
#endif
// Definition for VkLayerDispatchTable and VkLayerInstanceDispatchTable now appear in externally generated header
#include "vk_layer_dispatch_table.h"
#define MAX_NUM_UNKNOWN_EXTS 250
// Loader-Layer version negotiation API. Versions add the following features:
@ -45,9 +48,6 @@
#define CURRENT_LOADER_LAYER_INTERFACE_VERSION 2
#define MIN_SUPPORTED_LOADER_LAYER_INTERFACE_VERSION 1
// Internal function
typedef PFN_vkVoidFunction (VKAPI_PTR *PFN_GetPhysicalDeviceProcAddr)(VkInstance instance, const char* pName);
// Version negotiation values
typedef enum VkNegotiateLayerStructType {
LAYER_NEGOTIATE_UNINTIALIZED = 0,
@ -70,263 +70,6 @@ typedef VkResult (VKAPI_PTR *PFN_vkNegotiateLoaderLayerInterfaceVersion)(VkNegot
// Function prototype for unknown physical device extension command
typedef VkResult(VKAPI_PTR *PFN_PhysDevExt)(VkPhysicalDevice phys_device, ...);
typedef struct VkLayerDispatchTable_ {
PFN_vkGetDeviceProcAddr GetDeviceProcAddr;
PFN_vkDestroyDevice DestroyDevice;
PFN_vkGetDeviceQueue GetDeviceQueue;
PFN_vkQueueSubmit QueueSubmit;
PFN_vkQueueWaitIdle QueueWaitIdle;
PFN_vkDeviceWaitIdle DeviceWaitIdle;
PFN_vkAllocateMemory AllocateMemory;
PFN_vkFreeMemory FreeMemory;
PFN_vkMapMemory MapMemory;
PFN_vkUnmapMemory UnmapMemory;
PFN_vkFlushMappedMemoryRanges FlushMappedMemoryRanges;
PFN_vkInvalidateMappedMemoryRanges InvalidateMappedMemoryRanges;
PFN_vkGetDeviceMemoryCommitment GetDeviceMemoryCommitment;
PFN_vkGetImageSparseMemoryRequirements GetImageSparseMemoryRequirements;
PFN_vkGetImageMemoryRequirements GetImageMemoryRequirements;
PFN_vkGetBufferMemoryRequirements GetBufferMemoryRequirements;
PFN_vkBindImageMemory BindImageMemory;
PFN_vkBindBufferMemory BindBufferMemory;
PFN_vkQueueBindSparse QueueBindSparse;
PFN_vkCreateFence CreateFence;
PFN_vkDestroyFence DestroyFence;
PFN_vkGetFenceStatus GetFenceStatus;
PFN_vkResetFences ResetFences;
PFN_vkWaitForFences WaitForFences;
PFN_vkCreateSemaphore CreateSemaphore;
PFN_vkDestroySemaphore DestroySemaphore;
PFN_vkCreateEvent CreateEvent;
PFN_vkDestroyEvent DestroyEvent;
PFN_vkGetEventStatus GetEventStatus;
PFN_vkSetEvent SetEvent;
PFN_vkResetEvent ResetEvent;
PFN_vkCreateQueryPool CreateQueryPool;
PFN_vkDestroyQueryPool DestroyQueryPool;
PFN_vkGetQueryPoolResults GetQueryPoolResults;
PFN_vkCreateBuffer CreateBuffer;
PFN_vkDestroyBuffer DestroyBuffer;
PFN_vkCreateBufferView CreateBufferView;
PFN_vkDestroyBufferView DestroyBufferView;
PFN_vkCreateImage CreateImage;
PFN_vkDestroyImage DestroyImage;
PFN_vkGetImageSubresourceLayout GetImageSubresourceLayout;
PFN_vkCreateImageView CreateImageView;
PFN_vkDestroyImageView DestroyImageView;
PFN_vkCreateShaderModule CreateShaderModule;
PFN_vkDestroyShaderModule DestroyShaderModule;
PFN_vkCreatePipelineCache CreatePipelineCache;
PFN_vkDestroyPipelineCache DestroyPipelineCache;
PFN_vkGetPipelineCacheData GetPipelineCacheData;
PFN_vkMergePipelineCaches MergePipelineCaches;
PFN_vkCreateGraphicsPipelines CreateGraphicsPipelines;
PFN_vkCreateComputePipelines CreateComputePipelines;
PFN_vkDestroyPipeline DestroyPipeline;
PFN_vkCreatePipelineLayout CreatePipelineLayout;
PFN_vkDestroyPipelineLayout DestroyPipelineLayout;
PFN_vkCreateSampler CreateSampler;
PFN_vkDestroySampler DestroySampler;
PFN_vkCreateDescriptorSetLayout CreateDescriptorSetLayout;
PFN_vkDestroyDescriptorSetLayout DestroyDescriptorSetLayout;
PFN_vkCreateDescriptorPool CreateDescriptorPool;
PFN_vkDestroyDescriptorPool DestroyDescriptorPool;
PFN_vkResetDescriptorPool ResetDescriptorPool;
PFN_vkAllocateDescriptorSets AllocateDescriptorSets;
PFN_vkFreeDescriptorSets FreeDescriptorSets;
PFN_vkUpdateDescriptorSets UpdateDescriptorSets;
PFN_vkCreateFramebuffer CreateFramebuffer;
PFN_vkDestroyFramebuffer DestroyFramebuffer;
PFN_vkCreateRenderPass CreateRenderPass;
PFN_vkDestroyRenderPass DestroyRenderPass;
PFN_vkGetRenderAreaGranularity GetRenderAreaGranularity;
PFN_vkCreateCommandPool CreateCommandPool;
PFN_vkDestroyCommandPool DestroyCommandPool;
PFN_vkResetCommandPool ResetCommandPool;
PFN_vkAllocateCommandBuffers AllocateCommandBuffers;
PFN_vkFreeCommandBuffers FreeCommandBuffers;
PFN_vkBeginCommandBuffer BeginCommandBuffer;
PFN_vkEndCommandBuffer EndCommandBuffer;
PFN_vkResetCommandBuffer ResetCommandBuffer;
PFN_vkCmdBindPipeline CmdBindPipeline;
PFN_vkCmdBindDescriptorSets CmdBindDescriptorSets;
PFN_vkCmdBindVertexBuffers CmdBindVertexBuffers;
PFN_vkCmdBindIndexBuffer CmdBindIndexBuffer;
PFN_vkCmdSetViewport CmdSetViewport;
PFN_vkCmdSetScissor CmdSetScissor;
PFN_vkCmdSetLineWidth CmdSetLineWidth;
PFN_vkCmdSetDepthBias CmdSetDepthBias;
PFN_vkCmdSetBlendConstants CmdSetBlendConstants;
PFN_vkCmdSetDepthBounds CmdSetDepthBounds;
PFN_vkCmdSetStencilCompareMask CmdSetStencilCompareMask;
PFN_vkCmdSetStencilWriteMask CmdSetStencilWriteMask;
PFN_vkCmdSetStencilReference CmdSetStencilReference;
PFN_vkCmdDraw CmdDraw;
PFN_vkCmdDrawIndexed CmdDrawIndexed;
PFN_vkCmdDrawIndirect CmdDrawIndirect;
PFN_vkCmdDrawIndexedIndirect CmdDrawIndexedIndirect;
PFN_vkCmdDispatch CmdDispatch;
PFN_vkCmdDispatchIndirect CmdDispatchIndirect;
PFN_vkCmdCopyBuffer CmdCopyBuffer;
PFN_vkCmdCopyImage CmdCopyImage;
PFN_vkCmdBlitImage CmdBlitImage;
PFN_vkCmdCopyBufferToImage CmdCopyBufferToImage;
PFN_vkCmdCopyImageToBuffer CmdCopyImageToBuffer;
PFN_vkCmdUpdateBuffer CmdUpdateBuffer;
PFN_vkCmdFillBuffer CmdFillBuffer;
PFN_vkCmdClearColorImage CmdClearColorImage;
PFN_vkCmdClearDepthStencilImage CmdClearDepthStencilImage;
PFN_vkCmdClearAttachments CmdClearAttachments;
PFN_vkCmdResolveImage CmdResolveImage;
PFN_vkCmdSetEvent CmdSetEvent;
PFN_vkCmdResetEvent CmdResetEvent;
PFN_vkCmdWaitEvents CmdWaitEvents;
PFN_vkCmdPipelineBarrier CmdPipelineBarrier;
PFN_vkCmdBeginQuery CmdBeginQuery;
PFN_vkCmdEndQuery CmdEndQuery;
PFN_vkCmdResetQueryPool CmdResetQueryPool;
PFN_vkCmdWriteTimestamp CmdWriteTimestamp;
PFN_vkCmdCopyQueryPoolResults CmdCopyQueryPoolResults;
PFN_vkCmdPushConstants CmdPushConstants;
PFN_vkCmdBeginRenderPass CmdBeginRenderPass;
PFN_vkCmdNextSubpass CmdNextSubpass;
PFN_vkCmdEndRenderPass CmdEndRenderPass;
PFN_vkCmdExecuteCommands CmdExecuteCommands;
PFN_vkCreateSwapchainKHR CreateSwapchainKHR;
PFN_vkDestroySwapchainKHR DestroySwapchainKHR;
PFN_vkGetSwapchainImagesKHR GetSwapchainImagesKHR;
PFN_vkAcquireNextImageKHR AcquireNextImageKHR;
PFN_vkQueuePresentKHR QueuePresentKHR;
PFN_vkCmdDrawIndirectCountAMD CmdDrawIndirectCountAMD;
PFN_vkCmdDrawIndexedIndirectCountAMD CmdDrawIndexedIndirectCountAMD;
#ifdef VK_USE_PLATFORM_WIN32_KHR
PFN_vkGetMemoryWin32HandleNV GetMemoryWin32HandleNV;
#endif
PFN_vkCreateSharedSwapchainsKHR CreateSharedSwapchainsKHR;
PFN_vkDebugMarkerSetObjectTagEXT DebugMarkerSetObjectTagEXT;
PFN_vkDebugMarkerSetObjectNameEXT DebugMarkerSetObjectNameEXT;
PFN_vkCmdDebugMarkerBeginEXT CmdDebugMarkerBeginEXT;
PFN_vkCmdDebugMarkerEndEXT CmdDebugMarkerEndEXT;
PFN_vkCmdDebugMarkerInsertEXT CmdDebugMarkerInsertEXT;
// KHR_maintenance1
PFN_vkTrimCommandPoolKHR TrimCommandPoolKHR;
// EXT_display_control
PFN_vkDisplayPowerControlEXT DisplayPowerControlEXT;
PFN_vkRegisterDeviceEventEXT RegisterDeviceEventEXT;
PFN_vkRegisterDisplayEventEXT RegisterDisplayEventEXT;
PFN_vkGetSwapchainCounterEXT GetSwapchainCounterEXT;
// NVX_device_generated_commands
PFN_vkCmdProcessCommandsNVX CmdProcessCommandsNVX;
PFN_vkCmdReserveSpaceForCommandsNVX CmdReserveSpaceForCommandsNVX;
PFN_vkCreateIndirectCommandsLayoutNVX CreateIndirectCommandsLayoutNVX;
PFN_vkDestroyIndirectCommandsLayoutNVX DestroyIndirectCommandsLayoutNVX;
PFN_vkCreateObjectTableNVX CreateObjectTableNVX;
PFN_vkDestroyObjectTableNVX DestroyObjectTableNVX;
PFN_vkRegisterObjectsNVX RegisterObjectsNVX;
PFN_vkUnregisterObjectsNVX UnregisterObjectsNVX;
} VkLayerDispatchTable;
typedef struct VkLayerInstanceDispatchTable_ {
PFN_vkGetInstanceProcAddr GetInstanceProcAddr;
PFN_GetPhysicalDeviceProcAddr GetPhysicalDeviceProcAddr;
PFN_vkDestroyInstance DestroyInstance;
PFN_vkEnumeratePhysicalDevices EnumeratePhysicalDevices;
PFN_vkGetPhysicalDeviceFeatures GetPhysicalDeviceFeatures;
PFN_vkGetPhysicalDeviceImageFormatProperties
GetPhysicalDeviceImageFormatProperties;
PFN_vkGetPhysicalDeviceFormatProperties GetPhysicalDeviceFormatProperties;
PFN_vkGetPhysicalDeviceSparseImageFormatProperties
GetPhysicalDeviceSparseImageFormatProperties;
PFN_vkGetPhysicalDeviceProperties GetPhysicalDeviceProperties;
PFN_vkGetPhysicalDeviceQueueFamilyProperties
GetPhysicalDeviceQueueFamilyProperties;
PFN_vkGetPhysicalDeviceMemoryProperties GetPhysicalDeviceMemoryProperties;
PFN_vkEnumerateDeviceExtensionProperties EnumerateDeviceExtensionProperties;
PFN_vkEnumerateDeviceLayerProperties EnumerateDeviceLayerProperties;
PFN_vkDestroySurfaceKHR DestroySurfaceKHR;
PFN_vkGetPhysicalDeviceSurfaceSupportKHR GetPhysicalDeviceSurfaceSupportKHR;
PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR
GetPhysicalDeviceSurfaceCapabilitiesKHR;
PFN_vkGetPhysicalDeviceSurfaceFormatsKHR GetPhysicalDeviceSurfaceFormatsKHR;
PFN_vkGetPhysicalDeviceSurfacePresentModesKHR
GetPhysicalDeviceSurfacePresentModesKHR;
#ifdef VK_USE_PLATFORM_MIR_KHR
PFN_vkCreateMirSurfaceKHR CreateMirSurfaceKHR;
PFN_vkGetPhysicalDeviceMirPresentationSupportKHR
GetPhysicalDeviceMirPresentationSupportKHR;
#endif
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
PFN_vkCreateWaylandSurfaceKHR CreateWaylandSurfaceKHR;
PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR
GetPhysicalDeviceWaylandPresentationSupportKHR;
#endif
#ifdef VK_USE_PLATFORM_WIN32_KHR
PFN_vkCreateWin32SurfaceKHR CreateWin32SurfaceKHR;
PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR
GetPhysicalDeviceWin32PresentationSupportKHR;
#endif
#ifdef VK_USE_PLATFORM_XCB_KHR
PFN_vkCreateXcbSurfaceKHR CreateXcbSurfaceKHR;
PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR
GetPhysicalDeviceXcbPresentationSupportKHR;
#endif
#ifdef VK_USE_PLATFORM_XLIB_KHR
PFN_vkCreateXlibSurfaceKHR CreateXlibSurfaceKHR;
PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR
GetPhysicalDeviceXlibPresentationSupportKHR;
#endif
#ifdef VK_USE_PLATFORM_ANDROID_KHR
PFN_vkCreateAndroidSurfaceKHR CreateAndroidSurfaceKHR;
#endif
PFN_vkGetPhysicalDeviceDisplayPropertiesKHR
GetPhysicalDeviceDisplayPropertiesKHR;
PFN_vkGetPhysicalDeviceDisplayPlanePropertiesKHR
GetPhysicalDeviceDisplayPlanePropertiesKHR;
PFN_vkGetDisplayPlaneSupportedDisplaysKHR
GetDisplayPlaneSupportedDisplaysKHR;
PFN_vkGetDisplayModePropertiesKHR
GetDisplayModePropertiesKHR;
PFN_vkCreateDisplayModeKHR
CreateDisplayModeKHR;
PFN_vkGetDisplayPlaneCapabilitiesKHR
GetDisplayPlaneCapabilitiesKHR;
PFN_vkCreateDisplayPlaneSurfaceKHR
CreateDisplayPlaneSurfaceKHR;
// 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;
#ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT
// EXT_acquire_xlib_display
PFN_vkAcquireXlibDisplayEXT AcquireXlibDisplayEXT;
PFN_vkGetRandROutputDisplayEXT GetRandROutputDisplayEXT;
#endif
// EXT_debug_report
PFN_vkCreateDebugReportCallbackEXT CreateDebugReportCallbackEXT;
PFN_vkDestroyDebugReportCallbackEXT DestroyDebugReportCallbackEXT;
PFN_vkDebugReportMessageEXT DebugReportMessageEXT;
// EXT_direct_mode_display
PFN_vkReleaseDisplayEXT ReleaseDisplayEXT;
// EXT_display_surface_counter
PFN_vkGetPhysicalDeviceSurfaceCapabilities2EXT
GetPhysicalDeviceSurfaceCapabilities2EXT;
// NV_external_memory_capabilities
PFN_vkGetPhysicalDeviceExternalImageFormatPropertiesNV
GetPhysicalDeviceExternalImageFormatPropertiesNV;
// NVX_device_generated_commands (phys dev commands)
PFN_vkGetPhysicalDeviceGeneratedCommandsPropertiesNVX
GetPhysicalDeviceGeneratedCommandsPropertiesNVX;
} VkLayerInstanceDispatchTable;
// ------------------------------------------------------------------------------------------------
// CreateInstance and CreateDevice support structures

View File

@ -0,0 +1,403 @@
// *** THIS FILE IS GENERATED - DO NOT EDIT ***
// See loader_extension_generator.py for modifications
/*
* Copyright (c) 2015-2017 The Khronos Group Inc.
* Copyright (c) 2015-2017 Valve Corporation
* Copyright (c) 2015-2017 LunarG, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Author: Mark Lobodzinski <mark@lunarg.com>
* Author: Mark Young <marky@lunarg.com>
*/
#pragma once
typedef PFN_vkVoidFunction (VKAPI_PTR *PFN_GetPhysicalDeviceProcAddr)(VkInstance instance, const char* pName);
// Instance function pointer dispatch table
typedef struct VkLayerInstanceDispatchTable_ {
// Manually add in GetPhysicalDeviceProcAddr entry
PFN_GetPhysicalDeviceProcAddr GetPhysicalDeviceProcAddr;
// ---- Core 1_0 commands
PFN_vkCreateInstance CreateInstance;
PFN_vkDestroyInstance DestroyInstance;
PFN_vkEnumeratePhysicalDevices EnumeratePhysicalDevices;
PFN_vkGetPhysicalDeviceFeatures GetPhysicalDeviceFeatures;
PFN_vkGetPhysicalDeviceFormatProperties GetPhysicalDeviceFormatProperties;
PFN_vkGetPhysicalDeviceImageFormatProperties GetPhysicalDeviceImageFormatProperties;
PFN_vkGetPhysicalDeviceProperties GetPhysicalDeviceProperties;
PFN_vkGetPhysicalDeviceQueueFamilyProperties GetPhysicalDeviceQueueFamilyProperties;
PFN_vkGetPhysicalDeviceMemoryProperties GetPhysicalDeviceMemoryProperties;
PFN_vkGetInstanceProcAddr GetInstanceProcAddr;
PFN_vkCreateDevice CreateDevice;
PFN_vkEnumerateInstanceExtensionProperties EnumerateInstanceExtensionProperties;
PFN_vkEnumerateDeviceExtensionProperties EnumerateDeviceExtensionProperties;
PFN_vkEnumerateInstanceLayerProperties EnumerateInstanceLayerProperties;
PFN_vkEnumerateDeviceLayerProperties EnumerateDeviceLayerProperties;
PFN_vkGetPhysicalDeviceSparseImageFormatProperties GetPhysicalDeviceSparseImageFormatProperties;
// ---- VK_KHR_surface extension commands
PFN_vkDestroySurfaceKHR DestroySurfaceKHR;
PFN_vkGetPhysicalDeviceSurfaceSupportKHR GetPhysicalDeviceSurfaceSupportKHR;
PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR GetPhysicalDeviceSurfaceCapabilitiesKHR;
PFN_vkGetPhysicalDeviceSurfaceFormatsKHR GetPhysicalDeviceSurfaceFormatsKHR;
PFN_vkGetPhysicalDeviceSurfacePresentModesKHR GetPhysicalDeviceSurfacePresentModesKHR;
// ---- VK_KHR_display extension commands
PFN_vkGetPhysicalDeviceDisplayPropertiesKHR GetPhysicalDeviceDisplayPropertiesKHR;
PFN_vkGetPhysicalDeviceDisplayPlanePropertiesKHR GetPhysicalDeviceDisplayPlanePropertiesKHR;
PFN_vkGetDisplayPlaneSupportedDisplaysKHR GetDisplayPlaneSupportedDisplaysKHR;
PFN_vkGetDisplayModePropertiesKHR GetDisplayModePropertiesKHR;
PFN_vkCreateDisplayModeKHR CreateDisplayModeKHR;
PFN_vkGetDisplayPlaneCapabilitiesKHR GetDisplayPlaneCapabilitiesKHR;
PFN_vkCreateDisplayPlaneSurfaceKHR CreateDisplayPlaneSurfaceKHR;
// ---- VK_KHR_xlib_surface extension commands
#ifdef VK_USE_PLATFORM_XLIB_KHR
PFN_vkCreateXlibSurfaceKHR CreateXlibSurfaceKHR;
#endif // VK_USE_PLATFORM_XLIB_KHR
#ifdef VK_USE_PLATFORM_XLIB_KHR
PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR GetPhysicalDeviceXlibPresentationSupportKHR;
#endif // VK_USE_PLATFORM_XLIB_KHR
// ---- VK_KHR_xcb_surface extension commands
#ifdef VK_USE_PLATFORM_XCB_KHR
PFN_vkCreateXcbSurfaceKHR CreateXcbSurfaceKHR;
#endif // VK_USE_PLATFORM_XCB_KHR
#ifdef VK_USE_PLATFORM_XCB_KHR
PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR GetPhysicalDeviceXcbPresentationSupportKHR;
#endif // VK_USE_PLATFORM_XCB_KHR
// ---- VK_KHR_wayland_surface extension commands
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
PFN_vkCreateWaylandSurfaceKHR CreateWaylandSurfaceKHR;
#endif // VK_USE_PLATFORM_WAYLAND_KHR
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR GetPhysicalDeviceWaylandPresentationSupportKHR;
#endif // VK_USE_PLATFORM_WAYLAND_KHR
// ---- VK_KHR_mir_surface extension commands
#ifdef VK_USE_PLATFORM_MIR_KHR
PFN_vkCreateMirSurfaceKHR CreateMirSurfaceKHR;
#endif // VK_USE_PLATFORM_MIR_KHR
#ifdef VK_USE_PLATFORM_MIR_KHR
PFN_vkGetPhysicalDeviceMirPresentationSupportKHR GetPhysicalDeviceMirPresentationSupportKHR;
#endif // VK_USE_PLATFORM_MIR_KHR
// ---- VK_KHR_android_surface extension commands
#ifdef VK_USE_PLATFORM_ANDROID_KHR
PFN_vkCreateAndroidSurfaceKHR CreateAndroidSurfaceKHR;
#endif // VK_USE_PLATFORM_ANDROID_KHR
// ---- VK_KHR_win32_surface extension commands
#ifdef VK_USE_PLATFORM_WIN32_KHR
PFN_vkCreateWin32SurfaceKHR CreateWin32SurfaceKHR;
#endif // VK_USE_PLATFORM_WIN32_KHR
#ifdef VK_USE_PLATFORM_WIN32_KHR
PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR GetPhysicalDeviceWin32PresentationSupportKHR;
#endif // VK_USE_PLATFORM_WIN32_KHR
// ---- VK_KHR_get_physical_device_properties2 extension commands
PFN_vkGetPhysicalDeviceFeatures2KHR GetPhysicalDeviceFeatures2KHR;
PFN_vkGetPhysicalDeviceProperties2KHR GetPhysicalDeviceProperties2KHR;
PFN_vkGetPhysicalDeviceFormatProperties2KHR GetPhysicalDeviceFormatProperties2KHR;
PFN_vkGetPhysicalDeviceImageFormatProperties2KHR GetPhysicalDeviceImageFormatProperties2KHR;
PFN_vkGetPhysicalDeviceQueueFamilyProperties2KHR GetPhysicalDeviceQueueFamilyProperties2KHR;
PFN_vkGetPhysicalDeviceMemoryProperties2KHR GetPhysicalDeviceMemoryProperties2KHR;
PFN_vkGetPhysicalDeviceSparseImageFormatProperties2KHR GetPhysicalDeviceSparseImageFormatProperties2KHR;
// ---- VK_EXT_debug_report extension commands
PFN_vkCreateDebugReportCallbackEXT CreateDebugReportCallbackEXT;
PFN_vkDestroyDebugReportCallbackEXT DestroyDebugReportCallbackEXT;
PFN_vkDebugReportMessageEXT DebugReportMessageEXT;
// ---- VK_NV_external_memory_capabilities extension commands
PFN_vkGetPhysicalDeviceExternalImageFormatPropertiesNV GetPhysicalDeviceExternalImageFormatPropertiesNV;
// ---- VK_KHX_device_group extension commands
PFN_vkGetPhysicalDevicePresentRectanglesKHX GetPhysicalDevicePresentRectanglesKHX;
// ---- VK_NN_vi_surface extension commands
#ifdef VK_USE_PLATFORM_VI_NN
PFN_vkCreateViSurfaceNN CreateViSurfaceNN;
#endif // VK_USE_PLATFORM_VI_NN
// ---- VK_KHX_device_group_creation extension commands
PFN_vkEnumeratePhysicalDeviceGroupsKHX EnumeratePhysicalDeviceGroupsKHX;
// ---- VK_KHX_external_memory_capabilities extension commands
PFN_vkGetPhysicalDeviceExternalBufferPropertiesKHX GetPhysicalDeviceExternalBufferPropertiesKHX;
// ---- VK_KHX_external_semaphore_capabilities extension commands
PFN_vkGetPhysicalDeviceExternalSemaphorePropertiesKHX GetPhysicalDeviceExternalSemaphorePropertiesKHX;
// ---- VK_NVX_device_generated_commands extension commands
PFN_vkGetPhysicalDeviceGeneratedCommandsPropertiesNVX GetPhysicalDeviceGeneratedCommandsPropertiesNVX;
// ---- VK_EXT_direct_mode_display extension commands
PFN_vkReleaseDisplayEXT ReleaseDisplayEXT;
// ---- VK_EXT_acquire_xlib_display extension commands
#ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT
PFN_vkAcquireXlibDisplayEXT AcquireXlibDisplayEXT;
#endif // VK_USE_PLATFORM_XLIB_XRANDR_EXT
#ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT
PFN_vkGetRandROutputDisplayEXT GetRandROutputDisplayEXT;
#endif // VK_USE_PLATFORM_XLIB_XRANDR_EXT
// ---- VK_EXT_display_surface_counter extension commands
PFN_vkGetPhysicalDeviceSurfaceCapabilities2EXT GetPhysicalDeviceSurfaceCapabilities2EXT;
// ---- VK_MVK_ios_surface extension commands
#ifdef VK_USE_PLATFORM_IOS_MVK
PFN_vkCreateIOSSurfaceMVK CreateIOSSurfaceMVK;
#endif // VK_USE_PLATFORM_IOS_MVK
// ---- VK_MVK_macos_surface extension commands
#ifdef VK_USE_PLATFORM_MACOS_MVK
PFN_vkCreateMacOSSurfaceMVK CreateMacOSSurfaceMVK;
#endif // VK_USE_PLATFORM_MACOS_MVK
} VkLayerInstanceDispatchTable;
// Device function pointer dispatch table
typedef struct VkLayerDispatchTable_ {
// ---- Core 1_0 commands
PFN_vkGetDeviceProcAddr GetDeviceProcAddr;
PFN_vkDestroyDevice DestroyDevice;
PFN_vkGetDeviceQueue GetDeviceQueue;
PFN_vkQueueSubmit QueueSubmit;
PFN_vkQueueWaitIdle QueueWaitIdle;
PFN_vkDeviceWaitIdle DeviceWaitIdle;
PFN_vkAllocateMemory AllocateMemory;
PFN_vkFreeMemory FreeMemory;
PFN_vkMapMemory MapMemory;
PFN_vkUnmapMemory UnmapMemory;
PFN_vkFlushMappedMemoryRanges FlushMappedMemoryRanges;
PFN_vkInvalidateMappedMemoryRanges InvalidateMappedMemoryRanges;
PFN_vkGetDeviceMemoryCommitment GetDeviceMemoryCommitment;
PFN_vkBindBufferMemory BindBufferMemory;
PFN_vkBindImageMemory BindImageMemory;
PFN_vkGetBufferMemoryRequirements GetBufferMemoryRequirements;
PFN_vkGetImageMemoryRequirements GetImageMemoryRequirements;
PFN_vkGetImageSparseMemoryRequirements GetImageSparseMemoryRequirements;
PFN_vkQueueBindSparse QueueBindSparse;
PFN_vkCreateFence CreateFence;
PFN_vkDestroyFence DestroyFence;
PFN_vkResetFences ResetFences;
PFN_vkGetFenceStatus GetFenceStatus;
PFN_vkWaitForFences WaitForFences;
PFN_vkCreateSemaphore CreateSemaphore;
PFN_vkDestroySemaphore DestroySemaphore;
PFN_vkCreateEvent CreateEvent;
PFN_vkDestroyEvent DestroyEvent;
PFN_vkGetEventStatus GetEventStatus;
PFN_vkSetEvent SetEvent;
PFN_vkResetEvent ResetEvent;
PFN_vkCreateQueryPool CreateQueryPool;
PFN_vkDestroyQueryPool DestroyQueryPool;
PFN_vkGetQueryPoolResults GetQueryPoolResults;
PFN_vkCreateBuffer CreateBuffer;
PFN_vkDestroyBuffer DestroyBuffer;
PFN_vkCreateBufferView CreateBufferView;
PFN_vkDestroyBufferView DestroyBufferView;
PFN_vkCreateImage CreateImage;
PFN_vkDestroyImage DestroyImage;
PFN_vkGetImageSubresourceLayout GetImageSubresourceLayout;
PFN_vkCreateImageView CreateImageView;
PFN_vkDestroyImageView DestroyImageView;
PFN_vkCreateShaderModule CreateShaderModule;
PFN_vkDestroyShaderModule DestroyShaderModule;
PFN_vkCreatePipelineCache CreatePipelineCache;
PFN_vkDestroyPipelineCache DestroyPipelineCache;
PFN_vkGetPipelineCacheData GetPipelineCacheData;
PFN_vkMergePipelineCaches MergePipelineCaches;
PFN_vkCreateGraphicsPipelines CreateGraphicsPipelines;
PFN_vkCreateComputePipelines CreateComputePipelines;
PFN_vkDestroyPipeline DestroyPipeline;
PFN_vkCreatePipelineLayout CreatePipelineLayout;
PFN_vkDestroyPipelineLayout DestroyPipelineLayout;
PFN_vkCreateSampler CreateSampler;
PFN_vkDestroySampler DestroySampler;
PFN_vkCreateDescriptorSetLayout CreateDescriptorSetLayout;
PFN_vkDestroyDescriptorSetLayout DestroyDescriptorSetLayout;
PFN_vkCreateDescriptorPool CreateDescriptorPool;
PFN_vkDestroyDescriptorPool DestroyDescriptorPool;
PFN_vkResetDescriptorPool ResetDescriptorPool;
PFN_vkAllocateDescriptorSets AllocateDescriptorSets;
PFN_vkFreeDescriptorSets FreeDescriptorSets;
PFN_vkUpdateDescriptorSets UpdateDescriptorSets;
PFN_vkCreateFramebuffer CreateFramebuffer;
PFN_vkDestroyFramebuffer DestroyFramebuffer;
PFN_vkCreateRenderPass CreateRenderPass;
PFN_vkDestroyRenderPass DestroyRenderPass;
PFN_vkGetRenderAreaGranularity GetRenderAreaGranularity;
PFN_vkCreateCommandPool CreateCommandPool;
PFN_vkDestroyCommandPool DestroyCommandPool;
PFN_vkResetCommandPool ResetCommandPool;
PFN_vkAllocateCommandBuffers AllocateCommandBuffers;
PFN_vkFreeCommandBuffers FreeCommandBuffers;
PFN_vkBeginCommandBuffer BeginCommandBuffer;
PFN_vkEndCommandBuffer EndCommandBuffer;
PFN_vkResetCommandBuffer ResetCommandBuffer;
PFN_vkCmdBindPipeline CmdBindPipeline;
PFN_vkCmdSetViewport CmdSetViewport;
PFN_vkCmdSetScissor CmdSetScissor;
PFN_vkCmdSetLineWidth CmdSetLineWidth;
PFN_vkCmdSetDepthBias CmdSetDepthBias;
PFN_vkCmdSetBlendConstants CmdSetBlendConstants;
PFN_vkCmdSetDepthBounds CmdSetDepthBounds;
PFN_vkCmdSetStencilCompareMask CmdSetStencilCompareMask;
PFN_vkCmdSetStencilWriteMask CmdSetStencilWriteMask;
PFN_vkCmdSetStencilReference CmdSetStencilReference;
PFN_vkCmdBindDescriptorSets CmdBindDescriptorSets;
PFN_vkCmdBindIndexBuffer CmdBindIndexBuffer;
PFN_vkCmdBindVertexBuffers CmdBindVertexBuffers;
PFN_vkCmdDraw CmdDraw;
PFN_vkCmdDrawIndexed CmdDrawIndexed;
PFN_vkCmdDrawIndirect CmdDrawIndirect;
PFN_vkCmdDrawIndexedIndirect CmdDrawIndexedIndirect;
PFN_vkCmdDispatch CmdDispatch;
PFN_vkCmdDispatchIndirect CmdDispatchIndirect;
PFN_vkCmdCopyBuffer CmdCopyBuffer;
PFN_vkCmdCopyImage CmdCopyImage;
PFN_vkCmdBlitImage CmdBlitImage;
PFN_vkCmdCopyBufferToImage CmdCopyBufferToImage;
PFN_vkCmdCopyImageToBuffer CmdCopyImageToBuffer;
PFN_vkCmdUpdateBuffer CmdUpdateBuffer;
PFN_vkCmdFillBuffer CmdFillBuffer;
PFN_vkCmdClearColorImage CmdClearColorImage;
PFN_vkCmdClearDepthStencilImage CmdClearDepthStencilImage;
PFN_vkCmdClearAttachments CmdClearAttachments;
PFN_vkCmdResolveImage CmdResolveImage;
PFN_vkCmdSetEvent CmdSetEvent;
PFN_vkCmdResetEvent CmdResetEvent;
PFN_vkCmdWaitEvents CmdWaitEvents;
PFN_vkCmdPipelineBarrier CmdPipelineBarrier;
PFN_vkCmdBeginQuery CmdBeginQuery;
PFN_vkCmdEndQuery CmdEndQuery;
PFN_vkCmdResetQueryPool CmdResetQueryPool;
PFN_vkCmdWriteTimestamp CmdWriteTimestamp;
PFN_vkCmdCopyQueryPoolResults CmdCopyQueryPoolResults;
PFN_vkCmdPushConstants CmdPushConstants;
PFN_vkCmdBeginRenderPass CmdBeginRenderPass;
PFN_vkCmdNextSubpass CmdNextSubpass;
PFN_vkCmdEndRenderPass CmdEndRenderPass;
PFN_vkCmdExecuteCommands CmdExecuteCommands;
// ---- VK_KHR_swapchain extension commands
PFN_vkCreateSwapchainKHR CreateSwapchainKHR;
PFN_vkDestroySwapchainKHR DestroySwapchainKHR;
PFN_vkGetSwapchainImagesKHR GetSwapchainImagesKHR;
PFN_vkAcquireNextImageKHR AcquireNextImageKHR;
PFN_vkQueuePresentKHR QueuePresentKHR;
// ---- VK_KHR_display_swapchain extension commands
PFN_vkCreateSharedSwapchainsKHR CreateSharedSwapchainsKHR;
// ---- VK_KHR_maintenance1 extension commands
PFN_vkTrimCommandPoolKHR TrimCommandPoolKHR;
// ---- VK_KHR_push_descriptor extension commands
PFN_vkCmdPushDescriptorSetKHR CmdPushDescriptorSetKHR;
// ---- VK_KHR_descriptor_update_template extension commands
PFN_vkCreateDescriptorUpdateTemplateKHR CreateDescriptorUpdateTemplateKHR;
PFN_vkDestroyDescriptorUpdateTemplateKHR DestroyDescriptorUpdateTemplateKHR;
PFN_vkUpdateDescriptorSetWithTemplateKHR UpdateDescriptorSetWithTemplateKHR;
PFN_vkCmdPushDescriptorSetWithTemplateKHR CmdPushDescriptorSetWithTemplateKHR;
// ---- VK_EXT_debug_marker extension commands
PFN_vkDebugMarkerSetObjectTagEXT DebugMarkerSetObjectTagEXT;
PFN_vkDebugMarkerSetObjectNameEXT DebugMarkerSetObjectNameEXT;
PFN_vkCmdDebugMarkerBeginEXT CmdDebugMarkerBeginEXT;
PFN_vkCmdDebugMarkerEndEXT CmdDebugMarkerEndEXT;
PFN_vkCmdDebugMarkerInsertEXT CmdDebugMarkerInsertEXT;
// ---- VK_AMD_draw_indirect_count extension commands
PFN_vkCmdDrawIndirectCountAMD CmdDrawIndirectCountAMD;
PFN_vkCmdDrawIndexedIndirectCountAMD CmdDrawIndexedIndirectCountAMD;
// ---- VK_NV_external_memory_win32 extension commands
#ifdef VK_USE_PLATFORM_WIN32_KHR
PFN_vkGetMemoryWin32HandleNV GetMemoryWin32HandleNV;
#endif // VK_USE_PLATFORM_WIN32_KHR
// ---- VK_KHX_device_group extension commands
PFN_vkGetDeviceGroupPeerMemoryFeaturesKHX GetDeviceGroupPeerMemoryFeaturesKHX;
PFN_vkBindBufferMemory2KHX BindBufferMemory2KHX;
PFN_vkBindImageMemory2KHX BindImageMemory2KHX;
PFN_vkCmdSetDeviceMaskKHX CmdSetDeviceMaskKHX;
PFN_vkGetDeviceGroupPresentCapabilitiesKHX GetDeviceGroupPresentCapabilitiesKHX;
PFN_vkGetDeviceGroupSurfacePresentModesKHX GetDeviceGroupSurfacePresentModesKHX;
PFN_vkAcquireNextImage2KHX AcquireNextImage2KHX;
PFN_vkCmdDispatchBaseKHX CmdDispatchBaseKHX;
// ---- VK_KHX_external_memory_win32 extension commands
#ifdef VK_USE_PLATFORM_WIN32_KHX
PFN_vkGetMemoryWin32HandleKHX GetMemoryWin32HandleKHX;
#endif // VK_USE_PLATFORM_WIN32_KHX
#ifdef VK_USE_PLATFORM_WIN32_KHX
PFN_vkGetMemoryWin32HandlePropertiesKHX GetMemoryWin32HandlePropertiesKHX;
#endif // VK_USE_PLATFORM_WIN32_KHX
// ---- VK_KHX_external_memory_fd extension commands
PFN_vkGetMemoryFdKHX GetMemoryFdKHX;
PFN_vkGetMemoryFdPropertiesKHX GetMemoryFdPropertiesKHX;
// ---- VK_KHX_external_semaphore_win32 extension commands
#ifdef VK_USE_PLATFORM_WIN32_KHX
PFN_vkImportSemaphoreWin32HandleKHX ImportSemaphoreWin32HandleKHX;
#endif // VK_USE_PLATFORM_WIN32_KHX
#ifdef VK_USE_PLATFORM_WIN32_KHX
PFN_vkGetSemaphoreWin32HandleKHX GetSemaphoreWin32HandleKHX;
#endif // VK_USE_PLATFORM_WIN32_KHX
// ---- VK_KHX_external_semaphore_fd extension commands
PFN_vkImportSemaphoreFdKHX ImportSemaphoreFdKHX;
PFN_vkGetSemaphoreFdKHX GetSemaphoreFdKHX;
// ---- VK_NVX_device_generated_commands extension commands
PFN_vkCmdProcessCommandsNVX CmdProcessCommandsNVX;
PFN_vkCmdReserveSpaceForCommandsNVX CmdReserveSpaceForCommandsNVX;
PFN_vkCreateIndirectCommandsLayoutNVX CreateIndirectCommandsLayoutNVX;
PFN_vkDestroyIndirectCommandsLayoutNVX DestroyIndirectCommandsLayoutNVX;
PFN_vkCreateObjectTableNVX CreateObjectTableNVX;
PFN_vkDestroyObjectTableNVX DestroyObjectTableNVX;
PFN_vkRegisterObjectsNVX RegisterObjectsNVX;
PFN_vkUnregisterObjectsNVX UnregisterObjectsNVX;
// ---- VK_NV_clip_space_w_scaling extension commands
PFN_vkCmdSetViewportWScalingNV CmdSetViewportWScalingNV;
// ---- VK_EXT_display_control extension commands
PFN_vkDisplayPowerControlEXT DisplayPowerControlEXT;
PFN_vkRegisterDeviceEventEXT RegisterDeviceEventEXT;
PFN_vkRegisterDisplayEventEXT RegisterDisplayEventEXT;
PFN_vkGetSwapchainCounterEXT GetSwapchainCounterEXT;
// ---- VK_GOOGLE_display_timing extension commands
PFN_vkGetRefreshCycleDurationGOOGLE GetRefreshCycleDurationGOOGLE;
PFN_vkGetPastPresentationTimingGOOGLE GetPastPresentationTimingGOOGLE;
// ---- VK_EXT_discard_rectangles extension commands
PFN_vkCmdSetDiscardRectangleEXT CmdSetDiscardRectangleEXT;
// ---- VK_EXT_hdr_metadata extension commands
PFN_vkSetHdrMetadataEXT SetHdrMetadataEXT;
} VkLayerDispatchTable;

View File

@ -2,7 +2,7 @@
// File: vk_platform.h
//
/*
** Copyright (c) 2014-2015 The Khronos Group Inc.
** Copyright (c) 2014-2017 The Khronos Group Inc.
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff