Update the Vulkan loader to the latest version
This commit is contained in:
parent
f530ef749a
commit
8d476fc845
|
@ -227,46 +227,19 @@ void VulkanDevice::ReleaseQueue(VkQueue queue) {
|
|||
void VulkanDevice::DbgSetObjectName(VkDevice device, uint64_t object,
|
||||
VkDebugReportObjectTypeEXT object_type,
|
||||
std::string name) {
|
||||
PFN_vkDebugMarkerSetObjectNameEXT pfn_vkDebugMarkerSetObjectNameEXT = nullptr;
|
||||
if (!pfn_vkDebugMarkerSetObjectNameEXT) {
|
||||
pfn_vkDebugMarkerSetObjectNameEXT =
|
||||
(PFN_vkDebugMarkerSetObjectNameEXT)vkGetDeviceProcAddr(
|
||||
device, "vkDebugMarkerSetObjectNameEXT");
|
||||
|
||||
if (!pfn_vkDebugMarkerSetObjectNameEXT) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
VkDebugMarkerObjectNameInfoEXT info;
|
||||
info.sType = VK_STRUCTURE_TYPE_DEBUG_MARKER_OBJECT_NAME_INFO_EXT;
|
||||
info.pNext = nullptr;
|
||||
info.objectType = object_type;
|
||||
info.object = object;
|
||||
info.pObjectName = name.c_str();
|
||||
pfn_vkDebugMarkerSetObjectNameEXT(device, &info);
|
||||
vkDebugMarkerSetObjectNameEXT(device, &info);
|
||||
}
|
||||
|
||||
void VulkanDevice::DbgSetObjectName(uint64_t object,
|
||||
VkDebugReportObjectTypeEXT object_type,
|
||||
std::string name) {
|
||||
if (!pfn_vkDebugMarkerSetObjectNameEXT_) {
|
||||
pfn_vkDebugMarkerSetObjectNameEXT_ =
|
||||
(PFN_vkDebugMarkerSetObjectNameEXT)vkGetDeviceProcAddr(
|
||||
handle, "vkDebugMarkerSetObjectNameEXT");
|
||||
|
||||
if (!pfn_vkDebugMarkerSetObjectNameEXT_) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
VkDebugMarkerObjectNameInfoEXT info;
|
||||
info.sType = VK_STRUCTURE_TYPE_DEBUG_MARKER_OBJECT_NAME_INFO_EXT;
|
||||
info.pNext = nullptr;
|
||||
info.objectType = object_type;
|
||||
info.object = object;
|
||||
info.pObjectName = name.c_str();
|
||||
pfn_vkDebugMarkerSetObjectNameEXT_(handle, &info);
|
||||
DbgSetObjectName(*this, object, object_type, name);
|
||||
}
|
||||
|
||||
bool VulkanDevice::is_renderdoc_attached() const {
|
||||
|
|
|
@ -101,8 +101,6 @@ class VulkanDevice {
|
|||
std::vector<Requirement> required_layers_;
|
||||
std::vector<Requirement> required_extensions_;
|
||||
|
||||
PFN_vkDebugMarkerSetObjectNameEXT pfn_vkDebugMarkerSetObjectNameEXT_;
|
||||
|
||||
DeviceInfo device_info_;
|
||||
uint32_t queue_family_index_ = 0;
|
||||
std::mutex queue_mutex_;
|
||||
|
|
|
@ -88,6 +88,10 @@ void cJSON_Delete(cJSON *c) {
|
|||
}
|
||||
}
|
||||
|
||||
void cJSON_Free(void *p) {
|
||||
cJSON_free(p);
|
||||
}
|
||||
|
||||
/* Parse the input text to generate a number, and populate the result into item.
|
||||
*/
|
||||
static const char *parse_number(cJSON *item, const char *num) {
|
||||
|
|
|
@ -84,6 +84,8 @@ extern char *cJSON_PrintUnformatted(cJSON *item);
|
|||
extern char *cJSON_PrintBuffered(cJSON *item, int prebuffer, int fmt);
|
||||
/* Delete a cJSON entity and all subentities. */
|
||||
extern void cJSON_Delete(cJSON *c);
|
||||
/* Delete an item allocated inside the JSON parser*/
|
||||
extern void cJSON_Free(void *p);
|
||||
|
||||
/* Returns the number of items in an array (or object). */
|
||||
extern int cJSON_GetArraySize(cJSON *array);
|
||||
|
|
|
@ -49,12 +49,12 @@ void debug_report_add_instance_extensions(
|
|||
|
||||
void debug_report_create_instance(struct loader_instance *ptr_instance,
|
||||
const VkInstanceCreateInfo *pCreateInfo) {
|
||||
ptr_instance->debug_report_enabled = false;
|
||||
ptr_instance->enabled_known_extensions.ext_debug_report = 0;
|
||||
|
||||
for (uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; i++) {
|
||||
if (strcmp(pCreateInfo->ppEnabledExtensionNames[i],
|
||||
VK_EXT_DEBUG_REPORT_EXTENSION_NAME) == 0) {
|
||||
ptr_instance->debug_report_enabled = true;
|
||||
ptr_instance->enabled_known_extensions.ext_debug_report = 1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -65,18 +65,27 @@ util_CreateDebugReportCallback(struct loader_instance *inst,
|
|||
VkDebugReportCallbackCreateInfoEXT *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
VkDebugReportCallbackEXT callback) {
|
||||
VkLayerDbgFunctionNode *pNewDbgFuncNode;
|
||||
VkLayerDbgFunctionNode *pNewDbgFuncNode = NULL;
|
||||
|
||||
#if (DEBUG_DISABLE_APP_ALLOCATORS == 1)
|
||||
{
|
||||
#else
|
||||
if (pAllocator != NULL) {
|
||||
pNewDbgFuncNode = (VkLayerDbgFunctionNode *)pAllocator->pfnAllocation(
|
||||
pAllocator->pUserData, sizeof(VkLayerDbgFunctionNode),
|
||||
sizeof(int *), VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
|
||||
pNewDbgFuncNode =
|
||||
(VkLayerDbgFunctionNode *)pAllocator->pfnAllocation(
|
||||
pAllocator->pUserData, sizeof(VkLayerDbgFunctionNode),
|
||||
sizeof(int *), VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
|
||||
} else {
|
||||
pNewDbgFuncNode = (VkLayerDbgFunctionNode *)loader_heap_alloc(
|
||||
inst, sizeof(VkLayerDbgFunctionNode),
|
||||
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
|
||||
#endif
|
||||
pNewDbgFuncNode =
|
||||
(VkLayerDbgFunctionNode *)loader_instance_heap_alloc(
|
||||
inst, sizeof(VkLayerDbgFunctionNode),
|
||||
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
|
||||
}
|
||||
if (!pNewDbgFuncNode)
|
||||
if (!pNewDbgFuncNode) {
|
||||
return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
}
|
||||
memset(pNewDbgFuncNode, 0, sizeof(VkLayerDbgFunctionNode));
|
||||
|
||||
pNewDbgFuncNode->msgCallback = callback;
|
||||
pNewDbgFuncNode->pfnMsgCallback = pCreateInfo->pfnCallback;
|
||||
|
@ -88,17 +97,14 @@ util_CreateDebugReportCallback(struct loader_instance *inst,
|
|||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
static VKAPI_ATTR VkResult VKAPI_CALL debug_report_CreateDebugReportCallback(
|
||||
VkInstance instance, VkDebugReportCallbackCreateInfoEXT *pCreateInfo,
|
||||
VkAllocationCallbacks *pAllocator, VkDebugReportCallbackEXT *pCallback) {
|
||||
static VKAPI_ATTR VkResult VKAPI_CALL debug_report_CreateDebugReportCallbackEXT(
|
||||
VkInstance instance, const VkDebugReportCallbackCreateInfoEXT *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
VkDebugReportCallbackEXT *pCallback) {
|
||||
struct loader_instance *inst = loader_get_instance(instance);
|
||||
loader_platform_thread_lock_mutex(&loader_lock);
|
||||
VkResult result = inst->disp->CreateDebugReportCallbackEXT(
|
||||
instance, pCreateInfo, pAllocator, pCallback);
|
||||
if (result == VK_SUCCESS) {
|
||||
result = util_CreateDebugReportCallback(inst, pCreateInfo, pAllocator,
|
||||
*pCallback);
|
||||
}
|
||||
loader_platform_thread_unlock_mutex(&loader_lock);
|
||||
return result;
|
||||
}
|
||||
|
@ -137,10 +143,14 @@ void util_DestroyDebugReportCallback(struct loader_instance *inst,
|
|||
pPrev->pNext = pTrav->pNext;
|
||||
if (inst->DbgFunctionHead == pTrav)
|
||||
inst->DbgFunctionHead = pTrav->pNext;
|
||||
#if (DEBUG_DISABLE_APP_ALLOCATORS == 1)
|
||||
{
|
||||
#else
|
||||
if (pAllocator != NULL) {
|
||||
pAllocator->pfnFree(pAllocator->pUserData, pTrav);
|
||||
} else {
|
||||
loader_heap_free(inst, pTrav);
|
||||
#endif
|
||||
loader_instance_heap_free(inst, pTrav);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -159,6 +169,8 @@ VkResult util_CopyDebugReportCreateInfos(
|
|||
uint32_t *num_callbacks, VkDebugReportCallbackCreateInfoEXT **infos,
|
||||
VkDebugReportCallbackEXT **callbacks) {
|
||||
uint32_t n = *num_callbacks = 0;
|
||||
VkDebugReportCallbackCreateInfoEXT *pInfos = NULL;
|
||||
VkDebugReportCallbackEXT *pCallbacks = NULL;
|
||||
|
||||
// NOTE: The loader is not using pAllocator, and so this function doesn't
|
||||
// either.
|
||||
|
@ -176,20 +188,45 @@ VkResult util_CopyDebugReportCreateInfos(
|
|||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
// 2nd, allocate memory for each VkDebugReportCallbackCreateInfoEXT:
|
||||
VkDebugReportCallbackCreateInfoEXT *pInfos = *infos =
|
||||
((VkDebugReportCallbackCreateInfoEXT *)malloc(
|
||||
// 2nd, allocate memory for each VkDebugReportCallbackCreateInfoEXT:
|
||||
#if (DEBUG_DISABLE_APP_ALLOCATORS == 1)
|
||||
{
|
||||
#else
|
||||
if (pAllocator != NULL) {
|
||||
pInfos = *infos =
|
||||
((VkDebugReportCallbackCreateInfoEXT *)pAllocator->pfnAllocation(
|
||||
pAllocator->pUserData,
|
||||
n * sizeof(VkDebugReportCallbackCreateInfoEXT), sizeof(void *),
|
||||
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT));
|
||||
} else {
|
||||
#endif
|
||||
pInfos = *infos = ((VkDebugReportCallbackCreateInfoEXT *)malloc(
|
||||
n * sizeof(VkDebugReportCallbackCreateInfoEXT)));
|
||||
}
|
||||
if (!pInfos) {
|
||||
return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
}
|
||||
// 3rd, allocate memory for a unique handle for each callback:
|
||||
VkDebugReportCallbackEXT *pCallbacks = *callbacks =
|
||||
((VkDebugReportCallbackEXT *)malloc(n *
|
||||
sizeof(VkDebugReportCallbackEXT)));
|
||||
if (!pCallbacks) {
|
||||
free(pInfos);
|
||||
return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
// 3rd, allocate memory for a unique handle for each callback:
|
||||
#if (DEBUG_DISABLE_APP_ALLOCATORS == 1)
|
||||
{
|
||||
#else
|
||||
if (pAllocator != NULL) {
|
||||
pCallbacks = *callbacks =
|
||||
((VkDebugReportCallbackEXT *)pAllocator->pfnAllocation(
|
||||
pAllocator->pUserData, n * sizeof(VkDebugReportCallbackEXT),
|
||||
sizeof(void *), VK_SYSTEM_ALLOCATION_SCOPE_OBJECT));
|
||||
if (!pCallbacks) {
|
||||
pAllocator->pfnFree(pAllocator->pUserData, pInfos);
|
||||
return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
}
|
||||
} else {
|
||||
#endif
|
||||
pCallbacks = *callbacks = ((VkDebugReportCallbackEXT *)malloc(
|
||||
n * sizeof(VkDebugReportCallbackEXT)));
|
||||
if (!pCallbacks) {
|
||||
free(pInfos);
|
||||
return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
}
|
||||
}
|
||||
// 4th, copy each VkDebugReportCallbackCreateInfoEXT for use by
|
||||
// vkDestroyInstance, and assign a unique handle to each callback (just
|
||||
|
@ -199,7 +236,7 @@ VkResult util_CopyDebugReportCreateInfos(
|
|||
if (((VkInstanceCreateInfo *)pNext)->sType ==
|
||||
VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT) {
|
||||
memcpy(pInfos, pNext, sizeof(VkDebugReportCallbackCreateInfoEXT));
|
||||
*pCallbacks++ = (VkDebugReportCallbackEXT)pInfos++;
|
||||
*pCallbacks++ = (VkDebugReportCallbackEXT)(uintptr_t)pInfos++;
|
||||
}
|
||||
pNext = (void *)((VkInstanceCreateInfo *)pNext)->pNext;
|
||||
}
|
||||
|
@ -211,8 +248,17 @@ VkResult util_CopyDebugReportCreateInfos(
|
|||
void util_FreeDebugReportCreateInfos(const VkAllocationCallbacks *pAllocator,
|
||||
VkDebugReportCallbackCreateInfoEXT *infos,
|
||||
VkDebugReportCallbackEXT *callbacks) {
|
||||
free(infos);
|
||||
free(callbacks);
|
||||
#if (DEBUG_DISABLE_APP_ALLOCATORS == 1)
|
||||
{
|
||||
#else
|
||||
if (pAllocator != NULL) {
|
||||
pAllocator->pfnFree(pAllocator->pUserData, infos);
|
||||
pAllocator->pfnFree(pAllocator->pUserData, callbacks);
|
||||
} else {
|
||||
#endif
|
||||
free(infos);
|
||||
free(callbacks);
|
||||
}
|
||||
}
|
||||
|
||||
VkResult util_CreateDebugReportCallbacks(
|
||||
|
@ -243,9 +289,9 @@ void util_DestroyDebugReportCallbacks(struct loader_instance *inst,
|
|||
}
|
||||
|
||||
static VKAPI_ATTR void VKAPI_CALL
|
||||
debug_report_DestroyDebugReportCallback(VkInstance instance,
|
||||
VkDebugReportCallbackEXT callback,
|
||||
VkAllocationCallbacks *pAllocator) {
|
||||
debug_report_DestroyDebugReportCallbackEXT(
|
||||
VkInstance instance, VkDebugReportCallbackEXT callback,
|
||||
const VkAllocationCallbacks *pAllocator) {
|
||||
struct loader_instance *inst = loader_get_instance(instance);
|
||||
loader_platform_thread_lock_mutex(&loader_lock);
|
||||
|
||||
|
@ -256,7 +302,7 @@ debug_report_DestroyDebugReportCallback(VkInstance instance,
|
|||
loader_platform_thread_unlock_mutex(&loader_lock);
|
||||
}
|
||||
|
||||
static VKAPI_ATTR void VKAPI_CALL debug_report_DebugReportMessage(
|
||||
static VKAPI_ATTR void VKAPI_CALL debug_report_DebugReportMessageEXT(
|
||||
VkInstance instance, VkDebugReportFlagsEXT flags,
|
||||
VkDebugReportObjectTypeEXT objType, uint64_t object, size_t location,
|
||||
int32_t msgCode, const char *pLayerPrefix, const char *pMsg) {
|
||||
|
@ -275,101 +321,178 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDebugReportCallback(
|
|||
VkInstance instance, const VkDebugReportCallbackCreateInfoEXT *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
VkDebugReportCallbackEXT *pCallback) {
|
||||
VkDebugReportCallbackEXT *icd_info;
|
||||
const struct loader_icd *icd;
|
||||
VkDebugReportCallbackEXT *icd_info = NULL;
|
||||
const struct loader_icd_term *icd_term;
|
||||
struct loader_instance *inst = (struct loader_instance *)instance;
|
||||
VkResult res = VK_SUCCESS;
|
||||
uint32_t storage_idx;
|
||||
VkLayerDbgFunctionNode *pNewDbgFuncNode = NULL;
|
||||
|
||||
icd_info = calloc(sizeof(VkDebugReportCallbackEXT), inst->total_icd_count);
|
||||
#if (DEBUG_DISABLE_APP_ALLOCATORS == 1)
|
||||
{
|
||||
#else
|
||||
if (pAllocator != NULL) {
|
||||
icd_info = ((VkDebugReportCallbackEXT *)pAllocator->pfnAllocation(
|
||||
pAllocator->pUserData,
|
||||
inst->total_icd_count * sizeof(VkDebugReportCallbackEXT),
|
||||
sizeof(void *), VK_SYSTEM_ALLOCATION_SCOPE_OBJECT));
|
||||
memset(icd_info, 0,
|
||||
inst->total_icd_count * sizeof(VkDebugReportCallbackEXT));
|
||||
} else {
|
||||
#endif
|
||||
icd_info =
|
||||
calloc(sizeof(VkDebugReportCallbackEXT), inst->total_icd_count);
|
||||
}
|
||||
if (!icd_info) {
|
||||
return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
res = VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
goto out;
|
||||
}
|
||||
|
||||
storage_idx = 0;
|
||||
for (icd = inst->icds; icd; icd = icd->next) {
|
||||
if (!icd->CreateDebugReportCallbackEXT) {
|
||||
for (icd_term = inst->icd_terms; icd_term; icd_term = icd_term->next) {
|
||||
if (!icd_term->CreateDebugReportCallbackEXT) {
|
||||
continue;
|
||||
}
|
||||
|
||||
res = icd->CreateDebugReportCallbackEXT(
|
||||
icd->instance, pCreateInfo, pAllocator, &icd_info[storage_idx]);
|
||||
res = icd_term->CreateDebugReportCallbackEXT(icd_term->instance,
|
||||
pCreateInfo, pAllocator,
|
||||
&icd_info[storage_idx]);
|
||||
|
||||
if (res != VK_SUCCESS) {
|
||||
break;
|
||||
goto out;
|
||||
}
|
||||
storage_idx++;
|
||||
}
|
||||
|
||||
/* roll back on errors */
|
||||
if (icd) {
|
||||
// Setup the debug report callback in the terminator since a layer may want
|
||||
// to grab the information itself (RenderDoc) and then return back to the
|
||||
// user callback a sub-set of the messages.
|
||||
#if (DEBUG_DISABLE_APP_ALLOCATORS == 0)
|
||||
if (pAllocator != NULL) {
|
||||
pNewDbgFuncNode =
|
||||
(VkLayerDbgFunctionNode *)pAllocator->pfnAllocation(
|
||||
pAllocator->pUserData, sizeof(VkLayerDbgFunctionNode),
|
||||
sizeof(int *), VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
|
||||
} else {
|
||||
#else
|
||||
{
|
||||
#endif
|
||||
pNewDbgFuncNode =
|
||||
(VkLayerDbgFunctionNode *)loader_instance_heap_alloc(
|
||||
inst, sizeof(VkLayerDbgFunctionNode),
|
||||
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
|
||||
}
|
||||
if (!pNewDbgFuncNode) {
|
||||
res = VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
goto out;
|
||||
}
|
||||
memset(pNewDbgFuncNode, 0, sizeof(VkLayerDbgFunctionNode));
|
||||
|
||||
pNewDbgFuncNode->pfnMsgCallback = pCreateInfo->pfnCallback;
|
||||
pNewDbgFuncNode->msgFlags = pCreateInfo->flags;
|
||||
pNewDbgFuncNode->pUserData = pCreateInfo->pUserData;
|
||||
pNewDbgFuncNode->pNext = inst->DbgFunctionHead;
|
||||
inst->DbgFunctionHead = pNewDbgFuncNode;
|
||||
|
||||
*(VkDebugReportCallbackEXT **)pCallback = icd_info;
|
||||
pNewDbgFuncNode->msgCallback = *pCallback;
|
||||
|
||||
out:
|
||||
|
||||
// Roll back on errors
|
||||
if (VK_SUCCESS != res) {
|
||||
storage_idx = 0;
|
||||
for (icd = inst->icds; icd; icd = icd->next) {
|
||||
if (NULL == icd->DestroyDebugReportCallbackEXT) {
|
||||
for (icd_term = inst->icd_terms; icd_term; icd_term = icd_term->next) {
|
||||
if (NULL == icd_term->DestroyDebugReportCallbackEXT) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (icd_info[storage_idx]) {
|
||||
icd->DestroyDebugReportCallbackEXT(
|
||||
icd->instance, icd_info[storage_idx], pAllocator);
|
||||
icd_term->DestroyDebugReportCallbackEXT(
|
||||
icd_term->instance, icd_info[storage_idx], pAllocator);
|
||||
}
|
||||
storage_idx++;
|
||||
}
|
||||
|
||||
return res;
|
||||
#if (DEBUG_DISABLE_APP_ALLOCATORS == 1)
|
||||
{
|
||||
#else
|
||||
if (pAllocator != NULL) {
|
||||
if (NULL != pNewDbgFuncNode) {
|
||||
pAllocator->pfnFree(pAllocator->pUserData, pNewDbgFuncNode);
|
||||
}
|
||||
if (NULL != icd_info) {
|
||||
pAllocator->pfnFree(pAllocator->pUserData, icd_info);
|
||||
}
|
||||
} else {
|
||||
#endif
|
||||
if (NULL != pNewDbgFuncNode) {
|
||||
free(pNewDbgFuncNode);
|
||||
}
|
||||
if (NULL != icd_info) {
|
||||
free(icd_info);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*(VkDebugReportCallbackEXT **)pCallback = icd_info;
|
||||
|
||||
return VK_SUCCESS;
|
||||
return res;
|
||||
}
|
||||
|
||||
/*
|
||||
* This is the instance chain terminator function
|
||||
* for DestroyDebugReportCallback
|
||||
*/
|
||||
VKAPI_ATTR void VKAPI_CALL
|
||||
terminator_DestroyDebugReportCallback(VkInstance instance,
|
||||
VkDebugReportCallbackEXT callback,
|
||||
const VkAllocationCallbacks *pAllocator) {
|
||||
VKAPI_ATTR void VKAPI_CALL terminator_DestroyDebugReportCallback(
|
||||
VkInstance instance, VkDebugReportCallbackEXT callback,
|
||||
const VkAllocationCallbacks *pAllocator) {
|
||||
uint32_t storage_idx;
|
||||
VkDebugReportCallbackEXT *icd_info;
|
||||
const struct loader_icd *icd;
|
||||
const struct loader_icd_term *icd_term;
|
||||
|
||||
struct loader_instance *inst = (struct loader_instance *)instance;
|
||||
icd_info = *(VkDebugReportCallbackEXT **)&callback;
|
||||
storage_idx = 0;
|
||||
for (icd = inst->icds; icd; icd = icd->next) {
|
||||
if (NULL == icd->DestroyDebugReportCallbackEXT) {
|
||||
for (icd_term = inst->icd_terms; icd_term; icd_term = icd_term->next) {
|
||||
if (NULL == icd_term->DestroyDebugReportCallbackEXT) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (icd_info[storage_idx]) {
|
||||
icd->DestroyDebugReportCallbackEXT(
|
||||
icd->instance, icd_info[storage_idx], pAllocator);
|
||||
icd_term->DestroyDebugReportCallbackEXT(
|
||||
icd_term->instance, icd_info[storage_idx], pAllocator);
|
||||
}
|
||||
storage_idx++;
|
||||
}
|
||||
|
||||
#if (DEBUG_DISABLE_APP_ALLOCATORS == 1)
|
||||
{
|
||||
#else
|
||||
if (pAllocator != NULL) {
|
||||
pAllocator->pfnFree(pAllocator->pUserData, icd_info);
|
||||
} else {
|
||||
#endif
|
||||
free(icd_info);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* This is the instance chain terminator function
|
||||
* for DebugReportMessage
|
||||
*/
|
||||
VKAPI_ATTR void VKAPI_CALL
|
||||
terminator_DebugReportMessage(VkInstance instance, VkDebugReportFlagsEXT flags,
|
||||
VkDebugReportObjectTypeEXT objType,
|
||||
uint64_t object, size_t location, int32_t msgCode,
|
||||
const char *pLayerPrefix, const char *pMsg) {
|
||||
const struct loader_icd *icd;
|
||||
VKAPI_ATTR void VKAPI_CALL terminator_DebugReportMessage(
|
||||
VkInstance instance, VkDebugReportFlagsEXT flags,
|
||||
VkDebugReportObjectTypeEXT objType, uint64_t object, size_t location,
|
||||
int32_t msgCode, const char *pLayerPrefix, const char *pMsg) {
|
||||
const struct loader_icd_term *icd_term;
|
||||
|
||||
struct loader_instance *inst = (struct loader_instance *)instance;
|
||||
|
||||
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);
|
||||
for (icd_term = inst->icd_terms; icd_term; icd_term = icd_term->next) {
|
||||
if (icd_term->DebugReportMessageEXT != NULL) {
|
||||
icd_term->DebugReportMessageEXT(icd_term->instance, flags, objType,
|
||||
object, location, msgCode,
|
||||
pLayerPrefix, pMsg);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -392,20 +515,20 @@ bool debug_report_instance_gpa(struct loader_instance *ptr_instance,
|
|||
*addr = NULL;
|
||||
|
||||
if (!strcmp("vkCreateDebugReportCallbackEXT", name)) {
|
||||
*addr = ptr_instance->debug_report_enabled
|
||||
? (void *)debug_report_CreateDebugReportCallback
|
||||
*addr = (ptr_instance->enabled_known_extensions.ext_debug_report == 1)
|
||||
? (void *)debug_report_CreateDebugReportCallbackEXT
|
||||
: NULL;
|
||||
return true;
|
||||
}
|
||||
if (!strcmp("vkDestroyDebugReportCallbackEXT", name)) {
|
||||
*addr = ptr_instance->debug_report_enabled
|
||||
? (void *)debug_report_DestroyDebugReportCallback
|
||||
*addr = (ptr_instance->enabled_known_extensions.ext_debug_report == 1)
|
||||
? (void *)debug_report_DestroyDebugReportCallbackEXT
|
||||
: NULL;
|
||||
return true;
|
||||
}
|
||||
if (!strcmp("vkDebugReportMessageEXT", name)) {
|
||||
*addr = ptr_instance->debug_report_enabled
|
||||
? (void *)debug_report_DebugReportMessage
|
||||
*addr = (ptr_instance->enabled_known_extensions.ext_debug_report == 1)
|
||||
? (void *)debug_report_DebugReportMessageEXT
|
||||
: NULL;
|
||||
return true;
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -36,9 +36,9 @@ DIR *opendir(const char *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_instance_tls_heap_alloc(sizeof *dir)) != 0 &&
|
||||
(dir->name = (char *)loader_instance_tls_heap_alloc(
|
||||
base_length + strlen(all) + 1)) != 0) {
|
||||
strcat(strcpy(dir->name, name), all);
|
||||
|
||||
if ((dir->handle =
|
||||
|
@ -46,13 +46,13 @@ DIR *opendir(const char *name) {
|
|||
dir->result.d_name = 0;
|
||||
} else /* rollback */
|
||||
{
|
||||
loader_tls_heap_free(dir->name);
|
||||
loader_tls_heap_free(dir);
|
||||
loader_instance_tls_heap_free(dir->name);
|
||||
loader_instance_tls_heap_free(dir);
|
||||
dir = 0;
|
||||
}
|
||||
} else /* rollback */
|
||||
{
|
||||
loader_tls_heap_free(dir);
|
||||
loader_instance_tls_heap_free(dir);
|
||||
dir = 0;
|
||||
errno = ENOMEM;
|
||||
}
|
||||
|
@ -71,8 +71,8 @@ int closedir(DIR *dir) {
|
|||
result = _findclose(dir->handle);
|
||||
}
|
||||
|
||||
loader_tls_heap_free(dir->name);
|
||||
loader_tls_heap_free(dir);
|
||||
loader_instance_tls_heap_free(dir->name);
|
||||
loader_instance_tls_heap_free(dir);
|
||||
}
|
||||
|
||||
if (result == -1) /* map all errors to EBADF */
|
||||
|
|
|
@ -0,0 +1,279 @@
|
|||
/*
|
||||
* Copyright (c) 2015-2016 The Khronos Group Inc.
|
||||
* Copyright (c) 2015-2016 Valve Corporation
|
||||
* Copyright (c) 2015-2016 LunarG, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* Author: Mark Lobodzinski <mark@lunarg.com>
|
||||
*/
|
||||
|
||||
#define _GNU_SOURCE
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "vk_loader_platform.h"
|
||||
#include "loader.h"
|
||||
#include "extensions.h"
|
||||
#include <vulkan/vk_icd.h>
|
||||
#include "wsi.h"
|
||||
|
||||
// Definitions for the VK_EXT_debug_marker extension commands which
|
||||
// need to have a terminator function
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkDebugMarkerSetObjectTagEXT(
|
||||
VkDevice device, VkDebugMarkerObjectTagInfoEXT *pTagInfo) {
|
||||
const VkLayerDispatchTable *disp = loader_get_dispatch(device);
|
||||
// If this is a physical device, we have to replace it with the proper one
|
||||
// for the next call.
|
||||
if (pTagInfo->objectType ==
|
||||
VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT) {
|
||||
struct loader_physical_device_tramp *phys_dev_tramp =
|
||||
(struct loader_physical_device_tramp *)(uintptr_t)pTagInfo->object;
|
||||
pTagInfo->object = (uint64_t)(uintptr_t)phys_dev_tramp->phys_dev;
|
||||
}
|
||||
return disp->DebugMarkerSetObjectTagEXT(device, pTagInfo);
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL terminator_DebugMarkerSetObjectTagEXT(
|
||||
VkDevice device, VkDebugMarkerObjectTagInfoEXT *pTagInfo) {
|
||||
uint32_t icd_index = 0;
|
||||
struct loader_device *dev;
|
||||
struct loader_icd_term *icd_term =
|
||||
loader_get_icd_and_device(device, &dev, &icd_index);
|
||||
// If this is a physical device, we have to replace it with the proper one
|
||||
// for the next call.
|
||||
if (pTagInfo->objectType ==
|
||||
VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT) {
|
||||
struct loader_physical_device_term *phys_dev_term =
|
||||
(struct loader_physical_device_term *)(uintptr_t)pTagInfo->object;
|
||||
pTagInfo->object = (uint64_t)(uintptr_t)phys_dev_term->phys_dev;
|
||||
|
||||
// If this is a KHR_surface, and the ICD has created its own, we have to
|
||||
// replace it with the proper one for the next call.
|
||||
} else if (pTagInfo->objectType ==
|
||||
VK_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT) {
|
||||
if (NULL != icd_term && NULL != icd_term->CreateSwapchainKHR) {
|
||||
VkIcdSurface *icd_surface =
|
||||
(VkIcdSurface *)(uintptr_t)pTagInfo->object;
|
||||
if (NULL != icd_surface->real_icd_surfaces) {
|
||||
pTagInfo->object =
|
||||
(uint64_t)icd_surface->real_icd_surfaces[icd_index];
|
||||
}
|
||||
}
|
||||
}
|
||||
assert(icd_term != NULL && icd_term->DebugMarkerSetObjectTagEXT &&
|
||||
"loader: null DebugMarkerSetObjectTagEXT ICD pointer");
|
||||
return icd_term->DebugMarkerSetObjectTagEXT(device, pTagInfo);
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkDebugMarkerSetObjectNameEXT(
|
||||
VkDevice device, VkDebugMarkerObjectNameInfoEXT *pNameInfo) {
|
||||
const VkLayerDispatchTable *disp = loader_get_dispatch(device);
|
||||
// If this is a physical device, we have to replace it with the proper one
|
||||
// for the next call.
|
||||
if (pNameInfo->objectType ==
|
||||
VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT) {
|
||||
struct loader_physical_device_tramp *phys_dev_tramp =
|
||||
(struct loader_physical_device_tramp *)(uintptr_t)pNameInfo->object;
|
||||
pNameInfo->object = (uint64_t)(uintptr_t)phys_dev_tramp->phys_dev;
|
||||
}
|
||||
return disp->DebugMarkerSetObjectNameEXT(device, pNameInfo);
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL terminator_DebugMarkerSetObjectNameEXT(
|
||||
VkDevice device, VkDebugMarkerObjectNameInfoEXT *pNameInfo) {
|
||||
uint32_t icd_index = 0;
|
||||
struct loader_device *dev;
|
||||
struct loader_icd_term *icd_term =
|
||||
loader_get_icd_and_device(device, &dev, &icd_index);
|
||||
// If this is a physical device, we have to replace it with the proper one
|
||||
// for the next call.
|
||||
if (pNameInfo->objectType ==
|
||||
VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT) {
|
||||
struct loader_physical_device_term *phys_dev_term =
|
||||
(struct loader_physical_device_term *)(uintptr_t)pNameInfo->object;
|
||||
pNameInfo->object = (uint64_t)(uintptr_t)phys_dev_term->phys_dev;
|
||||
|
||||
// If this is a KHR_surface, and the ICD has created its own, we have to
|
||||
// replace it with the proper one for the next call.
|
||||
} else if (pNameInfo->objectType ==
|
||||
VK_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT) {
|
||||
if (NULL != icd_term && NULL != icd_term->CreateSwapchainKHR) {
|
||||
VkIcdSurface *icd_surface =
|
||||
(VkIcdSurface *)(uintptr_t)pNameInfo->object;
|
||||
if (NULL != icd_surface->real_icd_surfaces) {
|
||||
pNameInfo->object =
|
||||
(uint64_t)(
|
||||
uintptr_t)icd_surface->real_icd_surfaces[icd_index];
|
||||
}
|
||||
}
|
||||
}
|
||||
assert(icd_term != NULL && icd_term->DebugMarkerSetObjectNameEXT &&
|
||||
"loader: null DebugMarkerSetObjectNameEXT ICD pointer");
|
||||
return icd_term->DebugMarkerSetObjectNameEXT(device, pNameInfo);
|
||||
}
|
||||
|
||||
// Definitions for the VK_NV_external_memory_capabilities extension
|
||||
|
||||
LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
|
||||
vkGetPhysicalDeviceExternalImageFormatPropertiesNV(
|
||||
VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type,
|
||||
VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags,
|
||||
VkExternalMemoryHandleTypeFlagsNV externalHandleType,
|
||||
VkExternalImageFormatPropertiesNV *pExternalImageFormatProperties) {
|
||||
const VkLayerInstanceDispatchTable *disp;
|
||||
VkPhysicalDevice unwrapped_phys_dev =
|
||||
loader_unwrap_physical_device(physicalDevice);
|
||||
disp = loader_get_instance_dispatch(physicalDevice);
|
||||
|
||||
return disp->GetPhysicalDeviceExternalImageFormatPropertiesNV(
|
||||
unwrapped_phys_dev, format, type, tiling, usage, flags,
|
||||
externalHandleType, pExternalImageFormatProperties);
|
||||
}
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
terminator_GetPhysicalDeviceExternalImageFormatPropertiesNV(
|
||||
VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type,
|
||||
VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags,
|
||||
VkExternalMemoryHandleTypeFlagsNV externalHandleType,
|
||||
VkExternalImageFormatPropertiesNV *pExternalImageFormatProperties) {
|
||||
struct loader_physical_device_term *phys_dev_term =
|
||||
(struct loader_physical_device_term *)physicalDevice;
|
||||
struct loader_icd_term *icd_term = phys_dev_term->this_icd_term;
|
||||
|
||||
if (!icd_term->GetPhysicalDeviceExternalImageFormatPropertiesNV) {
|
||||
if (externalHandleType) {
|
||||
return VK_ERROR_FORMAT_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
if (!icd_term->GetPhysicalDeviceImageFormatProperties) {
|
||||
return VK_ERROR_INITIALIZATION_FAILED;
|
||||
}
|
||||
|
||||
pExternalImageFormatProperties->externalMemoryFeatures = 0;
|
||||
pExternalImageFormatProperties->exportFromImportedHandleTypes = 0;
|
||||
pExternalImageFormatProperties->compatibleHandleTypes = 0;
|
||||
|
||||
return icd_term->GetPhysicalDeviceImageFormatProperties(
|
||||
phys_dev_term->phys_dev, format, type, tiling, usage, flags,
|
||||
&pExternalImageFormatProperties->imageFormatProperties);
|
||||
}
|
||||
|
||||
return icd_term->GetPhysicalDeviceExternalImageFormatPropertiesNV(
|
||||
phys_dev_term->phys_dev, format, type, tiling, usage, flags,
|
||||
externalHandleType, pExternalImageFormatProperties);
|
||||
}
|
||||
|
||||
// Definitions for the VK_AMD_draw_indirect_count extension
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndirectCountAMD(
|
||||
VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
|
||||
VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount,
|
||||
uint32_t stride) {
|
||||
const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
|
||||
disp->CmdDrawIndirectCountAMD(commandBuffer, buffer, offset, countBuffer,
|
||||
countBufferOffset, maxDrawCount, stride);
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndexedIndirectCountAMD(
|
||||
VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
|
||||
VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount,
|
||||
uint32_t stride) {
|
||||
const VkLayerDispatchTable *disp = loader_get_dispatch(commandBuffer);
|
||||
disp->CmdDrawIndexedIndirectCountAMD(commandBuffer, buffer, offset,
|
||||
countBuffer, countBufferOffset,
|
||||
maxDrawCount, stride);
|
||||
}
|
||||
|
||||
#ifdef VK_USE_PLATFORM_WIN32_KHR
|
||||
|
||||
// Definitions for the VK_NV_external_memory_win32 extension
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryWin32HandleNV(
|
||||
VkDevice device, VkDeviceMemory memory,
|
||||
VkExternalMemoryHandleTypeFlagsNV handleType, HANDLE *pHandle) {
|
||||
const VkLayerDispatchTable *disp = loader_get_dispatch(device);
|
||||
return disp->GetMemoryWin32HandleNV(device, memory, handleType, pHandle);
|
||||
}
|
||||
|
||||
#endif // VK_USE_PLATFORM_WIN32_KHR
|
||||
|
||||
// GPA helpers for non-KHR extensions
|
||||
|
||||
bool extension_instance_gpa(struct loader_instance *ptr_instance,
|
||||
const char *name, void **addr) {
|
||||
*addr = NULL;
|
||||
|
||||
// Definitions for the VK_EXT_debug_marker extension commands which
|
||||
// need to have a terminator function. Since these are device
|
||||
// commands, we always need to return a valid value for them.
|
||||
|
||||
if (!strcmp("vkDebugMarkerSetObjectTagEXT", name)) {
|
||||
*addr = (void *)vkDebugMarkerSetObjectTagEXT;
|
||||
return true;
|
||||
}
|
||||
if (!strcmp("vkDebugMarkerSetObjectNameEXT", name)) {
|
||||
*addr = (void *)vkDebugMarkerSetObjectNameEXT;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Functions for the VK_NV_external_memory_capabilities extension
|
||||
|
||||
if (!strcmp("vkGetPhysicalDeviceExternalImageFormatPropertiesNV", name)) {
|
||||
*addr = (ptr_instance->enabled_known_extensions
|
||||
.nv_external_memory_capabilities == 1)
|
||||
? (void *)vkGetPhysicalDeviceExternalImageFormatPropertiesNV
|
||||
: NULL;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Functions for the VK_AMD_draw_indirect_count extension
|
||||
|
||||
if (!strcmp("vkCmdDrawIndirectCountAMD", name)) {
|
||||
*addr = (void *)vkCmdDrawIndirectCountAMD;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!strcmp("vkCmdDrawIndexedIndirectCountAMD", name)) {
|
||||
*addr = (void *)vkCmdDrawIndexedIndirectCountAMD;
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef VK_USE_PLATFORM_WIN32_KHR
|
||||
|
||||
// Functions for the VK_NV_external_memory_win32 extension
|
||||
|
||||
if (!strcmp("vkGetMemoryWin32HandleNV", name)) {
|
||||
*addr = (void *)vkGetMemoryWin32HandleNV;
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif // VK_USE_PLATFORM_WIN32_KHR
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void extensions_create_instance(struct loader_instance *ptr_instance,
|
||||
const VkInstanceCreateInfo *pCreateInfo) {
|
||||
ptr_instance->enabled_known_extensions.nv_external_memory_capabilities = 0;
|
||||
|
||||
for (uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; i++) {
|
||||
if (strcmp(pCreateInfo->ppEnabledExtensionNames[i],
|
||||
VK_NV_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME) == 0) {
|
||||
ptr_instance->enabled_known_extensions
|
||||
.nv_external_memory_capabilities = 1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* Copyright (c) 2015-2016 The Khronos Group Inc.
|
||||
* Copyright (c) 2015-2016 Valve Corporation
|
||||
* Copyright (c) 2015-2016 LunarG, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* Author: Mark Lobodzinski <mark@lunarg.com>
|
||||
*
|
||||
*/
|
||||
|
||||
#include "vk_loader_platform.h"
|
||||
#include "loader.h"
|
||||
|
||||
bool extension_instance_gpa(struct loader_instance *ptr_instance,
|
||||
const char *name, void **addr);
|
||||
|
||||
void extensions_create_instance(struct loader_instance *ptr_instance,
|
||||
const VkInstanceCreateInfo *pCreateInfo);
|
||||
|
||||
// Definitions for the VK_EXT_debug_marker extension
|
||||
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL terminator_DebugMarkerSetObjectTagEXT(
|
||||
VkDevice device, VkDebugMarkerObjectTagInfoEXT *pTagInfo);
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL terminator_DebugMarkerSetObjectNameEXT(
|
||||
VkDevice device, VkDebugMarkerObjectNameInfoEXT *pNameInfo);
|
||||
|
||||
// Definitions for the VK_NV_external_memory_capabilities extension
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
terminator_GetPhysicalDeviceExternalImageFormatPropertiesNV(
|
||||
VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type,
|
||||
VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags,
|
||||
VkExternalMemoryHandleTypeFlagsNV externalHandleType,
|
||||
VkExternalImageFormatPropertiesNV *pExternalImageFormatProperties);
|
|
@ -22,6 +22,7 @@
|
|||
#include <string.h>
|
||||
#include "debug_report.h"
|
||||
#include "wsi.h"
|
||||
#include "extensions.h"
|
||||
|
||||
static inline void *trampolineGetProcAddr(struct loader_instance *inst,
|
||||
const char *funcName) {
|
||||
|
@ -304,6 +305,9 @@ static inline void *trampolineGetProcAddr(struct loader_instance *inst,
|
|||
if (wsi_swapchain_instance_gpa(inst, funcName, &addr))
|
||||
return addr;
|
||||
|
||||
if (extension_instance_gpa(inst, funcName, &addr))
|
||||
return addr;
|
||||
|
||||
addr = loader_dev_ext_gpa(inst, funcName);
|
||||
return addr;
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -44,6 +44,9 @@
|
|||
#define LOADER_EXPORT
|
||||
#endif
|
||||
|
||||
// A debug option to disable allocators at compile time to investigate future issues.
|
||||
#define DEBUG_DISABLE_APP_ALLOCATORS 0
|
||||
|
||||
#define MAX_STRING_SIZE 1024
|
||||
#define VK_MAJOR(version) (version >> 22)
|
||||
#define VK_MINOR(version) ((version >> 12) & 0x3ff)
|
||||
|
@ -72,11 +75,11 @@ static const char UTF8_THREE_BYTE_MASK = 0xF8;
|
|||
static const char UTF8_DATA_BYTE_CODE = 0x80;
|
||||
static const char UTF8_DATA_BYTE_MASK = 0xC0;
|
||||
|
||||
static const char std_validation_names[8][VK_MAX_EXTENSION_NAME_SIZE] = {
|
||||
"VK_LAYER_GOOGLE_threading", "VK_LAYER_LUNARG_parameter_validation",
|
||||
"VK_LAYER_LUNARG_device_limits", "VK_LAYER_LUNARG_object_tracker",
|
||||
"VK_LAYER_LUNARG_image", "VK_LAYER_LUNARG_core_validation",
|
||||
"VK_LAYER_LUNARG_swapchain", "VK_LAYER_GOOGLE_unique_objects"};
|
||||
static const char std_validation_names[7][VK_MAX_EXTENSION_NAME_SIZE] = {
|
||||
"VK_LAYER_GOOGLE_threading", "VK_LAYER_LUNARG_parameter_validation",
|
||||
"VK_LAYER_LUNARG_object_tracker", "VK_LAYER_LUNARG_image",
|
||||
"VK_LAYER_LUNARG_core_validation", "VK_LAYER_LUNARG_swapchain",
|
||||
"VK_LAYER_GOOGLE_unique_objects"};
|
||||
|
||||
// form of all dynamic lists/arrays
|
||||
// only the list element should be changed
|
||||
|
@ -141,9 +144,9 @@ struct loader_dispatch_hash_list {
|
|||
};
|
||||
|
||||
#define MAX_NUM_DEV_EXTS 250
|
||||
// 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.
|
||||
// loader_dispatch_hash_entry and loader_dev_ext_dispatch_table.dev_ext have
|
||||
// one to one correspondence; one loader_dispatch_hash_entry for one dev_ext
|
||||
// dispatch entry.
|
||||
// Also have a one to one correspondence with functions in dev_ext_trampoline.c
|
||||
struct loader_dispatch_hash_entry {
|
||||
char *func_name;
|
||||
|
@ -152,7 +155,7 @@ struct loader_dispatch_hash_entry {
|
|||
|
||||
typedef void(VKAPI_PTR *PFN_vkDevExt)(VkDevice device);
|
||||
struct loader_dev_ext_dispatch_table {
|
||||
PFN_vkDevExt DevExt[MAX_NUM_DEV_EXTS];
|
||||
PFN_vkDevExt dev_ext[MAX_NUM_DEV_EXTS];
|
||||
};
|
||||
|
||||
struct loader_dev_dispatch_table {
|
||||
|
@ -160,23 +163,24 @@ struct loader_dev_dispatch_table {
|
|||
struct loader_dev_ext_dispatch_table ext_dispatch;
|
||||
};
|
||||
|
||||
/* per CreateDevice structure */
|
||||
// per CreateDevice structure
|
||||
struct loader_device {
|
||||
struct loader_dev_dispatch_table loader_dispatch;
|
||||
VkDevice device; // device object from the icd
|
||||
|
||||
uint32_t app_extension_count;
|
||||
VkExtensionProperties *app_extension_props;
|
||||
VkDevice chain_device; // device object from the dispatch chain
|
||||
VkDevice icd_device; // device object from the icd
|
||||
struct loader_physical_device_term *phys_dev_term;
|
||||
|
||||
struct loader_layer_list activated_layer_list;
|
||||
|
||||
VkAllocationCallbacks alloc_callbacks;
|
||||
|
||||
struct loader_device *next;
|
||||
};
|
||||
|
||||
/* per ICD structure */
|
||||
struct loader_icd {
|
||||
struct loader_icd_term {
|
||||
// pointers to find other structs
|
||||
const struct loader_scanned_icds *this_icd_lib;
|
||||
const struct loader_scanned_icd *scanned_icd;
|
||||
const struct loader_instance *this_instance;
|
||||
struct loader_device *logical_device_list;
|
||||
VkInstance instance; // instance object from the icd
|
||||
|
@ -198,29 +202,38 @@ struct loader_icd {
|
|||
PFN_vkCreateDebugReportCallbackEXT CreateDebugReportCallbackEXT;
|
||||
PFN_vkDestroyDebugReportCallbackEXT DestroyDebugReportCallbackEXT;
|
||||
PFN_vkDebugReportMessageEXT DebugReportMessageEXT;
|
||||
PFN_vkDebugMarkerSetObjectTagEXT DebugMarkerSetObjectTagEXT;
|
||||
PFN_vkDebugMarkerSetObjectNameEXT DebugMarkerSetObjectNameEXT;
|
||||
PFN_vkGetPhysicalDeviceSurfaceSupportKHR GetPhysicalDeviceSurfaceSupportKHR;
|
||||
PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR
|
||||
GetPhysicalDeviceSurfaceCapabilitiesKHR;
|
||||
PFN_vkGetPhysicalDeviceSurfaceFormatsKHR GetPhysicalDeviceSurfaceFormatsKHR;
|
||||
PFN_vkGetPhysicalDeviceSurfacePresentModesKHR
|
||||
GetPhysicalDeviceSurfacePresentModesKHR;
|
||||
PFN_vkGetPhysicalDeviceExternalImageFormatPropertiesNV
|
||||
GetPhysicalDeviceExternalImageFormatPropertiesNV;
|
||||
#ifdef VK_USE_PLATFORM_WIN32_KHR
|
||||
PFN_vkCreateWin32SurfaceKHR CreateWin32SurfaceKHR;
|
||||
PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR
|
||||
GetPhysicalDeviceWin32PresentationSupportKHR;
|
||||
#endif
|
||||
#ifdef VK_USE_PLATFORM_MIR_KHR
|
||||
PFN_vkCreateMirSurfaceKHR CreateMirSurfaceKHR;
|
||||
PFN_vkGetPhysicalDeviceMirPresentationSupportKHR
|
||||
GetPhysicalDeviceMirPresentvationSupportKHR;
|
||||
GetPhysicalDeviceMirPresentationSupportKHR;
|
||||
#endif
|
||||
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
|
||||
PFN_vkCreateWaylandSurfaceKHR CreateWaylandSurfaceKHR;
|
||||
PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR
|
||||
GetPhysicalDeviceWaylandPresentationSupportKHR;
|
||||
#endif
|
||||
#ifdef VK_USE_PLATFORM_XCB_KHR
|
||||
PFN_vkCreateXcbSurfaceKHR CreateXcbSurfaceKHR;
|
||||
PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR
|
||||
GetPhysicalDeviceXcbPresentationSupportKHR;
|
||||
#endif
|
||||
#ifdef VK_USE_PLATFORM_XLIB_KHR
|
||||
PFN_vkCreateXlibSurfaceKHR CreateXlibSurfaceKHR;
|
||||
PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR
|
||||
GetPhysicalDeviceXlibPresentationSupportKHR;
|
||||
#endif
|
||||
|
@ -235,39 +248,51 @@ struct loader_icd {
|
|||
PFN_vkGetDisplayPlaneCapabilitiesKHR GetDisplayPlaneCapabilitiesKHR;
|
||||
PFN_vkCreateDisplayPlaneSurfaceKHR CreateDisplayPlaneSurfaceKHR;
|
||||
PFN_vkDestroySurfaceKHR DestroySurfaceKHR;
|
||||
struct loader_icd *next;
|
||||
PFN_vkCreateSwapchainKHR CreateSwapchainKHR;
|
||||
struct loader_icd_term *next;
|
||||
};
|
||||
|
||||
/* per ICD library structure */
|
||||
struct loader_icd_libs {
|
||||
// per ICD library structure
|
||||
struct loader_icd_tramp_list {
|
||||
size_t capacity;
|
||||
uint32_t count;
|
||||
struct loader_scanned_icds *list;
|
||||
struct loader_scanned_icd *scanned_list;
|
||||
};
|
||||
|
||||
/* per instance structure */
|
||||
union loader_instance_extension_enables {
|
||||
struct {
|
||||
uint8_t ext_debug_report : 1;
|
||||
uint8_t nv_external_memory_capabilities : 1;
|
||||
};
|
||||
uint64_t padding[4];
|
||||
};
|
||||
|
||||
// per instance structure
|
||||
struct loader_instance {
|
||||
VkLayerInstanceDispatchTable *disp; // must be first entry in structure
|
||||
|
||||
uint32_t total_gpu_count; // count of the next two arrays
|
||||
struct loader_physical_device *phys_devs_term;
|
||||
struct loader_physical_device_tramp *
|
||||
phys_devs; // tramp wrapped physDev obj list
|
||||
uint32_t total_icd_count;
|
||||
struct loader_icd *icds;
|
||||
uint32_t total_gpu_count;
|
||||
struct loader_physical_device_term *phys_devs_term;
|
||||
struct loader_physical_device_tramp *phys_devs_tramp;
|
||||
|
||||
struct loader_instance *next;
|
||||
struct loader_extension_list ext_list; // icds and loaders extensions
|
||||
struct loader_icd_libs icd_libs;
|
||||
struct loader_layer_list instance_layer_list;
|
||||
|
||||
uint32_t total_icd_count;
|
||||
struct loader_icd_term *icd_terms;
|
||||
struct loader_icd_tramp_list icd_tramp_list;
|
||||
|
||||
struct loader_dispatch_hash_entry disp_hash[MAX_NUM_DEV_EXTS];
|
||||
|
||||
struct loader_msg_callback_map_entry *icd_msg_callback_map;
|
||||
|
||||
struct loader_layer_list instance_layer_list;
|
||||
struct loader_layer_list activated_layer_list;
|
||||
bool activated_layers_are_std_val;
|
||||
VkInstance instance; // layers/ICD instance returned to trampoline
|
||||
|
||||
bool debug_report_enabled;
|
||||
struct loader_extension_list ext_list; // icds and loaders extensions
|
||||
union loader_instance_extension_enables enabled_known_extensions;
|
||||
|
||||
VkLayerDbgFunctionNode *DbgFunctionHead;
|
||||
uint32_t num_tmp_callbacks;
|
||||
VkDebugReportCallbackCreateInfoEXT *tmp_dbg_create_infos;
|
||||
|
@ -298,7 +323,7 @@ struct loader_instance {
|
|||
};
|
||||
|
||||
/* VkPhysicalDevice requires special treatment by loader. Firstly, terminator
|
||||
* code must be able to get the struct loader_icd to call into the proper
|
||||
* code must be able to get the struct loader_icd_term to call into the proper
|
||||
* driver (multiple ICD/gpu case). This can be accomplished by wrapping the
|
||||
* created VkPhysicalDevice in loader terminate_EnumeratePhysicalDevices().
|
||||
* Secondly, the loader must be able to handle wrapped by layer VkPhysicalDevice
|
||||
|
@ -318,9 +343,10 @@ struct loader_physical_device_tramp {
|
|||
};
|
||||
|
||||
/* per enumerated PhysicalDevice structure, used to wrap in terminator code */
|
||||
struct loader_physical_device {
|
||||
struct loader_physical_device_term {
|
||||
VkLayerInstanceDispatchTable *disp; // must be first entry in structure
|
||||
struct loader_icd *this_icd;
|
||||
struct loader_icd_term *this_icd_term;
|
||||
uint8_t icd_index;
|
||||
VkPhysicalDevice phys_dev; // object from ICD
|
||||
};
|
||||
|
||||
|
@ -328,7 +354,7 @@ struct loader_struct {
|
|||
struct loader_instance *instances;
|
||||
};
|
||||
|
||||
struct loader_scanned_icds {
|
||||
struct loader_scanned_icd {
|
||||
char *lib_name;
|
||||
loader_platform_dl_handle handle;
|
||||
uint32_t api_version;
|
||||
|
@ -393,14 +419,22 @@ struct loader_msg_callback_map_entry {
|
|||
};
|
||||
|
||||
/* helper function definitions */
|
||||
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_tls_heap_alloc(size_t size);
|
||||
|
||||
void loader_tls_heap_free(void *pMemory);
|
||||
void *loader_instance_heap_alloc(const struct loader_instance *instance,
|
||||
size_t size,
|
||||
VkSystemAllocationScope allocationScope);
|
||||
void loader_instance_heap_free(const struct loader_instance *instance,
|
||||
void *pMemory);
|
||||
void *loader_instance_heap_realloc(const struct loader_instance *instance,
|
||||
void *pMemory, size_t orig_size, size_t size,
|
||||
VkSystemAllocationScope alloc_scope);
|
||||
void *loader_instance_tls_heap_alloc(size_t size);
|
||||
void loader_instance_tls_heap_free(void *pMemory);
|
||||
void *loader_device_heap_alloc(const struct loader_device *device, size_t size,
|
||||
VkSystemAllocationScope allocationScope);
|
||||
void loader_device_heap_free(const struct loader_device *device, void *pMemory);
|
||||
void *loader_device_heap_realloc(const struct loader_device *device,
|
||||
void *pMemory, size_t orig_size, size_t size,
|
||||
VkSystemAllocationScope alloc_scope);
|
||||
|
||||
void loader_log(const struct loader_instance *inst, VkFlags msg_type,
|
||||
int32_t msg_code, const char *format, ...);
|
||||
|
@ -420,9 +454,9 @@ VkResult loader_validate_instance_extensions(
|
|||
const VkInstanceCreateInfo *pCreateInfo);
|
||||
|
||||
void loader_initialize(void);
|
||||
void loader_copy_layer_properties(const struct loader_instance *inst,
|
||||
struct loader_layer_properties *dst,
|
||||
struct loader_layer_properties *src);
|
||||
VkResult loader_copy_layer_properties(const struct loader_instance *inst,
|
||||
struct loader_layer_properties *dst,
|
||||
struct loader_layer_properties *src);
|
||||
bool has_vk_extension_property_array(const VkExtensionProperties *vk_ext_prop,
|
||||
const uint32_t count,
|
||||
const VkExtensionProperties *ext_array);
|
||||
|
@ -444,20 +478,21 @@ VkResult loader_add_device_extensions(const struct loader_instance *inst,
|
|||
VkPhysicalDevice physical_device,
|
||||
const char *lib_name,
|
||||
struct loader_extension_list *ext_list);
|
||||
bool loader_init_generic_list(const struct loader_instance *inst,
|
||||
struct loader_generic_list *list_info,
|
||||
size_t element_size);
|
||||
VkResult loader_init_generic_list(const struct loader_instance *inst,
|
||||
struct loader_generic_list *list_info,
|
||||
size_t element_size);
|
||||
void loader_destroy_generic_list(const struct loader_instance *inst,
|
||||
struct loader_generic_list *list);
|
||||
void loader_destroy_layer_list(const struct loader_instance *inst,
|
||||
struct loader_device *device,
|
||||
struct loader_layer_list *layer_list);
|
||||
void loader_delete_layer_properties(const struct loader_instance *inst,
|
||||
struct loader_layer_list *layer_list);
|
||||
bool loader_find_layer_name_array(const char *name, uint32_t layer_count,
|
||||
const char layer_list[][VK_MAX_EXTENSION_NAME_SIZE]);
|
||||
void loader_expand_layer_names(
|
||||
struct loader_instance *inst, const char *key_name,
|
||||
uint32_t expand_count,
|
||||
bool loader_find_layer_name_array(
|
||||
const char *name, uint32_t layer_count,
|
||||
const char layer_list[][VK_MAX_EXTENSION_NAME_SIZE]);
|
||||
VkResult loader_expand_layer_names(
|
||||
struct loader_instance *inst, const char *key_name, uint32_t expand_count,
|
||||
const char expand_names[][VK_MAX_EXTENSION_NAME_SIZE],
|
||||
uint32_t *layer_count, char const *const **ppp_layer_names);
|
||||
void loader_init_std_validation_props(struct loader_layer_properties *props);
|
||||
|
@ -467,42 +502,55 @@ void loader_delete_shadow_dev_layer_names(const struct loader_instance *inst,
|
|||
void loader_delete_shadow_inst_layer_names(const struct loader_instance *inst,
|
||||
const VkInstanceCreateInfo *orig,
|
||||
VkInstanceCreateInfo *ours);
|
||||
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);
|
||||
VkResult loader_add_to_layer_list(const struct loader_instance *inst,
|
||||
struct loader_layer_list *list,
|
||||
uint32_t prop_list_count,
|
||||
const struct loader_layer_properties *props);
|
||||
void loader_find_layer_name_add_list(
|
||||
const struct loader_instance *inst, const char *name,
|
||||
const enum layer_type type, const struct loader_layer_list *search_list,
|
||||
struct loader_layer_list *found_list);
|
||||
void loader_scanned_icd_clear(const struct loader_instance *inst,
|
||||
struct loader_icd_libs *icd_libs);
|
||||
void loader_icd_scan(const struct loader_instance *inst,
|
||||
struct loader_icd_libs *icds);
|
||||
struct loader_icd_tramp_list *icd_tramp_list);
|
||||
VkResult loader_icd_scan(const struct loader_instance *inst,
|
||||
struct loader_icd_tramp_list *icd_tramp_list);
|
||||
void loader_layer_scan(const struct loader_instance *inst,
|
||||
struct loader_layer_list *instance_layers);
|
||||
void loader_implicit_layer_scan(const struct loader_instance *inst,
|
||||
struct loader_layer_list *instance_layers);
|
||||
void loader_get_icd_loader_instance_extensions(
|
||||
const struct loader_instance *inst, struct loader_icd_libs *icd_libs,
|
||||
VkResult loader_get_icd_loader_instance_extensions(
|
||||
const struct loader_instance *inst,
|
||||
struct loader_icd_tramp_list *icd_tramp_list,
|
||||
struct loader_extension_list *inst_exts);
|
||||
struct loader_icd *loader_get_icd_and_device(const VkDevice device,
|
||||
struct loader_device **found_dev);
|
||||
struct loader_icd_term *
|
||||
loader_get_icd_and_device(const VkDevice device,
|
||||
struct loader_device **found_dev,
|
||||
uint32_t *icd_index);
|
||||
void loader_init_dispatch_dev_ext(struct loader_instance *inst,
|
||||
struct loader_device *dev);
|
||||
void *loader_dev_ext_gpa(struct loader_instance *inst, const char *funcName);
|
||||
void *loader_get_dev_ext_trampoline(uint32_t index);
|
||||
void loader_override_terminating_device_proc(struct loader_device *dev);
|
||||
struct loader_instance *loader_get_instance(const VkInstance instance);
|
||||
void loader_deactivate_layers(const struct loader_instance *instance,
|
||||
struct loader_device *device,
|
||||
struct loader_layer_list *list);
|
||||
struct loader_device *
|
||||
loader_create_logical_device(const struct loader_instance *inst);
|
||||
loader_create_logical_device(const struct loader_instance *inst,
|
||||
const VkAllocationCallbacks *pAllocator);
|
||||
void loader_add_logical_device(const struct loader_instance *inst,
|
||||
struct loader_icd *icd,
|
||||
struct loader_icd_term *icd_term,
|
||||
struct loader_device *found_dev);
|
||||
void loader_remove_logical_device(const struct loader_instance *inst,
|
||||
struct loader_icd *icd,
|
||||
struct loader_device *found_dev);
|
||||
struct loader_icd_term *icd_term,
|
||||
struct loader_device *found_dev,
|
||||
const VkAllocationCallbacks *pAllocator);
|
||||
// NOTE: Outside of loader, this entry-point is only proivided for error
|
||||
// cleanup.
|
||||
void loader_destroy_logical_device(const struct loader_instance *inst,
|
||||
struct loader_device *dev,
|
||||
const VkAllocationCallbacks *pAllocator);
|
||||
|
||||
VkResult
|
||||
loader_enable_instance_layers(struct loader_instance *inst,
|
||||
const VkInstanceCreateInfo *pCreateInfo,
|
||||
|
|
|
@ -6,6 +6,7 @@ project("vulkan-loader")
|
|||
|
||||
defines({
|
||||
"_LIB",
|
||||
"API_NAME=\"vulkan\"",
|
||||
})
|
||||
removedefines({
|
||||
"_UNICODE",
|
||||
|
|
|
@ -31,10 +31,12 @@
|
|||
|
||||
static VkResult vkDevExtError(VkDevice dev) {
|
||||
struct loader_device *found_dev;
|
||||
struct loader_icd *icd = loader_get_icd_and_device(dev, &found_dev);
|
||||
// The device going in is a trampoline device
|
||||
struct loader_icd_term *icd_term =
|
||||
loader_get_icd_and_device(dev, &found_dev, NULL);
|
||||
|
||||
if (icd)
|
||||
loader_log(icd->this_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0,
|
||||
if (icd_term)
|
||||
loader_log(icd_term->this_instance, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0,
|
||||
"Bad destination in loader trampoline dispatch,"
|
||||
"Are layers and extensions that you are calling enabled?");
|
||||
return VK_ERROR_EXTENSION_NOT_PRESENT;
|
||||
|
@ -45,7 +47,7 @@ loader_init_device_dispatch_table(struct loader_dev_dispatch_table *dev_table,
|
|||
PFN_vkGetDeviceProcAddr gpa, VkDevice dev) {
|
||||
VkLayerDispatchTable *table = &dev_table->core_dispatch;
|
||||
for (uint32_t i = 0; i < MAX_NUM_DEV_EXTS; i++)
|
||||
dev_table->ext_dispatch.DevExt[i] = (PFN_vkDevExt)vkDevExtError;
|
||||
dev_table->ext_dispatch.dev_ext[i] = (PFN_vkDevExt)vkDevExtError;
|
||||
|
||||
table->GetDeviceProcAddr =
|
||||
(PFN_vkGetDeviceProcAddr)gpa(dev, "vkGetDeviceProcAddr");
|
||||
|
@ -267,6 +269,27 @@ static inline void loader_init_device_extension_dispatch_table(
|
|||
(PFN_vkGetSwapchainImagesKHR)gpa(dev, "vkGetSwapchainImagesKHR");
|
||||
table->QueuePresentKHR =
|
||||
(PFN_vkQueuePresentKHR)gpa(dev, "vkQueuePresentKHR");
|
||||
table->CmdDrawIndirectCountAMD =
|
||||
(PFN_vkCmdDrawIndirectCountAMD)gpa(dev, "vkCmdDrawIndirectCountAMD");
|
||||
table->CmdDrawIndexedIndirectCountAMD =
|
||||
(PFN_vkCmdDrawIndexedIndirectCountAMD)gpa(
|
||||
dev, "vkCmdDrawIndexedIndirectCountAMD");
|
||||
#ifdef VK_USE_PLATFORM_WIN32_KHR
|
||||
table->GetMemoryWin32HandleNV =
|
||||
(PFN_vkGetMemoryWin32HandleNV)gpa(dev, "vkGetMemoryWin32HandleNV");
|
||||
#endif // VK_USE_PLATFORM_WIN32_KHR
|
||||
table->CreateSharedSwapchainsKHR =
|
||||
(PFN_vkCreateSharedSwapchainsKHR)gpa(dev, "vkCreateSharedSwapchainsKHR");
|
||||
table->DebugMarkerSetObjectTagEXT =
|
||||
(PFN_vkDebugMarkerSetObjectTagEXT)gpa(dev, "vkDebugMarkerSetObjectTagEXT");
|
||||
table->DebugMarkerSetObjectNameEXT =
|
||||
(PFN_vkDebugMarkerSetObjectNameEXT)gpa(dev, "vkDebugMarkerSetObjectNameEXT");
|
||||
table->CmdDebugMarkerBeginEXT =
|
||||
(PFN_vkCmdDebugMarkerBeginEXT)gpa(dev, "vkCmdDebugMarkerBeginEXT");
|
||||
table->CmdDebugMarkerEndEXT =
|
||||
(PFN_vkCmdDebugMarkerEndEXT)gpa(dev, "vkCmdDebugMarkerEndEXT");
|
||||
table->CmdDebugMarkerInsertEXT =
|
||||
(PFN_vkCmdDebugMarkerInsertEXT)gpa(dev, "vkCmdDebugMarkerInsertEXT");
|
||||
}
|
||||
|
||||
static inline void *
|
||||
|
@ -519,6 +542,29 @@ loader_lookup_device_dispatch_table(const VkLayerDispatchTable *table,
|
|||
if (!strcmp(name, "CmdExecuteCommands"))
|
||||
return (void *)table->CmdExecuteCommands;
|
||||
|
||||
if (!strcmp(name, "DestroySwapchainKHR"))
|
||||
return (void *)table->DestroySwapchainKHR;
|
||||
if (!strcmp(name, "GetSwapchainImagesKHR"))
|
||||
return (void *)table->GetSwapchainImagesKHR;
|
||||
if (!strcmp(name, "AcquireNextImageKHR"))
|
||||
return (void *)table->AcquireNextImageKHR;
|
||||
if (!strcmp(name, "QueuePresentKHR"))
|
||||
return (void *)table->QueuePresentKHR;
|
||||
|
||||
// NOTE: Device Funcs needing Trampoline/Terminator.
|
||||
// Overrides for device functions needing a trampoline and
|
||||
// a terminator because certain device entry-points still need to go
|
||||
// through a terminator before hitting the ICD. This could be for
|
||||
// several reasons, but the main one is currently unwrapping an
|
||||
// object before passing the appropriate info along to the ICD.
|
||||
if (!strcmp(name, "CreateSwapchainKHR")) {
|
||||
return (void *)vkCreateSwapchainKHR;
|
||||
} else if (!strcmp(name, "DebugMarkerSetObjectTagEXT")) {
|
||||
return (void *)vkDebugMarkerSetObjectTagEXT;
|
||||
} else if (!strcmp(name, "DebugMarkerSetObjectNameEXT")) {
|
||||
return (void *)vkDebugMarkerSetObjectNameEXT;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -584,6 +630,9 @@ static inline void loader_init_instance_extension_dispatch_table(
|
|||
table->GetPhysicalDeviceSurfacePresentModesKHR =
|
||||
(PFN_vkGetPhysicalDeviceSurfacePresentModesKHR)gpa(
|
||||
inst, "vkGetPhysicalDeviceSurfacePresentModesKHR");
|
||||
table->GetPhysicalDeviceExternalImageFormatPropertiesNV =
|
||||
(PFN_vkGetPhysicalDeviceExternalImageFormatPropertiesNV)gpa(
|
||||
inst, "vkGetPhysicalDeviceExternalImageFormatPropertiesNV");
|
||||
#ifdef VK_USE_PLATFORM_MIR_KHR
|
||||
table->CreateMirSurfaceKHR =
|
||||
(PFN_vkCreateMirSurfaceKHR)gpa(inst, "vkCreateMirSurfaceKHR");
|
||||
|
@ -684,6 +733,8 @@ loader_lookup_instance_dispatch_table(const VkLayerInstanceDispatchTable *table,
|
|||
return (void *)table->GetPhysicalDeviceSurfaceFormatsKHR;
|
||||
if (!strcmp(name, "GetPhysicalDeviceSurfacePresentModesKHR"))
|
||||
return (void *)table->GetPhysicalDeviceSurfacePresentModesKHR;
|
||||
if (!strcmp(name, "GetPhysicalDeviceExternalImageFormatPropertiesNV"))
|
||||
return (void *)table->GetPhysicalDeviceExternalImageFormatPropertiesNV;
|
||||
#ifdef VK_USE_PLATFORM_MIR_KHR
|
||||
if (!strcmp(name, "CreateMirSurfaceKHR"))
|
||||
return (void *)table->CreateMirSurfaceKHR;
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "loader.h"
|
||||
#include "debug_report.h"
|
||||
#include "wsi.h"
|
||||
#include "extensions.h"
|
||||
#include "gpa_helper.h"
|
||||
#include "table_ops.h"
|
||||
|
||||
|
@ -120,8 +121,9 @@ vkEnumerateInstanceExtensionProperties(const char *pLayerName,
|
|||
struct loader_extension_list *global_ext_list = NULL;
|
||||
struct loader_layer_list instance_layers;
|
||||
struct loader_extension_list local_ext_list;
|
||||
struct loader_icd_libs icd_libs;
|
||||
struct loader_icd_tramp_list icd_tramp_list;
|
||||
uint32_t copy_size;
|
||||
VkResult res = VK_SUCCESS;
|
||||
|
||||
tls_instance = NULL;
|
||||
memset(&local_ext_list, 0, sizeof(local_ext_list));
|
||||
|
@ -134,7 +136,8 @@ vkEnumerateInstanceExtensionProperties(const char *pLayerName,
|
|||
VK_STRING_ERROR_NONE) {
|
||||
assert(VK_FALSE && "vkEnumerateInstanceExtensionProperties: "
|
||||
"pLayerName is too long or is badly formed");
|
||||
return VK_ERROR_EXTENSION_NOT_PRESENT;
|
||||
res = VK_ERROR_EXTENSION_NOT_PRESENT;
|
||||
goto out;
|
||||
}
|
||||
|
||||
loader_layer_scan(NULL, &instance_layers);
|
||||
|
@ -154,7 +157,7 @@ vkEnumerateInstanceExtensionProperties(const char *pLayerName,
|
|||
loader_add_to_ext_list(NULL, &local_ext_list, ext_list->count,
|
||||
ext_list->list);
|
||||
}
|
||||
loader_destroy_layer_list(NULL, &local_list);
|
||||
loader_destroy_layer_list(NULL, NULL, &local_list);
|
||||
global_ext_list = &local_ext_list;
|
||||
|
||||
} else {
|
||||
|
@ -169,12 +172,18 @@ vkEnumerateInstanceExtensionProperties(const char *pLayerName,
|
|||
}
|
||||
} else {
|
||||
/* Scan/discover all ICD libraries */
|
||||
memset(&icd_libs, 0, sizeof(struct loader_icd_libs));
|
||||
loader_icd_scan(NULL, &icd_libs);
|
||||
memset(&icd_tramp_list, 0, sizeof(struct loader_icd_tramp_list));
|
||||
res = loader_icd_scan(NULL, &icd_tramp_list);
|
||||
if (VK_SUCCESS != res) {
|
||||
goto out;
|
||||
}
|
||||
/* get extensions from all ICD's, merge so no duplicates */
|
||||
loader_get_icd_loader_instance_extensions(NULL, &icd_libs,
|
||||
&local_ext_list);
|
||||
loader_scanned_icd_clear(NULL, &icd_libs);
|
||||
res = loader_get_icd_loader_instance_extensions(NULL, &icd_tramp_list,
|
||||
&local_ext_list);
|
||||
if (VK_SUCCESS != res) {
|
||||
goto out;
|
||||
}
|
||||
loader_scanned_icd_clear(NULL, &icd_tramp_list);
|
||||
|
||||
// Append implicit layers.
|
||||
loader_implicit_layer_scan(NULL, &instance_layers);
|
||||
|
@ -189,16 +198,13 @@ vkEnumerateInstanceExtensionProperties(const char *pLayerName,
|
|||
}
|
||||
|
||||
if (global_ext_list == NULL) {
|
||||
loader_destroy_layer_list(NULL, &instance_layers);
|
||||
return VK_ERROR_LAYER_NOT_PRESENT;
|
||||
res = VK_ERROR_LAYER_NOT_PRESENT;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (pProperties == NULL) {
|
||||
*pPropertyCount = global_ext_list->count;
|
||||
loader_destroy_layer_list(NULL, &instance_layers);
|
||||
loader_destroy_generic_list(
|
||||
NULL, (struct loader_generic_list *)&local_ext_list);
|
||||
return VK_SUCCESS;
|
||||
goto out;
|
||||
}
|
||||
|
||||
copy_size = *pPropertyCount < global_ext_list->count
|
||||
|
@ -209,21 +215,21 @@ vkEnumerateInstanceExtensionProperties(const char *pLayerName,
|
|||
sizeof(VkExtensionProperties));
|
||||
}
|
||||
*pPropertyCount = copy_size;
|
||||
loader_destroy_generic_list(NULL,
|
||||
(struct loader_generic_list *)&local_ext_list);
|
||||
|
||||
if (copy_size < global_ext_list->count) {
|
||||
loader_destroy_layer_list(NULL, &instance_layers);
|
||||
return VK_INCOMPLETE;
|
||||
res = VK_INCOMPLETE;
|
||||
goto out;
|
||||
}
|
||||
|
||||
loader_destroy_layer_list(NULL, &instance_layers);
|
||||
return VK_SUCCESS;
|
||||
out:
|
||||
loader_destroy_generic_list(NULL,
|
||||
(struct loader_generic_list *)&local_ext_list);
|
||||
loader_delete_layer_properties(NULL, &instance_layers);
|
||||
return res;
|
||||
}
|
||||
|
||||
LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
|
||||
vkEnumerateInstanceLayerProperties(uint32_t *pPropertyCount,
|
||||
VkLayerProperties *pProperties) {
|
||||
LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceLayerProperties(
|
||||
uint32_t *pPropertyCount, VkLayerProperties *pProperties) {
|
||||
|
||||
struct loader_layer_list instance_layer_list;
|
||||
tls_instance = NULL;
|
||||
|
@ -238,7 +244,7 @@ vkEnumerateInstanceLayerProperties(uint32_t *pPropertyCount,
|
|||
|
||||
if (pProperties == NULL) {
|
||||
*pPropertyCount = instance_layer_list.count;
|
||||
loader_destroy_layer_list(NULL, &instance_layer_list);
|
||||
loader_destroy_layer_list(NULL, NULL, &instance_layer_list);
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -251,50 +257,54 @@ vkEnumerateInstanceLayerProperties(uint32_t *pPropertyCount,
|
|||
}
|
||||
|
||||
*pPropertyCount = copy_size;
|
||||
loader_destroy_layer_list(NULL, &instance_layer_list);
|
||||
|
||||
if (copy_size < instance_layer_list.count) {
|
||||
loader_destroy_layer_list(NULL, NULL, &instance_layer_list);
|
||||
return VK_INCOMPLETE;
|
||||
}
|
||||
|
||||
loader_destroy_layer_list(NULL, NULL, &instance_layer_list);
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
|
||||
vkCreateInstance(const VkInstanceCreateInfo *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
VkInstance *pInstance) {
|
||||
LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateInstance(
|
||||
const VkInstanceCreateInfo *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator, VkInstance *pInstance) {
|
||||
struct loader_instance *ptr_instance = NULL;
|
||||
VkInstance created_instance = VK_NULL_HANDLE;
|
||||
bool loaderLocked = false;
|
||||
VkResult res = VK_ERROR_INITIALIZATION_FAILED;
|
||||
|
||||
loader_platform_thread_once(&once_init, loader_initialize);
|
||||
|
||||
//TODO start handling the pAllocators again
|
||||
#if 0
|
||||
if (pAllocator) {
|
||||
ptr_instance = (struct loader_instance *) pAllocator->pfnAllocation(
|
||||
pAllocator->pUserData,
|
||||
sizeof(struct loader_instance),
|
||||
sizeof(int *),
|
||||
VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
|
||||
#if (DEBUG_DISABLE_APP_ALLOCATORS == 1)
|
||||
{
|
||||
#else
|
||||
if (pAllocator) {
|
||||
ptr_instance = (struct loader_instance *)pAllocator->pfnAllocation(
|
||||
pAllocator->pUserData, sizeof(struct loader_instance),
|
||||
sizeof(int *), VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
|
||||
} else {
|
||||
#endif
|
||||
ptr_instance =
|
||||
(struct loader_instance *)malloc(sizeof(struct loader_instance));
|
||||
//}
|
||||
ptr_instance =
|
||||
(struct loader_instance *)malloc(sizeof(struct loader_instance));
|
||||
}
|
||||
|
||||
VkInstanceCreateInfo ici = *pCreateInfo;
|
||||
|
||||
if (ptr_instance == NULL) {
|
||||
return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
res = VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
goto out;
|
||||
}
|
||||
|
||||
tls_instance = ptr_instance;
|
||||
loader_platform_thread_lock_mutex(&loader_lock);
|
||||
loaderLocked = true;
|
||||
memset(ptr_instance, 0, sizeof(struct loader_instance));
|
||||
#if 0
|
||||
if (pAllocator) {
|
||||
ptr_instance->alloc_callbacks = *pAllocator;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Look for one or more debug report create info structures
|
||||
|
@ -309,9 +319,8 @@ vkCreateInstance(const VkInstanceCreateInfo *pCreateInfo,
|
|||
&ptr_instance->tmp_callbacks)) {
|
||||
// One or more were found, but allocation failed. Therefore, clean up
|
||||
// and fail this function:
|
||||
loader_heap_free(ptr_instance, ptr_instance);
|
||||
loader_platform_thread_unlock_mutex(&loader_lock);
|
||||
return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
res = VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
goto out;
|
||||
} else if (ptr_instance->num_tmp_callbacks > 0) {
|
||||
// Setup the temporary callback(s) here to catch early issues:
|
||||
if (util_CreateDebugReportCallbacks(ptr_instance, pAllocator,
|
||||
|
@ -320,12 +329,8 @@ vkCreateInstance(const VkInstanceCreateInfo *pCreateInfo,
|
|||
ptr_instance->tmp_callbacks)) {
|
||||
// Failure of setting up one or more of the callback. Therefore,
|
||||
// clean up and fail this function:
|
||||
util_FreeDebugReportCreateInfos(pAllocator,
|
||||
ptr_instance->tmp_dbg_create_infos,
|
||||
ptr_instance->tmp_callbacks);
|
||||
loader_heap_free(ptr_instance, ptr_instance);
|
||||
loader_platform_thread_unlock_mutex(&loader_lock);
|
||||
return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
res = VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -343,75 +348,47 @@ vkCreateInstance(const VkInstanceCreateInfo *pCreateInfo,
|
|||
pCreateInfo->ppEnabledLayerNames,
|
||||
&ptr_instance->instance_layer_list);
|
||||
if (res != VK_SUCCESS) {
|
||||
util_DestroyDebugReportCallbacks(ptr_instance, pAllocator,
|
||||
ptr_instance->num_tmp_callbacks,
|
||||
ptr_instance->tmp_callbacks);
|
||||
util_FreeDebugReportCreateInfos(pAllocator,
|
||||
ptr_instance->tmp_dbg_create_infos,
|
||||
ptr_instance->tmp_callbacks);
|
||||
loader_heap_free(ptr_instance, ptr_instance);
|
||||
loader_platform_thread_unlock_mutex(&loader_lock);
|
||||
return res;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
/* convert any meta layers to the actual layers makes a copy of layer name*/
|
||||
VkInstanceCreateInfo ici = *pCreateInfo;
|
||||
loader_expand_layer_names(
|
||||
VkResult layerErr = loader_expand_layer_names(
|
||||
ptr_instance, std_validation_str,
|
||||
sizeof(std_validation_names) / sizeof(std_validation_names[0]),
|
||||
std_validation_names, &ici.enabledLayerCount, &ici.ppEnabledLayerNames);
|
||||
if (VK_SUCCESS != layerErr) {
|
||||
res = layerErr;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Scan/discover all ICD libraries */
|
||||
memset(&ptr_instance->icd_libs, 0, sizeof(ptr_instance->icd_libs));
|
||||
loader_icd_scan(ptr_instance, &ptr_instance->icd_libs);
|
||||
memset(&ptr_instance->icd_tramp_list, 0,
|
||||
sizeof(ptr_instance->icd_tramp_list));
|
||||
res = loader_icd_scan(ptr_instance, &ptr_instance->icd_tramp_list);
|
||||
if (res != VK_SUCCESS) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* get extensions from all ICD's, merge so no duplicates, then validate */
|
||||
loader_get_icd_loader_instance_extensions(
|
||||
ptr_instance, &ptr_instance->icd_libs, &ptr_instance->ext_list);
|
||||
res = loader_get_icd_loader_instance_extensions(
|
||||
ptr_instance, &ptr_instance->icd_tramp_list, &ptr_instance->ext_list);
|
||||
if (res != VK_SUCCESS) {
|
||||
goto out;
|
||||
}
|
||||
res = loader_validate_instance_extensions(
|
||||
ptr_instance, &ptr_instance->ext_list,
|
||||
&ptr_instance->instance_layer_list, &ici);
|
||||
if (res != VK_SUCCESS) {
|
||||
loader_delete_shadow_inst_layer_names(ptr_instance, pCreateInfo, &ici);
|
||||
loader_delete_layer_properties(ptr_instance,
|
||||
&ptr_instance->instance_layer_list);
|
||||
loader_scanned_icd_clear(ptr_instance, &ptr_instance->icd_libs);
|
||||
loader_destroy_generic_list(
|
||||
ptr_instance,
|
||||
(struct loader_generic_list *)&ptr_instance->ext_list);
|
||||
util_DestroyDebugReportCallbacks(ptr_instance, pAllocator,
|
||||
ptr_instance->num_tmp_callbacks,
|
||||
ptr_instance->tmp_callbacks);
|
||||
util_FreeDebugReportCreateInfos(pAllocator,
|
||||
ptr_instance->tmp_dbg_create_infos,
|
||||
ptr_instance->tmp_callbacks);
|
||||
loader_platform_thread_unlock_mutex(&loader_lock);
|
||||
loader_heap_free(ptr_instance, ptr_instance);
|
||||
return res;
|
||||
goto out;
|
||||
}
|
||||
|
||||
ptr_instance->disp =
|
||||
loader_heap_alloc(ptr_instance, sizeof(VkLayerInstanceDispatchTable),
|
||||
VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
|
||||
ptr_instance->disp = loader_instance_heap_alloc(
|
||||
ptr_instance, sizeof(VkLayerInstanceDispatchTable),
|
||||
VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
|
||||
if (ptr_instance->disp == NULL) {
|
||||
loader_delete_shadow_inst_layer_names(ptr_instance, pCreateInfo, &ici);
|
||||
|
||||
loader_delete_layer_properties(ptr_instance,
|
||||
&ptr_instance->instance_layer_list);
|
||||
loader_scanned_icd_clear(ptr_instance, &ptr_instance->icd_libs);
|
||||
loader_destroy_generic_list(
|
||||
ptr_instance,
|
||||
(struct loader_generic_list *)&ptr_instance->ext_list);
|
||||
util_DestroyDebugReportCallbacks(ptr_instance, pAllocator,
|
||||
ptr_instance->num_tmp_callbacks,
|
||||
ptr_instance->tmp_callbacks);
|
||||
util_FreeDebugReportCreateInfos(pAllocator,
|
||||
ptr_instance->tmp_dbg_create_infos,
|
||||
ptr_instance->tmp_callbacks);
|
||||
loader_platform_thread_unlock_mutex(&loader_lock);
|
||||
loader_heap_free(ptr_instance, ptr_instance);
|
||||
return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
res = VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
goto out;
|
||||
}
|
||||
memcpy(ptr_instance->disp, &instance_disp, sizeof(instance_disp));
|
||||
ptr_instance->next = loader.instances;
|
||||
|
@ -421,24 +398,7 @@ vkCreateInstance(const VkInstanceCreateInfo *pCreateInfo,
|
|||
res = loader_enable_instance_layers(ptr_instance, &ici,
|
||||
&ptr_instance->instance_layer_list);
|
||||
if (res != VK_SUCCESS) {
|
||||
loader_delete_shadow_inst_layer_names(ptr_instance, pCreateInfo, &ici);
|
||||
loader_delete_layer_properties(ptr_instance,
|
||||
&ptr_instance->instance_layer_list);
|
||||
loader_scanned_icd_clear(ptr_instance, &ptr_instance->icd_libs);
|
||||
loader_destroy_generic_list(
|
||||
ptr_instance,
|
||||
(struct loader_generic_list *)&ptr_instance->ext_list);
|
||||
loader.instances = ptr_instance->next;
|
||||
util_DestroyDebugReportCallbacks(ptr_instance, pAllocator,
|
||||
ptr_instance->num_tmp_callbacks,
|
||||
ptr_instance->tmp_callbacks);
|
||||
util_FreeDebugReportCreateInfos(pAllocator,
|
||||
ptr_instance->tmp_dbg_create_infos,
|
||||
ptr_instance->tmp_callbacks);
|
||||
loader_platform_thread_unlock_mutex(&loader_lock);
|
||||
loader_heap_free(ptr_instance, ptr_instance->disp);
|
||||
loader_heap_free(ptr_instance, ptr_instance);
|
||||
return res;
|
||||
goto out;
|
||||
}
|
||||
|
||||
created_instance = (VkInstance)ptr_instance;
|
||||
|
@ -448,6 +408,7 @@ vkCreateInstance(const VkInstanceCreateInfo *pCreateInfo,
|
|||
if (res == VK_SUCCESS) {
|
||||
wsi_create_instance(ptr_instance, &ici);
|
||||
debug_report_create_instance(ptr_instance, &ici);
|
||||
extensions_create_instance(ptr_instance, &ici);
|
||||
|
||||
*pInstance = created_instance;
|
||||
|
||||
|
@ -458,22 +419,60 @@ vkCreateInstance(const VkInstanceCreateInfo *pCreateInfo,
|
|||
* if enabled.
|
||||
*/
|
||||
loader_activate_instance_layer_extensions(ptr_instance, *pInstance);
|
||||
} else {
|
||||
// TODO: cleanup here.
|
||||
}
|
||||
|
||||
/* Remove temporary debug_report callback */
|
||||
util_DestroyDebugReportCallbacks(ptr_instance, pAllocator,
|
||||
ptr_instance->num_tmp_callbacks,
|
||||
ptr_instance->tmp_callbacks);
|
||||
loader_delete_shadow_inst_layer_names(ptr_instance, pCreateInfo, &ici);
|
||||
loader_platform_thread_unlock_mutex(&loader_lock);
|
||||
out:
|
||||
|
||||
if (NULL != ptr_instance) {
|
||||
if (res != VK_SUCCESS) {
|
||||
if (NULL != ptr_instance->next) {
|
||||
loader.instances = ptr_instance->next;
|
||||
}
|
||||
if (NULL != ptr_instance->disp) {
|
||||
loader_instance_heap_free(ptr_instance, ptr_instance->disp);
|
||||
}
|
||||
if (ptr_instance->num_tmp_callbacks > 0) {
|
||||
util_DestroyDebugReportCallbacks(
|
||||
ptr_instance, pAllocator, ptr_instance->num_tmp_callbacks,
|
||||
ptr_instance->tmp_callbacks);
|
||||
util_FreeDebugReportCreateInfos(
|
||||
pAllocator, ptr_instance->tmp_dbg_create_infos,
|
||||
ptr_instance->tmp_callbacks);
|
||||
}
|
||||
|
||||
loader_deactivate_layers(ptr_instance, NULL,
|
||||
&ptr_instance->activated_layer_list);
|
||||
|
||||
loader_delete_shadow_inst_layer_names(ptr_instance, pCreateInfo,
|
||||
&ici);
|
||||
loader_delete_layer_properties(ptr_instance,
|
||||
&ptr_instance->instance_layer_list);
|
||||
loader_scanned_icd_clear(ptr_instance,
|
||||
&ptr_instance->icd_tramp_list);
|
||||
loader_destroy_generic_list(
|
||||
ptr_instance,
|
||||
(struct loader_generic_list *)&ptr_instance->ext_list);
|
||||
|
||||
loader_instance_heap_free(ptr_instance, ptr_instance);
|
||||
} else {
|
||||
/* Remove temporary debug_report callback */
|
||||
util_DestroyDebugReportCallbacks(ptr_instance, pAllocator,
|
||||
ptr_instance->num_tmp_callbacks,
|
||||
ptr_instance->tmp_callbacks);
|
||||
loader_delete_shadow_inst_layer_names(ptr_instance, pCreateInfo,
|
||||
&ici);
|
||||
}
|
||||
|
||||
if (loaderLocked) {
|
||||
loader_platform_thread_unlock_mutex(&loader_lock);
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
|
||||
vkDestroyInstance(VkInstance instance,
|
||||
const VkAllocationCallbacks *pAllocator) {
|
||||
LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyInstance(
|
||||
VkInstance instance, const VkAllocationCallbacks *pAllocator) {
|
||||
const VkLayerInstanceDispatchTable *disp;
|
||||
struct loader_instance *ptr_instance = NULL;
|
||||
bool callback_setup = false;
|
||||
|
@ -488,6 +487,10 @@ vkDestroyInstance(VkInstance instance,
|
|||
|
||||
ptr_instance = loader_get_instance(instance);
|
||||
|
||||
if (pAllocator) {
|
||||
ptr_instance->alloc_callbacks = *pAllocator;
|
||||
}
|
||||
|
||||
if (ptr_instance->num_tmp_callbacks > 0) {
|
||||
// Setup the temporary callback(s) here to catch cleanup issues:
|
||||
if (!util_CreateDebugReportCallbacks(ptr_instance, pAllocator,
|
||||
|
@ -500,9 +503,11 @@ vkDestroyInstance(VkInstance instance,
|
|||
|
||||
disp->DestroyInstance(instance, pAllocator);
|
||||
|
||||
loader_deactivate_layers(ptr_instance, &ptr_instance->activated_layer_list);
|
||||
if (ptr_instance->phys_devs)
|
||||
loader_heap_free(ptr_instance, ptr_instance->phys_devs);
|
||||
loader_deactivate_layers(ptr_instance, NULL,
|
||||
&ptr_instance->activated_layer_list);
|
||||
if (ptr_instance->phys_devs_tramp) {
|
||||
loader_instance_heap_free(ptr_instance, ptr_instance->phys_devs_tramp);
|
||||
}
|
||||
if (callback_setup) {
|
||||
util_DestroyDebugReportCallbacks(ptr_instance, pAllocator,
|
||||
ptr_instance->num_tmp_callbacks,
|
||||
|
@ -511,8 +516,8 @@ vkDestroyInstance(VkInstance instance,
|
|||
ptr_instance->tmp_dbg_create_infos,
|
||||
ptr_instance->tmp_callbacks);
|
||||
}
|
||||
loader_heap_free(ptr_instance, ptr_instance->disp);
|
||||
loader_heap_free(ptr_instance, ptr_instance);
|
||||
loader_instance_heap_free(ptr_instance, ptr_instance->disp);
|
||||
loader_instance_heap_free(ptr_instance, ptr_instance);
|
||||
loader_platform_thread_unlock_mutex(&loader_lock);
|
||||
}
|
||||
|
||||
|
@ -549,14 +554,14 @@ vkEnumeratePhysicalDevices(VkInstance instance, uint32_t *pPhysicalDeviceCount,
|
|||
? inst->total_gpu_count
|
||||
: *pPhysicalDeviceCount;
|
||||
*pPhysicalDeviceCount = count;
|
||||
if (!inst->phys_devs) {
|
||||
inst->phys_devs =
|
||||
(struct loader_physical_device_tramp *)loader_heap_alloc(
|
||||
if (NULL == inst->phys_devs_tramp) {
|
||||
inst->phys_devs_tramp =
|
||||
(struct loader_physical_device_tramp *)loader_instance_heap_alloc(
|
||||
inst, inst->total_gpu_count *
|
||||
sizeof(struct loader_physical_device_tramp),
|
||||
VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
|
||||
}
|
||||
if (!inst->phys_devs) {
|
||||
if (NULL == inst->phys_devs_tramp) {
|
||||
loader_platform_thread_unlock_mutex(&loader_lock);
|
||||
return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
}
|
||||
|
@ -564,20 +569,19 @@ vkEnumeratePhysicalDevices(VkInstance instance, uint32_t *pPhysicalDeviceCount,
|
|||
for (i = 0; i < count; i++) {
|
||||
|
||||
// initialize the loader's physicalDevice object
|
||||
loader_set_dispatch((void *)&inst->phys_devs[i], inst->disp);
|
||||
inst->phys_devs[i].this_instance = inst;
|
||||
inst->phys_devs[i].phys_dev = pPhysicalDevices[i];
|
||||
loader_set_dispatch((void *)&inst->phys_devs_tramp[i], inst->disp);
|
||||
inst->phys_devs_tramp[i].this_instance = inst;
|
||||
inst->phys_devs_tramp[i].phys_dev = pPhysicalDevices[i];
|
||||
|
||||
// copy wrapped object into Application provided array
|
||||
pPhysicalDevices[i] = (VkPhysicalDevice)&inst->phys_devs[i];
|
||||
pPhysicalDevices[i] = (VkPhysicalDevice)&inst->phys_devs_tramp[i];
|
||||
}
|
||||
loader_platform_thread_unlock_mutex(&loader_lock);
|
||||
return res;
|
||||
}
|
||||
|
||||
LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
|
||||
vkGetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice,
|
||||
VkPhysicalDeviceFeatures *pFeatures) {
|
||||
LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFeatures(
|
||||
VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures *pFeatures) {
|
||||
const VkLayerInstanceDispatchTable *disp;
|
||||
VkPhysicalDevice unwrapped_phys_dev =
|
||||
loader_unwrap_physical_device(physicalDevice);
|
||||
|
@ -585,10 +589,9 @@ vkGetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice,
|
|||
disp->GetPhysicalDeviceFeatures(unwrapped_phys_dev, pFeatures);
|
||||
}
|
||||
|
||||
LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
|
||||
vkGetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice,
|
||||
VkFormat format,
|
||||
VkFormatProperties *pFormatInfo) {
|
||||
LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFormatProperties(
|
||||
VkPhysicalDevice physicalDevice, VkFormat format,
|
||||
VkFormatProperties *pFormatInfo) {
|
||||
const VkLayerInstanceDispatchTable *disp;
|
||||
VkPhysicalDevice unwrapped_pd =
|
||||
loader_unwrap_physical_device(physicalDevice);
|
||||
|
@ -610,9 +613,8 @@ vkGetPhysicalDeviceImageFormatProperties(
|
|||
pImageFormatProperties);
|
||||
}
|
||||
|
||||
LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
|
||||
vkGetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice,
|
||||
VkPhysicalDeviceProperties *pProperties) {
|
||||
LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceProperties(
|
||||
VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties *pProperties) {
|
||||
const VkLayerInstanceDispatchTable *disp;
|
||||
VkPhysicalDevice unwrapped_phys_dev =
|
||||
loader_unwrap_physical_device(physicalDevice);
|
||||
|
@ -643,14 +645,13 @@ LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceMemoryProperties(
|
|||
pMemoryProperties);
|
||||
}
|
||||
|
||||
LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
|
||||
vkCreateDevice(VkPhysicalDevice physicalDevice,
|
||||
const VkDeviceCreateInfo *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator, VkDevice *pDevice) {
|
||||
LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateDevice(
|
||||
VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator, VkDevice *pDevice) {
|
||||
VkResult res;
|
||||
struct loader_physical_device_tramp *phys_dev;
|
||||
struct loader_device *dev;
|
||||
struct loader_instance *inst;
|
||||
struct loader_physical_device_tramp *phys_dev = NULL;
|
||||
struct loader_device *dev = NULL;
|
||||
struct loader_instance *inst = NULL;
|
||||
|
||||
assert(pCreateInfo->queueCreateInfoCount >= 1);
|
||||
|
||||
|
@ -661,66 +662,78 @@ vkCreateDevice(VkPhysicalDevice physicalDevice,
|
|||
|
||||
/* Get the physical device (ICD) extensions */
|
||||
struct loader_extension_list icd_exts;
|
||||
if (!loader_init_generic_list(inst, (struct loader_generic_list *)&icd_exts,
|
||||
sizeof(VkExtensionProperties))) {
|
||||
loader_platform_thread_unlock_mutex(&loader_lock);
|
||||
return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
icd_exts.list = NULL;
|
||||
res =
|
||||
loader_init_generic_list(inst, (struct loader_generic_list *)&icd_exts,
|
||||
sizeof(VkExtensionProperties));
|
||||
if (VK_SUCCESS != res) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
res = loader_add_device_extensions(
|
||||
inst, inst->disp->EnumerateDeviceExtensionProperties,
|
||||
phys_dev->phys_dev, "Unknown", &icd_exts);
|
||||
if (res != VK_SUCCESS) {
|
||||
loader_platform_thread_unlock_mutex(&loader_lock);
|
||||
return res;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* make sure requested extensions to be enabled are supported */
|
||||
res = loader_validate_device_extensions(phys_dev, &inst->activated_layer_list,
|
||||
&icd_exts, pCreateInfo);
|
||||
res = loader_validate_device_extensions(
|
||||
phys_dev, &inst->activated_layer_list, &icd_exts, pCreateInfo);
|
||||
if (res != VK_SUCCESS) {
|
||||
loader_platform_thread_unlock_mutex(&loader_lock);
|
||||
return res;
|
||||
goto out;
|
||||
}
|
||||
|
||||
dev = loader_create_logical_device(inst);
|
||||
dev = loader_create_logical_device(inst, pAllocator);
|
||||
if (dev == NULL) {
|
||||
loader_platform_thread_unlock_mutex(&loader_lock);
|
||||
return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
res = VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* copy the instance layer list into the device */
|
||||
dev->activated_layer_list.capacity = inst->activated_layer_list.capacity;
|
||||
dev->activated_layer_list.count = inst->activated_layer_list.count;
|
||||
dev->activated_layer_list.list = loader_heap_alloc(inst,
|
||||
inst->activated_layer_list.capacity,
|
||||
VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
|
||||
dev->activated_layer_list.list =
|
||||
loader_device_heap_alloc(dev, inst->activated_layer_list.capacity,
|
||||
VK_SYSTEM_ALLOCATION_SCOPE_DEVICE);
|
||||
if (dev->activated_layer_list.list == NULL) {
|
||||
loader_platform_thread_unlock_mutex(&loader_lock);
|
||||
return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
res = VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
goto out;
|
||||
}
|
||||
memcpy(dev->activated_layer_list.list, inst->activated_layer_list.list,
|
||||
sizeof(*dev->activated_layer_list.list) * dev->activated_layer_list.count);
|
||||
sizeof(*dev->activated_layer_list.list) *
|
||||
dev->activated_layer_list.count);
|
||||
|
||||
|
||||
res = loader_create_device_chain(phys_dev, pCreateInfo, pAllocator, inst, dev);
|
||||
res = loader_create_device_chain(phys_dev, pCreateInfo, pAllocator, inst,
|
||||
dev);
|
||||
if (res != VK_SUCCESS) {
|
||||
loader_platform_thread_unlock_mutex(&loader_lock);
|
||||
return res;
|
||||
goto out;
|
||||
}
|
||||
|
||||
*pDevice = dev->device;
|
||||
*pDevice = dev->chain_device;
|
||||
|
||||
/* initialize any device extension dispatch entry's from the instance list*/
|
||||
// Initialize any device extension dispatch entry's from the instance list
|
||||
loader_init_dispatch_dev_ext(inst, dev);
|
||||
|
||||
/* initialize WSI device extensions as part of core dispatch since loader
|
||||
* has
|
||||
* dedicated trampoline code for these*/
|
||||
// Initialize WSI device extensions as part of core dispatch since loader
|
||||
// has dedicated trampoline code for these*/
|
||||
loader_init_device_extension_dispatch_table(
|
||||
&dev->loader_dispatch,
|
||||
dev->loader_dispatch.core_dispatch.GetDeviceProcAddr, *pDevice);
|
||||
|
||||
out:
|
||||
|
||||
// Failure cleanup
|
||||
if (VK_SUCCESS != res) {
|
||||
if (NULL != dev) {
|
||||
loader_destroy_logical_device(inst, dev, pAllocator);
|
||||
}
|
||||
}
|
||||
|
||||
if (NULL != icd_exts.list) {
|
||||
loader_destroy_generic_list(inst,
|
||||
(struct loader_generic_list *)&icd_exts);
|
||||
}
|
||||
loader_platform_thread_unlock_mutex(&loader_lock);
|
||||
return res;
|
||||
}
|
||||
|
@ -736,13 +749,15 @@ vkDestroyDevice(VkDevice device, const VkAllocationCallbacks *pAllocator) {
|
|||
|
||||
loader_platform_thread_lock_mutex(&loader_lock);
|
||||
|
||||
struct loader_icd *icd = loader_get_icd_and_device(device, &dev);
|
||||
const struct loader_instance *inst = icd->this_instance;
|
||||
struct loader_icd_term *icd_term =
|
||||
loader_get_icd_and_device(device, &dev, NULL);
|
||||
const struct loader_instance *inst = icd_term->this_instance;
|
||||
disp = loader_get_dispatch(device);
|
||||
|
||||
disp->DestroyDevice(device, pAllocator);
|
||||
dev->device = NULL;
|
||||
loader_remove_logical_device(inst, icd, dev);
|
||||
dev->chain_device = NULL;
|
||||
dev->icd_device = NULL;
|
||||
loader_remove_logical_device(inst, icd_term, dev, pAllocator);
|
||||
|
||||
loader_platform_thread_unlock_mutex(&loader_lock);
|
||||
}
|
||||
|
@ -786,8 +801,8 @@ vkEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice,
|
|||
i++) {
|
||||
loader_find_layer_name_add_list(
|
||||
NULL, std_validation_names[i],
|
||||
VK_LAYER_TYPE_INSTANCE_EXPLICIT, &inst->instance_layer_list,
|
||||
&local_list);
|
||||
VK_LAYER_TYPE_INSTANCE_EXPLICIT,
|
||||
&inst->instance_layer_list, &local_list);
|
||||
}
|
||||
for (uint32_t i = 0; i < local_list.count; i++) {
|
||||
struct loader_device_extension_list *ext_list =
|
||||
|
@ -880,7 +895,7 @@ vkEnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice,
|
|||
enabled_layers->count = count;
|
||||
enabled_layers->capacity = enabled_layers->count *
|
||||
sizeof(struct loader_layer_properties);
|
||||
enabled_layers->list = loader_heap_alloc(inst, enabled_layers->capacity,
|
||||
enabled_layers->list = loader_instance_heap_alloc(inst, enabled_layers->capacity,
|
||||
VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
|
||||
if (!enabled_layers->list)
|
||||
return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
|
@ -893,14 +908,21 @@ vkEnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice,
|
|||
std_val_count, std_validation_names)) {
|
||||
struct loader_layer_properties props;
|
||||
loader_init_std_validation_props(&props);
|
||||
loader_copy_layer_properties(inst,
|
||||
&enabled_layers->list[j], &props);
|
||||
VkResult err = loader_copy_layer_properties(inst,
|
||||
&enabled_layers->list[j],
|
||||
&props);
|
||||
if (err != VK_SUCCESS) {
|
||||
return err;
|
||||
}
|
||||
i += std_val_count;
|
||||
}
|
||||
else {
|
||||
loader_copy_layer_properties(inst,
|
||||
&enabled_layers->list[j],
|
||||
&inst->activated_layer_list.list[i++]);
|
||||
VkResult err = loader_copy_layer_properties(inst,
|
||||
&enabled_layers->list[j],
|
||||
&inst->activated_layer_list.list[i++]);
|
||||
if (err != VK_SUCCESS) {
|
||||
return err;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -916,8 +938,9 @@ vkEnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice,
|
|||
}
|
||||
*pPropertyCount = copy_size;
|
||||
|
||||
if (inst->activated_layers_are_std_val)
|
||||
if (inst->activated_layers_are_std_val) {
|
||||
loader_delete_layer_properties(inst, enabled_layers);
|
||||
}
|
||||
if (copy_size < count) {
|
||||
loader_platform_thread_unlock_mutex(&loader_lock);
|
||||
return VK_INCOMPLETE;
|
||||
|
@ -2014,7 +2037,7 @@ vkCmdCopyImageToBuffer(VkCommandBuffer commandBuffer, VkImage srcImage,
|
|||
LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
|
||||
vkCmdUpdateBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer,
|
||||
VkDeviceSize dstOffset, VkDeviceSize dataSize,
|
||||
const uint32_t *pData) {
|
||||
const void *pData) {
|
||||
const VkLayerDispatchTable *disp;
|
||||
|
||||
disp = loader_get_dispatch(commandBuffer);
|
||||
|
|
|
@ -50,69 +50,66 @@
|
|||
#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_DIR "/vulkan/"
|
||||
#define VULKAN_ICDCONF_DIR "icd.d"
|
||||
#define VULKAN_ICD_DIR "icd"
|
||||
#define VULKAN_ELAYERCONF_DIR "explicit_layer.d"
|
||||
#define VULKAN_ILAYERCONF_DIR "implicit_layer.d"
|
||||
#define VULKAN_LAYER_DIR "layer"
|
||||
|
||||
#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 ":"
|
||||
#if defined(EXTRASYSCONFDIR)
|
||||
#define EXTRA_DRIVERS_SYSCONFDIR_INFO ":" \
|
||||
EXTRASYSCONFDIR VULKAN_DIR VULKAN_ICDCONF_DIR
|
||||
#define EXTRA_ELAYERS_SYSCONFDIR_INFO ":" \
|
||||
EXTRASYSCONFDIR VULKAN_DIR VULKAN_ELAYERCONF_DIR
|
||||
#define EXTRA_ILAYERS_SYSCONFDIR_INFO ":" \
|
||||
EXTRASYSCONFDIR VULKAN_DIR VULKAN_ILAYERCONF_DIR
|
||||
#else
|
||||
#define LOCAL_DRIVERS_INFO
|
||||
#define LOCAL_ELAYERS_INFO
|
||||
#define LOCAL_ILAYERS_INFO
|
||||
#define EXTRA_DRIVERS_SYSCONFDIR_INFO
|
||||
#define EXTRA_ELAYERS_SYSCONFDIR_INFO
|
||||
#define EXTRA_ILAYERS_SYSCONFDIR_INFO
|
||||
#endif
|
||||
|
||||
#if defined(EXTRADATADIR)
|
||||
#define EXTRA_DRIVERS_DATADIR_INFO ":" \
|
||||
EXTRADATADIR VULKAN_DIR VULKAN_ICDCONF_DIR
|
||||
#define EXTRA_ELAYERS_DATADIR_INFO ":" \
|
||||
EXTRADATADIR VULKAN_DIR VULKAN_ELAYERCONF_DIR
|
||||
#define EXTRA_ILAYERS_DATADIR_INFO ":" \
|
||||
EXTRADATADIR VULKAN_DIR VULKAN_ILAYERCONF_DIR
|
||||
#else
|
||||
#define EXTRA_DRIVERS_DATADIR_INFO
|
||||
#define EXTRA_ELAYERS_DATADIR_INFO
|
||||
#define EXTRA_ILAYERS_DATADIR_INFO
|
||||
#endif
|
||||
|
||||
#define DEFAULT_VK_DRIVERS_INFO \
|
||||
LOCAL_DRIVERS_INFO \
|
||||
"/" SYSCONFDIR VULKAN_ICDCONF_DIR ":" \
|
||||
"/usr/" DATADIR VULKAN_ICDCONF_DIR
|
||||
#define DEFAULT_VK_DRIVERS_PATH ""
|
||||
SYSCONFDIR VULKAN_DIR VULKAN_ICDCONF_DIR ":" \
|
||||
DATADIR VULKAN_DIR VULKAN_ICDCONF_DIR \
|
||||
EXTRA_DRIVERS_SYSCONFDIR_INFO \
|
||||
EXTRA_DRIVERS_DATADIR_INFO
|
||||
#define DEFAULT_VK_ELAYERS_INFO \
|
||||
LOCAL_ELAYERS_INFO \
|
||||
"/" SYSCONFDIR VULKAN_ELAYERCONF_DIR ":" \
|
||||
"/usr/" DATADIR VULKAN_ELAYERCONF_DIR
|
||||
SYSCONFDIR VULKAN_DIR VULKAN_ELAYERCONF_DIR ":" \
|
||||
DATADIR VULKAN_DIR VULKAN_ELAYERCONF_DIR \
|
||||
EXTRA_ELAYERS_SYSCONFDIR_INFO \
|
||||
EXTRA_ELAYERS_DATADIR_INFO
|
||||
#define DEFAULT_VK_ILAYERS_INFO \
|
||||
LOCAL_ILAYERS_INFO \
|
||||
"/" SYSCONFDIR VULKAN_ILAYERCONF_DIR ":" \
|
||||
"/usr/" DATADIR VULKAN_ILAYERCONF_DIR
|
||||
SYSCONFDIR VULKAN_DIR VULKAN_ILAYERCONF_DIR ":" \
|
||||
DATADIR VULKAN_DIR VULKAN_ILAYERCONF_DIR \
|
||||
EXTRA_ILAYERS_SYSCONFDIR_INFO \
|
||||
EXTRA_ILAYERS_DATADIR_INFO
|
||||
|
||||
#define DEFAULT_VK_DRIVERS_PATH ""
|
||||
#define DEFAULT_VK_LAYERS_PATH ""
|
||||
|
||||
#if !defined(LAYERS_SOURCE_PATH)
|
||||
#define LAYERS_SOURCE_PATH NULL
|
||||
#endif
|
||||
#define LAYERS_PATH_ENV "VK_LAYER_PATH"
|
||||
#define HOME_VK_DRIVERS_INFO "/.local/share" VULKAN_ICDCONF_DIR
|
||||
#define HOME_VK_ELAYERS_INFO "/.local/share" VULKAN_ELAYERCONF_DIR
|
||||
#define HOME_VK_ILAYERS_INFO "/.local/share" VULKAN_ILAYERCONF_DIR
|
||||
|
||||
#define HOME_VK_DRIVERS_INFO VULKAN_DIR VULKAN_ICDCONF_DIR
|
||||
#define HOME_VK_ELAYERS_INFO VULKAN_DIR VULKAN_ELAYERCONF_DIR
|
||||
#define HOME_VK_ILAYERS_INFO VULKAN_DIR VULKAN_ILAYERCONF_DIR
|
||||
|
||||
// C99:
|
||||
#define PRINTF_SIZE_T_SPECIFIER "%zu"
|
||||
|
@ -136,12 +133,6 @@ 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 void loader_free_getenv(const char *val) {}
|
||||
|
||||
// Dynamic Loading of libraries:
|
||||
typedef void *loader_platform_dl_handle;
|
||||
static inline loader_platform_dl_handle
|
||||
|
@ -248,11 +239,10 @@ using namespace std;
|
|||
#define PATH_SEPERATOR ';'
|
||||
#define DIRECTORY_SYMBOL '\\'
|
||||
#define DEFAULT_VK_REGISTRY_HIVE HKEY_LOCAL_MACHINE
|
||||
#define DEFAULT_VK_DRIVERS_INFO "SOFTWARE\\Khronos\\Vulkan\\Drivers"
|
||||
// TODO: Are these the correct paths
|
||||
#define DEFAULT_VK_DRIVERS_INFO "SOFTWARE\\Khronos\\" API_NAME "\\Drivers"
|
||||
#define DEFAULT_VK_DRIVERS_PATH ""
|
||||
#define DEFAULT_VK_ELAYERS_INFO "SOFTWARE\\Khronos\\Vulkan\\ExplicitLayers"
|
||||
#define DEFAULT_VK_ILAYERS_INFO "SOFTWARE\\Khronos\\Vulkan\\ImplicitLayers"
|
||||
#define DEFAULT_VK_ELAYERS_INFO "SOFTWARE\\Khronos\\" API_NAME "\\ExplicitLayers"
|
||||
#define DEFAULT_VK_ILAYERS_INFO "SOFTWARE\\Khronos\\" API_NAME "\\ImplicitLayers"
|
||||
#if !defined(DEFAULT_VK_LAYERS_PATH)
|
||||
#define DEFAULT_VK_LAYERS_PATH ""
|
||||
#endif
|
||||
|
@ -322,29 +312,6 @@ static char *loader_platform_basename(char *pathname) {
|
|||
return current;
|
||||
}
|
||||
|
||||
// Environment variables
|
||||
|
||||
static inline char *loader_getenv(const char *name) {
|
||||
char *retVal;
|
||||
DWORD valSize;
|
||||
|
||||
valSize = GetEnvironmentVariableA(name, NULL, 0);
|
||||
|
||||
// valSize DOES include the null terminator, so for any set variable
|
||||
// will always be at least 1. If it's 0, the variable wasn't set.
|
||||
if (valSize == 0)
|
||||
return NULL;
|
||||
|
||||
// TODO; FIXME This should be using any app defined memory allocation
|
||||
retVal = (char *)malloc(valSize);
|
||||
|
||||
GetEnvironmentVariableA(name, retVal, valSize);
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
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
|
||||
|
@ -352,8 +319,8 @@ loader_platform_open_library(const char *libPath) {
|
|||
return LoadLibrary(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);
|
||||
static char errorMsg[164];
|
||||
snprintf(errorMsg, 163, "Failed to open dynamic library \"%s\"", libPath);
|
||||
return errorMsg;
|
||||
}
|
||||
static void loader_platform_close_library(loader_platform_dl_handle library) {
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -19,9 +19,38 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#ifndef WSI_H
|
||||
#define WSI_H
|
||||
|
||||
#include "vk_loader_platform.h"
|
||||
#include "loader.h"
|
||||
|
||||
typedef struct {
|
||||
union {
|
||||
#ifdef VK_USE_PLATFORM_MIR_KHR
|
||||
VkIcdSurfaceMir mir_surf;
|
||||
#endif // VK_USE_PLATFORM_MIR_KHR
|
||||
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
|
||||
VkIcdSurfaceWayland wayland_surf;
|
||||
#endif // VK_USE_PLATFORM_WAYLAND_KHR
|
||||
#ifdef VK_USE_PLATFORM_WIN32_KHR
|
||||
VkIcdSurfaceWin32 win_surf;
|
||||
#endif // VK_USE_PLATFORM_WIN32_KHR
|
||||
#ifdef VK_USE_PLATFORM_XCB_KHR
|
||||
VkIcdSurfaceXcb xcb_surf;
|
||||
#endif // VK_USE_PLATFORM_XCB_KHR
|
||||
#ifdef VK_USE_PLATFORM_XLIB_KHR
|
||||
VkIcdSurfaceXlib xlib_surf;
|
||||
#endif // VK_USE_PLATFORM_XLIB_KHR
|
||||
VkIcdSurfaceDisplay display_surf;
|
||||
};
|
||||
uint32_t base_size; // Size of VkIcdSurfaceBase
|
||||
uint32_t platform_size; // Size of corresponding VkIcdSurfaceXXX
|
||||
uint32_t non_platform_offset; // Start offset to base_size
|
||||
uint32_t entire_size; // Size of entire VkIcdSurface
|
||||
VkSurfaceKHR *real_icd_surfaces;
|
||||
} VkIcdSurface;
|
||||
|
||||
bool wsi_swapchain_instance_gpa(struct loader_instance *ptr_instance,
|
||||
const char *name, void **addr);
|
||||
|
||||
|
@ -29,6 +58,10 @@ void wsi_create_instance(struct loader_instance *ptr_instance,
|
|||
const VkInstanceCreateInfo *pCreateInfo);
|
||||
bool wsi_unsupported_instance_extension(const VkExtensionProperties *ext_prop);
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL terminator_vkCreateSwapchainKHR(
|
||||
VkDevice device, const VkSwapchainCreateInfoKHR *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator, VkSwapchainKHR *pSwapchain);
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL
|
||||
terminator_DestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface,
|
||||
const VkAllocationCallbacks *pAllocator);
|
||||
|
@ -135,3 +168,5 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_GetDisplayPlaneCapabilitiesKHR(
|
|||
VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDisplayPlaneSurfaceKHR(
|
||||
VkInstance instance, const VkDisplaySurfaceCreateInfoKHR *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface);
|
||||
|
||||
#endif /* WSI_H */
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
/*
|
||||
* Loader-ICD version negotiation API
|
||||
*/
|
||||
#define CURRENT_LOADER_ICD_INTERFACE_VERSION 2
|
||||
#define CURRENT_LOADER_ICD_INTERFACE_VERSION 3
|
||||
#define MIN_SUPPORTED_LOADER_ICD_INTERFACE_VERSION 0
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkNegotiateLoaderICDInterfaceVersion)(uint32_t *pVersion);
|
||||
/*
|
||||
|
@ -111,6 +111,12 @@ typedef struct {
|
|||
} VkIcdSurfaceXlib;
|
||||
#endif // VK_USE_PLATFORM_XLIB_KHR
|
||||
|
||||
#ifdef VK_USE_PLATFORM_ANDROID_KHR
|
||||
typedef struct {
|
||||
ANativeWindow* window;
|
||||
} VkIcdSurfaceAndroid;
|
||||
#endif //VK_USE_PLATFORM_ANDROID_KHR
|
||||
|
||||
typedef struct {
|
||||
VkIcdSurfaceBase base;
|
||||
VkDisplayModeKHR displayMode;
|
||||
|
@ -121,4 +127,5 @@ typedef struct {
|
|||
VkDisplayPlaneAlphaFlagBitsKHR alphaMode;
|
||||
VkExtent2D imageExtent;
|
||||
} VkIcdSurfaceDisplay;
|
||||
|
||||
#endif // VKICD_H
|
||||
|
|
|
@ -162,6 +162,17 @@ typedef struct VkLayerDispatchTable_ {
|
|||
PFN_vkGetSwapchainImagesKHR GetSwapchainImagesKHR;
|
||||
PFN_vkAcquireNextImageKHR AcquireNextImageKHR;
|
||||
PFN_vkQueuePresentKHR QueuePresentKHR;
|
||||
PFN_vkCmdDrawIndirectCountAMD CmdDrawIndirectCountAMD;
|
||||
PFN_vkCmdDrawIndexedIndirectCountAMD CmdDrawIndexedIndirectCountAMD;
|
||||
#ifdef VK_USE_PLATFORM_WIN32_KHR
|
||||
PFN_vkGetMemoryWin32HandleNV GetMemoryWin32HandleNV;
|
||||
#endif
|
||||
PFN_vkCreateSharedSwapchainsKHR CreateSharedSwapchainsKHR;
|
||||
PFN_vkDebugMarkerSetObjectTagEXT DebugMarkerSetObjectTagEXT;
|
||||
PFN_vkDebugMarkerSetObjectNameEXT DebugMarkerSetObjectNameEXT;
|
||||
PFN_vkCmdDebugMarkerBeginEXT CmdDebugMarkerBeginEXT;
|
||||
PFN_vkCmdDebugMarkerEndEXT CmdDebugMarkerEndEXT;
|
||||
PFN_vkCmdDebugMarkerInsertEXT CmdDebugMarkerInsertEXT;
|
||||
} VkLayerDispatchTable;
|
||||
|
||||
typedef struct VkLayerInstanceDispatchTable_ {
|
||||
|
@ -232,6 +243,8 @@ typedef struct VkLayerInstanceDispatchTable_ {
|
|||
GetDisplayPlaneCapabilitiesKHR;
|
||||
PFN_vkCreateDisplayPlaneSurfaceKHR
|
||||
CreateDisplayPlaneSurfaceKHR;
|
||||
PFN_vkGetPhysicalDeviceExternalImageFormatPropertiesNV
|
||||
GetPhysicalDeviceExternalImageFormatPropertiesNV;
|
||||
} VkLayerInstanceDispatchTable;
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -51,13 +51,13 @@ extern "C"
|
|||
#define VKAPI_ATTR
|
||||
#define VKAPI_CALL __stdcall
|
||||
#define VKAPI_PTR VKAPI_CALL
|
||||
#elif defined(__ANDROID__) && defined(__ARM_EABI__) && !defined(__ARM_ARCH_7A__)
|
||||
// Android does not support Vulkan in native code using the "armeabi" ABI.
|
||||
#error "Vulkan requires the 'armeabi-v7a' or 'armeabi-v7a-hard' ABI on 32-bit ARM CPUs"
|
||||
#elif defined(__ANDROID__) && defined(__ARM_ARCH_7A__)
|
||||
// On Android/ARMv7a, Vulkan functions use the armeabi-v7a-hard calling
|
||||
// convention, even if the application's native code is compiled with the
|
||||
// armeabi-v7a calling convention.
|
||||
#elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH < 7
|
||||
#error "Vulkan isn't supported for the 'armeabi' NDK ABI"
|
||||
#elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH >= 7 && defined(__ARM_32BIT_STATE)
|
||||
// On Android 32-bit ARM targets, Vulkan functions use the "hardfloat"
|
||||
// calling convention, i.e. float parameters are passed in registers. This
|
||||
// is true even if the rest of the application passes floats on the stack,
|
||||
// as it does by default when compiling for the armeabi-v7a NDK ABI.
|
||||
#define VKAPI_ATTR __attribute__((pcs("aapcs-vfp")))
|
||||
#define VKAPI_CALL
|
||||
#define VKAPI_PTR VKAPI_ATTR
|
||||
|
|
|
@ -43,7 +43,7 @@ extern "C" {
|
|||
#define VK_VERSION_MINOR(version) (((uint32_t)(version) >> 12) & 0x3ff)
|
||||
#define VK_VERSION_PATCH(version) ((uint32_t)(version) & 0xfff)
|
||||
// Version of this file
|
||||
#define VK_HEADER_VERSION 16
|
||||
#define VK_HEADER_VERSION 34
|
||||
|
||||
|
||||
#define VK_NULL_HANDLE 0
|
||||
|
@ -53,11 +53,13 @@ extern "C" {
|
|||
#define VK_DEFINE_HANDLE(object) typedef struct object##_T* object;
|
||||
|
||||
|
||||
#if defined(__LP64__) || defined(_WIN64) || defined(__x86_64__) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__)
|
||||
#if !defined(VK_DEFINE_NON_DISPATCHABLE_HANDLE)
|
||||
#if defined(__LP64__) || defined(_WIN64) || (defined(__x86_64__) && !defined(__ILP32__) ) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__)
|
||||
#define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef struct object##_T *object;
|
||||
#else
|
||||
#define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef uint64_t object;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
@ -135,6 +137,7 @@ typedef enum VkResult {
|
|||
VK_ERROR_INCOMPATIBLE_DRIVER = -9,
|
||||
VK_ERROR_TOO_MANY_OBJECTS = -10,
|
||||
VK_ERROR_FORMAT_NOT_SUPPORTED = -11,
|
||||
VK_ERROR_FRAGMENTED_POOL = -12,
|
||||
VK_ERROR_SURFACE_LOST_KHR = -1000000000,
|
||||
VK_ERROR_NATIVE_WINDOW_IN_USE_KHR = -1000000001,
|
||||
VK_SUBOPTIMAL_KHR = 1000001003,
|
||||
|
@ -142,9 +145,9 @@ typedef enum VkResult {
|
|||
VK_ERROR_INCOMPATIBLE_DISPLAY_KHR = -1000003001,
|
||||
VK_ERROR_VALIDATION_FAILED_EXT = -1000011001,
|
||||
VK_ERROR_INVALID_SHADER_NV = -1000012000,
|
||||
VK_RESULT_BEGIN_RANGE = VK_ERROR_FORMAT_NOT_SUPPORTED,
|
||||
VK_RESULT_BEGIN_RANGE = VK_ERROR_FRAGMENTED_POOL,
|
||||
VK_RESULT_END_RANGE = VK_INCOMPLETE,
|
||||
VK_RESULT_RANGE_SIZE = (VK_INCOMPLETE - VK_ERROR_FORMAT_NOT_SUPPORTED + 1),
|
||||
VK_RESULT_RANGE_SIZE = (VK_INCOMPLETE - VK_ERROR_FRAGMENTED_POOL + 1),
|
||||
VK_RESULT_MAX_ENUM = 0x7FFFFFFF
|
||||
} VkResult;
|
||||
|
||||
|
@ -214,6 +217,15 @@ typedef enum VkStructureType {
|
|||
VK_STRUCTURE_TYPE_DEBUG_MARKER_OBJECT_NAME_INFO_EXT = 1000022000,
|
||||
VK_STRUCTURE_TYPE_DEBUG_MARKER_OBJECT_TAG_INFO_EXT = 1000022001,
|
||||
VK_STRUCTURE_TYPE_DEBUG_MARKER_MARKER_INFO_EXT = 1000022002,
|
||||
VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_IMAGE_CREATE_INFO_NV = 1000026000,
|
||||
VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_BUFFER_CREATE_INFO_NV = 1000026001,
|
||||
VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_MEMORY_ALLOCATE_INFO_NV = 1000026002,
|
||||
VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO_NV = 1000056000,
|
||||
VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO_NV = 1000056001,
|
||||
VK_STRUCTURE_TYPE_IMPORT_MEMORY_WIN32_HANDLE_INFO_NV = 1000057000,
|
||||
VK_STRUCTURE_TYPE_EXPORT_MEMORY_WIN32_HANDLE_INFO_NV = 1000057001,
|
||||
VK_STRUCTURE_TYPE_WIN32_KEYED_MUTEX_ACQUIRE_RELEASE_INFO_NV = 1000058000,
|
||||
VK_STRUCTURE_TYPE_VALIDATION_FLAGS_EXT = 1000061000,
|
||||
VK_STRUCTURE_TYPE_BEGIN_RANGE = VK_STRUCTURE_TYPE_APPLICATION_INFO,
|
||||
VK_STRUCTURE_TYPE_END_RANGE = VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO,
|
||||
VK_STRUCTURE_TYPE_RANGE_SIZE = (VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO - VK_STRUCTURE_TYPE_APPLICATION_INFO + 1),
|
||||
|
@ -426,6 +438,14 @@ typedef enum VkFormat {
|
|||
VK_FORMAT_ASTC_12x10_SRGB_BLOCK = 182,
|
||||
VK_FORMAT_ASTC_12x12_UNORM_BLOCK = 183,
|
||||
VK_FORMAT_ASTC_12x12_SRGB_BLOCK = 184,
|
||||
VK_FORMAT_PVRTC1_2BPP_UNORM_BLOCK_IMG = 1000054000,
|
||||
VK_FORMAT_PVRTC1_4BPP_UNORM_BLOCK_IMG = 1000054001,
|
||||
VK_FORMAT_PVRTC2_2BPP_UNORM_BLOCK_IMG = 1000054002,
|
||||
VK_FORMAT_PVRTC2_4BPP_UNORM_BLOCK_IMG = 1000054003,
|
||||
VK_FORMAT_PVRTC1_2BPP_SRGB_BLOCK_IMG = 1000054004,
|
||||
VK_FORMAT_PVRTC1_4BPP_SRGB_BLOCK_IMG = 1000054005,
|
||||
VK_FORMAT_PVRTC2_2BPP_SRGB_BLOCK_IMG = 1000054006,
|
||||
VK_FORMAT_PVRTC2_4BPP_SRGB_BLOCK_IMG = 1000054007,
|
||||
VK_FORMAT_BEGIN_RANGE = VK_FORMAT_UNDEFINED,
|
||||
VK_FORMAT_END_RANGE = VK_FORMAT_ASTC_12x12_SRGB_BLOCK,
|
||||
VK_FORMAT_RANGE_SIZE = (VK_FORMAT_ASTC_12x12_SRGB_BLOCK - VK_FORMAT_UNDEFINED + 1),
|
||||
|
@ -2347,7 +2367,7 @@ typedef void (VKAPI_PTR *PFN_vkCmdCopyImage)(VkCommandBuffer commandBuffer, VkIm
|
|||
typedef void (VKAPI_PTR *PFN_vkCmdBlitImage)(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageBlit* pRegions, VkFilter filter);
|
||||
typedef void (VKAPI_PTR *PFN_vkCmdCopyBufferToImage)(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkBufferImageCopy* pRegions);
|
||||
typedef void (VKAPI_PTR *PFN_vkCmdCopyImageToBuffer)(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkBuffer dstBuffer, uint32_t regionCount, const VkBufferImageCopy* pRegions);
|
||||
typedef void (VKAPI_PTR *PFN_vkCmdUpdateBuffer)(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize dataSize, const uint32_t* pData);
|
||||
typedef void (VKAPI_PTR *PFN_vkCmdUpdateBuffer)(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize dataSize, const void* pData);
|
||||
typedef void (VKAPI_PTR *PFN_vkCmdFillBuffer)(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize size, uint32_t data);
|
||||
typedef void (VKAPI_PTR *PFN_vkCmdClearColorImage)(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, const VkClearColorValue* pColor, uint32_t rangeCount, const VkImageSubresourceRange* pRanges);
|
||||
typedef void (VKAPI_PTR *PFN_vkCmdClearDepthStencilImage)(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, const VkClearDepthStencilValue* pDepthStencil, uint32_t rangeCount, const VkImageSubresourceRange* pRanges);
|
||||
|
@ -3032,7 +3052,7 @@ VKAPI_ATTR void VKAPI_CALL vkCmdUpdateBuffer(
|
|||
VkBuffer dstBuffer,
|
||||
VkDeviceSize dstOffset,
|
||||
VkDeviceSize dataSize,
|
||||
const uint32_t* pData);
|
||||
const void* pData);
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL vkCmdFillBuffer(
|
||||
VkCommandBuffer commandBuffer,
|
||||
|
@ -3715,7 +3735,7 @@ VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceWin32PresentationSupportKHR(
|
|||
#define VK_EXT_debug_report 1
|
||||
VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDebugReportCallbackEXT)
|
||||
|
||||
#define VK_EXT_DEBUG_REPORT_SPEC_VERSION 2
|
||||
#define VK_EXT_DEBUG_REPORT_SPEC_VERSION 3
|
||||
#define VK_EXT_DEBUG_REPORT_EXTENSION_NAME "VK_EXT_debug_report"
|
||||
#define VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT
|
||||
|
||||
|
@ -3927,6 +3947,213 @@ VKAPI_ATTR void VKAPI_CALL vkCmdDebugMarkerInsertEXT(
|
|||
#define VK_AMD_GCN_SHADER_EXTENSION_NAME "VK_AMD_gcn_shader"
|
||||
|
||||
|
||||
#define VK_NV_dedicated_allocation 1
|
||||
#define VK_NV_DEDICATED_ALLOCATION_SPEC_VERSION 1
|
||||
#define VK_NV_DEDICATED_ALLOCATION_EXTENSION_NAME "VK_NV_dedicated_allocation"
|
||||
|
||||
typedef struct VkDedicatedAllocationImageCreateInfoNV {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkBool32 dedicatedAllocation;
|
||||
} VkDedicatedAllocationImageCreateInfoNV;
|
||||
|
||||
typedef struct VkDedicatedAllocationBufferCreateInfoNV {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkBool32 dedicatedAllocation;
|
||||
} VkDedicatedAllocationBufferCreateInfoNV;
|
||||
|
||||
typedef struct VkDedicatedAllocationMemoryAllocateInfoNV {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkImage image;
|
||||
VkBuffer buffer;
|
||||
} VkDedicatedAllocationMemoryAllocateInfoNV;
|
||||
|
||||
|
||||
|
||||
#define VK_AMD_draw_indirect_count 1
|
||||
#define VK_AMD_DRAW_INDIRECT_COUNT_SPEC_VERSION 1
|
||||
#define VK_AMD_DRAW_INDIRECT_COUNT_EXTENSION_NAME "VK_AMD_draw_indirect_count"
|
||||
|
||||
typedef void (VKAPI_PTR *PFN_vkCmdDrawIndirectCountAMD)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride);
|
||||
typedef void (VKAPI_PTR *PFN_vkCmdDrawIndexedIndirectCountAMD)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride);
|
||||
|
||||
#ifndef VK_NO_PROTOTYPES
|
||||
VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndirectCountAMD(
|
||||
VkCommandBuffer commandBuffer,
|
||||
VkBuffer buffer,
|
||||
VkDeviceSize offset,
|
||||
VkBuffer countBuffer,
|
||||
VkDeviceSize countBufferOffset,
|
||||
uint32_t maxDrawCount,
|
||||
uint32_t stride);
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndexedIndirectCountAMD(
|
||||
VkCommandBuffer commandBuffer,
|
||||
VkBuffer buffer,
|
||||
VkDeviceSize offset,
|
||||
VkBuffer countBuffer,
|
||||
VkDeviceSize countBufferOffset,
|
||||
uint32_t maxDrawCount,
|
||||
uint32_t stride);
|
||||
#endif
|
||||
|
||||
#define VK_AMD_negative_viewport_height 1
|
||||
#define VK_AMD_NEGATIVE_VIEWPORT_HEIGHT_SPEC_VERSION 1
|
||||
#define VK_AMD_NEGATIVE_VIEWPORT_HEIGHT_EXTENSION_NAME "VK_AMD_negative_viewport_height"
|
||||
|
||||
|
||||
#define VK_AMD_gpu_shader_half_float 1
|
||||
#define VK_AMD_GPU_SHADER_HALF_FLOAT_SPEC_VERSION 1
|
||||
#define VK_AMD_GPU_SHADER_HALF_FLOAT_EXTENSION_NAME "VK_AMD_gpu_shader_half_float"
|
||||
|
||||
|
||||
#define VK_AMD_shader_ballot 1
|
||||
#define VK_AMD_SHADER_BALLOT_SPEC_VERSION 1
|
||||
#define VK_AMD_SHADER_BALLOT_EXTENSION_NAME "VK_AMD_shader_ballot"
|
||||
|
||||
|
||||
#define VK_IMG_format_pvrtc 1
|
||||
#define VK_IMG_FORMAT_PVRTC_SPEC_VERSION 1
|
||||
#define VK_IMG_FORMAT_PVRTC_EXTENSION_NAME "VK_IMG_format_pvrtc"
|
||||
|
||||
|
||||
#define VK_NV_external_memory_capabilities 1
|
||||
#define VK_NV_EXTERNAL_MEMORY_CAPABILITIES_SPEC_VERSION 1
|
||||
#define VK_NV_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME "VK_NV_external_memory_capabilities"
|
||||
|
||||
|
||||
typedef enum VkExternalMemoryHandleTypeFlagBitsNV {
|
||||
VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT_NV = 0x00000001,
|
||||
VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_NV = 0x00000002,
|
||||
VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_IMAGE_BIT_NV = 0x00000004,
|
||||
VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_IMAGE_KMT_BIT_NV = 0x00000008,
|
||||
VK_EXTERNAL_MEMORY_HANDLE_TYPE_FLAG_BITS_MAX_ENUM_NV = 0x7FFFFFFF
|
||||
} VkExternalMemoryHandleTypeFlagBitsNV;
|
||||
typedef VkFlags VkExternalMemoryHandleTypeFlagsNV;
|
||||
|
||||
typedef enum VkExternalMemoryFeatureFlagBitsNV {
|
||||
VK_EXTERNAL_MEMORY_FEATURE_DEDICATED_ONLY_BIT_NV = 0x00000001,
|
||||
VK_EXTERNAL_MEMORY_FEATURE_EXPORTABLE_BIT_NV = 0x00000002,
|
||||
VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT_NV = 0x00000004,
|
||||
VK_EXTERNAL_MEMORY_FEATURE_FLAG_BITS_MAX_ENUM_NV = 0x7FFFFFFF
|
||||
} VkExternalMemoryFeatureFlagBitsNV;
|
||||
typedef VkFlags VkExternalMemoryFeatureFlagsNV;
|
||||
|
||||
typedef struct VkExternalImageFormatPropertiesNV {
|
||||
VkImageFormatProperties imageFormatProperties;
|
||||
VkExternalMemoryFeatureFlagsNV externalMemoryFeatures;
|
||||
VkExternalMemoryHandleTypeFlagsNV exportFromImportedHandleTypes;
|
||||
VkExternalMemoryHandleTypeFlagsNV compatibleHandleTypes;
|
||||
} VkExternalImageFormatPropertiesNV;
|
||||
|
||||
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceExternalImageFormatPropertiesNV)(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, VkExternalMemoryHandleTypeFlagsNV externalHandleType, VkExternalImageFormatPropertiesNV* pExternalImageFormatProperties);
|
||||
|
||||
#ifndef VK_NO_PROTOTYPES
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceExternalImageFormatPropertiesNV(
|
||||
VkPhysicalDevice physicalDevice,
|
||||
VkFormat format,
|
||||
VkImageType type,
|
||||
VkImageTiling tiling,
|
||||
VkImageUsageFlags usage,
|
||||
VkImageCreateFlags flags,
|
||||
VkExternalMemoryHandleTypeFlagsNV externalHandleType,
|
||||
VkExternalImageFormatPropertiesNV* pExternalImageFormatProperties);
|
||||
#endif
|
||||
|
||||
#define VK_NV_external_memory 1
|
||||
#define VK_NV_EXTERNAL_MEMORY_SPEC_VERSION 1
|
||||
#define VK_NV_EXTERNAL_MEMORY_EXTENSION_NAME "VK_NV_external_memory"
|
||||
|
||||
typedef struct VkExternalMemoryImageCreateInfoNV {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkExternalMemoryHandleTypeFlagsNV handleTypes;
|
||||
} VkExternalMemoryImageCreateInfoNV;
|
||||
|
||||
typedef struct VkExportMemoryAllocateInfoNV {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkExternalMemoryHandleTypeFlagsNV handleTypes;
|
||||
} VkExportMemoryAllocateInfoNV;
|
||||
|
||||
|
||||
|
||||
#ifdef VK_USE_PLATFORM_WIN32_KHR
|
||||
#define VK_NV_external_memory_win32 1
|
||||
#define VK_NV_EXTERNAL_MEMORY_WIN32_SPEC_VERSION 1
|
||||
#define VK_NV_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME "VK_NV_external_memory_win32"
|
||||
|
||||
typedef struct VkImportMemoryWin32HandleInfoNV {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
VkExternalMemoryHandleTypeFlagsNV handleType;
|
||||
HANDLE handle;
|
||||
} VkImportMemoryWin32HandleInfoNV;
|
||||
|
||||
typedef struct VkExportMemoryWin32HandleInfoNV {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
const SECURITY_ATTRIBUTES* pAttributes;
|
||||
DWORD dwAccess;
|
||||
} VkExportMemoryWin32HandleInfoNV;
|
||||
|
||||
|
||||
typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryWin32HandleNV)(VkDevice device, VkDeviceMemory memory, VkExternalMemoryHandleTypeFlagsNV handleType, HANDLE* pHandle);
|
||||
|
||||
#ifndef VK_NO_PROTOTYPES
|
||||
VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryWin32HandleNV(
|
||||
VkDevice device,
|
||||
VkDeviceMemory memory,
|
||||
VkExternalMemoryHandleTypeFlagsNV handleType,
|
||||
HANDLE* pHandle);
|
||||
#endif
|
||||
#endif /* VK_USE_PLATFORM_WIN32_KHR */
|
||||
|
||||
#ifdef VK_USE_PLATFORM_WIN32_KHR
|
||||
#define VK_NV_win32_keyed_mutex 1
|
||||
#define VK_NV_WIN32_KEYED_MUTEX_SPEC_VERSION 1
|
||||
#define VK_NV_WIN32_KEYED_MUTEX_EXTENSION_NAME "VK_NV_win32_keyed_mutex"
|
||||
|
||||
typedef struct VkWin32KeyedMutexAcquireReleaseInfoNV {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
uint32_t acquireCount;
|
||||
const VkDeviceMemory* pAcquireSyncs;
|
||||
const uint64_t* pAcquireKeys;
|
||||
const uint32_t* pAcquireTimeoutMilliseconds;
|
||||
uint32_t releaseCount;
|
||||
const VkDeviceMemory* pReleaseSyncs;
|
||||
const uint64_t* pReleaseKeys;
|
||||
} VkWin32KeyedMutexAcquireReleaseInfoNV;
|
||||
|
||||
|
||||
#endif /* VK_USE_PLATFORM_WIN32_KHR */
|
||||
|
||||
#define VK_EXT_validation_flags 1
|
||||
#define VK_EXT_VALIDATION_FLAGS_SPEC_VERSION 1
|
||||
#define VK_EXT_VALIDATION_FLAGS_EXTENSION_NAME "VK_EXT_validation_flags"
|
||||
|
||||
|
||||
typedef enum VkValidationCheckEXT {
|
||||
VK_VALIDATION_CHECK_ALL_EXT = 0,
|
||||
VK_VALIDATION_CHECK_BEGIN_RANGE_EXT = VK_VALIDATION_CHECK_ALL_EXT,
|
||||
VK_VALIDATION_CHECK_END_RANGE_EXT = VK_VALIDATION_CHECK_ALL_EXT,
|
||||
VK_VALIDATION_CHECK_RANGE_SIZE_EXT = (VK_VALIDATION_CHECK_ALL_EXT - VK_VALIDATION_CHECK_ALL_EXT + 1),
|
||||
VK_VALIDATION_CHECK_MAX_ENUM_EXT = 0x7FFFFFFF
|
||||
} VkValidationCheckEXT;
|
||||
|
||||
typedef struct VkValidationFlagsEXT {
|
||||
VkStructureType sType;
|
||||
const void* pNext;
|
||||
uint32_t disabledValidationCheckCount;
|
||||
VkValidationCheckEXT* pDisabledValidationChecks;
|
||||
} VkValidationFlagsEXT;
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue