mirror of
https://gitee.com/openharmony/third_party_vulkan-loader
synced 2024-11-23 07:10:23 +00:00
loader:Update copyright and apply clang-format (no logic changes)
This commit is contained in:
parent
35db91812a
commit
1c75aec41d
1823
loader/cJSON.c
1823
loader/cJSON.c
File diff suppressed because it is too large
Load Diff
162
loader/cJSON.h
162
loader/cJSON.h
@ -1,16 +1,19 @@
|
||||
/*
|
||||
Copyright (c) 2009 Dave Gamble
|
||||
|
||||
Copyright (c) 2015-2016 The Khronos Group Inc.
|
||||
Copyright (c) 2015-2016 Valve Corporation
|
||||
Copyright (c) 2015-2016 LunarG, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
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 Software.
|
||||
|
||||
|
||||
THE SOFTWARE IS 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
|
||||
@ -24,8 +27,7 @@
|
||||
#define cJSON__h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* cJSON Types: */
|
||||
@ -36,54 +38,67 @@ extern "C"
|
||||
#define cJSON_String 4
|
||||
#define cJSON_Array 5
|
||||
#define cJSON_Object 6
|
||||
|
||||
|
||||
#define cJSON_IsReference 256
|
||||
#define cJSON_StringIsConst 512
|
||||
|
||||
/* The cJSON structure: */
|
||||
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 *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. */
|
||||
|
||||
int type; /* The type of the item, as above. */
|
||||
int type; /* The type of the item, as above. */
|
||||
|
||||
char *valuestring; /* The item's string, if type==cJSON_String */
|
||||
int valueint; /* The item's number, if type==cJSON_Number */
|
||||
double valuedouble; /* The item's number, if type==cJSON_Number */
|
||||
char *valuestring; /* The item's string, if type==cJSON_String */
|
||||
int valueint; /* The item's number, if type==cJSON_Number */
|
||||
double valuedouble; /* The item's number, if type==cJSON_Number */
|
||||
|
||||
char *string; /* The item's name string, if this item is the child of, or is in the list of subitems of an object. */
|
||||
char *
|
||||
string; /* The item's name string, if this item is the child of, or is
|
||||
in the list of subitems of an object. */
|
||||
} cJSON;
|
||||
|
||||
typedef struct cJSON_Hooks {
|
||||
void *(*malloc_fn)(size_t sz);
|
||||
void (*free_fn)(void *ptr);
|
||||
void *(*malloc_fn)(size_t sz);
|
||||
void (*free_fn)(void *ptr);
|
||||
} cJSON_Hooks;
|
||||
|
||||
/* Supply malloc, realloc and free functions to cJSON */
|
||||
extern void cJSON_InitHooks(cJSON_Hooks* hooks);
|
||||
extern void cJSON_InitHooks(cJSON_Hooks *hooks);
|
||||
|
||||
|
||||
/* Supply a block of JSON, and this returns a cJSON object you can interrogate. Call cJSON_Delete when finished. */
|
||||
/* Supply a block of JSON, and this returns a cJSON object you can interrogate.
|
||||
* Call cJSON_Delete when finished. */
|
||||
extern cJSON *cJSON_Parse(const char *value);
|
||||
/* Render a cJSON entity to text for transfer/storage. Free the char* when finished. */
|
||||
extern char *cJSON_Print(cJSON *item);
|
||||
/* Render a cJSON entity to text for transfer/storage without any formatting. Free the char* when finished. */
|
||||
extern char *cJSON_PrintUnformatted(cJSON *item);
|
||||
/* Render a cJSON entity to text using a buffered strategy. prebuffer is a guess at the final size. guessing well reduces reallocation. fmt=0 gives unformatted, =1 gives formatted */
|
||||
extern char *cJSON_PrintBuffered(cJSON *item,int prebuffer,int fmt);
|
||||
/* Render a cJSON entity to text for transfer/storage. Free the char* when
|
||||
* finished. */
|
||||
extern char *cJSON_Print(cJSON *item);
|
||||
/* Render a cJSON entity to text for transfer/storage without any formatting.
|
||||
* Free the char* when finished. */
|
||||
extern char *cJSON_PrintUnformatted(cJSON *item);
|
||||
/* Render a cJSON entity to text using a buffered strategy. prebuffer is a guess
|
||||
* at the final size. guessing well reduces reallocation. fmt=0 gives
|
||||
* unformatted, =1 gives formatted */
|
||||
extern char *cJSON_PrintBuffered(cJSON *item, int prebuffer, int fmt);
|
||||
/* Delete a cJSON entity and all subentities. */
|
||||
extern void cJSON_Delete(cJSON *c);
|
||||
extern void cJSON_Delete(cJSON *c);
|
||||
|
||||
/* Returns the number of items in an array (or object). */
|
||||
extern int cJSON_GetArraySize(cJSON *array);
|
||||
/* Retrieve item number "item" from array "array". Returns NULL if unsuccessful. */
|
||||
extern cJSON *cJSON_GetArrayItem(cJSON *array,int item);
|
||||
extern int cJSON_GetArraySize(cJSON *array);
|
||||
/* Retrieve item number "item" from array "array". Returns NULL if unsuccessful.
|
||||
*/
|
||||
extern cJSON *cJSON_GetArrayItem(cJSON *array, int item);
|
||||
/* Get item "string" from object. Case insensitive. */
|
||||
extern cJSON *cJSON_GetObjectItem(cJSON *object,const char *string);
|
||||
extern cJSON *cJSON_GetObjectItem(cJSON *object, const char *string);
|
||||
|
||||
/* For analysing failed parses. This returns a pointer to the parse error. You'll probably need to look a few chars back to make sense of it. Defined when cJSON_Parse() returns 0. 0 when cJSON_Parse() succeeds. */
|
||||
/* For analysing failed parses. This returns a pointer to the parse error.
|
||||
* You'll probably need to look a few chars back to make sense of it. Defined
|
||||
* when cJSON_Parse() returns 0. 0 when cJSON_Parse() succeeds. */
|
||||
extern const char *cJSON_GetErrorPtr(void);
|
||||
|
||||
|
||||
/* These calls create a cJSON item of the appropriate type. */
|
||||
extern cJSON *cJSON_CreateNull(void);
|
||||
extern cJSON *cJSON_CreateTrue(void);
|
||||
@ -95,52 +110,77 @@ extern cJSON *cJSON_CreateArray(void);
|
||||
extern cJSON *cJSON_CreateObject(void);
|
||||
|
||||
/* These utilities create an Array of count items. */
|
||||
extern cJSON *cJSON_CreateIntArray(const int *numbers,int count);
|
||||
extern cJSON *cJSON_CreateFloatArray(const float *numbers,int count);
|
||||
extern cJSON *cJSON_CreateDoubleArray(const double *numbers,int count);
|
||||
extern cJSON *cJSON_CreateStringArray(const char **strings,int count);
|
||||
extern cJSON *cJSON_CreateIntArray(const int *numbers, int count);
|
||||
extern cJSON *cJSON_CreateFloatArray(const float *numbers, int count);
|
||||
extern cJSON *cJSON_CreateDoubleArray(const double *numbers, int count);
|
||||
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 */
|
||||
/* 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_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);
|
||||
extern void cJSON_DeleteItemFromArray(cJSON *array,int which);
|
||||
extern cJSON *cJSON_DetachItemFromObject(cJSON *object,const char *string);
|
||||
extern void cJSON_DeleteItemFromObject(cJSON *object,const char *string);
|
||||
|
||||
extern cJSON *cJSON_DetachItemFromArray(cJSON *array, int which);
|
||||
extern void cJSON_DeleteItemFromArray(cJSON *array, int which);
|
||||
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_ReplaceItemInArray(cJSON *array,int which,cJSON *newitem);
|
||||
extern void cJSON_ReplaceItemInObject(cJSON *object,const char *string,cJSON *newitem);
|
||||
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);
|
||||
|
||||
/* Duplicate a cJSON item */
|
||||
extern cJSON *cJSON_Duplicate(cJSON *item,int recurse);
|
||||
/* Duplicate will create a new, identical cJSON item to the one you pass, in new memory that will
|
||||
need to be released. With recurse!=0, it will duplicate any children connected to the item.
|
||||
extern cJSON *cJSON_Duplicate(cJSON *item, int recurse);
|
||||
/* Duplicate will create a new, identical cJSON item to the one you pass, in new
|
||||
memory that will
|
||||
need to be released. With recurse!=0, it will duplicate any children connected
|
||||
to the item.
|
||||
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);
|
||||
/* 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 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))
|
||||
/* 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))
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -1,27 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2015-2016 The Khronos Group Inc.
|
||||
* Copyright (c) 2015-2016 Valve Corporation
|
||||
* Copyright (c) 2015-2016 LunarG, Inc.
|
||||
* Copyright (C) 2015-2016 Google Inc.
|
||||
*
|
||||
* Copyright (C) 2015 Valve Corporation
|
||||
* Copyright (C) 2015 Google 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:
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
* The above copyright notice(s) and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Materials.
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
* The Materials are Confidential Information as defined by the Khronos
|
||||
* Membership Agreement until designated non-confidential by Khronos, at which
|
||||
* point this condition clause shall be removed.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* 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 SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
* 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.
|
||||
*
|
||||
* Author: Courtney Goeltzenleuchter <courtney@LunarG.com>
|
||||
* Author: Jon Ashburn <jon@LunarG.com>
|
||||
*
|
||||
*/
|
||||
|
||||
@ -38,45 +45,46 @@
|
||||
#include "debug_report.h"
|
||||
#include "vulkan/vk_layer.h"
|
||||
|
||||
typedef void (VKAPI_PTR *PFN_stringCallback)(char *message);
|
||||
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)
|
||||
{
|
||||
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->debug_report_enabled = false;
|
||||
|
||||
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->debug_report_enabled = true;
|
||||
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;
|
||||
if (pAllocator != NULL) {
|
||||
pNewDbgFuncNode = (VkLayerDbgFunctionNode *) pAllocator->pfnAllocation(pAllocator->pUserData, sizeof(VkLayerDbgFunctionNode), sizeof(int *), VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
|
||||
pNewDbgFuncNode = (VkLayerDbgFunctionNode *)pAllocator->pfnAllocation(
|
||||
pAllocator->pUserData, sizeof(VkLayerDbgFunctionNode),
|
||||
sizeof(int *), VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
|
||||
} else {
|
||||
pNewDbgFuncNode = (VkLayerDbgFunctionNode *) loader_heap_alloc(inst, sizeof(VkLayerDbgFunctionNode), VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
|
||||
pNewDbgFuncNode = (VkLayerDbgFunctionNode *)loader_heap_alloc(
|
||||
inst, sizeof(VkLayerDbgFunctionNode),
|
||||
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
|
||||
}
|
||||
if (!pNewDbgFuncNode)
|
||||
return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
@ -92,43 +100,34 @@ VkResult util_CreateDebugReportCallback(
|
||||
}
|
||||
|
||||
static VKAPI_ATTR VkResult VKAPI_CALL debug_report_CreateDebugReportCallback(
|
||||
VkInstance instance,
|
||||
VkDebugReportCallbackCreateInfoEXT *pCreateInfo,
|
||||
VkAllocationCallbacks *pAllocator,
|
||||
VkDebugReportCallbackEXT* pCallback)
|
||||
{
|
||||
VkInstance instance, VkDebugReportCallbackCreateInfoEXT *pCreateInfo,
|
||||
VkAllocationCallbacks *pAllocator, VkDebugReportCallbackEXT *pCallback) {
|
||||
struct loader_instance *inst = loader_get_instance(instance);
|
||||
loader_platform_thread_lock_mutex(&loader_lock);
|
||||
VkResult result = inst->disp->CreateDebugReportCallbackEXT(instance, pCreateInfo, pAllocator, pCallback);
|
||||
VkResult result = inst->disp->CreateDebugReportCallbackEXT(
|
||||
instance, pCreateInfo, pAllocator, pCallback);
|
||||
if (result == VK_SUCCESS) {
|
||||
result = util_CreateDebugReportCallback(inst, pCreateInfo, pAllocator, *pCallback);
|
||||
result = util_CreateDebugReportCallback(inst, 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;
|
||||
}
|
||||
}
|
||||
@ -138,11 +137,9 @@ VkBool32 util_DebugReportMessage(
|
||||
return bail;
|
||||
}
|
||||
|
||||
void util_DestroyDebugReportCallback(
|
||||
struct loader_instance *inst,
|
||||
VkDebugReportCallbackEXT callback,
|
||||
const VkAllocationCallbacks *pAllocator)
|
||||
{
|
||||
void util_DestroyDebugReportCallback(struct loader_instance *inst,
|
||||
VkDebugReportCallbackEXT callback,
|
||||
const VkAllocationCallbacks *pAllocator) {
|
||||
VkLayerDbgFunctionNode *pTrav = inst->DbgFunctionHead;
|
||||
VkLayerDbgFunctionNode *pPrev = pTrav;
|
||||
|
||||
@ -163,11 +160,10 @@ void util_DestroyDebugReportCallback(
|
||||
}
|
||||
}
|
||||
|
||||
static VKAPI_ATTR void VKAPI_CALL debug_report_DestroyDebugReportCallback(
|
||||
VkInstance instance,
|
||||
VkDebugReportCallbackEXT callback,
|
||||
VkAllocationCallbacks *pAllocator)
|
||||
{
|
||||
static VKAPI_ATTR void VKAPI_CALL
|
||||
debug_report_DestroyDebugReportCallback(VkInstance instance,
|
||||
VkDebugReportCallbackEXT callback,
|
||||
VkAllocationCallbacks *pAllocator) {
|
||||
struct loader_instance *inst = loader_get_instance(instance);
|
||||
loader_platform_thread_lock_mutex(&loader_lock);
|
||||
|
||||
@ -179,19 +175,13 @@ static VKAPI_ATTR void VKAPI_CALL debug_report_DestroyDebugReportCallback(
|
||||
}
|
||||
|
||||
static VKAPI_ATTR void VKAPI_CALL debug_report_DebugReportMessage(
|
||||
VkInstance instance,
|
||||
VkDebugReportFlagsEXT flags,
|
||||
VkDebugReportObjectTypeEXT objType,
|
||||
uint64_t object,
|
||||
size_t location,
|
||||
int32_t msgCode,
|
||||
const char* pLayerPrefix,
|
||||
const char* pMsg)
|
||||
{
|
||||
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->DebugReportMessageEXT(instance, flags, objType, object, location, msgCode, pLayerPrefix, pMsg);
|
||||
|
||||
inst->disp->DebugReportMessageEXT(instance, flags, objType, object,
|
||||
location, msgCode, pLayerPrefix, pMsg);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -200,14 +190,12 @@ static VKAPI_ATTR void VKAPI_CALL debug_report_DebugReportMessage(
|
||||
*/
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL loader_CreateDebugReportCallback(
|
||||
VkInstance instance,
|
||||
const VkDebugReportCallbackCreateInfoEXT *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
VkDebugReportCallbackEXT *pCallback)
|
||||
{
|
||||
VkInstance instance, const VkDebugReportCallbackCreateInfoEXT *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
VkDebugReportCallbackEXT *pCallback) {
|
||||
VkDebugReportCallbackEXT *icd_info;
|
||||
const struct loader_icd *icd;
|
||||
struct loader_instance *inst = (struct loader_instance *) instance;
|
||||
struct loader_instance *inst = (struct loader_instance *)instance;
|
||||
VkResult res;
|
||||
uint32_t storage_idx;
|
||||
|
||||
@ -223,10 +211,7 @@ VKAPI_ATTR VkResult VKAPI_CALL loader_CreateDebugReportCallback(
|
||||
}
|
||||
|
||||
res = icd->CreateDebugReportCallbackEXT(
|
||||
icd->instance,
|
||||
pCreateInfo,
|
||||
pAllocator,
|
||||
&icd_info[storage_idx]);
|
||||
icd->instance, pCreateInfo, pAllocator, &icd_info[storage_idx]);
|
||||
|
||||
if (res != VK_SUCCESS) {
|
||||
break;
|
||||
@ -240,9 +225,7 @@ VKAPI_ATTR VkResult VKAPI_CALL loader_CreateDebugReportCallback(
|
||||
for (icd = inst->icds; icd; icd = icd->next) {
|
||||
if (icd_info[storage_idx]) {
|
||||
icd->DestroyDebugReportCallbackEXT(
|
||||
icd->instance,
|
||||
icd_info[storage_idx],
|
||||
pAllocator);
|
||||
icd->instance, icd_info[storage_idx], pAllocator);
|
||||
}
|
||||
storage_idx++;
|
||||
}
|
||||
@ -259,83 +242,81 @@ VKAPI_ATTR VkResult VKAPI_CALL loader_CreateDebugReportCallback(
|
||||
* This is the instance chain terminator function
|
||||
* for DestroyDebugReportCallback
|
||||
*/
|
||||
VKAPI_ATTR void VKAPI_CALL loader_DestroyDebugReportCallback(VkInstance instance,
|
||||
VkDebugReportCallbackEXT callback, const VkAllocationCallbacks *pAllocator)
|
||||
{
|
||||
VKAPI_ATTR void VKAPI_CALL
|
||||
loader_DestroyDebugReportCallback(VkInstance instance,
|
||||
VkDebugReportCallbackEXT callback,
|
||||
const VkAllocationCallbacks *pAllocator) {
|
||||
uint32_t storage_idx;
|
||||
VkDebugReportCallbackEXT *icd_info;
|
||||
const struct loader_icd *icd;
|
||||
|
||||
struct loader_instance *inst = (struct loader_instance *) instance;
|
||||
icd_info = *(VkDebugReportCallbackEXT **) &callback;
|
||||
struct loader_instance *inst = (struct loader_instance *)instance;
|
||||
icd_info = *(VkDebugReportCallbackEXT **)&callback;
|
||||
storage_idx = 0;
|
||||
for (icd = inst->icds; icd; icd = icd->next) {
|
||||
if (icd_info[storage_idx]) {
|
||||
icd->DestroyDebugReportCallbackEXT(
|
||||
icd->instance,
|
||||
icd_info[storage_idx],
|
||||
pAllocator);
|
||||
icd->instance, icd_info[storage_idx], pAllocator);
|
||||
}
|
||||
storage_idx++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* This is the instance chain terminator function
|
||||
* for DebugReportMessage
|
||||
*/
|
||||
VKAPI_ATTR void VKAPI_CALL loader_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
|
||||
loader_DebugReportMessage(VkInstance instance, VkDebugReportFlagsEXT flags,
|
||||
VkDebugReportObjectTypeEXT objType, uint64_t object,
|
||||
size_t location, int32_t msgCode,
|
||||
const char *pLayerPrefix, const char *pMsg) {
|
||||
const struct loader_icd *icd;
|
||||
|
||||
|
||||
struct loader_instance *inst = (struct loader_instance *) instance;
|
||||
struct loader_instance *inst = (struct loader_instance *)instance;
|
||||
|
||||
loader_platform_thread_lock_mutex(&loader_lock);
|
||||
for (icd = inst->icds; icd; icd = icd->next) {
|
||||
if (icd->DebugReportMessageEXT != NULL) {
|
||||
icd->DebugReportMessageEXT(icd->instance, flags, objType, object, location, msgCode, pLayerPrefix, pMsg);
|
||||
icd->DebugReportMessageEXT(icd->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.
|
||||
* 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->debug_report_enabled ? (void *) debug_report_CreateDebugReportCallback : NULL;
|
||||
*addr = ptr_instance->debug_report_enabled
|
||||
? (void *)debug_report_CreateDebugReportCallback
|
||||
: NULL;
|
||||
return true;
|
||||
}
|
||||
if (!strcmp("vkDestroyDebugReportCallbackEXT", name)) {
|
||||
*addr = ptr_instance->debug_report_enabled ? (void *) debug_report_DestroyDebugReportCallback : NULL;
|
||||
*addr = ptr_instance->debug_report_enabled
|
||||
? (void *)debug_report_DestroyDebugReportCallback
|
||||
: NULL;
|
||||
return true;
|
||||
}
|
||||
if (!strcmp("vkDebugReportMessageEXT", name)) {
|
||||
*addr = ptr_instance->debug_report_enabled ? (void *) debug_report_DebugReportMessage : NULL;
|
||||
*addr = ptr_instance->debug_report_enabled
|
||||
? (void *)debug_report_DebugReportMessage
|
||||
: NULL;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -1,25 +1,31 @@
|
||||
/*
|
||||
* Copyright (c) 2015-2016 The Khronos Group Inc.
|
||||
* Copyright (c) 2015-2016 Valve Corporation
|
||||
* Copyright (c) 2015-2016 LunarG, Inc.
|
||||
* Copyright (C) 2015-2016 Google Inc.
|
||||
*
|
||||
* Copyright (C) 2015 Valve Corporation
|
||||
* Copyright (C) 2015 Google 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:
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
* The above copyright notice(s) and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Materials.
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
* The Materials are Confidential Information as defined by the Khronos
|
||||
* Membership Agreement until designated non-confidential by Khronos, at which
|
||||
* point this condition clause shall be removed.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* 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 SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
* 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.
|
||||
*
|
||||
* Author: Courtney Goeltzenleuchter <courtney@LunarG.com>
|
||||
* Author: Jon Ashburn <jon@lunarg.com>
|
||||
@ -29,118 +35,121 @@
|
||||
#include "vk_loader_platform.h"
|
||||
#include "loader.h"
|
||||
#include "vulkan/vk_ext_debug_report.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.
|
||||
*/
|
||||
/*
|
||||
* 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);
|
||||
const struct loader_instance *inst, struct loader_extension_list *ext_list);
|
||||
|
||||
void debug_report_create_instance(
|
||||
struct loader_instance *ptr_instance,
|
||||
const VkInstanceCreateInfo *pCreateInfo);
|
||||
void debug_report_create_instance(struct loader_instance *ptr_instance,
|
||||
const VkInstanceCreateInfo *pCreateInfo);
|
||||
|
||||
bool debug_report_instance_gpa(
|
||||
struct loader_instance *ptr_instance,
|
||||
const char* name,
|
||||
void **addr);
|
||||
bool debug_report_instance_gpa(struct loader_instance *ptr_instance,
|
||||
const char *name, void **addr);
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL loader_CreateDebugReportCallback(
|
||||
VkInstance instance,
|
||||
const VkDebugReportCallbackCreateInfoEXT *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
VkDebugReportCallbackEXT *pCallback);
|
||||
VkInstance instance, const VkDebugReportCallbackCreateInfoEXT *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
VkDebugReportCallbackEXT *pCallback);
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL loader_DestroyDebugReportCallback(
|
||||
VkInstance instance,
|
||||
VkDebugReportCallbackEXT callback,
|
||||
const VkAllocationCallbacks *pAllocator);
|
||||
VKAPI_ATTR void VKAPI_CALL
|
||||
loader_DestroyDebugReportCallback(VkInstance instance,
|
||||
VkDebugReportCallbackEXT callback,
|
||||
const VkAllocationCallbacks *pAllocator);
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL loader_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
|
||||
loader_DebugReportMessage(VkInstance instance, VkDebugReportFlagsEXT flags,
|
||||
VkDebugReportObjectTypeEXT objType, uint64_t object,
|
||||
size_t location, int32_t msgCode,
|
||||
const char *pLayerPrefix, const char *pMsg);
|
||||
|
||||
VkResult util_CreateDebugReportCallback(
|
||||
struct loader_instance *inst,
|
||||
VkDebugReportCallbackCreateInfoEXT *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
VkDebugReportCallbackEXT callback);
|
||||
VkResult
|
||||
util_CreateDebugReportCallback(struct loader_instance *inst,
|
||||
VkDebugReportCallbackCreateInfoEXT *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
VkDebugReportCallbackEXT callback);
|
||||
|
||||
void util_DestroyDebugReportCallback(
|
||||
struct loader_instance *inst,
|
||||
VkDebugReportCallbackEXT callback,
|
||||
const VkAllocationCallbacks *pAllocator);
|
||||
void util_DestroyDebugReportCallback(struct loader_instance *inst,
|
||||
VkDebugReportCallbackEXT callback,
|
||||
const VkAllocationCallbacks *pAllocator);
|
||||
|
||||
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);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -16,70 +16,58 @@
|
||||
#include "loader.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef ptrdiff_t handle_type; /* C99's intptr_t not sufficiently portable */
|
||||
|
||||
struct DIR
|
||||
{
|
||||
handle_type handle; /* -1 for failed rewind */
|
||||
struct _finddata_t info;
|
||||
struct dirent result; /* d_name null iff first time */
|
||||
char *name; /* null-terminated char string */
|
||||
struct DIR {
|
||||
handle_type handle; /* -1 for failed rewind */
|
||||
struct _finddata_t info;
|
||||
struct dirent result; /* d_name null iff first time */
|
||||
char *name; /* null-terminated char string */
|
||||
};
|
||||
|
||||
DIR *opendir(const char *name)
|
||||
{
|
||||
DIR *opendir(const char *name) {
|
||||
DIR *dir = 0;
|
||||
|
||||
if(name && name[0])
|
||||
{
|
||||
if (name && name[0]) {
|
||||
size_t base_length = strlen(name);
|
||||
const char *all = /* search pattern must end with suitable wildcard */
|
||||
strchr("/\\", name[base_length - 1]) ? "*" : "/*";
|
||||
|
||||
if((dir = (DIR *) loader_tls_heap_alloc(sizeof *dir)) != 0 &&
|
||||
(dir->name = (char *) loader_tls_heap_alloc(base_length + strlen(all) + 1)) != 0)
|
||||
{
|
||||
if ((dir = (DIR *)loader_tls_heap_alloc(sizeof *dir)) != 0 &&
|
||||
(dir->name = (char *)loader_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 */
|
||||
} else /* rollback */
|
||||
{
|
||||
loader_tls_heap_free(dir->name);
|
||||
loader_tls_heap_free(dir);
|
||||
dir = 0;
|
||||
}
|
||||
}
|
||||
else /* rollback */
|
||||
} else /* rollback */
|
||||
{
|
||||
loader_tls_heap_free(dir);
|
||||
dir = 0;
|
||||
dir = 0;
|
||||
errno = ENOMEM;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
errno = EINVAL;
|
||||
}
|
||||
|
||||
return dir;
|
||||
}
|
||||
|
||||
int closedir(DIR *dir)
|
||||
{
|
||||
int closedir(DIR *dir) {
|
||||
int result = -1;
|
||||
|
||||
if(dir)
|
||||
{
|
||||
if(dir->handle != -1)
|
||||
{
|
||||
if (dir) {
|
||||
if (dir->handle != -1) {
|
||||
result = _findclose(dir->handle);
|
||||
}
|
||||
|
||||
@ -87,7 +75,7 @@ int closedir(DIR *dir)
|
||||
loader_tls_heap_free(dir);
|
||||
}
|
||||
|
||||
if(result == -1) /* map all errors to EBADF */
|
||||
if (result == -1) /* map all errors to EBADF */
|
||||
{
|
||||
errno = EBADF;
|
||||
}
|
||||
@ -95,36 +83,27 @@ int closedir(DIR *dir)
|
||||
return result;
|
||||
}
|
||||
|
||||
struct dirent *readdir(DIR *dir)
|
||||
{
|
||||
struct dirent *readdir(DIR *dir) {
|
||||
struct dirent *result = 0;
|
||||
|
||||
if(dir && dir->handle != -1)
|
||||
{
|
||||
if(!dir->result.d_name || _findnext(dir->handle, &dir->info) != -1)
|
||||
{
|
||||
result = &dir->result;
|
||||
if (dir && dir->handle != -1) {
|
||||
if (!dir->result.d_name || _findnext(dir->handle, &dir->info) != -1) {
|
||||
result = &dir->result;
|
||||
result->d_name = dir->info.name;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
errno = EBADF;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void rewinddir(DIR *dir)
|
||||
{
|
||||
if(dir && dir->handle != -1)
|
||||
{
|
||||
void rewinddir(DIR *dir) {
|
||||
if (dir && dir->handle != -1) {
|
||||
_findclose(dir->handle);
|
||||
dir->handle = (handle_type) _findfirst(dir->name, &dir->info);
|
||||
dir->handle = (handle_type)_findfirst(dir->name, &dir->info);
|
||||
dir->result.d_name = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
errno = EBADF;
|
||||
}
|
||||
}
|
||||
@ -136,12 +115,14 @@ void rewinddir(DIR *dir)
|
||||
/*
|
||||
|
||||
Copyright Kevlin Henney, 1997, 2003, 2012. All rights reserved.
|
||||
|
||||
Copyright (c) 2015 The Khronos Group Inc.
|
||||
Copyright (c) 2015 Valve Corporation
|
||||
Copyright (c) 2015 LunarG, Inc.
|
||||
Permission to use, copy, modify, and distribute this software and its
|
||||
documentation for any purpose is hereby granted without fee, provided
|
||||
that this copyright and permissions notice appear in all copies and
|
||||
derivatives.
|
||||
|
||||
|
||||
This software is supplied "as is" without express or implied warranty.
|
||||
|
||||
But that said, if there are any problems please get in touch.
|
||||
|
@ -8,35 +8,36 @@
|
||||
Author: Kevlin Henney (kevlin@acm.org, kevlin@curbralan.com)
|
||||
History: Created March 1997. Updated June 2003.
|
||||
Rights: See end of file.
|
||||
|
||||
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct DIR DIR;
|
||||
|
||||
struct dirent
|
||||
{
|
||||
struct dirent {
|
||||
char *d_name;
|
||||
};
|
||||
|
||||
DIR *opendir(const char *);
|
||||
int closedir(DIR *);
|
||||
DIR *opendir(const char *);
|
||||
int closedir(DIR *);
|
||||
struct dirent *readdir(DIR *);
|
||||
void rewinddir(DIR *);
|
||||
void rewinddir(DIR *);
|
||||
|
||||
/*
|
||||
|
||||
Copyright Kevlin Henney, 1997, 2003. All rights reserved.
|
||||
Copyright (c) 2015 The Khronos Group Inc.
|
||||
Copyright (c) 2015 Valve Corporation
|
||||
Copyright (c) 2015 LunarG, Inc.
|
||||
|
||||
Permission to use, copy, modify, and distribute this software and its
|
||||
documentation for any purpose is hereby granted without fee, provided
|
||||
that this copyright and permissions notice appear in all copies and
|
||||
derivatives.
|
||||
|
||||
|
||||
This software is supplied "as is" without express or implied warranty.
|
||||
|
||||
But that said, if there are any problems please get in touch.
|
||||
|
@ -1,306 +1,311 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (C) 2015 Valve Corporation
|
||||
* Copyright (c) 2015 The Khronos Group Inc.
|
||||
* Copyright (c) 2015 Valve Corporation
|
||||
* Copyright (c) 2015 LunarG, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
* 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 Software.
|
||||
* The above copyright notice(s) and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Materials.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* The Materials are Confidential Information as defined by the Khronos
|
||||
* Membership Agreement until designated non-confidential by Khronos, at which
|
||||
* point this condition clause shall be removed.
|
||||
*
|
||||
* 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 SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
* 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.
|
||||
*
|
||||
* Author: Cody Northrop <cody@lunarg.com>
|
||||
* Author: Jon Ashburn <jon@lunarg.com>
|
||||
* Author: Tony Barbour <tony@LunarG.com>
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include "debug_report.h"
|
||||
#include "wsi.h"
|
||||
|
||||
static inline void* trampolineGetProcAddr(struct loader_instance *inst,
|
||||
const char *funcName)
|
||||
{
|
||||
//Don't include or check global functions
|
||||
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;
|
||||
return (PFN_vkVoidFunction)vkGetInstanceProcAddr;
|
||||
if (!strcmp(funcName, "vkDestroyInstance"))
|
||||
return (PFN_vkVoidFunction) vkDestroyInstance;
|
||||
return (PFN_vkVoidFunction)vkDestroyInstance;
|
||||
if (!strcmp(funcName, "vkEnumeratePhysicalDevices"))
|
||||
return (PFN_vkVoidFunction) vkEnumeratePhysicalDevices;
|
||||
return (PFN_vkVoidFunction)vkEnumeratePhysicalDevices;
|
||||
if (!strcmp(funcName, "vkGetPhysicalDeviceFeatures"))
|
||||
return (PFN_vkVoidFunction) vkGetPhysicalDeviceFeatures;
|
||||
return (PFN_vkVoidFunction)vkGetPhysicalDeviceFeatures;
|
||||
if (!strcmp(funcName, "vkGetPhysicalDeviceFormatProperties"))
|
||||
return (PFN_vkVoidFunction) vkGetPhysicalDeviceFormatProperties;
|
||||
return (PFN_vkVoidFunction)vkGetPhysicalDeviceFormatProperties;
|
||||
if (!strcmp(funcName, "vkGetPhysicalDeviceImageFormatProperties"))
|
||||
return (PFN_vkVoidFunction) vkGetPhysicalDeviceImageFormatProperties;
|
||||
return (PFN_vkVoidFunction)vkGetPhysicalDeviceImageFormatProperties;
|
||||
if (!strcmp(funcName, "vkGetPhysicalDeviceSparseImageFormatProperties"))
|
||||
return(PFN_vkVoidFunction) vkGetPhysicalDeviceSparseImageFormatProperties;
|
||||
return (
|
||||
PFN_vkVoidFunction)vkGetPhysicalDeviceSparseImageFormatProperties;
|
||||
if (!strcmp(funcName, "vkGetPhysicalDeviceProperties"))
|
||||
return (PFN_vkVoidFunction) vkGetPhysicalDeviceProperties;
|
||||
return (PFN_vkVoidFunction)vkGetPhysicalDeviceProperties;
|
||||
if (!strcmp(funcName, "vkGetPhysicalDeviceQueueFamilyProperties"))
|
||||
return (PFN_vkVoidFunction) vkGetPhysicalDeviceQueueFamilyProperties;
|
||||
return (PFN_vkVoidFunction)vkGetPhysicalDeviceQueueFamilyProperties;
|
||||
if (!strcmp(funcName, "vkGetPhysicalDeviceMemoryProperties"))
|
||||
return (PFN_vkVoidFunction) vkGetPhysicalDeviceMemoryProperties;
|
||||
return (PFN_vkVoidFunction)vkGetPhysicalDeviceMemoryProperties;
|
||||
if (!strcmp(funcName, "vkEnumerateDeviceLayerProperties"))
|
||||
return (PFN_vkVoidFunction) vkEnumerateDeviceLayerProperties;
|
||||
return (PFN_vkVoidFunction)vkEnumerateDeviceLayerProperties;
|
||||
if (!strcmp(funcName, "vkEnumerateDeviceExtensionProperties"))
|
||||
return (PFN_vkVoidFunction) vkEnumerateDeviceExtensionProperties;
|
||||
return (PFN_vkVoidFunction)vkEnumerateDeviceExtensionProperties;
|
||||
if (!strcmp(funcName, "vkCreateDevice"))
|
||||
return (PFN_vkVoidFunction) vkCreateDevice;
|
||||
return (PFN_vkVoidFunction)vkCreateDevice;
|
||||
if (!strcmp(funcName, "vkGetDeviceProcAddr"))
|
||||
return (PFN_vkVoidFunction) vkGetDeviceProcAddr;
|
||||
return (PFN_vkVoidFunction)vkGetDeviceProcAddr;
|
||||
if (!strcmp(funcName, "vkDestroyDevice"))
|
||||
return (PFN_vkVoidFunction) vkDestroyDevice;
|
||||
return (PFN_vkVoidFunction)vkDestroyDevice;
|
||||
if (!strcmp(funcName, "vkGetDeviceQueue"))
|
||||
return (PFN_vkVoidFunction) vkGetDeviceQueue;
|
||||
return (PFN_vkVoidFunction)vkGetDeviceQueue;
|
||||
if (!strcmp(funcName, "vkQueueSubmit"))
|
||||
return (PFN_vkVoidFunction) vkQueueSubmit;
|
||||
return (PFN_vkVoidFunction)vkQueueSubmit;
|
||||
if (!strcmp(funcName, "vkQueueWaitIdle"))
|
||||
return (PFN_vkVoidFunction) vkQueueWaitIdle;
|
||||
return (PFN_vkVoidFunction)vkQueueWaitIdle;
|
||||
if (!strcmp(funcName, "vkDeviceWaitIdle"))
|
||||
return (PFN_vkVoidFunction) vkDeviceWaitIdle;
|
||||
return (PFN_vkVoidFunction)vkDeviceWaitIdle;
|
||||
if (!strcmp(funcName, "vkAllocateMemory"))
|
||||
return (PFN_vkVoidFunction) vkAllocateMemory;
|
||||
return (PFN_vkVoidFunction)vkAllocateMemory;
|
||||
if (!strcmp(funcName, "vkFreeMemory"))
|
||||
return (PFN_vkVoidFunction) vkFreeMemory;
|
||||
return (PFN_vkVoidFunction)vkFreeMemory;
|
||||
if (!strcmp(funcName, "vkMapMemory"))
|
||||
return (PFN_vkVoidFunction) vkMapMemory;
|
||||
return (PFN_vkVoidFunction)vkMapMemory;
|
||||
if (!strcmp(funcName, "vkUnmapMemory"))
|
||||
return (PFN_vkVoidFunction) vkUnmapMemory;
|
||||
return (PFN_vkVoidFunction)vkUnmapMemory;
|
||||
if (!strcmp(funcName, "vkFlushMappedMemoryRanges"))
|
||||
return (PFN_vkVoidFunction) vkFlushMappedMemoryRanges;
|
||||
return (PFN_vkVoidFunction)vkFlushMappedMemoryRanges;
|
||||
if (!strcmp(funcName, "vkInvalidateMappedMemoryRanges"))
|
||||
return (PFN_vkVoidFunction) vkInvalidateMappedMemoryRanges;
|
||||
return (PFN_vkVoidFunction)vkInvalidateMappedMemoryRanges;
|
||||
if (!strcmp(funcName, "vkGetDeviceMemoryCommitment"))
|
||||
return (PFN_vkVoidFunction) vkGetDeviceMemoryCommitment;
|
||||
return (PFN_vkVoidFunction)vkGetDeviceMemoryCommitment;
|
||||
if (!strcmp(funcName, "vkGetImageSparseMemoryRequirements"))
|
||||
return (PFN_vkVoidFunction) vkGetImageSparseMemoryRequirements;
|
||||
return (PFN_vkVoidFunction)vkGetImageSparseMemoryRequirements;
|
||||
if (!strcmp(funcName, "vkGetImageMemoryRequirements"))
|
||||
return (PFN_vkVoidFunction) vkGetImageMemoryRequirements;
|
||||
return (PFN_vkVoidFunction)vkGetImageMemoryRequirements;
|
||||
if (!strcmp(funcName, "vkGetBufferMemoryRequirements"))
|
||||
return (PFN_vkVoidFunction) vkGetBufferMemoryRequirements;
|
||||
return (PFN_vkVoidFunction)vkGetBufferMemoryRequirements;
|
||||
if (!strcmp(funcName, "vkBindImageMemory"))
|
||||
return (PFN_vkVoidFunction) vkBindImageMemory;
|
||||
return (PFN_vkVoidFunction)vkBindImageMemory;
|
||||
if (!strcmp(funcName, "vkBindBufferMemory"))
|
||||
return (PFN_vkVoidFunction) vkBindBufferMemory;
|
||||
return (PFN_vkVoidFunction)vkBindBufferMemory;
|
||||
if (!strcmp(funcName, "vkQueueBindSparse"))
|
||||
return (PFN_vkVoidFunction) vkQueueBindSparse;
|
||||
return (PFN_vkVoidFunction)vkQueueBindSparse;
|
||||
if (!strcmp(funcName, "vkCreateFence"))
|
||||
return (PFN_vkVoidFunction) vkCreateFence;
|
||||
return (PFN_vkVoidFunction)vkCreateFence;
|
||||
if (!strcmp(funcName, "vkDestroyFence"))
|
||||
return (PFN_vkVoidFunction) vkDestroyFence;
|
||||
return (PFN_vkVoidFunction)vkDestroyFence;
|
||||
if (!strcmp(funcName, "vkGetFenceStatus"))
|
||||
return (PFN_vkVoidFunction) vkGetFenceStatus;
|
||||
return (PFN_vkVoidFunction)vkGetFenceStatus;
|
||||
if (!strcmp(funcName, "vkResetFences"))
|
||||
return (PFN_vkVoidFunction) vkResetFences;
|
||||
return (PFN_vkVoidFunction)vkResetFences;
|
||||
if (!strcmp(funcName, "vkWaitForFences"))
|
||||
return (PFN_vkVoidFunction) vkWaitForFences;
|
||||
return (PFN_vkVoidFunction)vkWaitForFences;
|
||||
if (!strcmp(funcName, "vkCreateSemaphore"))
|
||||
return (PFN_vkVoidFunction) vkCreateSemaphore;
|
||||
return (PFN_vkVoidFunction)vkCreateSemaphore;
|
||||
if (!strcmp(funcName, "vkDestroySemaphore"))
|
||||
return (PFN_vkVoidFunction) vkDestroySemaphore;
|
||||
return (PFN_vkVoidFunction)vkDestroySemaphore;
|
||||
if (!strcmp(funcName, "vkCreateEvent"))
|
||||
return (PFN_vkVoidFunction) vkCreateEvent;
|
||||
return (PFN_vkVoidFunction)vkCreateEvent;
|
||||
if (!strcmp(funcName, "vkDestroyEvent"))
|
||||
return (PFN_vkVoidFunction) vkDestroyEvent;
|
||||
return (PFN_vkVoidFunction)vkDestroyEvent;
|
||||
if (!strcmp(funcName, "vkGetEventStatus"))
|
||||
return (PFN_vkVoidFunction) vkGetEventStatus;
|
||||
return (PFN_vkVoidFunction)vkGetEventStatus;
|
||||
if (!strcmp(funcName, "vkSetEvent"))
|
||||
return (PFN_vkVoidFunction) vkSetEvent;
|
||||
return (PFN_vkVoidFunction)vkSetEvent;
|
||||
if (!strcmp(funcName, "vkResetEvent"))
|
||||
return (PFN_vkVoidFunction) vkResetEvent;
|
||||
return (PFN_vkVoidFunction)vkResetEvent;
|
||||
if (!strcmp(funcName, "vkCreateQueryPool"))
|
||||
return (PFN_vkVoidFunction) vkCreateQueryPool;
|
||||
return (PFN_vkVoidFunction)vkCreateQueryPool;
|
||||
if (!strcmp(funcName, "vkDestroyQueryPool"))
|
||||
return (PFN_vkVoidFunction) vkDestroyQueryPool;
|
||||
return (PFN_vkVoidFunction)vkDestroyQueryPool;
|
||||
if (!strcmp(funcName, "vkGetQueryPoolResults"))
|
||||
return (PFN_vkVoidFunction) vkGetQueryPoolResults;
|
||||
return (PFN_vkVoidFunction)vkGetQueryPoolResults;
|
||||
if (!strcmp(funcName, "vkCreateBuffer"))
|
||||
return (PFN_vkVoidFunction) vkCreateBuffer;
|
||||
return (PFN_vkVoidFunction)vkCreateBuffer;
|
||||
if (!strcmp(funcName, "vkDestroyBuffer"))
|
||||
return (PFN_vkVoidFunction) vkDestroyBuffer;
|
||||
return (PFN_vkVoidFunction)vkDestroyBuffer;
|
||||
if (!strcmp(funcName, "vkCreateBufferView"))
|
||||
return (PFN_vkVoidFunction) vkCreateBufferView;
|
||||
return (PFN_vkVoidFunction)vkCreateBufferView;
|
||||
if (!strcmp(funcName, "vkDestroyBufferView"))
|
||||
return (PFN_vkVoidFunction) vkDestroyBufferView;
|
||||
return (PFN_vkVoidFunction)vkDestroyBufferView;
|
||||
if (!strcmp(funcName, "vkCreateImage"))
|
||||
return (PFN_vkVoidFunction) vkCreateImage;
|
||||
return (PFN_vkVoidFunction)vkCreateImage;
|
||||
if (!strcmp(funcName, "vkDestroyImage"))
|
||||
return (PFN_vkVoidFunction) vkDestroyImage;
|
||||
return (PFN_vkVoidFunction)vkDestroyImage;
|
||||
if (!strcmp(funcName, "vkGetImageSubresourceLayout"))
|
||||
return (PFN_vkVoidFunction) vkGetImageSubresourceLayout;
|
||||
return (PFN_vkVoidFunction)vkGetImageSubresourceLayout;
|
||||
if (!strcmp(funcName, "vkCreateImageView"))
|
||||
return (PFN_vkVoidFunction) vkCreateImageView;
|
||||
return (PFN_vkVoidFunction)vkCreateImageView;
|
||||
if (!strcmp(funcName, "vkDestroyImageView"))
|
||||
return (PFN_vkVoidFunction) vkDestroyImageView;
|
||||
return (PFN_vkVoidFunction)vkDestroyImageView;
|
||||
if (!strcmp(funcName, "vkCreateShaderModule"))
|
||||
return (PFN_vkVoidFunction) vkCreateShaderModule;
|
||||
return (PFN_vkVoidFunction)vkCreateShaderModule;
|
||||
if (!strcmp(funcName, "vkDestroyShaderModule"))
|
||||
return (PFN_vkVoidFunction) vkDestroyShaderModule;
|
||||
return (PFN_vkVoidFunction)vkDestroyShaderModule;
|
||||
if (!strcmp(funcName, "vkCreatePipelineCache"))
|
||||
return (PFN_vkVoidFunction) vkCreatePipelineCache;
|
||||
return (PFN_vkVoidFunction)vkCreatePipelineCache;
|
||||
if (!strcmp(funcName, "vkDestroyPipelineCache"))
|
||||
return (PFN_vkVoidFunction) vkDestroyPipelineCache;
|
||||
return (PFN_vkVoidFunction)vkDestroyPipelineCache;
|
||||
if (!strcmp(funcName, "vkGetPipelineCacheData"))
|
||||
return (PFN_vkVoidFunction) vkGetPipelineCacheData;
|
||||
return (PFN_vkVoidFunction)vkGetPipelineCacheData;
|
||||
if (!strcmp(funcName, "vkMergePipelineCaches"))
|
||||
return (PFN_vkVoidFunction) vkMergePipelineCaches;
|
||||
return (PFN_vkVoidFunction)vkMergePipelineCaches;
|
||||
if (!strcmp(funcName, "vkCreateGraphicsPipelines"))
|
||||
return (PFN_vkVoidFunction) vkCreateGraphicsPipelines;
|
||||
return (PFN_vkVoidFunction)vkCreateGraphicsPipelines;
|
||||
if (!strcmp(funcName, "vkCreateComputePipelines"))
|
||||
return (PFN_vkVoidFunction) vkCreateComputePipelines;
|
||||
return (PFN_vkVoidFunction)vkCreateComputePipelines;
|
||||
if (!strcmp(funcName, "vkDestroyPipeline"))
|
||||
return (PFN_vkVoidFunction) vkDestroyPipeline;
|
||||
return (PFN_vkVoidFunction)vkDestroyPipeline;
|
||||
if (!strcmp(funcName, "vkCreatePipelineLayout"))
|
||||
return (PFN_vkVoidFunction) vkCreatePipelineLayout;
|
||||
return (PFN_vkVoidFunction)vkCreatePipelineLayout;
|
||||
if (!strcmp(funcName, "vkDestroyPipelineLayout"))
|
||||
return (PFN_vkVoidFunction) vkDestroyPipelineLayout;
|
||||
return (PFN_vkVoidFunction)vkDestroyPipelineLayout;
|
||||
if (!strcmp(funcName, "vkCreateSampler"))
|
||||
return (PFN_vkVoidFunction) vkCreateSampler;
|
||||
return (PFN_vkVoidFunction)vkCreateSampler;
|
||||
if (!strcmp(funcName, "vkDestroySampler"))
|
||||
return (PFN_vkVoidFunction) vkDestroySampler;
|
||||
return (PFN_vkVoidFunction)vkDestroySampler;
|
||||
if (!strcmp(funcName, "vkCreateDescriptorSetLayout"))
|
||||
return (PFN_vkVoidFunction) vkCreateDescriptorSetLayout;
|
||||
return (PFN_vkVoidFunction)vkCreateDescriptorSetLayout;
|
||||
if (!strcmp(funcName, "vkDestroyDescriptorSetLayout"))
|
||||
return (PFN_vkVoidFunction) vkDestroyDescriptorSetLayout;
|
||||
return (PFN_vkVoidFunction)vkDestroyDescriptorSetLayout;
|
||||
if (!strcmp(funcName, "vkCreateDescriptorPool"))
|
||||
return (PFN_vkVoidFunction) vkCreateDescriptorPool;
|
||||
return (PFN_vkVoidFunction)vkCreateDescriptorPool;
|
||||
if (!strcmp(funcName, "vkDestroyDescriptorPool"))
|
||||
return (PFN_vkVoidFunction) vkDestroyDescriptorPool;
|
||||
return (PFN_vkVoidFunction)vkDestroyDescriptorPool;
|
||||
if (!strcmp(funcName, "vkResetDescriptorPool"))
|
||||
return (PFN_vkVoidFunction) vkResetDescriptorPool;
|
||||
return (PFN_vkVoidFunction)vkResetDescriptorPool;
|
||||
if (!strcmp(funcName, "vkAllocateDescriptorSets"))
|
||||
return (PFN_vkVoidFunction) vkAllocateDescriptorSets;
|
||||
return (PFN_vkVoidFunction)vkAllocateDescriptorSets;
|
||||
if (!strcmp(funcName, "vkFreeDescriptorSets"))
|
||||
return (PFN_vkVoidFunction) vkFreeDescriptorSets;
|
||||
return (PFN_vkVoidFunction)vkFreeDescriptorSets;
|
||||
if (!strcmp(funcName, "vkUpdateDescriptorSets"))
|
||||
return (PFN_vkVoidFunction) vkUpdateDescriptorSets;
|
||||
return (PFN_vkVoidFunction)vkUpdateDescriptorSets;
|
||||
if (!strcmp(funcName, "vkCreateFramebuffer"))
|
||||
return (PFN_vkVoidFunction) vkCreateFramebuffer;
|
||||
return (PFN_vkVoidFunction)vkCreateFramebuffer;
|
||||
if (!strcmp(funcName, "vkDestroyFramebuffer"))
|
||||
return (PFN_vkVoidFunction) vkDestroyFramebuffer;
|
||||
return (PFN_vkVoidFunction)vkDestroyFramebuffer;
|
||||
if (!strcmp(funcName, "vkCreateRenderPass"))
|
||||
return (PFN_vkVoidFunction) vkCreateRenderPass;
|
||||
return (PFN_vkVoidFunction)vkCreateRenderPass;
|
||||
if (!strcmp(funcName, "vkDestroyRenderPass"))
|
||||
return (PFN_vkVoidFunction) vkDestroyRenderPass;
|
||||
return (PFN_vkVoidFunction)vkDestroyRenderPass;
|
||||
if (!strcmp(funcName, "vkGetRenderAreaGranularity"))
|
||||
return (PFN_vkVoidFunction) vkGetRenderAreaGranularity;
|
||||
return (PFN_vkVoidFunction)vkGetRenderAreaGranularity;
|
||||
if (!strcmp(funcName, "vkCreateCommandPool"))
|
||||
return (PFN_vkVoidFunction) vkCreateCommandPool;
|
||||
return (PFN_vkVoidFunction)vkCreateCommandPool;
|
||||
if (!strcmp(funcName, "vkDestroyCommandPool"))
|
||||
return (PFN_vkVoidFunction) vkDestroyCommandPool;
|
||||
return (PFN_vkVoidFunction)vkDestroyCommandPool;
|
||||
if (!strcmp(funcName, "vkResetCommandPool"))
|
||||
return (PFN_vkVoidFunction) vkResetCommandPool;
|
||||
return (PFN_vkVoidFunction)vkResetCommandPool;
|
||||
if (!strcmp(funcName, "vkAllocateCommandBuffers"))
|
||||
return (PFN_vkVoidFunction) vkAllocateCommandBuffers;
|
||||
return (PFN_vkVoidFunction)vkAllocateCommandBuffers;
|
||||
if (!strcmp(funcName, "vkFreeCommandBuffers"))
|
||||
return (PFN_vkVoidFunction) vkFreeCommandBuffers;
|
||||
return (PFN_vkVoidFunction)vkFreeCommandBuffers;
|
||||
if (!strcmp(funcName, "vkBeginCommandBuffer"))
|
||||
return (PFN_vkVoidFunction) vkBeginCommandBuffer;
|
||||
return (PFN_vkVoidFunction)vkBeginCommandBuffer;
|
||||
if (!strcmp(funcName, "vkEndCommandBuffer"))
|
||||
return (PFN_vkVoidFunction) vkEndCommandBuffer;
|
||||
return (PFN_vkVoidFunction)vkEndCommandBuffer;
|
||||
if (!strcmp(funcName, "vkResetCommandBuffer"))
|
||||
return (PFN_vkVoidFunction) vkResetCommandBuffer;
|
||||
return (PFN_vkVoidFunction)vkResetCommandBuffer;
|
||||
if (!strcmp(funcName, "vkCmdBindPipeline"))
|
||||
return (PFN_vkVoidFunction) vkCmdBindPipeline;
|
||||
return (PFN_vkVoidFunction)vkCmdBindPipeline;
|
||||
if (!strcmp(funcName, "vkCmdBindDescriptorSets"))
|
||||
return (PFN_vkVoidFunction) vkCmdBindDescriptorSets;
|
||||
return (PFN_vkVoidFunction)vkCmdBindDescriptorSets;
|
||||
if (!strcmp(funcName, "vkCmdBindVertexBuffers"))
|
||||
return (PFN_vkVoidFunction) vkCmdBindVertexBuffers;
|
||||
return (PFN_vkVoidFunction)vkCmdBindVertexBuffers;
|
||||
if (!strcmp(funcName, "vkCmdBindIndexBuffer"))
|
||||
return (PFN_vkVoidFunction) vkCmdBindIndexBuffer;
|
||||
return (PFN_vkVoidFunction)vkCmdBindIndexBuffer;
|
||||
if (!strcmp(funcName, "vkCmdSetViewport"))
|
||||
return (PFN_vkVoidFunction) vkCmdSetViewport;
|
||||
return (PFN_vkVoidFunction)vkCmdSetViewport;
|
||||
if (!strcmp(funcName, "vkCmdSetScissor"))
|
||||
return (PFN_vkVoidFunction) vkCmdSetScissor;
|
||||
return (PFN_vkVoidFunction)vkCmdSetScissor;
|
||||
if (!strcmp(funcName, "vkCmdSetLineWidth"))
|
||||
return (PFN_vkVoidFunction) vkCmdSetLineWidth;
|
||||
return (PFN_vkVoidFunction)vkCmdSetLineWidth;
|
||||
if (!strcmp(funcName, "vkCmdSetDepthBias"))
|
||||
return (PFN_vkVoidFunction) vkCmdSetDepthBias;
|
||||
return (PFN_vkVoidFunction)vkCmdSetDepthBias;
|
||||
if (!strcmp(funcName, "vkCmdSetBlendConstants"))
|
||||
return (PFN_vkVoidFunction) vkCmdSetBlendConstants;
|
||||
return (PFN_vkVoidFunction)vkCmdSetBlendConstants;
|
||||
if (!strcmp(funcName, "vkCmdSetDepthBounds"))
|
||||
return (PFN_vkVoidFunction) vkCmdSetDepthBounds;
|
||||
return (PFN_vkVoidFunction)vkCmdSetDepthBounds;
|
||||
if (!strcmp(funcName, "vkCmdSetStencilCompareMask"))
|
||||
return (PFN_vkVoidFunction) vkCmdSetStencilCompareMask;
|
||||
return (PFN_vkVoidFunction)vkCmdSetStencilCompareMask;
|
||||
if (!strcmp(funcName, "vkCmdSetStencilWriteMask"))
|
||||
return (PFN_vkVoidFunction) vkCmdSetStencilWriteMask;
|
||||
return (PFN_vkVoidFunction)vkCmdSetStencilWriteMask;
|
||||
if (!strcmp(funcName, "vkCmdSetStencilReference"))
|
||||
return (PFN_vkVoidFunction) vkCmdSetStencilReference;
|
||||
return (PFN_vkVoidFunction)vkCmdSetStencilReference;
|
||||
if (!strcmp(funcName, "vkCmdDraw"))
|
||||
return (PFN_vkVoidFunction) vkCmdDraw;
|
||||
return (PFN_vkVoidFunction)vkCmdDraw;
|
||||
if (!strcmp(funcName, "vkCmdDrawIndexed"))
|
||||
return (PFN_vkVoidFunction) vkCmdDrawIndexed;
|
||||
return (PFN_vkVoidFunction)vkCmdDrawIndexed;
|
||||
if (!strcmp(funcName, "vkCmdDrawIndirect"))
|
||||
return (PFN_vkVoidFunction) vkCmdDrawIndirect;
|
||||
return (PFN_vkVoidFunction)vkCmdDrawIndirect;
|
||||
if (!strcmp(funcName, "vkCmdDrawIndexedIndirect"))
|
||||
return (PFN_vkVoidFunction) vkCmdDrawIndexedIndirect;
|
||||
return (PFN_vkVoidFunction)vkCmdDrawIndexedIndirect;
|
||||
if (!strcmp(funcName, "vkCmdDispatch"))
|
||||
return (PFN_vkVoidFunction) vkCmdDispatch;
|
||||
return (PFN_vkVoidFunction)vkCmdDispatch;
|
||||
if (!strcmp(funcName, "vkCmdDispatchIndirect"))
|
||||
return (PFN_vkVoidFunction) vkCmdDispatchIndirect;
|
||||
return (PFN_vkVoidFunction)vkCmdDispatchIndirect;
|
||||
if (!strcmp(funcName, "vkCmdCopyBuffer"))
|
||||
return (PFN_vkVoidFunction) vkCmdCopyBuffer;
|
||||
return (PFN_vkVoidFunction)vkCmdCopyBuffer;
|
||||
if (!strcmp(funcName, "vkCmdCopyImage"))
|
||||
return (PFN_vkVoidFunction) vkCmdCopyImage;
|
||||
return (PFN_vkVoidFunction)vkCmdCopyImage;
|
||||
if (!strcmp(funcName, "vkCmdBlitImage"))
|
||||
return (PFN_vkVoidFunction) vkCmdBlitImage;
|
||||
return (PFN_vkVoidFunction)vkCmdBlitImage;
|
||||
if (!strcmp(funcName, "vkCmdCopyBufferToImage"))
|
||||
return (PFN_vkVoidFunction) vkCmdCopyBufferToImage;
|
||||
return (PFN_vkVoidFunction)vkCmdCopyBufferToImage;
|
||||
if (!strcmp(funcName, "vkCmdCopyImageToBuffer"))
|
||||
return (PFN_vkVoidFunction) vkCmdCopyImageToBuffer;
|
||||
return (PFN_vkVoidFunction)vkCmdCopyImageToBuffer;
|
||||
if (!strcmp(funcName, "vkCmdUpdateBuffer"))
|
||||
return (PFN_vkVoidFunction) vkCmdUpdateBuffer;
|
||||
return (PFN_vkVoidFunction)vkCmdUpdateBuffer;
|
||||
if (!strcmp(funcName, "vkCmdFillBuffer"))
|
||||
return (PFN_vkVoidFunction) vkCmdFillBuffer;
|
||||
return (PFN_vkVoidFunction)vkCmdFillBuffer;
|
||||
if (!strcmp(funcName, "vkCmdClearColorImage"))
|
||||
return (PFN_vkVoidFunction) vkCmdClearColorImage;
|
||||
return (PFN_vkVoidFunction)vkCmdClearColorImage;
|
||||
if (!strcmp(funcName, "vkCmdClearDepthStencilImage"))
|
||||
return (PFN_vkVoidFunction) vkCmdClearDepthStencilImage;
|
||||
return (PFN_vkVoidFunction)vkCmdClearDepthStencilImage;
|
||||
if (!strcmp(funcName, "vkCmdClearAttachments"))
|
||||
return (PFN_vkVoidFunction) vkCmdClearAttachments;
|
||||
return (PFN_vkVoidFunction)vkCmdClearAttachments;
|
||||
if (!strcmp(funcName, "vkCmdResolveImage"))
|
||||
return (PFN_vkVoidFunction) vkCmdResolveImage;
|
||||
return (PFN_vkVoidFunction)vkCmdResolveImage;
|
||||
if (!strcmp(funcName, "vkCmdSetEvent"))
|
||||
return (PFN_vkVoidFunction) vkCmdSetEvent;
|
||||
return (PFN_vkVoidFunction)vkCmdSetEvent;
|
||||
if (!strcmp(funcName, "vkCmdResetEvent"))
|
||||
return (PFN_vkVoidFunction) vkCmdResetEvent;
|
||||
return (PFN_vkVoidFunction)vkCmdResetEvent;
|
||||
if (!strcmp(funcName, "vkCmdWaitEvents"))
|
||||
return (PFN_vkVoidFunction) vkCmdWaitEvents;
|
||||
return (PFN_vkVoidFunction)vkCmdWaitEvents;
|
||||
if (!strcmp(funcName, "vkCmdPipelineBarrier"))
|
||||
return (PFN_vkVoidFunction) vkCmdPipelineBarrier;
|
||||
return (PFN_vkVoidFunction)vkCmdPipelineBarrier;
|
||||
if (!strcmp(funcName, "vkCmdBeginQuery"))
|
||||
return (PFN_vkVoidFunction) vkCmdBeginQuery;
|
||||
return (PFN_vkVoidFunction)vkCmdBeginQuery;
|
||||
if (!strcmp(funcName, "vkCmdEndQuery"))
|
||||
return (PFN_vkVoidFunction) vkCmdEndQuery;
|
||||
return (PFN_vkVoidFunction)vkCmdEndQuery;
|
||||
if (!strcmp(funcName, "vkCmdResetQueryPool"))
|
||||
return (PFN_vkVoidFunction) vkCmdResetQueryPool;
|
||||
return (PFN_vkVoidFunction)vkCmdResetQueryPool;
|
||||
if (!strcmp(funcName, "vkCmdWriteTimestamp"))
|
||||
return (PFN_vkVoidFunction) vkCmdWriteTimestamp;
|
||||
return (PFN_vkVoidFunction)vkCmdWriteTimestamp;
|
||||
if (!strcmp(funcName, "vkCmdCopyQueryPoolResults"))
|
||||
return (PFN_vkVoidFunction) vkCmdCopyQueryPoolResults;
|
||||
return (PFN_vkVoidFunction)vkCmdCopyQueryPoolResults;
|
||||
if (!strcmp(funcName, "vkCmdPushConstants"))
|
||||
return (PFN_vkVoidFunction) vkCmdPushConstants;
|
||||
return (PFN_vkVoidFunction)vkCmdPushConstants;
|
||||
if (!strcmp(funcName, "vkCmdBeginRenderPass"))
|
||||
return (PFN_vkVoidFunction) vkCmdBeginRenderPass;
|
||||
return (PFN_vkVoidFunction)vkCmdBeginRenderPass;
|
||||
if (!strcmp(funcName, "vkCmdNextSubpass"))
|
||||
return (PFN_vkVoidFunction) vkCmdNextSubpass;
|
||||
return (PFN_vkVoidFunction)vkCmdNextSubpass;
|
||||
if (!strcmp(funcName, "vkCmdEndRenderPass"))
|
||||
return (PFN_vkVoidFunction) vkCmdEndRenderPass;
|
||||
return (PFN_vkVoidFunction)vkCmdEndRenderPass;
|
||||
if (!strcmp(funcName, "vkCmdExecuteCommands"))
|
||||
return (PFN_vkVoidFunction) vkCmdExecuteCommands;
|
||||
return (PFN_vkVoidFunction)vkCmdExecuteCommands;
|
||||
|
||||
// Instance extensions
|
||||
void *addr;
|
||||
@ -314,18 +319,17 @@ static inline void* trampolineGetProcAddr(struct loader_instance *inst,
|
||||
return addr;
|
||||
}
|
||||
|
||||
static inline void* globalGetProcAddr(const char *name)
|
||||
{
|
||||
static inline void *globalGetProcAddr(const char *name) {
|
||||
if (!name || name[0] != 'v' || name[1] != 'k')
|
||||
return NULL;
|
||||
|
||||
name += 2;
|
||||
if (!strcmp(name, "CreateInstance"))
|
||||
return (void*) vkCreateInstance;
|
||||
return (void *)vkCreateInstance;
|
||||
if (!strcmp(name, "EnumerateInstanceExtensionProperties"))
|
||||
return (void*) vkEnumerateInstanceExtensionProperties;
|
||||
return (void *)vkEnumerateInstanceExtensionProperties;
|
||||
if (!strcmp(name, "EnumerateInstanceLayerProperties"))
|
||||
return (void*) vkEnumerateInstanceLayerProperties;
|
||||
return (void *)vkEnumerateInstanceLayerProperties;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@ -334,48 +338,46 @@ static inline void* globalGetProcAddr(const char *name)
|
||||
* They are not just generic trampoline code entrypoints.
|
||||
* Thus GPA must return loader entrypoint for these instead of first function
|
||||
* in the chain. */
|
||||
static inline void *loader_non_passthrough_gipa(const char *name)
|
||||
{
|
||||
static inline void *loader_non_passthrough_gipa(const char *name) {
|
||||
if (!name || name[0] != 'v' || name[1] != 'k')
|
||||
return NULL;
|
||||
|
||||
name += 2;
|
||||
if (!strcmp(name, "CreateInstance"))
|
||||
return (void*) vkCreateInstance;
|
||||
return (void *)vkCreateInstance;
|
||||
if (!strcmp(name, "DestroyInstance"))
|
||||
return (void*) vkDestroyInstance;
|
||||
return (void *)vkDestroyInstance;
|
||||
if (!strcmp(name, "GetDeviceProcAddr"))
|
||||
return (void*) vkGetDeviceProcAddr;
|
||||
// remove once no longer locks
|
||||
return (void *)vkGetDeviceProcAddr;
|
||||
// remove once no longer locks
|
||||
if (!strcmp(name, "EnumeratePhysicalDevices"))
|
||||
return (void*) vkEnumeratePhysicalDevices;
|
||||
return (void *)vkEnumeratePhysicalDevices;
|
||||
if (!strcmp(name, "EnumerateDeviceExtensionProperties"))
|
||||
return (void*) vkEnumerateDeviceExtensionProperties;
|
||||
return (void *)vkEnumerateDeviceExtensionProperties;
|
||||
if (!strcmp(name, "EnumerateDeviceLayerProperties"))
|
||||
return (void*) vkEnumerateDeviceLayerProperties;
|
||||
return (void *)vkEnumerateDeviceLayerProperties;
|
||||
if (!strcmp(name, "GetInstanceProcAddr"))
|
||||
return (void*) vkGetInstanceProcAddr;
|
||||
return (void *)vkGetInstanceProcAddr;
|
||||
if (!strcmp(name, "CreateDevice"))
|
||||
return (void*) vkCreateDevice;
|
||||
return (void *)vkCreateDevice;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline void *loader_non_passthrough_gdpa(const char *name)
|
||||
{
|
||||
static inline void *loader_non_passthrough_gdpa(const char *name) {
|
||||
if (!name || name[0] != 'v' || name[1] != 'k')
|
||||
return NULL;
|
||||
|
||||
name += 2;
|
||||
|
||||
if (!strcmp(name, "GetDeviceProcAddr"))
|
||||
return (void*) vkGetDeviceProcAddr;
|
||||
return (void *)vkGetDeviceProcAddr;
|
||||
if (!strcmp(name, "DestroyDevice"))
|
||||
return (void*) vkDestroyDevice;
|
||||
return (void *)vkDestroyDevice;
|
||||
if (!strcmp(name, "GetDeviceQueue"))
|
||||
return (void*) vkGetDeviceQueue;
|
||||
return (void *)vkGetDeviceQueue;
|
||||
if (!strcmp(name, "AllocateCommandBuffers"))
|
||||
return (void*) vkAllocateCommandBuffers;
|
||||
return (void *)vkAllocateCommandBuffers;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
2456
loader/loader.c
2456
loader/loader.c
File diff suppressed because it is too large
Load Diff
388
loader/loader.h
388
loader/loader.h
@ -1,32 +1,38 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (C) 2015 Valve Corporation
|
||||
* Copyright (c) 2014-2016 The Khronos Group Inc.
|
||||
* Copyright (c) 2014-2016 Valve Corporation
|
||||
* Copyright (c) 2014-2016 LunarG, Inc.
|
||||
* Copyright (C) 2015 Google Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
* 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 Software.
|
||||
* The above copyright notice(s) and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Materials.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* The Materials are Confidential Information as defined by the Khronos
|
||||
* Membership Agreement until designated non-confidential by Khronos, at which
|
||||
* point this condition clause shall be removed.
|
||||
*
|
||||
* 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 SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
* 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.
|
||||
*
|
||||
* Author: Jon Ashburn <jon@lunarg.com>
|
||||
* Author: Courtney Goeltzenleuchter <courtney@LunarG.com>
|
||||
* Author: Chia-I Wu <olvaffe@gmail.com>
|
||||
* Author: Chia-I Wu <olv@lunarg.com>
|
||||
* Author: Chris Forbes <chrisf@ijw.co.nz>
|
||||
* Author: Courtney Goeltzenleuchter <courtney@LunarG.com>
|
||||
* Author: Jon Ashburn <jon@lunarg.com>
|
||||
* Author: Tony Barbour <tony@LunarG.com>
|
||||
* Author: Mark Lobodzinski <mark@LunarG.com>
|
||||
*
|
||||
*/
|
||||
|
||||
@ -43,11 +49,11 @@
|
||||
#include <assert.h>
|
||||
|
||||
#if defined(__GNUC__) && __GNUC__ >= 4
|
||||
# define LOADER_EXPORT __attribute__((visibility("default")))
|
||||
#define LOADER_EXPORT __attribute__((visibility("default")))
|
||||
#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)
|
||||
# define LOADER_EXPORT __attribute__((visibility("default")))
|
||||
#define LOADER_EXPORT __attribute__((visibility("default")))
|
||||
#else
|
||||
# define LOADER_EXPORT
|
||||
#define LOADER_EXPORT
|
||||
#endif
|
||||
|
||||
#define MAX_STRING_SIZE 1024
|
||||
@ -58,10 +64,12 @@
|
||||
enum layer_type {
|
||||
VK_LAYER_TYPE_DEVICE_EXPLICIT = 0x1,
|
||||
VK_LAYER_TYPE_INSTANCE_EXPLICIT = 0x2,
|
||||
VK_LAYER_TYPE_GLOBAL_EXPLICIT = 0x3, // both instance and device layer, bitwise
|
||||
VK_LAYER_TYPE_GLOBAL_EXPLICIT =
|
||||
0x3, // both instance and device layer, bitwise
|
||||
VK_LAYER_TYPE_DEVICE_IMPLICIT = 0x4,
|
||||
VK_LAYER_TYPE_INSTANCE_IMPLICIT = 0x8,
|
||||
VK_LAYER_TYPE_GLOBAL_IMPLICIT = 0xc, // both instance and device layer, bitwise
|
||||
VK_LAYER_TYPE_GLOBAL_IMPLICIT =
|
||||
0xc, // both instance and device layer, bitwise
|
||||
};
|
||||
|
||||
// form of all dynamic lists/arrays
|
||||
@ -134,19 +142,20 @@ struct loader_layer_library_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
|
||||
};
|
||||
|
||||
#define MAX_NUM_DEV_EXTS 250
|
||||
// loader_dispatch_hash_entry and loader_dev_ext_dispatch_table.DevExt have one to one
|
||||
// loader_dispatch_hash_entry and loader_dev_ext_dispatch_table.DevExt have one
|
||||
// to one
|
||||
// correspondence; one loader_dispatch_hash_entry for one DevExt 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);
|
||||
typedef void(VKAPI_PTR *PFN_vkDevExt)(VkDevice device);
|
||||
struct loader_dev_ext_dispatch_table {
|
||||
PFN_vkDevExt DevExt[MAX_NUM_DEV_EXTS];
|
||||
};
|
||||
@ -159,9 +168,9 @@ struct loader_dev_dispatch_table {
|
||||
/* per CreateDevice structure */
|
||||
struct loader_device {
|
||||
struct loader_dev_dispatch_table loader_dispatch;
|
||||
VkDevice device; // device object from the icd
|
||||
VkDevice device; // device object from the icd
|
||||
|
||||
uint32_t app_extension_count;
|
||||
uint32_t app_extension_count;
|
||||
VkExtensionProperties *app_extension_props;
|
||||
|
||||
struct loader_layer_list activated_layer_list;
|
||||
@ -176,40 +185,50 @@ struct loader_icd {
|
||||
const struct loader_instance *this_instance;
|
||||
|
||||
struct loader_device *logical_device_list;
|
||||
VkInstance instance; // instance object from the icd
|
||||
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_vkGetPhysicalDeviceImageFormatProperties
|
||||
GetPhysicalDeviceImageFormatProperties;
|
||||
PFN_vkCreateDevice CreateDevice;
|
||||
PFN_vkGetPhysicalDeviceProperties GetPhysicalDeviceProperties;
|
||||
PFN_vkGetPhysicalDeviceQueueFamilyProperties GetPhysicalDeviceQueueFamilyProperties;
|
||||
PFN_vkGetPhysicalDeviceQueueFamilyProperties
|
||||
GetPhysicalDeviceQueueFamilyProperties;
|
||||
PFN_vkGetPhysicalDeviceMemoryProperties GetPhysicalDeviceMemoryProperties;
|
||||
PFN_vkEnumerateDeviceExtensionProperties EnumerateDeviceExtensionProperties;
|
||||
PFN_vkGetPhysicalDeviceSparseImageFormatProperties GetPhysicalDeviceSparseImageFormatProperties;
|
||||
PFN_vkGetPhysicalDeviceSparseImageFormatProperties
|
||||
GetPhysicalDeviceSparseImageFormatProperties;
|
||||
PFN_vkCreateDebugReportCallbackEXT CreateDebugReportCallbackEXT;
|
||||
PFN_vkDestroyDebugReportCallbackEXT DestroyDebugReportCallbackEXT;
|
||||
PFN_vkDebugReportMessageEXT DebugReportMessageEXT;
|
||||
PFN_vkGetPhysicalDeviceSurfaceSupportKHR GetPhysicalDeviceSurfaceSupportKHR;
|
||||
PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR GetPhysicalDeviceSurfaceCapabilitiesKHR;
|
||||
PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR
|
||||
GetPhysicalDeviceSurfaceCapabilitiesKHR;
|
||||
PFN_vkGetPhysicalDeviceSurfaceFormatsKHR GetPhysicalDeviceSurfaceFormatsKHR;
|
||||
PFN_vkGetPhysicalDeviceSurfacePresentModesKHR GetPhysicalDeviceSurfacePresentModesKHR;
|
||||
PFN_vkGetPhysicalDeviceSurfacePresentModesKHR
|
||||
GetPhysicalDeviceSurfacePresentModesKHR;
|
||||
#ifdef VK_USE_PLATFORM_WIN32_KHR
|
||||
PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR GetPhysicalDeviceWin32PresentationSupportKHR;
|
||||
PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR
|
||||
GetPhysicalDeviceWin32PresentationSupportKHR;
|
||||
#endif
|
||||
#ifdef VK_USE_PLATFORM_MIR_KHR
|
||||
PFN_vkGetPhysicalDeviceMirPresentationSupportKHR GetPhysicalDeviceMirPresentvationSupportKHR;
|
||||
PFN_vkGetPhysicalDeviceMirPresentationSupportKHR
|
||||
GetPhysicalDeviceMirPresentvationSupportKHR;
|
||||
#endif
|
||||
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
|
||||
PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR GetPhysicalDeviceWaylandPresentationSupportKHR;
|
||||
PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR
|
||||
GetPhysicalDeviceWaylandPresentationSupportKHR;
|
||||
#endif
|
||||
#ifdef VK_USE_PLATFORM_XCB_KHR
|
||||
PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR GetPhysicalDeviceXcbPresentationSupportKHR;
|
||||
PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR
|
||||
GetPhysicalDeviceXcbPresentationSupportKHR;
|
||||
#endif
|
||||
#ifdef VK_USE_PLATFORM_XLIB_KHR
|
||||
PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR GetPhysicalDeviceXlibPresentationSupportKHR;
|
||||
PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR
|
||||
GetPhysicalDeviceXlibPresentationSupportKHR;
|
||||
#endif
|
||||
|
||||
struct loader_icd *next;
|
||||
@ -231,7 +250,7 @@ struct loader_instance {
|
||||
uint32_t total_icd_count;
|
||||
struct loader_icd *icds;
|
||||
struct loader_instance *next;
|
||||
struct loader_extension_list ext_list; // icds and loaders extensions
|
||||
struct loader_extension_list ext_list; // icds and loaders extensions
|
||||
struct loader_icd_libs icd_libs;
|
||||
struct loader_layer_list instance_layer_list;
|
||||
struct loader_layer_list device_layer_list;
|
||||
@ -274,11 +293,11 @@ struct loader_physical_device {
|
||||
VkLayerInstanceDispatchTable *disp; // must be first entry in structure
|
||||
struct loader_instance *this_instance;
|
||||
struct loader_icd *this_icd;
|
||||
VkPhysicalDevice phys_dev; // object from ICD
|
||||
/*
|
||||
* Fill in the cache of available device extensions from
|
||||
* this physical device. This cache can be used during CreateDevice
|
||||
*/
|
||||
VkPhysicalDevice phys_dev; // object from ICD
|
||||
/*
|
||||
* Fill in the cache of available device extensions from
|
||||
* this physical device. This cache can be used during CreateDevice
|
||||
*/
|
||||
struct loader_extension_list device_extension_cache;
|
||||
};
|
||||
|
||||
@ -299,38 +318,37 @@ struct loader_scanned_icds {
|
||||
uint32_t api_version;
|
||||
PFN_vkGetInstanceProcAddr GetInstanceProcAddr;
|
||||
PFN_vkCreateInstance CreateInstance;
|
||||
PFN_vkEnumerateInstanceExtensionProperties EnumerateInstanceExtensionProperties;
|
||||
PFN_vkEnumerateInstanceExtensionProperties
|
||||
EnumerateInstanceExtensionProperties;
|
||||
};
|
||||
|
||||
static inline struct loader_instance *loader_instance(VkInstance instance) {
|
||||
return (struct loader_instance *) instance;
|
||||
return (struct loader_instance *)instance;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
return *((struct loader_dev_dispatch_table **) 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_dispatch(const void* obj)
|
||||
{
|
||||
return *((VkLayerInstanceDispatchTable **) obj);
|
||||
static inline VkLayerInstanceDispatchTable *
|
||||
loader_get_instance_dispatch(const void *obj) {
|
||||
return *((VkLayerInstanceDispatchTable **)obj);
|
||||
}
|
||||
|
||||
static inline void loader_init_dispatch(void* obj, const void *data)
|
||||
{
|
||||
static inline void loader_init_dispatch(void *obj, const void *data) {
|
||||
#ifdef DEBUG
|
||||
assert(valid_loader_magic_value(obj) &&
|
||||
"Incompatible ICD, first dword must be initialized to ICD_LOADER_MAGIC. See loader/README.md for details.");
|
||||
"Incompatible ICD, first dword must be initialized to "
|
||||
"ICD_LOADER_MAGIC. See loader/README.md for details.");
|
||||
#endif
|
||||
|
||||
loader_set_dispatch(obj, data);
|
||||
@ -349,172 +367,142 @@ struct loader_msg_callback_map_entry {
|
||||
VkDebugReportCallbackEXT loader_obj;
|
||||
};
|
||||
|
||||
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 uint32_t layer_count,
|
||||
const char * const *ppEnabledLayerNames,
|
||||
const struct loader_layer_list *list);
|
||||
VkResult loader_validate_layers(const uint32_t layer_count,
|
||||
const char *const *ppEnabledLayerNames,
|
||||
const struct loader_layer_list *list);
|
||||
|
||||
VkResult loader_validate_instance_extensions(
|
||||
const struct loader_extension_list *icd_exts,
|
||||
const struct loader_layer_list *instance_layer,
|
||||
const VkInstanceCreateInfo* pCreateInfo);
|
||||
const struct loader_extension_list *icd_exts,
|
||||
const struct loader_layer_list *instance_layer,
|
||||
const VkInstanceCreateInfo *pCreateInfo);
|
||||
|
||||
/* instance layer chain termination entrypoint definitions */
|
||||
VKAPI_ATTR VkResult VKAPI_CALL loader_CreateInstance(
|
||||
const VkInstanceCreateInfo* pCreateInfo,
|
||||
const VkAllocationCallbacks* pAllocator,
|
||||
VkInstance* pInstance);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
loader_CreateInstance(const VkInstanceCreateInfo *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
VkInstance *pInstance);
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL loader_DestroyInstance(
|
||||
VkInstance instance,
|
||||
const VkAllocationCallbacks* pAllocator);
|
||||
VKAPI_ATTR void VKAPI_CALL
|
||||
loader_DestroyInstance(VkInstance instance,
|
||||
const VkAllocationCallbacks *pAllocator);
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL loader_EnumeratePhysicalDevices(
|
||||
VkInstance instance,
|
||||
uint32_t* pPhysicalDeviceCount,
|
||||
VkPhysicalDevice* pPhysicalDevices);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
loader_EnumeratePhysicalDevices(VkInstance instance,
|
||||
uint32_t *pPhysicalDeviceCount,
|
||||
VkPhysicalDevice *pPhysicalDevices);
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL loader_GetPhysicalDeviceFeatures(
|
||||
VkPhysicalDevice physicalDevice,
|
||||
VkPhysicalDeviceFeatures* pFeatures);
|
||||
VKAPI_ATTR void VKAPI_CALL
|
||||
loader_GetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice,
|
||||
VkPhysicalDeviceFeatures *pFeatures);
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL loader_GetPhysicalDeviceFormatProperties(
|
||||
VkPhysicalDevice physicalDevice,
|
||||
VkFormat format,
|
||||
VkFormatProperties* pFormatInfo);
|
||||
VKAPI_ATTR void VKAPI_CALL
|
||||
loader_GetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice,
|
||||
VkFormat format,
|
||||
VkFormatProperties *pFormatInfo);
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL loader_GetPhysicalDeviceImageFormatProperties(
|
||||
VkPhysicalDevice physicalDevice,
|
||||
VkFormat format,
|
||||
VkImageType type,
|
||||
VkImageTiling tiling,
|
||||
VkImageUsageFlags usage,
|
||||
VkImageCreateFlags flags,
|
||||
VkImageFormatProperties* pImageFormatProperties);
|
||||
VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type,
|
||||
VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags,
|
||||
VkImageFormatProperties *pImageFormatProperties);
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL loader_GetPhysicalDeviceSparseImageFormatProperties(
|
||||
VkPhysicalDevice physicalDevice,
|
||||
VkFormat format,
|
||||
VkImageType type,
|
||||
VkSampleCountFlagBits samples,
|
||||
VkImageUsageFlags usage,
|
||||
VkImageTiling tiling,
|
||||
uint32_t* pNumProperties,
|
||||
VkSparseImageFormatProperties* pProperties);
|
||||
VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type,
|
||||
VkSampleCountFlagBits samples, VkImageUsageFlags usage,
|
||||
VkImageTiling tiling, uint32_t *pNumProperties,
|
||||
VkSparseImageFormatProperties *pProperties);
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL loader_GetPhysicalDeviceProperties (
|
||||
VkPhysicalDevice physicalDevice,
|
||||
VkPhysicalDeviceProperties* pProperties);
|
||||
VKAPI_ATTR void VKAPI_CALL
|
||||
loader_GetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice,
|
||||
VkPhysicalDeviceProperties *pProperties);
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL loader_EnumerateDeviceExtensionProperties (VkPhysicalDevice physicalDevice,
|
||||
const char *pLayerName, uint32_t *pCount,
|
||||
VkExtensionProperties* pProperties);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
loader_EnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice,
|
||||
const char *pLayerName,
|
||||
uint32_t *pCount,
|
||||
VkExtensionProperties *pProperties);
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL loader_EnumerateDeviceLayerProperties (VkPhysicalDevice physicalDevice,
|
||||
uint32_t *pCount,
|
||||
VkLayerProperties* pProperties);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
loader_EnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice,
|
||||
uint32_t *pCount,
|
||||
VkLayerProperties *pProperties);
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL loader_GetPhysicalDeviceQueueFamilyProperties (
|
||||
VkPhysicalDevice physicalDevice,
|
||||
uint32_t* pCount,
|
||||
VkQueueFamilyProperties* pProperties);
|
||||
VKAPI_ATTR void VKAPI_CALL loader_GetPhysicalDeviceQueueFamilyProperties(
|
||||
VkPhysicalDevice physicalDevice, uint32_t *pCount,
|
||||
VkQueueFamilyProperties *pProperties);
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL loader_GetPhysicalDeviceMemoryProperties (
|
||||
VkPhysicalDevice physicalDevice,
|
||||
VkPhysicalDeviceMemoryProperties * pProperties);
|
||||
VKAPI_ATTR void VKAPI_CALL loader_GetPhysicalDeviceMemoryProperties(
|
||||
VkPhysicalDevice physicalDevice,
|
||||
VkPhysicalDeviceMemoryProperties *pProperties);
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL loader_create_device_terminator(
|
||||
VkPhysicalDevice physicalDevice,
|
||||
const VkDeviceCreateInfo* pCreateInfo,
|
||||
const VkAllocationCallbacks* pAllocator,
|
||||
VkDevice* pDevice);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
loader_create_device_terminator(VkPhysicalDevice physicalDevice,
|
||||
const VkDeviceCreateInfo *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
VkDevice *pDevice);
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL loader_CreateDevice(
|
||||
VkPhysicalDevice gpu,
|
||||
const VkDeviceCreateInfo* pCreateInfo,
|
||||
const VkAllocationCallbacks* pAllocator,
|
||||
VkDevice* pDevice);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
loader_CreateDevice(VkPhysicalDevice gpu, const VkDeviceCreateInfo *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator, VkDevice *pDevice);
|
||||
|
||||
/* helper function definitions */
|
||||
void loader_initialize(void);
|
||||
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_array(const VkExtensionProperties *vk_ext_prop,
|
||||
const uint32_t count,
|
||||
const VkExtensionProperties *ext_array);
|
||||
bool has_vk_extension_property(const VkExtensionProperties *vk_ext_prop,
|
||||
const struct loader_extension_list *ext_list);
|
||||
|
||||
VkResult loader_add_to_ext_list(
|
||||
const struct loader_instance *inst,
|
||||
struct loader_extension_list *ext_list,
|
||||
uint32_t prop_list_count,
|
||||
const VkExtensionProperties *props);
|
||||
void loader_destroy_generic_list(
|
||||
const struct loader_instance *inst,
|
||||
struct loader_generic_list *list);
|
||||
void loader_delete_layer_properties(
|
||||
const struct loader_instance *inst,
|
||||
struct loader_layer_list *layer_list);
|
||||
void 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_scanned_icd_clear(
|
||||
const struct loader_instance *inst,
|
||||
struct loader_icd_libs *icd_libs);
|
||||
void loader_icd_scan(
|
||||
const struct loader_instance *inst,
|
||||
struct loader_icd_libs *icds);
|
||||
void loader_layer_scan(
|
||||
const struct loader_instance *inst,
|
||||
struct loader_layer_list *instance_layers,
|
||||
struct loader_layer_list *device_layers);
|
||||
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);
|
||||
void loader_destroy_generic_list(const struct loader_instance *inst,
|
||||
struct loader_generic_list *list);
|
||||
void loader_delete_layer_properties(const struct loader_instance *inst,
|
||||
struct loader_layer_list *layer_list);
|
||||
void 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_scanned_icd_clear(const struct loader_instance *inst,
|
||||
struct loader_icd_libs *icd_libs);
|
||||
void loader_icd_scan(const struct loader_instance *inst,
|
||||
struct loader_icd_libs *icds);
|
||||
void loader_layer_scan(const struct loader_instance *inst,
|
||||
struct loader_layer_list *instance_layers,
|
||||
struct loader_layer_list *device_layers);
|
||||
void loader_get_icd_loader_instance_extensions(
|
||||
const struct loader_instance *inst,
|
||||
struct loader_icd_libs *icd_libs,
|
||||
struct loader_extension_list *inst_exts);
|
||||
struct loader_icd *loader_get_icd_and_device(
|
||||
const VkDevice device,
|
||||
struct loader_device **found_dev);
|
||||
void *loader_dev_ext_gpa(
|
||||
struct loader_instance *inst,
|
||||
const char *funcName);
|
||||
void *loader_get_dev_ext_trampoline(
|
||||
uint32_t index);
|
||||
struct loader_instance *loader_get_instance(
|
||||
const VkInstance instance);
|
||||
void loader_remove_logical_device(
|
||||
const struct loader_instance *inst,
|
||||
struct loader_icd *icd,
|
||||
struct loader_device *found_dev);
|
||||
VkResult loader_enable_instance_layers(
|
||||
struct loader_instance *inst,
|
||||
const VkInstanceCreateInfo *pCreateInfo,
|
||||
const struct loader_layer_list *instance_layers);
|
||||
const struct loader_instance *inst, struct loader_icd_libs *icd_libs,
|
||||
struct loader_extension_list *inst_exts);
|
||||
struct loader_icd *loader_get_icd_and_device(const VkDevice device,
|
||||
struct loader_device **found_dev);
|
||||
void *loader_dev_ext_gpa(struct loader_instance *inst, const char *funcName);
|
||||
void *loader_get_dev_ext_trampoline(uint32_t index);
|
||||
struct loader_instance *loader_get_instance(const VkInstance instance);
|
||||
void loader_remove_logical_device(const struct loader_instance *inst,
|
||||
struct loader_icd *icd,
|
||||
struct loader_device *found_dev);
|
||||
VkResult
|
||||
loader_enable_instance_layers(struct loader_instance *inst,
|
||||
const VkInstanceCreateInfo *pCreateInfo,
|
||||
const struct loader_layer_list *instance_layers);
|
||||
void loader_deactivate_instance_layers(struct loader_instance *instance);
|
||||
|
||||
VkResult loader_create_instance_chain(
|
||||
const VkInstanceCreateInfo *pCreateInfo,
|
||||
const VkAllocationCallbacks* pAllocator,
|
||||
struct loader_instance *inst,
|
||||
VkInstance created_instance);
|
||||
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);
|
||||
void loader_activate_instance_layer_extensions(struct loader_instance *inst,
|
||||
VkInstance created_inst);
|
||||
|
||||
void* loader_heap_alloc(
|
||||
const struct loader_instance *instance,
|
||||
size_t size,
|
||||
VkSystemAllocationScope allocationScope);
|
||||
void *loader_heap_alloc(const struct loader_instance *instance, size_t size,
|
||||
VkSystemAllocationScope allocationScope);
|
||||
|
||||
void loader_heap_free(
|
||||
const struct loader_instance *instance,
|
||||
void *pMemory);
|
||||
void loader_heap_free(const struct loader_instance *instance, void *pMemory);
|
||||
|
||||
void *loader_tls_heap_alloc(size_t size);
|
||||
|
||||
|
@ -3,6 +3,32 @@
|
||||
* `murmurhash.h' - murmurhash
|
||||
*
|
||||
* copyright (c) 2014 joseph werle <joseph.werle@gmail.com>
|
||||
* Copyright (c) 2015-2016 The Khronos Group Inc.
|
||||
* Copyright (c) 2015-2016 Valve Corporation
|
||||
* Copyright (c) 2015-2016 LunarG, 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(s) and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Materials.
|
||||
*
|
||||
* The Materials are Confidential Information as defined by the Khronos
|
||||
* Membership Agreement until designated non-confidential by Khronos, at which
|
||||
* point this condition clause shall be removed.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
@ -10,65 +36,66 @@
|
||||
#include <stdint.h>
|
||||
#include "murmurhash.h"
|
||||
|
||||
uint32_t
|
||||
murmurhash (const char *key, size_t len, uint32_t seed) {
|
||||
uint32_t c1 = 0xcc9e2d51;
|
||||
uint32_t c2 = 0x1b873593;
|
||||
uint32_t r1 = 15;
|
||||
uint32_t r2 = 13;
|
||||
uint32_t m = 5;
|
||||
uint32_t n = 0xe6546b64;
|
||||
uint32_t h = 0;
|
||||
uint32_t k = 0;
|
||||
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
|
||||
int i = 0;
|
||||
int l = (int) len / 4; // chunk length
|
||||
uint32_t murmurhash(const char *key, size_t len, uint32_t seed) {
|
||||
uint32_t c1 = 0xcc9e2d51;
|
||||
uint32_t c2 = 0x1b873593;
|
||||
uint32_t r1 = 15;
|
||||
uint32_t r2 = 13;
|
||||
uint32_t m = 5;
|
||||
uint32_t n = 0xe6546b64;
|
||||
uint32_t h = 0;
|
||||
uint32_t k = 0;
|
||||
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
|
||||
int i = 0;
|
||||
int l = (int)len / 4; // chunk length
|
||||
|
||||
h = seed;
|
||||
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) {
|
||||
// next 4 byte chunk of `key'
|
||||
k = chunks[i];
|
||||
// for each 4 byte chunk of `key'
|
||||
for (i = -l; i != 0; ++i) {
|
||||
// next 4 byte chunk of `key'
|
||||
k = chunks[i];
|
||||
|
||||
// encode next 4 byte chunk of `key'
|
||||
k *= c1;
|
||||
k = (k << r1) | (k >> (32 - r1));
|
||||
k *= c2;
|
||||
// encode next 4 byte chunk of `key'
|
||||
k *= c1;
|
||||
k = (k << r1) | (k >> (32 - r1));
|
||||
k *= c2;
|
||||
|
||||
// append to hash
|
||||
h ^= k;
|
||||
h = (h << r2) | (h >> (32 - r2));
|
||||
h = h * m + n;
|
||||
}
|
||||
// append to hash
|
||||
h ^= k;
|
||||
h = (h << r2) | (h >> (32 - r2));
|
||||
h = h * m + n;
|
||||
}
|
||||
|
||||
k = 0;
|
||||
k = 0;
|
||||
|
||||
// remainder
|
||||
switch (len & 3) { // `len % 4'
|
||||
case 3: k ^= (tail[2] << 16);
|
||||
case 2: k ^= (tail[1] << 8);
|
||||
// remainder
|
||||
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;
|
||||
}
|
||||
k ^= tail[0];
|
||||
k *= c1;
|
||||
k = (k << r1) | (k >> (32 - r1));
|
||||
k *= c2;
|
||||
h ^= k;
|
||||
}
|
||||
|
||||
h ^= len;
|
||||
h ^= len;
|
||||
|
||||
h ^= (h >> 16);
|
||||
h *= 0x85ebca6b;
|
||||
h ^= (h >> 13);
|
||||
h *= 0xc2b2ae35;
|
||||
h ^= (h >> 16);
|
||||
h ^= (h >> 16);
|
||||
h *= 0x85ebca6b;
|
||||
h ^= (h >> 13);
|
||||
h *= 0xc2b2ae35;
|
||||
h ^= (h >> 16);
|
||||
|
||||
return h;
|
||||
return h;
|
||||
}
|
||||
|
@ -3,6 +3,32 @@
|
||||
* `murmurhash.h' - murmurhash
|
||||
*
|
||||
* copyright (c) 2014 joseph werle <joseph.werle@gmail.com>
|
||||
* Copyright (c) 2015-2016 The Khronos Group Inc.
|
||||
* Copyright (c) 2015-2016 Valve Corporation
|
||||
* Copyright (c) 2015-2016 LunarG, 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(s) and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Materials.
|
||||
*
|
||||
* The Materials are Confidential Information as defined by the Khronos
|
||||
* Membership Agreement until designated non-confidential by Khronos, at which
|
||||
* point this condition clause shall be removed.
|
||||
*
|
||||
* 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 MURMURHASH_H
|
||||
@ -21,8 +47,7 @@ extern "C" {
|
||||
* using the MurmurHash3 algorithm
|
||||
*/
|
||||
|
||||
uint32_t
|
||||
murmurhash (const char *key, size_t len, uint32_t seed);
|
||||
uint32_t murmurhash(const char *key, size_t len, uint32_t seed);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
1047
loader/trampoline.c
1047
loader/trampoline.c
File diff suppressed because it is too large
Load Diff
@ -1,24 +1,31 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# Copyright (C) 2015 Valve Corporation
|
||||
# Copyright (c) 2015-2016 The Khronos Group Inc.
|
||||
# Copyright (c) 2015-2016 Valve Corporation
|
||||
# Copyright (c) 2015-2016 LunarG, Inc.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a
|
||||
# copy of this software and associated documentation files (the "Software"),
|
||||
# to deal in the Software without restriction, including without limitation
|
||||
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
# and/or sell copies of the Software, and to permit persons to whom the
|
||||
# Software is furnished to do so, subject to the following conditions:
|
||||
# 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 Software.
|
||||
# The above copyright notice(s) and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Materials.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# The Materials are Confidential Information as defined by the Khronos
|
||||
# Membership Agreement until designated non-confidential by Khronos, at which
|
||||
# point this condition clause shall be removed.
|
||||
#
|
||||
# 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 SOFTWARE OR THE USE OR OTHER
|
||||
# DEALINGS IN THE SOFTWARE.
|
||||
# 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.Copyright (C) 2015 Valve Corporation
|
||||
#
|
||||
# Author: Jon Ashburn <jon@lunarg.com>
|
||||
#
|
||||
@ -89,27 +96,32 @@ class Subcommand(object):
|
||||
return """/* THIS FILE IS GENERATED. DO NOT EDIT. */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2015-2016 The Khronos Group Inc.
|
||||
* Copyright (c) 2015-2016 Valve Corporation
|
||||
* Copyright (c) 2015-2016 LunarG, Inc.
|
||||
*
|
||||
* Copyright (C) 2015 Valve Corporation
|
||||
* All Rights Reserved.
|
||||
* 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:
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
* The above copyright notice(s) and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Materials.
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
* The Materials are Confidential Information as defined by the Khronos
|
||||
* Membership Agreement until designated non-confidential by Khronos, at which
|
||||
* point this condition clause shall be removed.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* 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 SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
* 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.
|
||||
*
|
||||
* Author: Jon Ashburn <jon@lunarg.com>
|
||||
* Author: Chia-I Wu <olv@lunarg.com>
|
||||
@ -342,27 +354,33 @@ class WinDefFileSubcommand(Subcommand):
|
||||
return """; THIS FILE IS GENERATED. DO NOT EDIT.
|
||||
|
||||
;;;; Begin Copyright Notice ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; Vulkan
|
||||
; Copyright (c) 2015-2016 The Khronos Group Inc.
|
||||
; Copyright (c) 2015-2016 Valve Corporation
|
||||
; Copyright (c) 2015-2016 LunarG, Inc.
|
||||
;
|
||||
; Copyright (C) 2015 Valve Corporation
|
||||
; 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:
|
||||
;
|
||||
; Permission is hereby granted, free of charge, to any person obtaining a
|
||||
; copy of this software and associated documentation files (the "Software"),
|
||||
; to deal in the Software without restriction, including without limitation
|
||||
; the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
; and/or sell copies of the Software, and to permit persons to whom the
|
||||
; Software is furnished to do so, subject to the following conditions:
|
||||
; The above copyright notice(s) and this permission notice shall be included in
|
||||
; all copies or substantial portions of the Materials.
|
||||
;
|
||||
; The above copyright notice and this permission notice shall be included
|
||||
; in all copies or substantial portions of the Software.
|
||||
; The Materials are Confidential Information as defined by the Khronos
|
||||
; Membership Agreement until designated non-confidential by Khronos, at which
|
||||
; point this condition clause shall be removed.
|
||||
;
|
||||
; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
; 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 SOFTWARE OR THE USE OR OTHER
|
||||
; DEALINGS IN THE SOFTWARE.
|
||||
; 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.
|
||||
;
|
||||
;
|
||||
; Author: Jon Ashburn <jon@lunarg.com>
|
||||
;;;; End Copyright Notice ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"""
|
||||
|
@ -1,30 +1,34 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (C) 2015 Valve Corporation
|
||||
* Copyright 2014 Valve Software
|
||||
* Copyright (C) 2015 Google Inc.
|
||||
* All Rights Reserved.
|
||||
* Copyright (c) 2015-2016 The Khronos Group Inc.
|
||||
* Copyright (c) 2015-2016 Valve Corporation
|
||||
* Copyright (c) 2015-2016 LunarG, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
* 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 Software.
|
||||
* The above copyright notice(s) and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Materials.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* The Materials are Confidential Information as defined by the Khronos
|
||||
* Membership Agreement until designated non-confidential by Khronos, at which
|
||||
* point this condition clause shall be removed.
|
||||
*
|
||||
* 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 SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
*
|
||||
* Author: James Jones <jajones@nvidia.com>
|
||||
* Author: Tobin Ehlis <tobin@lunarg.com>
|
||||
* 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.
|
||||
*
|
||||
* Author: Ian Elliot <ian@lunarg.com>
|
||||
* Author: Jon Ashburn <jon@lunarg.com>
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
@ -57,115 +61,126 @@
|
||||
#define PATH_SEPERATOR ':'
|
||||
#define DIRECTORY_SYMBOL '/'
|
||||
|
||||
#define VULKAN_ICDCONF_DIR "/" "vulkan" "/" "icd.d"
|
||||
#define VULKAN_ICD_DIR "/" "vulkan" "/" "icd"
|
||||
#define VULKAN_ELAYERCONF_DIR "/" "vulkan" "/" "explicit_layer.d"
|
||||
#define VULKAN_ILAYERCONF_DIR "/" "vulkan" "/" "implicit_layer.d"
|
||||
#define VULKAN_LAYER_DIR "/" "vulkan" "/" "layer"
|
||||
#define VULKAN_ICDCONF_DIR \
|
||||
"/" \
|
||||
"vulkan" \
|
||||
"/" \
|
||||
"icd.d"
|
||||
#define VULKAN_ICD_DIR \
|
||||
"/" \
|
||||
"vulkan" \
|
||||
"/" \
|
||||
"icd"
|
||||
#define VULKAN_ELAYERCONF_DIR \
|
||||
"/" \
|
||||
"vulkan" \
|
||||
"/" \
|
||||
"explicit_layer.d"
|
||||
#define VULKAN_ILAYERCONF_DIR \
|
||||
"/" \
|
||||
"vulkan" \
|
||||
"/" \
|
||||
"implicit_layer.d"
|
||||
#define VULKAN_LAYER_DIR \
|
||||
"/" \
|
||||
"vulkan" \
|
||||
"/" \
|
||||
"layer"
|
||||
|
||||
#if defined(LOCALPREFIX)
|
||||
#define LOCAL_DRIVERS_INFO \
|
||||
LOCALPREFIX "/" SYSCONFDIR VULKAN_ICDCONF_DIR ":" \
|
||||
LOCALPREFIX "/" DATADIR VULKAN_ICDCONF_DIR ":"
|
||||
#define LOCAL_ELAYERS_INFO \
|
||||
LOCALPREFIX "/" SYSCONFDIR VULKAN_ELAYERCONF_DIR ":" \
|
||||
LOCALPREFIX "/" DATADIR VULKAN_ELAYERCONF_DIR ":"
|
||||
#define LOCAL_ILAYERS_INFO \
|
||||
LOCALPREFIX "/" SYSCONFDIR VULKAN_ILAYERCONF_DIR ":" \
|
||||
LOCALPREFIX "/" DATADIR VULKAN_ILAYERCONF_DIR ":"
|
||||
#define LOCAL_DRIVERS_INFO \
|
||||
LOCALPREFIX "/" SYSCONFDIR VULKAN_ICDCONF_DIR ":" LOCALPREFIX \
|
||||
"/" DATADIR VULKAN_ICDCONF_DIR ":"
|
||||
#define LOCAL_ELAYERS_INFO \
|
||||
LOCALPREFIX "/" SYSCONFDIR VULKAN_ELAYERCONF_DIR ":" LOCALPREFIX \
|
||||
"/" DATADIR VULKAN_ELAYERCONF_DIR ":"
|
||||
#define LOCAL_ILAYERS_INFO \
|
||||
LOCALPREFIX "/" SYSCONFDIR VULKAN_ILAYERCONF_DIR ":" LOCALPREFIX \
|
||||
"/" DATADIR VULKAN_ILAYERCONF_DIR ":"
|
||||
#else
|
||||
#define LOCAL_DRIVERS_INFO
|
||||
#define LOCAL_ELAYERS_INFO
|
||||
#define LOCAL_ILAYERS_INFO
|
||||
#endif
|
||||
|
||||
#define DEFAULT_VK_DRIVERS_INFO \
|
||||
LOCAL_DRIVERS_INFO \
|
||||
"/" SYSCONFDIR VULKAN_ICDCONF_DIR ":" \
|
||||
#define DEFAULT_VK_DRIVERS_INFO \
|
||||
LOCAL_DRIVERS_INFO \
|
||||
"/" SYSCONFDIR VULKAN_ICDCONF_DIR ":" \
|
||||
"/usr/" DATADIR VULKAN_ICDCONF_DIR
|
||||
#define DEFAULT_VK_DRIVERS_PATH ""
|
||||
#define DEFAULT_VK_ELAYERS_INFO \
|
||||
LOCAL_ELAYERS_INFO \
|
||||
"/" SYSCONFDIR VULKAN_ELAYERCONF_DIR ":" \
|
||||
#define DEFAULT_VK_ELAYERS_INFO \
|
||||
LOCAL_ELAYERS_INFO \
|
||||
"/" SYSCONFDIR VULKAN_ELAYERCONF_DIR ":" \
|
||||
"/usr/" DATADIR VULKAN_ELAYERCONF_DIR ":"
|
||||
#define DEFAULT_VK_ILAYERS_INFO \
|
||||
LOCAL_ILAYERS_INFO \
|
||||
"/" SYSCONFDIR VULKAN_ILAYERCONF_DIR ":" \
|
||||
#define DEFAULT_VK_ILAYERS_INFO \
|
||||
LOCAL_ILAYERS_INFO \
|
||||
"/" SYSCONFDIR VULKAN_ILAYERCONF_DIR ":" \
|
||||
"/usr/" DATADIR VULKAN_ILAYERCONF_DIR
|
||||
#define DEFAULT_VK_LAYERS_PATH ""
|
||||
#define LAYERS_PATH_ENV "VK_LAYER_PATH"
|
||||
|
||||
// C99:
|
||||
#define PRINTF_SIZE_T_SPECIFIER "%zu"
|
||||
#define PRINTF_SIZE_T_SPECIFIER "%zu"
|
||||
|
||||
// File IO
|
||||
static inline bool loader_platform_file_exists(const char *path)
|
||||
{
|
||||
static inline bool loader_platform_file_exists(const char *path) {
|
||||
if (access(path, F_OK))
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline bool loader_platform_is_path_absolute(const char *path)
|
||||
{
|
||||
static inline bool loader_platform_is_path_absolute(const char *path) {
|
||||
if (path[0] == '/')
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline char *loader_platform_dirname(char *path)
|
||||
{
|
||||
static inline char *loader_platform_dirname(char *path) {
|
||||
return dirname(path);
|
||||
}
|
||||
|
||||
// Environment variables
|
||||
|
||||
static inline char *loader_getenv(const char *name)
|
||||
{
|
||||
return getenv(name);
|
||||
}
|
||||
static inline char *loader_getenv(const char *name) { return getenv(name); }
|
||||
|
||||
static inline void loader_free_getenv(const char *val)
|
||||
{
|
||||
}
|
||||
static inline void loader_free_getenv(const char *val) {}
|
||||
|
||||
// Dynamic Loading of libraries:
|
||||
typedef void * loader_platform_dl_handle;
|
||||
static inline loader_platform_dl_handle loader_platform_open_library(const char* libPath)
|
||||
{
|
||||
typedef void *loader_platform_dl_handle;
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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 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)
|
||||
{
|
||||
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) \
|
||||
#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))
|
||||
{
|
||||
#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)) {
|
||||
assert(func != NULL);
|
||||
assert(ctl != NULL);
|
||||
pthread_once(ctl, func);
|
||||
@ -173,40 +188,40 @@ static inline void loader_platform_thread_once(pthread_once_t *ctl, void (* func
|
||||
|
||||
// Thread IDs:
|
||||
typedef pthread_t loader_platform_thread_id;
|
||||
static inline loader_platform_thread_id loader_platform_get_thread_id()
|
||||
{
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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_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)
|
||||
{
|
||||
static inline void
|
||||
loader_platform_thread_cond_broadcast(loader_platform_thread_cond *pCond) {
|
||||
pthread_cond_broadcast(pCond);
|
||||
}
|
||||
|
||||
@ -246,25 +261,22 @@ using namespace std;
|
||||
#define DEFAULT_VK_LAYERS_PATH "C:\\Windows\\System32;C:\\Windows\\SysWow64"
|
||||
#define LAYERS_PATH_ENV "VK_LAYER_PATH"
|
||||
|
||||
#define PRINTF_SIZE_T_SPECIFIER "%Iu"
|
||||
#define PRINTF_SIZE_T_SPECIFIER "%Iu"
|
||||
|
||||
// File IO
|
||||
static bool loader_platform_file_exists(const char *path)
|
||||
{
|
||||
static bool loader_platform_file_exists(const char *path) {
|
||||
if ((_access(path, 0)) == -1)
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool loader_platform_is_path_absolute(const char *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)
|
||||
{
|
||||
static inline char *loader_platform_dirname(char *path) {
|
||||
char *current, *next;
|
||||
|
||||
// TODO/TBD: Do we need to deal with the Windows's ":" character?
|
||||
@ -287,13 +299,12 @@ static inline char *loader_platform_dirname(char *path)
|
||||
// Microsoft also doesn't have basename(). Paths are different on Windows, and
|
||||
// so this is just a temporary solution in order to get us compiling, so that we
|
||||
// can test some scenarios, and develop the correct solution for Windows.
|
||||
// TODO: Develop a better, permanent solution for Windows, to replace this
|
||||
// temporary code:
|
||||
static char *loader_platform_basename(char *pathname)
|
||||
{
|
||||
// TODO: Develop a better, permanent solution for Windows, to replace this
|
||||
// temporary code:
|
||||
static char *loader_platform_basename(char *pathname) {
|
||||
char *current, *next;
|
||||
|
||||
// TODO/TBD: Do we need to deal with the Windows's ":" character?
|
||||
// TODO/TBD: Do we need to deal with the Windows's ":" character?
|
||||
|
||||
for (current = pathname; *current != '\0'; current = next) {
|
||||
next = strchr(current, DIRECTORY_SYMBOL);
|
||||
@ -311,8 +322,7 @@ static char *loader_platform_basename(char *pathname)
|
||||
|
||||
// Environment variables
|
||||
|
||||
static inline char *loader_getenv(const char *name)
|
||||
{
|
||||
static inline char *loader_getenv(const char *name) {
|
||||
char *retVal;
|
||||
DWORD valSize;
|
||||
|
||||
@ -323,7 +333,7 @@ static inline char *loader_getenv(const char *name)
|
||||
if (valSize == 0)
|
||||
return NULL;
|
||||
|
||||
//TODO; FIXME This should be using any app defined memory allocation
|
||||
// TODO; FIXME This should be using any app defined memory allocation
|
||||
retVal = (char *)malloc(valSize);
|
||||
|
||||
GetEnvironmentVariableA(name, retVal, valSize);
|
||||
@ -331,104 +341,95 @@ static inline char *loader_getenv(const char *name)
|
||||
return retVal;
|
||||
}
|
||||
|
||||
static inline void loader_free_getenv(const char *val)
|
||||
{
|
||||
free((void *)val);
|
||||
}
|
||||
static inline void loader_free_getenv(const char *val) { free((void *)val); }
|
||||
|
||||
// Dynamic Loading:
|
||||
typedef HMODULE loader_platform_dl_handle;
|
||||
static loader_platform_dl_handle loader_platform_open_library(const char* 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 *loader_platform_open_library_error(const char *libPath) {
|
||||
static char errorMsg[120];
|
||||
snprintf(errorMsg, 119, "Failed to open dynamic library \"%s\"", libPath);
|
||||
return errorMsg;
|
||||
}
|
||||
static void loader_platform_close_library(loader_platform_dl_handle library)
|
||||
{
|
||||
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_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 *loader_platform_get_proc_address_error(const char *name) {
|
||||
static char errorMsg[120];
|
||||
snprintf(errorMsg, 119, "Failed to find function \"%s\" in dynamic library", name);
|
||||
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) \
|
||||
#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)
|
||||
{
|
||||
#define LOADER_PLATFORM_THREAD_ONCE_DEFINITION(var) INIT_ONCE var;
|
||||
static BOOL CALLBACK
|
||||
InitFuncWrapper(PINIT_ONCE InitOnce, PVOID Parameter, PVOID *Context) {
|
||||
void (*func)(void) = (void (*)(void))Parameter;
|
||||
func();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void loader_platform_thread_once(void *ctl, void (* func) (void))
|
||||
{
|
||||
static void loader_platform_thread_once(void *ctl, void (*func)(void)) {
|
||||
assert(func != NULL);
|
||||
assert(ctl != NULL);
|
||||
InitOnceExecuteOnce((PINIT_ONCE) ctl, InitFuncWrapper, func, NULL);
|
||||
InitOnceExecuteOnce((PINIT_ONCE)ctl, InitFuncWrapper, func, NULL);
|
||||
}
|
||||
|
||||
// Thread IDs:
|
||||
typedef DWORD loader_platform_thread_id;
|
||||
static loader_platform_thread_id loader_platform_get_thread_id()
|
||||
{
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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_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)
|
||||
{
|
||||
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,
|
||||
char *loader_get_registry_string(const HKEY hive, const LPCTSTR sub_key,
|
||||
const char *value);
|
||||
|
||||
#define loader_stack_alloc(size) _alloca(size)
|
||||
@ -447,7 +448,6 @@ char *loader_get_registry_string(const HKEY hive,
|
||||
|
||||
// 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)
|
||||
{
|
||||
static inline bool loader_platform_is_path(const char *path) {
|
||||
return strchr(path, DIRECTORY_SYMBOL) != NULL;
|
||||
}
|
||||
|
849
loader/wsi.c
849
loader/wsi.c
File diff suppressed because it is too large
Load Diff
181
loader/wsi.h
181
loader/wsi.h
@ -1,24 +1,30 @@
|
||||
/*
|
||||
* Copyright (c) 2015-2016 The Khronos Group Inc.
|
||||
* Copyright (c) 2015-2016 Valve Corporation
|
||||
* Copyright (c) 2015-2016 LunarG, Inc.
|
||||
*
|
||||
* Copyright (C) 2015 Valve Corporation
|
||||
* 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:
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
* The above copyright notice(s) and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Materials.
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
* The Materials are Confidential Information as defined by the Khronos
|
||||
* Membership Agreement until designated non-confidential by Khronos, at which
|
||||
* point this condition clause shall be removed.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* 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 SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
* 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.
|
||||
*
|
||||
* Author: Ian Elliott <ian@lunarg.com>
|
||||
*
|
||||
@ -28,98 +34,91 @@
|
||||
#include "loader.h"
|
||||
|
||||
bool wsi_swapchain_instance_gpa(struct loader_instance *ptr_instance,
|
||||
const char* name, void **addr);
|
||||
void wsi_add_instance_extensions(
|
||||
const struct loader_instance *inst,
|
||||
struct loader_extension_list *ext_list);
|
||||
const char *name, void **addr);
|
||||
void wsi_add_instance_extensions(const struct loader_instance *inst,
|
||||
struct loader_extension_list *ext_list);
|
||||
|
||||
void wsi_create_instance(
|
||||
struct loader_instance *ptr_instance,
|
||||
const VkInstanceCreateInfo *pCreateInfo);
|
||||
void wsi_create_instance(struct loader_instance *ptr_instance,
|
||||
const VkInstanceCreateInfo *pCreateInfo);
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL
|
||||
loader_DestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface,
|
||||
const VkAllocationCallbacks *pAllocator);
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL loader_DestroySurfaceKHR(
|
||||
VkInstance instance,
|
||||
VkSurfaceKHR surface,
|
||||
const VkAllocationCallbacks* pAllocator);
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL loader_GetPhysicalDeviceSurfaceSupportKHR(
|
||||
VkPhysicalDevice physicalDevice,
|
||||
uint32_t queueFamilyIndex,
|
||||
VkSurfaceKHR surface,
|
||||
VkBool32* pSupported);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
loader_GetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevice physicalDevice,
|
||||
uint32_t queueFamilyIndex,
|
||||
VkSurfaceKHR surface,
|
||||
VkBool32 *pSupported);
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL loader_GetPhysicalDeviceSurfaceCapabilitiesKHR(
|
||||
VkPhysicalDevice physicalDevice,
|
||||
VkSurfaceKHR surface,
|
||||
VkSurfaceCapabilitiesKHR* pSurfaceCapabilities);
|
||||
VkPhysicalDevice physicalDevice, VkSurfaceKHR surface,
|
||||
VkSurfaceCapabilitiesKHR *pSurfaceCapabilities);
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL loader_GetPhysicalDeviceSurfaceFormatsKHR(
|
||||
VkPhysicalDevice physicalDevice,
|
||||
VkSurfaceKHR surface,
|
||||
uint32_t* pSurfaceFormatCount,
|
||||
VkSurfaceFormatKHR* pSurfaceFormats);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
loader_GetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice physicalDevice,
|
||||
VkSurfaceKHR surface,
|
||||
uint32_t *pSurfaceFormatCount,
|
||||
VkSurfaceFormatKHR *pSurfaceFormats);
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL loader_GetPhysicalDeviceSurfacePresentModesKHR(
|
||||
VkPhysicalDevice physicalDevice,
|
||||
VkSurfaceKHR surface,
|
||||
uint32_t* pPresentModeCount,
|
||||
VkPresentModeKHR* pPresentModes);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
loader_GetPhysicalDeviceSurfacePresentModesKHR(VkPhysicalDevice physicalDevice,
|
||||
VkSurfaceKHR surface,
|
||||
uint32_t *pPresentModeCount,
|
||||
VkPresentModeKHR *pPresentModes);
|
||||
|
||||
#ifdef VK_USE_PLATFORM_WIN32_KHR
|
||||
VKAPI_ATTR VkResult VKAPI_CALL loader_CreateWin32SurfaceKHR(
|
||||
VkInstance instance,
|
||||
const VkWin32SurfaceCreateInfoKHR* pCreateInfo,
|
||||
const VkAllocationCallbacks* pAllocator,
|
||||
VkSurfaceKHR* pSurface);
|
||||
VKAPI_ATTR VkBool32 VKAPI_CALL loader_GetPhysicalDeviceWin32PresentationSupportKHR(
|
||||
VkPhysicalDevice physicalDevice,
|
||||
uint32_t queueFamilyIndex);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
loader_CreateWin32SurfaceKHR(VkInstance instance,
|
||||
const VkWin32SurfaceCreateInfoKHR *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
VkSurfaceKHR *pSurface);
|
||||
VKAPI_ATTR VkBool32 VKAPI_CALL
|
||||
loader_GetPhysicalDeviceWin32PresentationSupportKHR(
|
||||
VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex);
|
||||
#endif
|
||||
#ifdef VK_USE_PLATFORM_MIR_KHR
|
||||
VKAPI_ATTR VkResult VKAPI_CALL loader_CreateMirSurfaceKHR(
|
||||
VkInstance instance,
|
||||
const VkMirSurfaceCreateInfoKHR* pCreateInfo,
|
||||
const VkAllocationCallbacks* pAllocator,
|
||||
VkSurfaceKHR* pSurface);
|
||||
VKAPI_ATTR VkBool32 VKAPI_CALL loader_GetPhysicalDeviceMirPresentationSupportKHR(
|
||||
VkPhysicalDevice physicalDevice,
|
||||
uint32_t queueFamilyIndex,
|
||||
MirConnection* connection);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
loader_CreateMirSurfaceKHR(VkInstance instance,
|
||||
const VkMirSurfaceCreateInfoKHR *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
VkSurfaceKHR *pSurface);
|
||||
VKAPI_ATTR VkBool32 VKAPI_CALL
|
||||
loader_GetPhysicalDeviceMirPresentationSupportKHR(
|
||||
VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex,
|
||||
MirConnection *connection);
|
||||
#endif
|
||||
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
|
||||
VKAPI_ATTR VkResult VKAPI_CALL loader_CreateWaylandSurfaceKHR(
|
||||
VkInstance instance,
|
||||
const VkWaylandSurfaceCreateInfoKHR* pCreateInfo,
|
||||
const VkAllocationCallbacks* pAllocator,
|
||||
VkSurfaceKHR* pSurface);
|
||||
VKAPI_ATTR VkBool32 VKAPI_CALL loader_GetPhysicalDeviceWaylandPresentationSupportKHR(
|
||||
VkPhysicalDevice physicalDevice,
|
||||
uint32_t queueFamilyIndex,
|
||||
struct wl_display* display);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
loader_CreateWaylandSurfaceKHR(VkInstance instance,
|
||||
const VkWaylandSurfaceCreateInfoKHR *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
VkSurfaceKHR *pSurface);
|
||||
VKAPI_ATTR VkBool32 VKAPI_CALL
|
||||
loader_GetPhysicalDeviceWaylandPresentationSupportKHR(
|
||||
VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex,
|
||||
struct wl_display *display);
|
||||
#endif
|
||||
#ifdef VK_USE_PLATFORM_XCB_KHR
|
||||
VKAPI_ATTR VkResult VKAPI_CALL loader_CreateXcbSurfaceKHR(
|
||||
VkInstance instance,
|
||||
const VkXcbSurfaceCreateInfoKHR* pCreateInfo,
|
||||
const VkAllocationCallbacks* pAllocator,
|
||||
VkSurfaceKHR* pSurface);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
loader_CreateXcbSurfaceKHR(VkInstance instance,
|
||||
const VkXcbSurfaceCreateInfoKHR *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
VkSurfaceKHR *pSurface);
|
||||
|
||||
VKAPI_ATTR VkBool32 VKAPI_CALL loader_GetPhysicalDeviceXcbPresentationSupportKHR(
|
||||
VkPhysicalDevice physicalDevice,
|
||||
uint32_t queueFamilyIndex,
|
||||
xcb_connection_t* connection,
|
||||
xcb_visualid_t visual_id);
|
||||
VKAPI_ATTR VkBool32 VKAPI_CALL
|
||||
loader_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 loader_CreateXlibSurfaceKHR(
|
||||
VkInstance instance,
|
||||
const VkXlibSurfaceCreateInfoKHR* pCreateInfo,
|
||||
const VkAllocationCallbacks* pAllocator,
|
||||
VkSurfaceKHR* pSurface);
|
||||
VKAPI_ATTR VkBool32 VKAPI_CALL loader_GetPhysicalDeviceXlibPresentationSupportKHR(
|
||||
VkPhysicalDevice physicalDevice,
|
||||
uint32_t queueFamilyIndex,
|
||||
Display* dpy,
|
||||
VisualID visualID);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
loader_CreateXlibSurfaceKHR(VkInstance instance,
|
||||
const VkXlibSurfaceCreateInfoKHR *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
VkSurfaceKHR *pSurface);
|
||||
VKAPI_ATTR VkBool32 VKAPI_CALL
|
||||
loader_GetPhysicalDeviceXlibPresentationSupportKHR(
|
||||
VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, Display *dpy,
|
||||
VisualID visualID);
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user