Update the vulkan loader and headers.
This commit is contained in:
14
third_party/vulkan/loader/cJSON.c
vendored
14
third_party/vulkan/loader/cJSON.c
vendored
@@ -343,7 +343,7 @@ static const char *parse_string(cJSON *item, const char *str) {
|
||||
*--ptr2 = ((uc | 0x80) & 0xBF);
|
||||
uc >>= 6;
|
||||
case 1:
|
||||
*--ptr2 = (uc | firstByteMark[len]);
|
||||
*--ptr2 = ((unsigned char)uc | firstByteMark[len]);
|
||||
}
|
||||
ptr2 += len;
|
||||
break;
|
||||
@@ -423,7 +423,6 @@ static char *print_string_ptr(const char *str, printbuffer *p) {
|
||||
if ((unsigned char)*ptr > 31 && *ptr != '\"' && *ptr != '\\')
|
||||
*ptr2++ = *ptr++;
|
||||
else {
|
||||
*ptr2++ = '\\';
|
||||
switch (token = *ptr++) {
|
||||
case '\\':
|
||||
*ptr2++ = '\\';
|
||||
@@ -432,19 +431,19 @@ static char *print_string_ptr(const char *str, printbuffer *p) {
|
||||
*ptr2++ = '\"';
|
||||
break;
|
||||
case '\b':
|
||||
*ptr2++ = 'b';
|
||||
*ptr2++ = '\b';
|
||||
break;
|
||||
case '\f':
|
||||
*ptr2++ = 'f';
|
||||
*ptr2++ = '\f';
|
||||
break;
|
||||
case '\n':
|
||||
*ptr2++ = 'n';
|
||||
*ptr2++ = '\n';
|
||||
break;
|
||||
case '\r':
|
||||
*ptr2++ = 'r';
|
||||
*ptr2++ = '\r';
|
||||
break;
|
||||
case '\t':
|
||||
*ptr2++ = 't';
|
||||
*ptr2++ = '\t';
|
||||
break;
|
||||
default:
|
||||
sprintf(ptr2, "u%04x", token);
|
||||
@@ -521,7 +520,6 @@ char *cJSON_PrintBuffered(cJSON *item, int prebuffer, int fmt) {
|
||||
p.length = prebuffer;
|
||||
p.offset = 0;
|
||||
return print_value(item, 0, fmt, &p);
|
||||
return p.buffer;
|
||||
}
|
||||
|
||||
/* Parser core - when encountering text, process appropriately. */
|
||||
|
||||
5
third_party/vulkan/loader/cJSON.h
vendored
5
third_party/vulkan/loader/cJSON.h
vendored
@@ -57,9 +57,8 @@ typedef struct cJSON {
|
||||
int valueint; /* The item's number, if type==cJSON_Number */
|
||||
double valuedouble; /* The item's number, if type==cJSON_Number */
|
||||
|
||||
char *
|
||||
string; /* The item's name string, if this item is the child of, or is
|
||||
in the list of subitems of an object. */
|
||||
char *string; /* The item's name string, if this item is the child of, or is
|
||||
in the list of subitems of an object. */
|
||||
} cJSON;
|
||||
|
||||
typedef struct cJSON_Hooks {
|
||||
|
||||
144
third_party/vulkan/loader/debug_report.c
vendored
144
third_party/vulkan/loader/debug_report.c
vendored
@@ -4,24 +4,17 @@
|
||||
* Copyright (c) 2015-2016 LunarG, Inc.
|
||||
* Copyright (C) 2015-2016 Google Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and/or associated documentation files (the "Materials"), to
|
||||
* deal in the Materials without restriction, including without limitation the
|
||||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
* sell copies of the Materials, and to permit persons to whom the Materials are
|
||||
* furnished to do so, subject to the following conditions:
|
||||
* 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
|
||||
*
|
||||
* The above copyright notice(s) and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Materials.
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
*
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE
|
||||
* USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* Author: Courtney Goeltzenleuchter <courtney@LunarG.com>
|
||||
* Author: Jon Ashburn <jon@LunarG.com>
|
||||
@@ -156,6 +149,99 @@ void util_DestroyDebugReportCallback(struct loader_instance *inst,
|
||||
}
|
||||
}
|
||||
|
||||
// This utility (used by vkInstanceCreateInfo(), looks at a pNext chain. It
|
||||
// counts any VkDebugReportCallbackCreateInfoEXT structs that it finds. It
|
||||
// then allocates array that can hold that many structs, as well as that many
|
||||
// VkDebugReportCallbackEXT handles. It then copies each
|
||||
// VkDebugReportCallbackCreateInfoEXT, and initializes each handle.
|
||||
VkResult util_CopyDebugReportCreateInfos(
|
||||
const void *pChain, const VkAllocationCallbacks *pAllocator,
|
||||
uint32_t *num_callbacks, VkDebugReportCallbackCreateInfoEXT **infos,
|
||||
VkDebugReportCallbackEXT **callbacks) {
|
||||
uint32_t n = *num_callbacks = 0;
|
||||
|
||||
// NOTE: The loader is not using pAllocator, and so this function doesn't
|
||||
// either.
|
||||
|
||||
const void *pNext = pChain;
|
||||
while (pNext) {
|
||||
// 1st, count the number VkDebugReportCallbackCreateInfoEXT:
|
||||
if (((VkDebugReportCallbackCreateInfoEXT *)pNext)->sType ==
|
||||
VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT) {
|
||||
n++;
|
||||
}
|
||||
pNext = (void *)((VkDebugReportCallbackCreateInfoEXT *)pNext)->pNext;
|
||||
}
|
||||
if (n == 0) {
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
// 2nd, allocate memory for each VkDebugReportCallbackCreateInfoEXT:
|
||||
VkDebugReportCallbackCreateInfoEXT *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;
|
||||
}
|
||||
// 4th, copy each VkDebugReportCallbackCreateInfoEXT for use by
|
||||
// vkDestroyInstance, and assign a unique handle to each callback (just
|
||||
// use the address of the copied VkDebugReportCallbackCreateInfoEXT):
|
||||
pNext = pChain;
|
||||
while (pNext) {
|
||||
if (((VkInstanceCreateInfo *)pNext)->sType ==
|
||||
VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT) {
|
||||
memcpy(pInfos, pNext, sizeof(VkDebugReportCallbackCreateInfoEXT));
|
||||
*pCallbacks++ = (VkDebugReportCallbackEXT)pInfos++;
|
||||
}
|
||||
pNext = (void *)((VkInstanceCreateInfo *)pNext)->pNext;
|
||||
}
|
||||
|
||||
*num_callbacks = n;
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
void util_FreeDebugReportCreateInfos(const VkAllocationCallbacks *pAllocator,
|
||||
VkDebugReportCallbackCreateInfoEXT *infos,
|
||||
VkDebugReportCallbackEXT *callbacks) {
|
||||
free(infos);
|
||||
free(callbacks);
|
||||
}
|
||||
|
||||
VkResult util_CreateDebugReportCallbacks(
|
||||
struct loader_instance *inst, const VkAllocationCallbacks *pAllocator,
|
||||
uint32_t num_callbacks, VkDebugReportCallbackCreateInfoEXT *infos,
|
||||
VkDebugReportCallbackEXT *callbacks) {
|
||||
VkResult rtn = VK_SUCCESS;
|
||||
for (uint32_t i = 0; i < num_callbacks; i++) {
|
||||
rtn = util_CreateDebugReportCallback(inst, &infos[i], pAllocator,
|
||||
callbacks[i]);
|
||||
if (rtn != VK_SUCCESS) {
|
||||
for (uint32_t j = 0; j < i; j++) {
|
||||
util_DestroyDebugReportCallback(inst, callbacks[j], pAllocator);
|
||||
}
|
||||
return rtn;
|
||||
}
|
||||
}
|
||||
return rtn;
|
||||
}
|
||||
|
||||
void util_DestroyDebugReportCallbacks(struct loader_instance *inst,
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
uint32_t num_callbacks,
|
||||
VkDebugReportCallbackEXT *callbacks) {
|
||||
for (uint32_t i = 0; i < num_callbacks; i++) {
|
||||
util_DestroyDebugReportCallback(inst, callbacks[i], pAllocator);
|
||||
}
|
||||
}
|
||||
|
||||
static VKAPI_ATTR void VKAPI_CALL
|
||||
debug_report_DestroyDebugReportCallback(VkInstance instance,
|
||||
VkDebugReportCallbackEXT callback,
|
||||
@@ -185,14 +271,14 @@ static VKAPI_ATTR void VKAPI_CALL debug_report_DebugReportMessage(
|
||||
* for CreateDebugReportCallback
|
||||
*/
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL loader_CreateDebugReportCallback(
|
||||
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;
|
||||
struct loader_instance *inst = (struct loader_instance *)instance;
|
||||
VkResult res;
|
||||
VkResult res = VK_SUCCESS;
|
||||
uint32_t storage_idx;
|
||||
|
||||
icd_info = calloc(sizeof(VkDebugReportCallbackEXT), inst->total_icd_count);
|
||||
@@ -219,6 +305,10 @@ VKAPI_ATTR VkResult VKAPI_CALL loader_CreateDebugReportCallback(
|
||||
if (icd) {
|
||||
storage_idx = 0;
|
||||
for (icd = inst->icds; icd; icd = icd->next) {
|
||||
if (NULL == icd->DestroyDebugReportCallbackEXT) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (icd_info[storage_idx]) {
|
||||
icd->DestroyDebugReportCallbackEXT(
|
||||
icd->instance, icd_info[storage_idx], pAllocator);
|
||||
@@ -239,9 +329,9 @@ VKAPI_ATTR VkResult VKAPI_CALL loader_CreateDebugReportCallback(
|
||||
* for DestroyDebugReportCallback
|
||||
*/
|
||||
VKAPI_ATTR void VKAPI_CALL
|
||||
loader_DestroyDebugReportCallback(VkInstance instance,
|
||||
VkDebugReportCallbackEXT callback,
|
||||
const VkAllocationCallbacks *pAllocator) {
|
||||
terminator_DestroyDebugReportCallback(VkInstance instance,
|
||||
VkDebugReportCallbackEXT callback,
|
||||
const VkAllocationCallbacks *pAllocator) {
|
||||
uint32_t storage_idx;
|
||||
VkDebugReportCallbackEXT *icd_info;
|
||||
const struct loader_icd *icd;
|
||||
@@ -250,6 +340,10 @@ loader_DestroyDebugReportCallback(VkInstance instance,
|
||||
icd_info = *(VkDebugReportCallbackEXT **)&callback;
|
||||
storage_idx = 0;
|
||||
for (icd = inst->icds; icd; icd = icd->next) {
|
||||
if (NULL == icd->DestroyDebugReportCallbackEXT) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (icd_info[storage_idx]) {
|
||||
icd->DestroyDebugReportCallbackEXT(
|
||||
icd->instance, icd_info[storage_idx], pAllocator);
|
||||
@@ -263,10 +357,10 @@ loader_DestroyDebugReportCallback(VkInstance instance,
|
||||
* for DebugReportMessage
|
||||
*/
|
||||
VKAPI_ATTR void VKAPI_CALL
|
||||
loader_DebugReportMessage(VkInstance instance, VkDebugReportFlagsEXT flags,
|
||||
VkDebugReportObjectTypeEXT objType, uint64_t object,
|
||||
size_t location, int32_t msgCode,
|
||||
const char *pLayerPrefix, const char *pMsg) {
|
||||
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;
|
||||
|
||||
struct loader_instance *inst = (struct loader_instance *)instance;
|
||||
|
||||
58
third_party/vulkan/loader/debug_report.h
vendored
58
third_party/vulkan/loader/debug_report.h
vendored
@@ -4,24 +4,17 @@
|
||||
* Copyright (c) 2015-2016 LunarG, Inc.
|
||||
* Copyright (C) 2015-2016 Google Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and/or associated documentation files (the "Materials"), to
|
||||
* deal in the Materials without restriction, including without limitation the
|
||||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
* sell copies of the Materials, and to permit persons to whom the Materials are
|
||||
* furnished to do so, subject to the following conditions:
|
||||
* 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
|
||||
*
|
||||
* The above copyright notice(s) and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Materials.
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
*
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE
|
||||
* USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* Author: Courtney Goeltzenleuchter <courtney@LunarG.com>
|
||||
* Author: Jon Ashburn <jon@lunarg.com>
|
||||
@@ -116,21 +109,21 @@ void debug_report_create_instance(struct loader_instance *ptr_instance,
|
||||
bool debug_report_instance_gpa(struct loader_instance *ptr_instance,
|
||||
const char *name, void **addr);
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL loader_CreateDebugReportCallback(
|
||||
VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDebugReportCallback(
|
||||
VkInstance instance, const VkDebugReportCallbackCreateInfoEXT *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
VkDebugReportCallbackEXT *pCallback);
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL
|
||||
loader_DestroyDebugReportCallback(VkInstance instance,
|
||||
VkDebugReportCallbackEXT callback,
|
||||
const VkAllocationCallbacks *pAllocator);
|
||||
terminator_DestroyDebugReportCallback(VkInstance instance,
|
||||
VkDebugReportCallbackEXT callback,
|
||||
const VkAllocationCallbacks *pAllocator);
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL
|
||||
loader_DebugReportMessage(VkInstance instance, VkDebugReportFlagsEXT flags,
|
||||
VkDebugReportObjectTypeEXT objType, uint64_t object,
|
||||
size_t location, int32_t msgCode,
|
||||
const char *pLayerPrefix, const char *pMsg);
|
||||
terminator_DebugReportMessage(VkInstance instance, VkDebugReportFlagsEXT flags,
|
||||
VkDebugReportObjectTypeEXT objType,
|
||||
uint64_t object, size_t location, int32_t msgCode,
|
||||
const char *pLayerPrefix, const char *pMsg);
|
||||
|
||||
VkResult
|
||||
util_CreateDebugReportCallback(struct loader_instance *inst,
|
||||
@@ -142,6 +135,23 @@ void util_DestroyDebugReportCallback(struct loader_instance *inst,
|
||||
VkDebugReportCallbackEXT callback,
|
||||
const VkAllocationCallbacks *pAllocator);
|
||||
|
||||
VkResult util_CopyDebugReportCreateInfos(
|
||||
const void *pChain, const VkAllocationCallbacks *pAllocator,
|
||||
uint32_t *num_callbacks, VkDebugReportCallbackCreateInfoEXT **infos,
|
||||
VkDebugReportCallbackEXT **callbacks);
|
||||
void util_FreeDebugReportCreateInfos(const VkAllocationCallbacks *pAllocator,
|
||||
VkDebugReportCallbackCreateInfoEXT *infos,
|
||||
VkDebugReportCallbackEXT *callbacks);
|
||||
VkResult util_CreateDebugReportCallbacks(
|
||||
struct loader_instance *inst, const VkAllocationCallbacks *pAllocator,
|
||||
uint32_t num_callbacks, VkDebugReportCallbackCreateInfoEXT *infos,
|
||||
VkDebugReportCallbackEXT *callbacks);
|
||||
|
||||
void util_DestroyDebugReportCallbacks(struct loader_instance *inst,
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
uint32_t num_callbacks,
|
||||
VkDebugReportCallbackEXT *callbacks);
|
||||
|
||||
VkBool32 util_DebugReportMessage(const struct loader_instance *inst,
|
||||
VkFlags msgFlags,
|
||||
VkDebugReportObjectTypeEXT objectType,
|
||||
|
||||
25
third_party/vulkan/loader/dev_ext_trampoline.c
vendored
25
third_party/vulkan/loader/dev_ext_trampoline.c
vendored
@@ -3,24 +3,17 @@
|
||||
* Copyright (c) 2015-2016 Valve Corporation
|
||||
* Copyright (c) 2015-2016 LunarG, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and/or associated documentation files (the "Materials"), to
|
||||
* deal in the Materials without restriction, including without limitation the
|
||||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
* sell copies of the Materials, and to permit persons to whom the Materials are
|
||||
* furnished to do so, subject to the following conditions:
|
||||
* 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
|
||||
*
|
||||
* The above copyright notice(s) and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Materials.
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
*
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE
|
||||
* USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
* 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: Jon Ashburn <jon@lunarg.com>
|
||||
*/
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
Rights: See end of file.
|
||||
|
||||
*/
|
||||
#include <dirent_on_windows.h>
|
||||
#include "dirent_on_windows.h"
|
||||
#include <errno.h>
|
||||
#include <io.h> /* _findfirst and _findnext set errno iff they return -1 */
|
||||
#include <stdlib.h>
|
||||
|
||||
25
third_party/vulkan/loader/gpa_helper.h
vendored
25
third_party/vulkan/loader/gpa_helper.h
vendored
@@ -4,24 +4,17 @@
|
||||
* Copyright (c) 2015 Valve Corporation
|
||||
* Copyright (c) 2015 LunarG, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and/or associated documentation files (the "Materials"), to
|
||||
* deal in the Materials without restriction, including without limitation the
|
||||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
* sell copies of the Materials, and to permit persons to whom the Materials are
|
||||
* furnished to do so, subject to the following conditions:
|
||||
* 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
|
||||
*
|
||||
* The above copyright notice(s) and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Materials.
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
*
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE
|
||||
* USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
* 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: Jon Ashburn <jon@lunarg.com>
|
||||
*/
|
||||
|
||||
2688
third_party/vulkan/loader/loader.c
vendored
2688
third_party/vulkan/loader/loader.c
vendored
File diff suppressed because it is too large
Load Diff
355
third_party/vulkan/loader/loader.h
vendored
355
third_party/vulkan/loader/loader.h
vendored
@@ -5,24 +5,17 @@
|
||||
* Copyright (c) 2014-2016 LunarG, Inc.
|
||||
* Copyright (C) 2015 Google Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and/or associated documentation files (the "Materials"), to
|
||||
* deal in the Materials without restriction, including without limitation the
|
||||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
* sell copies of the Materials, and to permit persons to whom the Materials are
|
||||
* furnished to do so, subject to the following conditions:
|
||||
* 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
|
||||
*
|
||||
* The above copyright notice(s) and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Materials.
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
*
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE
|
||||
* USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
* 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: Jon Ashburn <jon@lunarg.com>
|
||||
* Author: Courtney Goeltzenleuchter <courtney@LunarG.com>
|
||||
@@ -36,10 +29,10 @@
|
||||
#define LOADER_H
|
||||
|
||||
#include <vulkan/vulkan.h>
|
||||
#include <vk_loader_platform.h>
|
||||
|
||||
|
||||
#include "vk_loader_platform.h"
|
||||
#include "vk_loader_layer.h"
|
||||
#include <vulkan/vk_layer.h>
|
||||
|
||||
#include <vulkan/vk_icd.h>
|
||||
#include <assert.h>
|
||||
|
||||
@@ -57,13 +50,9 @@
|
||||
#define VK_PATCH(version) (version & 0xfff)
|
||||
|
||||
enum layer_type {
|
||||
VK_LAYER_TYPE_DEVICE_EXPLICIT = 0x1,
|
||||
VK_LAYER_TYPE_INSTANCE_EXPLICIT = 0x2,
|
||||
VK_LAYER_TYPE_GLOBAL_EXPLICIT = 0x3, // instance and device layer, bitwise
|
||||
VK_LAYER_TYPE_DEVICE_IMPLICIT = 0x4,
|
||||
VK_LAYER_TYPE_INSTANCE_IMPLICIT = 0x8,
|
||||
VK_LAYER_TYPE_GLOBAL_IMPLICIT = 0xc, // instance and device layer, bitwise
|
||||
VK_LAYER_TYPE_META_EXPLICT = 0x10,
|
||||
VK_LAYER_TYPE_INSTANCE_EXPLICIT = 0x1,
|
||||
VK_LAYER_TYPE_INSTANCE_IMPLICIT = 0x2,
|
||||
VK_LAYER_TYPE_META_EXPLICT = 0x4,
|
||||
};
|
||||
|
||||
typedef enum VkStringErrorFlagBits {
|
||||
@@ -83,12 +72,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[9][VK_MAX_EXTENSION_NAME_SIZE] = {
|
||||
"VK_LAYER_LUNARG_threading", "VK_LAYER_LUNARG_param_checker",
|
||||
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_mem_tracker",
|
||||
"VK_LAYER_LUNARG_draw_state", "VK_LAYER_LUNARG_swapchain",
|
||||
"VK_LAYER_GOOGLE_unique_objects"};
|
||||
"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
|
||||
@@ -121,12 +109,6 @@ struct loader_name_value {
|
||||
char value[MAX_STRING_SIZE];
|
||||
};
|
||||
|
||||
struct loader_lib_info {
|
||||
char lib_name[MAX_STRING_SIZE];
|
||||
uint32_t ref_count;
|
||||
loader_platform_dl_handle lib_handle;
|
||||
};
|
||||
|
||||
struct loader_layer_functions {
|
||||
char str_gipa[MAX_STRING_SIZE];
|
||||
char str_gdpa[MAX_STRING_SIZE];
|
||||
@@ -138,6 +120,7 @@ struct loader_layer_properties {
|
||||
VkLayerProperties info;
|
||||
enum layer_type type;
|
||||
char lib_name[MAX_STRING_SIZE];
|
||||
loader_platform_dl_handle lib_handle;
|
||||
struct loader_layer_functions functions;
|
||||
struct loader_extension_list instance_extension_list;
|
||||
struct loader_device_extension_list device_extension_list;
|
||||
@@ -151,12 +134,6 @@ struct loader_layer_list {
|
||||
struct loader_layer_properties *list;
|
||||
};
|
||||
|
||||
struct loader_layer_library_list {
|
||||
size_t capacity;
|
||||
uint32_t count;
|
||||
struct loader_lib_info *list;
|
||||
};
|
||||
|
||||
struct loader_dispatch_hash_list {
|
||||
size_t capacity;
|
||||
uint32_t count;
|
||||
@@ -201,7 +178,6 @@ struct loader_icd {
|
||||
// pointers to find other structs
|
||||
const struct loader_scanned_icds *this_icd_lib;
|
||||
const struct loader_instance *this_instance;
|
||||
|
||||
struct loader_device *logical_device_list;
|
||||
VkInstance instance; // instance object from the icd
|
||||
PFN_vkGetDeviceProcAddr GetDeviceProcAddr;
|
||||
@@ -248,7 +224,17 @@ struct loader_icd {
|
||||
PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR
|
||||
GetPhysicalDeviceXlibPresentationSupportKHR;
|
||||
#endif
|
||||
|
||||
PFN_vkGetPhysicalDeviceDisplayPropertiesKHR
|
||||
GetPhysicalDeviceDisplayPropertiesKHR;
|
||||
PFN_vkGetPhysicalDeviceDisplayPlanePropertiesKHR
|
||||
GetPhysicalDeviceDisplayPlanePropertiesKHR;
|
||||
PFN_vkGetDisplayPlaneSupportedDisplaysKHR
|
||||
GetDisplayPlaneSupportedDisplaysKHR;
|
||||
PFN_vkGetDisplayModePropertiesKHR GetDisplayModePropertiesKHR;
|
||||
PFN_vkCreateDisplayModeKHR CreateDisplayModeKHR;
|
||||
PFN_vkGetDisplayPlaneCapabilitiesKHR GetDisplayPlaneCapabilitiesKHR;
|
||||
PFN_vkCreateDisplayPlaneSurfaceKHR CreateDisplayPlaneSurfaceKHR;
|
||||
PFN_vkDestroySurfaceKHR DestroySurfaceKHR;
|
||||
struct loader_icd *next;
|
||||
};
|
||||
|
||||
@@ -263,25 +249,29 @@ struct loader_icd_libs {
|
||||
struct loader_instance {
|
||||
VkLayerInstanceDispatchTable *disp; // must be first entry in structure
|
||||
|
||||
uint32_t total_gpu_count;
|
||||
struct loader_physical_device *phys_devs;
|
||||
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;
|
||||
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;
|
||||
struct loader_layer_list device_layer_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 activated_layer_list;
|
||||
|
||||
VkInstance instance;
|
||||
bool activated_layers_are_std_val;
|
||||
VkInstance instance; // layers/ICD instance returned to trampoline
|
||||
|
||||
bool debug_report_enabled;
|
||||
VkLayerDbgFunctionNode *DbgFunctionHead;
|
||||
uint32_t num_tmp_callbacks;
|
||||
VkDebugReportCallbackCreateInfoEXT *tmp_dbg_create_infos;
|
||||
VkDebugReportCallbackEXT *tmp_callbacks;
|
||||
|
||||
VkAllocationCallbacks alloc_callbacks;
|
||||
|
||||
@@ -304,36 +294,45 @@ struct loader_instance {
|
||||
#ifdef VK_USE_PLATFORM_ANDROID_KHR
|
||||
bool wsi_android_surface_enabled;
|
||||
#endif
|
||||
bool wsi_display_enabled;
|
||||
};
|
||||
|
||||
/* per enumerated PhysicalDevice structure */
|
||||
struct loader_physical_device {
|
||||
/* VkPhysicalDevice requires special treatment by loader. Firstly, terminator
|
||||
* code must be able to get the struct loader_icd to call into the proper
|
||||
* driver (multiple ICD/gpu case). This can be accomplished by wrapping the
|
||||
* created VkPhysicalDevice in loader terminate_EnumeratePhysicalDevices().
|
||||
* Secondly, the loader must be able to handle wrapped by layer VkPhysicalDevice
|
||||
* in trampoline code. This implies, that the loader trampoline code must also
|
||||
* wrap the VkPhysicalDevice object in trampoline code. Thus, loader has to
|
||||
* wrap the VkPhysicalDevice created object twice. In trampoline code it can't
|
||||
* rely on the terminator object wrapping since a layer may also wrap. Since
|
||||
* trampoline code wraps the VkPhysicalDevice this means all loader trampoline
|
||||
* code that passes a VkPhysicalDevice should unwrap it. */
|
||||
|
||||
/* per enumerated PhysicalDevice structure, used to wrap in trampoline code and
|
||||
also same structure used to wrap in terminator code */
|
||||
struct loader_physical_device_tramp {
|
||||
VkLayerInstanceDispatchTable *disp; // must be first entry in structure
|
||||
struct loader_instance *this_instance;
|
||||
VkPhysicalDevice phys_dev; // object from layers/loader terminator
|
||||
};
|
||||
|
||||
/* per enumerated PhysicalDevice structure, used to wrap in terminator code */
|
||||
struct loader_physical_device {
|
||||
VkLayerInstanceDispatchTable *disp; // must be first entry in structure
|
||||
struct loader_icd *this_icd;
|
||||
VkPhysicalDevice phys_dev; // object from ICD
|
||||
/*
|
||||
* Fill in the cache of available device extensions from
|
||||
* this physical device. This cache can be used during CreateDevice
|
||||
*/
|
||||
struct loader_extension_list device_extension_cache;
|
||||
};
|
||||
|
||||
struct loader_struct {
|
||||
struct loader_instance *instances;
|
||||
|
||||
unsigned int loaded_layer_lib_count;
|
||||
size_t loaded_layer_lib_capacity;
|
||||
struct loader_lib_info *loaded_layer_lib_list;
|
||||
// TODO add ref counting of ICD libraries
|
||||
// TODO use this struct loader_layer_library_list scanned_layer_libraries;
|
||||
// TODO add list of icd libraries for ref counting them for closure
|
||||
};
|
||||
|
||||
struct loader_scanned_icds {
|
||||
char *lib_name;
|
||||
loader_platform_dl_handle handle;
|
||||
uint32_t api_version;
|
||||
uint32_t interface_version;
|
||||
PFN_vkGetInstanceProcAddr GetInstanceProcAddr;
|
||||
PFN_vkCreateInstance CreateInstance;
|
||||
PFN_vkEnumerateInstanceExtensionProperties
|
||||
@@ -344,6 +343,13 @@ static inline struct loader_instance *loader_instance(VkInstance instance) {
|
||||
return (struct loader_instance *)instance;
|
||||
}
|
||||
|
||||
static inline VkPhysicalDevice
|
||||
loader_unwrap_physical_device(VkPhysicalDevice physicalDevice) {
|
||||
struct loader_physical_device_tramp *phys_dev =
|
||||
(struct loader_physical_device_tramp *)physicalDevice;
|
||||
return phys_dev->phys_dev;
|
||||
}
|
||||
|
||||
static inline void loader_set_dispatch(void *obj, const void *data) {
|
||||
*((const void **)obj) = data;
|
||||
}
|
||||
@@ -386,8 +392,18 @@ struct loader_msg_callback_map_entry {
|
||||
VkDebugReportCallbackEXT loader_obj;
|
||||
};
|
||||
|
||||
/* 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_log(const struct loader_instance *inst, VkFlags msg_type,
|
||||
int32_t msg_code, const char *format, ...);
|
||||
int32_t msg_code, const char *format, ...);
|
||||
|
||||
bool compare_vk_extension_properties(const VkExtensionProperties *op1,
|
||||
const VkExtensionProperties *op2);
|
||||
@@ -403,76 +419,10 @@ VkResult loader_validate_instance_extensions(
|
||||
const struct loader_layer_list *instance_layer,
|
||||
const VkInstanceCreateInfo *pCreateInfo);
|
||||
|
||||
/* instance layer chain termination entrypoint definitions */
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
loader_CreateInstance(const VkInstanceCreateInfo *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
VkInstance *pInstance);
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL
|
||||
loader_DestroyInstance(VkInstance instance,
|
||||
const VkAllocationCallbacks *pAllocator);
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
loader_EnumeratePhysicalDevices(VkInstance instance,
|
||||
uint32_t *pPhysicalDeviceCount,
|
||||
VkPhysicalDevice *pPhysicalDevices);
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL
|
||||
loader_GetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice,
|
||||
VkPhysicalDeviceFeatures *pFeatures);
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL
|
||||
loader_GetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice,
|
||||
VkFormat format,
|
||||
VkFormatProperties *pFormatInfo);
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL loader_GetPhysicalDeviceImageFormatProperties(
|
||||
VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type,
|
||||
VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags,
|
||||
VkImageFormatProperties *pImageFormatProperties);
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL loader_GetPhysicalDeviceSparseImageFormatProperties(
|
||||
VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type,
|
||||
VkSampleCountFlagBits samples, VkImageUsageFlags usage,
|
||||
VkImageTiling tiling, uint32_t *pNumProperties,
|
||||
VkSparseImageFormatProperties *pProperties);
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL
|
||||
loader_GetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice,
|
||||
VkPhysicalDeviceProperties *pProperties);
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
loader_EnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice,
|
||||
const char *pLayerName,
|
||||
uint32_t *pCount,
|
||||
VkExtensionProperties *pProperties);
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
loader_EnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice,
|
||||
uint32_t *pCount,
|
||||
VkLayerProperties *pProperties);
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL loader_GetPhysicalDeviceQueueFamilyProperties(
|
||||
VkPhysicalDevice physicalDevice, uint32_t *pCount,
|
||||
VkQueueFamilyProperties *pProperties);
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL loader_GetPhysicalDeviceMemoryProperties(
|
||||
VkPhysicalDevice physicalDevice,
|
||||
VkPhysicalDeviceMemoryProperties *pProperties);
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
loader_create_device_terminator(VkPhysicalDevice physicalDevice,
|
||||
const VkDeviceCreateInfo *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
VkDevice *pDevice);
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
loader_CreateDevice(VkPhysicalDevice gpu, const VkDeviceCreateInfo *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator, VkDevice *pDevice);
|
||||
|
||||
/* helper function definitions */
|
||||
void loader_initialize(void);
|
||||
void 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);
|
||||
@@ -483,42 +433,73 @@ VkResult loader_add_to_ext_list(const struct loader_instance *inst,
|
||||
struct loader_extension_list *ext_list,
|
||||
uint32_t prop_list_count,
|
||||
const VkExtensionProperties *props);
|
||||
VkResult
|
||||
loader_add_to_dev_ext_list(const struct loader_instance *inst,
|
||||
struct loader_device_extension_list *ext_list,
|
||||
const VkExtensionProperties *props,
|
||||
uint32_t entry_count, char **entrys);
|
||||
VkResult loader_add_device_extensions(const struct loader_instance *inst,
|
||||
PFN_vkEnumerateDeviceExtensionProperties
|
||||
fpEnumerateDeviceExtensionProperties,
|
||||
VkPhysicalDevice physical_device,
|
||||
const char *lib_name,
|
||||
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);
|
||||
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_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(
|
||||
const struct loader_instance *inst, const char *key_name,
|
||||
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 ***ppp_layer_names);
|
||||
void loader_unexpand_dev_layer_names(const struct loader_instance *inst,
|
||||
uint32_t layer_count, char **layer_names,
|
||||
char **layer_ptr,
|
||||
const VkDeviceCreateInfo *pCreateInfo);
|
||||
void loader_unexpand_inst_layer_names(const struct loader_instance *inst,
|
||||
uint32_t layer_count, char **layer_names,
|
||||
char **layer_ptr,
|
||||
const VkInstanceCreateInfo *pCreateInfo);
|
||||
uint32_t *layer_count, char const *const **ppp_layer_names);
|
||||
void loader_init_std_validation_props(struct loader_layer_properties *props);
|
||||
void loader_delete_shadow_dev_layer_names(const struct loader_instance *inst,
|
||||
const VkDeviceCreateInfo *orig,
|
||||
VkDeviceCreateInfo *ours);
|
||||
void loader_delete_shadow_inst_layer_names(const struct loader_instance *inst,
|
||||
const VkInstanceCreateInfo *orig,
|
||||
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);
|
||||
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);
|
||||
void loader_layer_scan(const struct loader_instance *inst,
|
||||
struct loader_layer_list *instance_layers,
|
||||
struct loader_layer_list *device_layers);
|
||||
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,
|
||||
struct loader_extension_list *inst_exts);
|
||||
struct loader_icd *loader_get_icd_and_device(const VkDevice device,
|
||||
struct loader_device **found_dev);
|
||||
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);
|
||||
struct loader_instance *loader_get_instance(const VkInstance instance);
|
||||
void loader_deactivate_layers(const struct loader_instance *instance,
|
||||
struct loader_layer_list *list);
|
||||
struct loader_device *
|
||||
loader_create_logical_device(const struct loader_instance *inst);
|
||||
void loader_add_logical_device(const struct loader_instance *inst,
|
||||
struct loader_icd *icd,
|
||||
struct loader_device *found_dev);
|
||||
void loader_remove_logical_device(const struct loader_instance *inst,
|
||||
struct loader_icd *icd,
|
||||
struct loader_device *found_dev);
|
||||
@@ -535,15 +516,87 @@ VkResult loader_create_instance_chain(const VkInstanceCreateInfo *pCreateInfo,
|
||||
|
||||
void loader_activate_instance_layer_extensions(struct loader_instance *inst,
|
||||
VkInstance created_inst);
|
||||
VkResult
|
||||
loader_enable_device_layers(const struct loader_instance *inst,
|
||||
struct loader_layer_list *activated_layer_list,
|
||||
const VkDeviceCreateInfo *pCreateInfo,
|
||||
const struct loader_layer_list *device_layers);
|
||||
|
||||
void *loader_heap_alloc(const struct loader_instance *instance, size_t size,
|
||||
VkSystemAllocationScope allocationScope);
|
||||
VkResult
|
||||
loader_create_device_chain(const struct loader_physical_device_tramp *pd,
|
||||
const VkDeviceCreateInfo *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
const struct loader_instance *inst,
|
||||
struct loader_device *dev);
|
||||
VkResult loader_validate_device_extensions(
|
||||
struct loader_physical_device_tramp *phys_dev,
|
||||
const struct loader_layer_list *activated_device_layers,
|
||||
const struct loader_extension_list *icd_exts,
|
||||
const VkDeviceCreateInfo *pCreateInfo);
|
||||
|
||||
void loader_heap_free(const struct loader_instance *instance, void *pMemory);
|
||||
/* instance layer chain termination entrypoint definitions */
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
terminator_CreateInstance(const VkInstanceCreateInfo *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
VkInstance *pInstance);
|
||||
|
||||
void *loader_tls_heap_alloc(size_t size);
|
||||
VKAPI_ATTR void VKAPI_CALL
|
||||
terminator_DestroyInstance(VkInstance instance,
|
||||
const VkAllocationCallbacks *pAllocator);
|
||||
|
||||
void loader_tls_heap_free(void *pMemory);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
terminator_EnumeratePhysicalDevices(VkInstance instance,
|
||||
uint32_t *pPhysicalDeviceCount,
|
||||
VkPhysicalDevice *pPhysicalDevices);
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL
|
||||
terminator_GetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice,
|
||||
VkPhysicalDeviceFeatures *pFeatures);
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL
|
||||
terminator_GetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice,
|
||||
VkFormat format,
|
||||
VkFormatProperties *pFormatInfo);
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
terminator_GetPhysicalDeviceImageFormatProperties(
|
||||
VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type,
|
||||
VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags,
|
||||
VkImageFormatProperties *pImageFormatProperties);
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL
|
||||
terminator_GetPhysicalDeviceSparseImageFormatProperties(
|
||||
VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type,
|
||||
VkSampleCountFlagBits samples, VkImageUsageFlags usage,
|
||||
VkImageTiling tiling, uint32_t *pNumProperties,
|
||||
VkSparseImageFormatProperties *pProperties);
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL
|
||||
terminator_GetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice,
|
||||
VkPhysicalDeviceProperties *pProperties);
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL terminator_EnumerateDeviceExtensionProperties(
|
||||
VkPhysicalDevice physicalDevice, const char *pLayerName, uint32_t *pCount,
|
||||
VkExtensionProperties *pProperties);
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
terminator_EnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice,
|
||||
uint32_t *pCount,
|
||||
VkLayerProperties *pProperties);
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceQueueFamilyProperties(
|
||||
VkPhysicalDevice physicalDevice, uint32_t *pCount,
|
||||
VkQueueFamilyProperties *pProperties);
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL terminator_GetPhysicalDeviceMemoryProperties(
|
||||
VkPhysicalDevice physicalDevice,
|
||||
VkPhysicalDeviceMemoryProperties *pProperties);
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
terminator_CreateDevice(VkPhysicalDevice gpu,
|
||||
const VkDeviceCreateInfo *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
VkDevice *pDevice);
|
||||
|
||||
VkStringErrorFlags vk_string_validate(const int max_length,
|
||||
const char *char_array);
|
||||
|
||||
67
third_party/vulkan/loader/table_ops.h
vendored
67
third_party/vulkan/loader/table_ops.h
vendored
@@ -5,24 +5,17 @@
|
||||
* Copyright (c) 2015-2016 LunarG, Inc.
|
||||
* Copyright (C) 2016 Google Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and/or associated documentation files (the "Materials"), to
|
||||
* deal in the Materials without restriction, including without limitation the
|
||||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
* sell copies of the Materials, and to permit persons to whom the Materials are
|
||||
* furnished to do so, subject to the following conditions:
|
||||
* 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
|
||||
*
|
||||
* The above copyright notice(s) and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Materials.
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
*
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE
|
||||
* USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* Author: Courtney Goeltzenleuchter <courtney@lunarg.com>
|
||||
* Author: Jon Ashburn <jon@lunarg.com>
|
||||
@@ -626,14 +619,36 @@ static inline void loader_init_instance_extension_dispatch_table(
|
||||
(PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR)gpa(
|
||||
inst, "vkGetPhysicalDeviceXlibPresentationSupportKHR");
|
||||
#endif
|
||||
table->GetPhysicalDeviceDisplayPropertiesKHR =
|
||||
(PFN_vkGetPhysicalDeviceDisplayPropertiesKHR)gpa(
|
||||
inst, "vkGetPhysicalDeviceDisplayPropertiesKHR");
|
||||
table->GetPhysicalDeviceDisplayPlanePropertiesKHR =
|
||||
(PFN_vkGetPhysicalDeviceDisplayPlanePropertiesKHR)gpa(
|
||||
inst, "vkGetPhysicalDeviceDisplayPlanePropertiesKHR");
|
||||
table->GetDisplayPlaneSupportedDisplaysKHR =
|
||||
(PFN_vkGetDisplayPlaneSupportedDisplaysKHR)gpa(
|
||||
inst, "vkGetDisplayPlaneSupportedDisplaysKHR");
|
||||
table->GetDisplayModePropertiesKHR = (PFN_vkGetDisplayModePropertiesKHR)gpa(
|
||||
inst, "vkGetDisplayModePropertiesKHR");
|
||||
table->CreateDisplayModeKHR =
|
||||
(PFN_vkCreateDisplayModeKHR)gpa(inst, "vkCreateDisplayModeKHR");
|
||||
table->GetDisplayPlaneCapabilitiesKHR =
|
||||
(PFN_vkGetDisplayPlaneCapabilitiesKHR)gpa(
|
||||
inst, "vkGetDisplayPlaneCapabilitiesKHR");
|
||||
table->CreateDisplayPlaneSurfaceKHR =
|
||||
(PFN_vkCreateDisplayPlaneSurfaceKHR)gpa(
|
||||
inst, "vkCreateDisplayPlaneSurfaceKHR");
|
||||
}
|
||||
|
||||
static inline void *
|
||||
loader_lookup_instance_dispatch_table(const VkLayerInstanceDispatchTable *table,
|
||||
const char *name) {
|
||||
if (!name || name[0] != 'v' || name[1] != 'k')
|
||||
const char *name, bool *found_name) {
|
||||
if (!name || name[0] != 'v' || name[1] != 'k') {
|
||||
*found_name = false;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
*found_name = true;
|
||||
name += 2;
|
||||
if (!strcmp(name, "DestroyInstance"))
|
||||
return (void *)table->DestroyInstance;
|
||||
@@ -699,6 +714,21 @@ loader_lookup_instance_dispatch_table(const VkLayerInstanceDispatchTable *table,
|
||||
if (!strcmp(name, "GetPhysicalDeviceXlibPresentationSupportKHR"))
|
||||
return (void *)table->GetPhysicalDeviceXlibPresentationSupportKHR;
|
||||
#endif
|
||||
if (!strcmp(name, "GetPhysicalDeviceDisplayPropertiesKHR"))
|
||||
return (void *)table->GetPhysicalDeviceDisplayPropertiesKHR;
|
||||
if (!strcmp(name, "GetPhysicalDeviceDisplayPlanePropertiesKHR"))
|
||||
return (void *)table->GetPhysicalDeviceDisplayPlanePropertiesKHR;
|
||||
if (!strcmp(name, "GetDisplayPlaneSupportedDisplaysKHR"))
|
||||
return (void *)table->GetDisplayPlaneSupportedDisplaysKHR;
|
||||
if (!strcmp(name, "GetDisplayModePropertiesKHR"))
|
||||
return (void *)table->GetDisplayModePropertiesKHR;
|
||||
if (!strcmp(name, "CreateDisplayModeKHR"))
|
||||
return (void *)table->CreateDisplayModeKHR;
|
||||
if (!strcmp(name, "GetDisplayPlaneCapabilitiesKHR"))
|
||||
return (void *)table->GetDisplayPlaneCapabilitiesKHR;
|
||||
if (!strcmp(name, "CreateDisplayPlaneSurfaceKHR"))
|
||||
return (void *)table->CreateDisplayPlaneSurfaceKHR;
|
||||
|
||||
if (!strcmp(name, "CreateDebugReportCallbackEXT"))
|
||||
return (void *)table->CreateDebugReportCallbackEXT;
|
||||
if (!strcmp(name, "DestroyDebugReportCallbackEXT"))
|
||||
@@ -706,5 +736,6 @@ loader_lookup_instance_dispatch_table(const VkLayerInstanceDispatchTable *table,
|
||||
if (!strcmp(name, "DebugReportMessageEXT"))
|
||||
return (void *)table->DebugReportMessageEXT;
|
||||
|
||||
*found_name = false;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
755
third_party/vulkan/loader/trampoline.c
vendored
755
third_party/vulkan/loader/trampoline.c
vendored
@@ -5,24 +5,17 @@
|
||||
* Copyright (c) 2015-2016 LunarG, Inc.
|
||||
* Copyright (C) 2015 Google Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and/or associated documentation files (the "Materials"), to
|
||||
* deal in the Materials without restriction, including without limitation the
|
||||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
* sell copies of the Materials, and to permit persons to whom the Materials are
|
||||
* furnished to do so, subject to the following conditions:
|
||||
* 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
|
||||
*
|
||||
* The above copyright notice(s) and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Materials.
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
*
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE
|
||||
* USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* Author: Courtney Goeltzenleuchter <courtney@lunarg.com>
|
||||
* Author: Jon Ashburn <jon@lunarg.com>
|
||||
@@ -37,8 +30,236 @@
|
||||
#include "loader.h"
|
||||
#include "debug_report.h"
|
||||
#include "wsi.h"
|
||||
#include "gpa_helper.h"
|
||||
#include "table_ops.h"
|
||||
|
||||
/* Trampoline entrypoints are in this file for core Vulkan commands */
|
||||
/**
|
||||
* Get an instance level or global level entry point address.
|
||||
* @param instance
|
||||
* @param pName
|
||||
* @return
|
||||
* If instance == NULL returns a global level functions only
|
||||
* If instance is valid returns a trampoline entry point for all dispatchable
|
||||
* Vulkan
|
||||
* functions both core and extensions.
|
||||
*/
|
||||
LOADER_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL
|
||||
vkGetInstanceProcAddr(VkInstance instance, const char *pName) {
|
||||
|
||||
void *addr;
|
||||
|
||||
addr = globalGetProcAddr(pName);
|
||||
if (instance == VK_NULL_HANDLE) {
|
||||
// get entrypoint addresses that are global (no dispatchable object)
|
||||
|
||||
return addr;
|
||||
} else {
|
||||
// if a global entrypoint return NULL
|
||||
if (addr)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct loader_instance *ptr_instance = loader_get_instance(instance);
|
||||
if (ptr_instance == NULL)
|
||||
return NULL;
|
||||
// Return trampoline code for non-global entrypoints including any
|
||||
// extensions.
|
||||
// Device extensions are returned if a layer or ICD supports the extension.
|
||||
// Instance extensions are returned if the extension is enabled and the
|
||||
// loader
|
||||
// or someone else supports the extension
|
||||
return trampolineGetProcAddr(ptr_instance, pName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a device level or global level entry point address.
|
||||
* @param device
|
||||
* @param pName
|
||||
* @return
|
||||
* If device is valid, returns a device relative entry point for device level
|
||||
* entry points both core and extensions.
|
||||
* Device relative means call down the device chain.
|
||||
*/
|
||||
LOADER_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL
|
||||
vkGetDeviceProcAddr(VkDevice device, const char *pName) {
|
||||
void *addr;
|
||||
|
||||
/* for entrypoints that loader must handle (ie non-dispatchable or create
|
||||
object)
|
||||
make sure the loader entrypoint is returned */
|
||||
addr = loader_non_passthrough_gdpa(pName);
|
||||
if (addr) {
|
||||
return addr;
|
||||
}
|
||||
|
||||
/* Although CreateDevice is on device chain it's dispatchable object isn't
|
||||
* a VkDevice or child of VkDevice so return NULL.
|
||||
*/
|
||||
if (!strcmp(pName, "CreateDevice"))
|
||||
return NULL;
|
||||
|
||||
/* return the dispatch table entrypoint for the fastest case */
|
||||
const VkLayerDispatchTable *disp_table = *(VkLayerDispatchTable **)device;
|
||||
if (disp_table == NULL)
|
||||
return NULL;
|
||||
|
||||
addr = loader_lookup_device_dispatch_table(disp_table, pName);
|
||||
if (addr)
|
||||
return addr;
|
||||
|
||||
if (disp_table->GetDeviceProcAddr == NULL)
|
||||
return NULL;
|
||||
return disp_table->GetDeviceProcAddr(device, pName);
|
||||
}
|
||||
|
||||
LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
|
||||
vkEnumerateInstanceExtensionProperties(const char *pLayerName,
|
||||
uint32_t *pPropertyCount,
|
||||
VkExtensionProperties *pProperties) {
|
||||
struct loader_extension_list *global_ext_list = NULL;
|
||||
struct loader_layer_list instance_layers;
|
||||
struct loader_extension_list local_ext_list;
|
||||
struct loader_icd_libs icd_libs;
|
||||
uint32_t copy_size;
|
||||
|
||||
tls_instance = NULL;
|
||||
memset(&local_ext_list, 0, sizeof(local_ext_list));
|
||||
memset(&instance_layers, 0, sizeof(instance_layers));
|
||||
loader_platform_thread_once(&once_init, loader_initialize);
|
||||
|
||||
/* get layer libraries if needed */
|
||||
if (pLayerName && strlen(pLayerName) != 0) {
|
||||
if (vk_string_validate(MaxLoaderStringLength, pLayerName) !=
|
||||
VK_STRING_ERROR_NONE) {
|
||||
assert(VK_FALSE && "vkEnumerateInstanceExtensionProperties: "
|
||||
"pLayerName is too long or is badly formed");
|
||||
return VK_ERROR_EXTENSION_NOT_PRESENT;
|
||||
}
|
||||
|
||||
loader_layer_scan(NULL, &instance_layers);
|
||||
if (strcmp(pLayerName, std_validation_str) == 0) {
|
||||
struct loader_layer_list local_list;
|
||||
memset(&local_list, 0, sizeof(local_list));
|
||||
for (uint32_t i = 0; i < sizeof(std_validation_names) /
|
||||
sizeof(std_validation_names[0]);
|
||||
i++) {
|
||||
loader_find_layer_name_add_list(NULL, std_validation_names[i],
|
||||
VK_LAYER_TYPE_INSTANCE_EXPLICIT,
|
||||
&instance_layers, &local_list);
|
||||
}
|
||||
for (uint32_t i = 0; i < local_list.count; i++) {
|
||||
struct loader_extension_list *ext_list =
|
||||
&local_list.list[i].instance_extension_list;
|
||||
loader_add_to_ext_list(NULL, &local_ext_list, ext_list->count,
|
||||
ext_list->list);
|
||||
}
|
||||
loader_destroy_layer_list(NULL, &local_list);
|
||||
global_ext_list = &local_ext_list;
|
||||
|
||||
} else {
|
||||
for (uint32_t i = 0; i < instance_layers.count; i++) {
|
||||
struct loader_layer_properties *props =
|
||||
&instance_layers.list[i];
|
||||
if (strcmp(props->info.layerName, pLayerName) == 0) {
|
||||
global_ext_list = &props->instance_extension_list;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* Scan/discover all ICD libraries */
|
||||
memset(&icd_libs, 0, sizeof(struct loader_icd_libs));
|
||||
loader_icd_scan(NULL, &icd_libs);
|
||||
/* 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);
|
||||
|
||||
// Append implicit layers.
|
||||
loader_implicit_layer_scan(NULL, &instance_layers);
|
||||
for (uint32_t i = 0; i < instance_layers.count; i++) {
|
||||
struct loader_extension_list *ext_list =
|
||||
&instance_layers.list[i].instance_extension_list;
|
||||
loader_add_to_ext_list(NULL, &local_ext_list, ext_list->count,
|
||||
ext_list->list);
|
||||
}
|
||||
|
||||
global_ext_list = &local_ext_list;
|
||||
}
|
||||
|
||||
if (global_ext_list == NULL) {
|
||||
loader_destroy_layer_list(NULL, &instance_layers);
|
||||
return VK_ERROR_LAYER_NOT_PRESENT;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
copy_size = *pPropertyCount < global_ext_list->count
|
||||
? *pPropertyCount
|
||||
: global_ext_list->count;
|
||||
for (uint32_t i = 0; i < copy_size; i++) {
|
||||
memcpy(&pProperties[i], &global_ext_list->list[i],
|
||||
sizeof(VkExtensionProperties));
|
||||
}
|
||||
*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;
|
||||
}
|
||||
|
||||
loader_destroy_layer_list(NULL, &instance_layers);
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
|
||||
vkEnumerateInstanceLayerProperties(uint32_t *pPropertyCount,
|
||||
VkLayerProperties *pProperties) {
|
||||
|
||||
struct loader_layer_list instance_layer_list;
|
||||
tls_instance = NULL;
|
||||
|
||||
loader_platform_thread_once(&once_init, loader_initialize);
|
||||
|
||||
uint32_t copy_size;
|
||||
|
||||
/* get layer libraries */
|
||||
memset(&instance_layer_list, 0, sizeof(instance_layer_list));
|
||||
loader_layer_scan(NULL, &instance_layer_list);
|
||||
|
||||
if (pProperties == NULL) {
|
||||
*pPropertyCount = instance_layer_list.count;
|
||||
loader_destroy_layer_list(NULL, &instance_layer_list);
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
copy_size = (*pPropertyCount < instance_layer_list.count)
|
||||
? *pPropertyCount
|
||||
: instance_layer_list.count;
|
||||
for (uint32_t i = 0; i < copy_size; i++) {
|
||||
memcpy(&pProperties[i], &instance_layer_list.list[i].info,
|
||||
sizeof(VkLayerProperties));
|
||||
}
|
||||
|
||||
*pPropertyCount = copy_size;
|
||||
loader_destroy_layer_list(NULL, &instance_layer_list);
|
||||
|
||||
if (copy_size < instance_layer_list.count) {
|
||||
return VK_INCOMPLETE;
|
||||
}
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
/* Trampoline entrypoints */
|
||||
LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
|
||||
vkCreateInstance(const VkInstanceCreateInfo *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
@@ -46,11 +267,10 @@ vkCreateInstance(const VkInstanceCreateInfo *pCreateInfo,
|
||||
struct loader_instance *ptr_instance = NULL;
|
||||
VkInstance created_instance = VK_NULL_HANDLE;
|
||||
VkResult res = VK_ERROR_INITIALIZATION_FAILED;
|
||||
VkDebugReportCallbackEXT instance_callback = VK_NULL_HANDLE;
|
||||
void *pNext = (void *)pCreateInfo->pNext;
|
||||
|
||||
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(
|
||||
@@ -77,32 +297,44 @@ vkCreateInstance(const VkInstanceCreateInfo *pCreateInfo,
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Look for a debug report create info structure
|
||||
* and setup a callback if found.
|
||||
* Look for one or more debug report create info structures
|
||||
* and setup a callback(s) for each one found.
|
||||
*/
|
||||
while (pNext) {
|
||||
if (((VkInstanceCreateInfo *)pNext)->sType ==
|
||||
VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT) {
|
||||
instance_callback = (VkDebugReportCallbackEXT)ptr_instance;
|
||||
if (util_CreateDebugReportCallback(ptr_instance, pNext, NULL,
|
||||
instance_callback)) {
|
||||
loader_heap_free(ptr_instance, ptr_instance);
|
||||
loader_platform_thread_unlock_mutex(&loader_lock);
|
||||
return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
}
|
||||
ptr_instance->num_tmp_callbacks = 0;
|
||||
ptr_instance->tmp_dbg_create_infos = NULL;
|
||||
ptr_instance->tmp_callbacks = NULL;
|
||||
if (util_CopyDebugReportCreateInfos(pCreateInfo->pNext, pAllocator,
|
||||
&ptr_instance->num_tmp_callbacks,
|
||||
&ptr_instance->tmp_dbg_create_infos,
|
||||
&ptr_instance->tmp_callbacks)) {
|
||||
// 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;
|
||||
} else if (ptr_instance->num_tmp_callbacks > 0) {
|
||||
// Setup the temporary callback(s) here to catch early issues:
|
||||
if (util_CreateDebugReportCallbacks(ptr_instance, pAllocator,
|
||||
ptr_instance->num_tmp_callbacks,
|
||||
ptr_instance->tmp_dbg_create_infos,
|
||||
ptr_instance->tmp_callbacks)) {
|
||||
// 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;
|
||||
}
|
||||
pNext = (void *)((VkInstanceCreateInfo *)pNext)->pNext;
|
||||
}
|
||||
|
||||
/* Due to implicit layers need to get layer list even if
|
||||
* enabledLayerCount == 0 and VK_INSTANCE_LAYERS is unset. For now always
|
||||
* get layer list (both instance and device) via loader_layer_scan(). */
|
||||
* get layer list via loader_layer_scan(). */
|
||||
memset(&ptr_instance->instance_layer_list, 0,
|
||||
sizeof(ptr_instance->instance_layer_list));
|
||||
memset(&ptr_instance->device_layer_list, 0,
|
||||
sizeof(ptr_instance->device_layer_list));
|
||||
loader_layer_scan(ptr_instance, &ptr_instance->instance_layer_list,
|
||||
&ptr_instance->device_layer_list);
|
||||
loader_layer_scan(ptr_instance, &ptr_instance->instance_layer_list);
|
||||
|
||||
/* validate the app requested layers to be enabled */
|
||||
if (pCreateInfo->enabledLayerCount > 0) {
|
||||
@@ -111,8 +343,12 @@ vkCreateInstance(const VkInstanceCreateInfo *pCreateInfo,
|
||||
pCreateInfo->ppEnabledLayerNames,
|
||||
&ptr_instance->instance_layer_list);
|
||||
if (res != VK_SUCCESS) {
|
||||
util_DestroyDebugReportCallback(ptr_instance, instance_callback,
|
||||
NULL);
|
||||
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;
|
||||
@@ -120,21 +356,11 @@ vkCreateInstance(const VkInstanceCreateInfo *pCreateInfo,
|
||||
}
|
||||
|
||||
/* convert any meta layers to the actual layers makes a copy of layer name*/
|
||||
uint32_t saved_layer_count = pCreateInfo->enabledLayerCount;
|
||||
char **saved_layer_names;
|
||||
char **saved_layer_ptr;
|
||||
saved_layer_names =
|
||||
loader_stack_alloc(sizeof(char *) * pCreateInfo->enabledLayerCount);
|
||||
for (uint32_t i = 0; i < saved_layer_count; i++) {
|
||||
saved_layer_names[i] = (char *)pCreateInfo->ppEnabledLayerNames[i];
|
||||
}
|
||||
saved_layer_ptr = (char **)pCreateInfo->ppEnabledLayerNames;
|
||||
|
||||
VkInstanceCreateInfo ici = *pCreateInfo;
|
||||
loader_expand_layer_names(
|
||||
ptr_instance, std_validation_str,
|
||||
sizeof(std_validation_names) / sizeof(std_validation_names[0]),
|
||||
std_validation_names, (uint32_t *)&pCreateInfo->enabledLayerCount,
|
||||
(char ***)&pCreateInfo->ppEnabledLayerNames);
|
||||
std_validation_names, &ici.enabledLayerCount, &ici.ppEnabledLayerNames);
|
||||
|
||||
/* Scan/discover all ICD libraries */
|
||||
memset(&ptr_instance->icd_libs, 0, sizeof(ptr_instance->icd_libs));
|
||||
@@ -145,20 +371,21 @@ vkCreateInstance(const VkInstanceCreateInfo *pCreateInfo,
|
||||
ptr_instance, &ptr_instance->icd_libs, &ptr_instance->ext_list);
|
||||
res = loader_validate_instance_extensions(
|
||||
ptr_instance, &ptr_instance->ext_list,
|
||||
&ptr_instance->instance_layer_list, pCreateInfo);
|
||||
&ptr_instance->instance_layer_list, &ici);
|
||||
if (res != VK_SUCCESS) {
|
||||
loader_unexpand_inst_layer_names(ptr_instance, saved_layer_count,
|
||||
saved_layer_names, saved_layer_ptr,
|
||||
pCreateInfo);
|
||||
loader_delete_layer_properties(ptr_instance,
|
||||
&ptr_instance->device_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_libs);
|
||||
loader_destroy_generic_list(
|
||||
ptr_instance,
|
||||
(struct loader_generic_list *)&ptr_instance->ext_list);
|
||||
util_DestroyDebugReportCallback(ptr_instance, instance_callback, NULL);
|
||||
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;
|
||||
@@ -168,18 +395,20 @@ vkCreateInstance(const VkInstanceCreateInfo *pCreateInfo,
|
||||
loader_heap_alloc(ptr_instance, sizeof(VkLayerInstanceDispatchTable),
|
||||
VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
|
||||
if (ptr_instance->disp == NULL) {
|
||||
loader_unexpand_inst_layer_names(ptr_instance, saved_layer_count,
|
||||
saved_layer_names, saved_layer_ptr,
|
||||
pCreateInfo);
|
||||
loader_delete_layer_properties(ptr_instance,
|
||||
&ptr_instance->device_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_libs);
|
||||
loader_destroy_generic_list(
|
||||
ptr_instance,
|
||||
(struct loader_generic_list *)&ptr_instance->ext_list);
|
||||
util_DestroyDebugReportCallback(ptr_instance, instance_callback, NULL);
|
||||
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;
|
||||
@@ -189,14 +418,10 @@ vkCreateInstance(const VkInstanceCreateInfo *pCreateInfo,
|
||||
loader.instances = ptr_instance;
|
||||
|
||||
/* activate any layers on instance chain */
|
||||
res = loader_enable_instance_layers(ptr_instance, pCreateInfo,
|
||||
res = loader_enable_instance_layers(ptr_instance, &ici,
|
||||
&ptr_instance->instance_layer_list);
|
||||
if (res != VK_SUCCESS) {
|
||||
loader_unexpand_inst_layer_names(ptr_instance, saved_layer_count,
|
||||
saved_layer_names, saved_layer_ptr,
|
||||
pCreateInfo);
|
||||
loader_delete_layer_properties(ptr_instance,
|
||||
&ptr_instance->device_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_libs);
|
||||
@@ -204,7 +429,12 @@ vkCreateInstance(const VkInstanceCreateInfo *pCreateInfo,
|
||||
ptr_instance,
|
||||
(struct loader_generic_list *)&ptr_instance->ext_list);
|
||||
loader.instances = ptr_instance->next;
|
||||
util_DestroyDebugReportCallback(ptr_instance, instance_callback, NULL);
|
||||
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);
|
||||
@@ -212,12 +442,12 @@ vkCreateInstance(const VkInstanceCreateInfo *pCreateInfo,
|
||||
}
|
||||
|
||||
created_instance = (VkInstance)ptr_instance;
|
||||
res = loader_create_instance_chain(pCreateInfo, pAllocator, ptr_instance,
|
||||
res = loader_create_instance_chain(&ici, pAllocator, ptr_instance,
|
||||
&created_instance);
|
||||
|
||||
if (res == VK_SUCCESS) {
|
||||
wsi_create_instance(ptr_instance, pCreateInfo);
|
||||
debug_report_create_instance(ptr_instance, pCreateInfo);
|
||||
wsi_create_instance(ptr_instance, &ici);
|
||||
debug_report_create_instance(ptr_instance, &ici);
|
||||
|
||||
*pInstance = created_instance;
|
||||
|
||||
@@ -233,10 +463,10 @@ vkCreateInstance(const VkInstanceCreateInfo *pCreateInfo,
|
||||
}
|
||||
|
||||
/* Remove temporary debug_report callback */
|
||||
util_DestroyDebugReportCallback(ptr_instance, instance_callback, NULL);
|
||||
loader_unexpand_inst_layer_names(ptr_instance, saved_layer_count,
|
||||
saved_layer_names, saved_layer_ptr,
|
||||
pCreateInfo);
|
||||
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);
|
||||
return res;
|
||||
}
|
||||
@@ -246,16 +476,41 @@ vkDestroyInstance(VkInstance instance,
|
||||
const VkAllocationCallbacks *pAllocator) {
|
||||
const VkLayerInstanceDispatchTable *disp;
|
||||
struct loader_instance *ptr_instance = NULL;
|
||||
bool callback_setup = false;
|
||||
|
||||
if (instance == VK_NULL_HANDLE) {
|
||||
return;
|
||||
}
|
||||
|
||||
disp = loader_get_instance_dispatch(instance);
|
||||
|
||||
loader_platform_thread_lock_mutex(&loader_lock);
|
||||
|
||||
/* TODO: Do we need a temporary callback here to catch cleanup issues? */
|
||||
|
||||
ptr_instance = loader_get_instance(instance);
|
||||
|
||||
if (ptr_instance->num_tmp_callbacks > 0) {
|
||||
// Setup the temporary callback(s) here to catch cleanup issues:
|
||||
if (!util_CreateDebugReportCallbacks(ptr_instance, pAllocator,
|
||||
ptr_instance->num_tmp_callbacks,
|
||||
ptr_instance->tmp_dbg_create_infos,
|
||||
ptr_instance->tmp_callbacks)) {
|
||||
callback_setup = true;
|
||||
}
|
||||
}
|
||||
|
||||
disp->DestroyInstance(instance, pAllocator);
|
||||
|
||||
loader_deactivate_instance_layers(ptr_instance);
|
||||
loader_deactivate_layers(ptr_instance, &ptr_instance->activated_layer_list);
|
||||
if (ptr_instance->phys_devs)
|
||||
loader_heap_free(ptr_instance, ptr_instance->phys_devs);
|
||||
if (callback_setup) {
|
||||
util_DestroyDebugReportCallbacks(ptr_instance, pAllocator,
|
||||
ptr_instance->num_tmp_callbacks,
|
||||
ptr_instance->tmp_callbacks);
|
||||
util_FreeDebugReportCreateInfos(pAllocator,
|
||||
ptr_instance->tmp_dbg_create_infos,
|
||||
ptr_instance->tmp_callbacks);
|
||||
}
|
||||
loader_heap_free(ptr_instance, ptr_instance->disp);
|
||||
loader_heap_free(ptr_instance, ptr_instance);
|
||||
loader_platform_thread_unlock_mutex(&loader_lock);
|
||||
@@ -266,31 +521,79 @@ vkEnumeratePhysicalDevices(VkInstance instance, uint32_t *pPhysicalDeviceCount,
|
||||
VkPhysicalDevice *pPhysicalDevices) {
|
||||
const VkLayerInstanceDispatchTable *disp;
|
||||
VkResult res;
|
||||
uint32_t count, i;
|
||||
struct loader_instance *inst;
|
||||
disp = loader_get_instance_dispatch(instance);
|
||||
|
||||
loader_platform_thread_lock_mutex(&loader_lock);
|
||||
res = disp->EnumeratePhysicalDevices(instance, pPhysicalDeviceCount,
|
||||
pPhysicalDevices);
|
||||
|
||||
if (res != VK_SUCCESS && res != VK_INCOMPLETE) {
|
||||
loader_platform_thread_unlock_mutex(&loader_lock);
|
||||
return res;
|
||||
}
|
||||
|
||||
if (!pPhysicalDevices) {
|
||||
loader_platform_thread_unlock_mutex(&loader_lock);
|
||||
return res;
|
||||
}
|
||||
|
||||
// wrap the PhysDev object for loader usage, return wrapped objects
|
||||
inst = loader_get_instance(instance);
|
||||
if (!inst) {
|
||||
loader_platform_thread_unlock_mutex(&loader_lock);
|
||||
return VK_ERROR_INITIALIZATION_FAILED;
|
||||
}
|
||||
count = (inst->total_gpu_count < *pPhysicalDeviceCount)
|
||||
? inst->total_gpu_count
|
||||
: *pPhysicalDeviceCount;
|
||||
*pPhysicalDeviceCount = count;
|
||||
if (!inst->phys_devs) {
|
||||
inst->phys_devs =
|
||||
(struct loader_physical_device_tramp *)loader_heap_alloc(
|
||||
inst, inst->total_gpu_count *
|
||||
sizeof(struct loader_physical_device_tramp),
|
||||
VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
|
||||
}
|
||||
if (!inst->phys_devs) {
|
||||
loader_platform_thread_unlock_mutex(&loader_lock);
|
||||
return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
}
|
||||
|
||||
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];
|
||||
|
||||
// copy wrapped object into Application provided array
|
||||
pPhysicalDevices[i] = (VkPhysicalDevice)&inst->phys_devs[i];
|
||||
}
|
||||
loader_platform_thread_unlock_mutex(&loader_lock);
|
||||
return res;
|
||||
}
|
||||
|
||||
LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
|
||||
vkGetPhysicalDeviceFeatures(VkPhysicalDevice gpu,
|
||||
vkGetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice,
|
||||
VkPhysicalDeviceFeatures *pFeatures) {
|
||||
const VkLayerInstanceDispatchTable *disp;
|
||||
|
||||
disp = loader_get_instance_dispatch(gpu);
|
||||
disp->GetPhysicalDeviceFeatures(gpu, pFeatures);
|
||||
VkPhysicalDevice unwrapped_phys_dev =
|
||||
loader_unwrap_physical_device(physicalDevice);
|
||||
disp = loader_get_instance_dispatch(physicalDevice);
|
||||
disp->GetPhysicalDeviceFeatures(unwrapped_phys_dev, pFeatures);
|
||||
}
|
||||
|
||||
LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
|
||||
vkGetPhysicalDeviceFormatProperties(VkPhysicalDevice gpu, VkFormat format,
|
||||
vkGetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice,
|
||||
VkFormat format,
|
||||
VkFormatProperties *pFormatInfo) {
|
||||
const VkLayerInstanceDispatchTable *disp;
|
||||
|
||||
disp = loader_get_instance_dispatch(gpu);
|
||||
disp->GetPhysicalDeviceFormatProperties(gpu, format, pFormatInfo);
|
||||
VkPhysicalDevice unwrapped_pd =
|
||||
loader_unwrap_physical_device(physicalDevice);
|
||||
disp = loader_get_instance_dispatch(physicalDevice);
|
||||
disp->GetPhysicalDeviceFormatProperties(unwrapped_pd, format, pFormatInfo);
|
||||
}
|
||||
|
||||
LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
|
||||
@@ -299,49 +602,124 @@ vkGetPhysicalDeviceImageFormatProperties(
|
||||
VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags,
|
||||
VkImageFormatProperties *pImageFormatProperties) {
|
||||
const VkLayerInstanceDispatchTable *disp;
|
||||
|
||||
VkPhysicalDevice unwrapped_phys_dev =
|
||||
loader_unwrap_physical_device(physicalDevice);
|
||||
disp = loader_get_instance_dispatch(physicalDevice);
|
||||
return disp->GetPhysicalDeviceImageFormatProperties(
|
||||
physicalDevice, format, type, tiling, usage, flags,
|
||||
unwrapped_phys_dev, format, type, tiling, usage, flags,
|
||||
pImageFormatProperties);
|
||||
}
|
||||
|
||||
LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
|
||||
vkGetPhysicalDeviceProperties(VkPhysicalDevice gpu,
|
||||
vkGetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice,
|
||||
VkPhysicalDeviceProperties *pProperties) {
|
||||
const VkLayerInstanceDispatchTable *disp;
|
||||
|
||||
disp = loader_get_instance_dispatch(gpu);
|
||||
disp->GetPhysicalDeviceProperties(gpu, pProperties);
|
||||
VkPhysicalDevice unwrapped_phys_dev =
|
||||
loader_unwrap_physical_device(physicalDevice);
|
||||
disp = loader_get_instance_dispatch(physicalDevice);
|
||||
disp->GetPhysicalDeviceProperties(unwrapped_phys_dev, pProperties);
|
||||
}
|
||||
|
||||
LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
|
||||
vkGetPhysicalDeviceQueueFamilyProperties(
|
||||
VkPhysicalDevice gpu, uint32_t *pQueueFamilyPropertyCount,
|
||||
VkPhysicalDevice physicalDevice, uint32_t *pQueueFamilyPropertyCount,
|
||||
VkQueueFamilyProperties *pQueueProperties) {
|
||||
const VkLayerInstanceDispatchTable *disp;
|
||||
|
||||
disp = loader_get_instance_dispatch(gpu);
|
||||
disp->GetPhysicalDeviceQueueFamilyProperties(gpu, pQueueFamilyPropertyCount,
|
||||
pQueueProperties);
|
||||
VkPhysicalDevice unwrapped_phys_dev =
|
||||
loader_unwrap_physical_device(physicalDevice);
|
||||
disp = loader_get_instance_dispatch(physicalDevice);
|
||||
disp->GetPhysicalDeviceQueueFamilyProperties(
|
||||
unwrapped_phys_dev, pQueueFamilyPropertyCount, pQueueProperties);
|
||||
}
|
||||
|
||||
LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceMemoryProperties(
|
||||
VkPhysicalDevice gpu, VkPhysicalDeviceMemoryProperties *pMemoryProperties) {
|
||||
VkPhysicalDevice physicalDevice,
|
||||
VkPhysicalDeviceMemoryProperties *pMemoryProperties) {
|
||||
const VkLayerInstanceDispatchTable *disp;
|
||||
|
||||
disp = loader_get_instance_dispatch(gpu);
|
||||
disp->GetPhysicalDeviceMemoryProperties(gpu, pMemoryProperties);
|
||||
VkPhysicalDevice unwrapped_phys_dev =
|
||||
loader_unwrap_physical_device(physicalDevice);
|
||||
disp = loader_get_instance_dispatch(physicalDevice);
|
||||
disp->GetPhysicalDeviceMemoryProperties(unwrapped_phys_dev,
|
||||
pMemoryProperties);
|
||||
}
|
||||
|
||||
LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
|
||||
vkCreateDevice(VkPhysicalDevice gpu, const VkDeviceCreateInfo *pCreateInfo,
|
||||
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;
|
||||
|
||||
assert(pCreateInfo->queueCreateInfoCount >= 1);
|
||||
|
||||
loader_platform_thread_lock_mutex(&loader_lock);
|
||||
|
||||
res = loader_CreateDevice(gpu, pCreateInfo, pAllocator, pDevice);
|
||||
phys_dev = (struct loader_physical_device_tramp *)physicalDevice;
|
||||
inst = (struct loader_instance *)phys_dev->this_instance;
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/* make sure requested extensions to be enabled are supported */
|
||||
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;
|
||||
}
|
||||
|
||||
dev = loader_create_logical_device(inst);
|
||||
if (dev == NULL) {
|
||||
loader_platform_thread_unlock_mutex(&loader_lock);
|
||||
return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
}
|
||||
|
||||
/* 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);
|
||||
if (dev->activated_layer_list.list == NULL) {
|
||||
loader_platform_thread_unlock_mutex(&loader_lock);
|
||||
return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
}
|
||||
memcpy(dev->activated_layer_list.list, inst->activated_layer_list.list,
|
||||
sizeof(*dev->activated_layer_list.list) * dev->activated_layer_list.count);
|
||||
|
||||
|
||||
res = loader_create_device_chain(phys_dev, pCreateInfo, pAllocator, inst, dev);
|
||||
if (res != VK_SUCCESS) {
|
||||
loader_platform_thread_unlock_mutex(&loader_lock);
|
||||
return res;
|
||||
}
|
||||
|
||||
*pDevice = dev->device;
|
||||
|
||||
/* 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*/
|
||||
loader_init_device_extension_dispatch_table(
|
||||
&dev->loader_dispatch,
|
||||
dev->loader_dispatch.core_dispatch.GetDeviceProcAddr, *pDevice);
|
||||
|
||||
loader_platform_thread_unlock_mutex(&loader_lock);
|
||||
return res;
|
||||
@@ -352,6 +730,10 @@ vkDestroyDevice(VkDevice device, const VkAllocationCallbacks *pAllocator) {
|
||||
const VkLayerDispatchTable *disp;
|
||||
struct loader_device *dev;
|
||||
|
||||
if (device == VK_NULL_HANDLE) {
|
||||
return;
|
||||
}
|
||||
|
||||
loader_platform_thread_lock_mutex(&loader_lock);
|
||||
|
||||
struct loader_icd *icd = loader_get_icd_and_device(device, &dev);
|
||||
@@ -370,7 +752,9 @@ vkEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice,
|
||||
const char *pLayerName,
|
||||
uint32_t *pPropertyCount,
|
||||
VkExtensionProperties *pProperties) {
|
||||
VkResult res;
|
||||
VkResult res = VK_SUCCESS;
|
||||
struct loader_physical_device_tramp *phys_dev;
|
||||
phys_dev = (struct loader_physical_device_tramp *)physicalDevice;
|
||||
|
||||
loader_platform_thread_lock_mutex(&loader_lock);
|
||||
|
||||
@@ -383,10 +767,78 @@ vkEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice,
|
||||
|
||||
disp = loader_get_instance_dispatch(physicalDevice);
|
||||
res = disp->EnumerateDeviceExtensionProperties(
|
||||
physicalDevice, NULL, pPropertyCount, pProperties);
|
||||
phys_dev->phys_dev, NULL, pPropertyCount, pProperties);
|
||||
} else {
|
||||
res = loader_EnumerateDeviceExtensionProperties(
|
||||
physicalDevice, pLayerName, pPropertyCount, pProperties);
|
||||
|
||||
uint32_t count;
|
||||
uint32_t copy_size;
|
||||
const struct loader_instance *inst = phys_dev->this_instance;
|
||||
struct loader_device_extension_list *dev_ext_list = NULL;
|
||||
struct loader_device_extension_list local_ext_list;
|
||||
memset(&local_ext_list, 0, sizeof(local_ext_list));
|
||||
if (vk_string_validate(MaxLoaderStringLength, pLayerName) ==
|
||||
VK_STRING_ERROR_NONE) {
|
||||
if (strcmp(pLayerName, std_validation_str) == 0) {
|
||||
struct loader_layer_list local_list;
|
||||
memset(&local_list, 0, sizeof(local_list));
|
||||
for (uint32_t i = 0; i < sizeof(std_validation_names) /
|
||||
sizeof(std_validation_names[0]);
|
||||
i++) {
|
||||
loader_find_layer_name_add_list(
|
||||
NULL, std_validation_names[i],
|
||||
VK_LAYER_TYPE_INSTANCE_EXPLICIT, &inst->instance_layer_list,
|
||||
&local_list);
|
||||
}
|
||||
for (uint32_t i = 0; i < local_list.count; i++) {
|
||||
struct loader_device_extension_list *ext_list =
|
||||
&local_list.list[i].device_extension_list;
|
||||
for (uint32_t j = 0; j < ext_list->count; j++) {
|
||||
loader_add_to_dev_ext_list(NULL, &local_ext_list,
|
||||
&ext_list->list[j].props, 0,
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
dev_ext_list = &local_ext_list;
|
||||
|
||||
} else {
|
||||
for (uint32_t i = 0; i < inst->instance_layer_list.count; i++) {
|
||||
struct loader_layer_properties *props =
|
||||
&inst->instance_layer_list.list[i];
|
||||
if (strcmp(props->info.layerName, pLayerName) == 0) {
|
||||
dev_ext_list = &props->device_extension_list;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
count = (dev_ext_list == NULL) ? 0 : dev_ext_list->count;
|
||||
if (pProperties == NULL) {
|
||||
*pPropertyCount = count;
|
||||
loader_destroy_generic_list(
|
||||
inst, (struct loader_generic_list *)&local_ext_list);
|
||||
loader_platform_thread_unlock_mutex(&loader_lock);
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
copy_size = *pPropertyCount < count ? *pPropertyCount : count;
|
||||
for (uint32_t i = 0; i < copy_size; i++) {
|
||||
memcpy(&pProperties[i], &dev_ext_list->list[i].props,
|
||||
sizeof(VkExtensionProperties));
|
||||
}
|
||||
*pPropertyCount = copy_size;
|
||||
|
||||
loader_destroy_generic_list(
|
||||
inst, (struct loader_generic_list *)&local_ext_list);
|
||||
if (copy_size < count) {
|
||||
loader_platform_thread_unlock_mutex(&loader_lock);
|
||||
return VK_INCOMPLETE;
|
||||
}
|
||||
} else {
|
||||
loader_log(inst, VK_DEBUG_REPORT_ERROR_BIT_EXT, 0,
|
||||
"vkEnumerateDeviceExtensionProperties: pLayerName "
|
||||
"is too long or is badly formed");
|
||||
loader_platform_thread_unlock_mutex(&loader_lock);
|
||||
return VK_ERROR_EXTENSION_NOT_PRESENT;
|
||||
}
|
||||
}
|
||||
|
||||
loader_platform_thread_unlock_mutex(&loader_lock);
|
||||
@@ -397,16 +849,82 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
|
||||
vkEnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice,
|
||||
uint32_t *pPropertyCount,
|
||||
VkLayerProperties *pProperties) {
|
||||
VkResult res;
|
||||
|
||||
uint32_t copy_size;
|
||||
struct loader_physical_device_tramp *phys_dev;
|
||||
struct loader_layer_list *enabled_layers, layers_list;
|
||||
uint32_t std_val_count = sizeof(std_validation_names) /
|
||||
sizeof(std_validation_names[0]);
|
||||
memset(&layers_list, 0, sizeof(layers_list));
|
||||
loader_platform_thread_lock_mutex(&loader_lock);
|
||||
|
||||
/* Don't dispatch this call down the instance chain, want all device layers
|
||||
enumerated and instance chain may not contain all device layers */
|
||||
res = loader_EnumerateDeviceLayerProperties(physicalDevice, pPropertyCount,
|
||||
pProperties);
|
||||
// TODO re-evaluate the above statement we maybe able to start calling
|
||||
// down the chain
|
||||
|
||||
phys_dev = (struct loader_physical_device_tramp *)physicalDevice;
|
||||
const struct loader_instance *inst = phys_dev->this_instance;
|
||||
|
||||
uint32_t count = inst->activated_layer_list.count;
|
||||
if (inst->activated_layers_are_std_val)
|
||||
count = count - std_val_count + 1;
|
||||
if (pProperties == NULL) {
|
||||
*pPropertyCount = count;
|
||||
loader_platform_thread_unlock_mutex(&loader_lock);
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
/* make sure to enumerate standard_validation if that is what was used
|
||||
at the instance layer enablement */
|
||||
if (inst->activated_layers_are_std_val) {
|
||||
enabled_layers = &layers_list;
|
||||
enabled_layers->count = count;
|
||||
enabled_layers->capacity = enabled_layers->count *
|
||||
sizeof(struct loader_layer_properties);
|
||||
enabled_layers->list = loader_heap_alloc(inst, enabled_layers->capacity,
|
||||
VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
|
||||
if (!enabled_layers->list)
|
||||
return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
|
||||
uint32_t j = 0;
|
||||
for (uint32_t i = 0; i < inst->activated_layer_list.count; j++) {
|
||||
|
||||
if (loader_find_layer_name_array(
|
||||
inst->activated_layer_list.list[i].info.layerName,
|
||||
std_val_count, std_validation_names)) {
|
||||
struct loader_layer_properties props;
|
||||
loader_init_std_validation_props(&props);
|
||||
loader_copy_layer_properties(inst,
|
||||
&enabled_layers->list[j], &props);
|
||||
i += std_val_count;
|
||||
}
|
||||
else {
|
||||
loader_copy_layer_properties(inst,
|
||||
&enabled_layers->list[j],
|
||||
&inst->activated_layer_list.list[i++]);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
enabled_layers = (struct loader_layer_list *) &inst->activated_layer_list;
|
||||
}
|
||||
|
||||
|
||||
copy_size = (*pPropertyCount < count) ? *pPropertyCount : count;
|
||||
for (uint32_t i = 0; i < copy_size; i++) {
|
||||
memcpy(&pProperties[i], &(enabled_layers->list[i].info),
|
||||
sizeof(VkLayerProperties));
|
||||
}
|
||||
*pPropertyCount = copy_size;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
loader_platform_thread_unlock_mutex(&loader_lock);
|
||||
return res;
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
|
||||
@@ -577,12 +1095,13 @@ vkGetPhysicalDeviceSparseImageFormatProperties(
|
||||
VkImageTiling tiling, uint32_t *pPropertyCount,
|
||||
VkSparseImageFormatProperties *pProperties) {
|
||||
const VkLayerInstanceDispatchTable *disp;
|
||||
|
||||
VkPhysicalDevice unwrapped_phys_dev =
|
||||
loader_unwrap_physical_device(physicalDevice);
|
||||
disp = loader_get_instance_dispatch(physicalDevice);
|
||||
|
||||
disp->GetPhysicalDeviceSparseImageFormatProperties(
|
||||
physicalDevice, format, type, samples, usage, tiling, pPropertyCount,
|
||||
pProperties);
|
||||
unwrapped_phys_dev, format, type, samples, usage, tiling,
|
||||
pPropertyCount, pProperties);
|
||||
}
|
||||
|
||||
LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
|
||||
|
||||
46
third_party/vulkan/loader/vk_loader_platform.h
vendored
46
third_party/vulkan/loader/vk_loader_platform.h
vendored
@@ -4,24 +4,17 @@
|
||||
* Copyright (c) 2015-2016 Valve Corporation
|
||||
* Copyright (c) 2015-2016 LunarG, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and/or associated documentation files (the "Materials"), to
|
||||
* deal in the Materials without restriction, including without limitation the
|
||||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
* sell copies of the Materials, and to permit persons to whom the Materials are
|
||||
* furnished to do so, subject to the following conditions:
|
||||
* 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
|
||||
*
|
||||
* The above copyright notice(s) and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Materials.
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
*
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE
|
||||
* USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
* 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: Ian Elliot <ian@lunarg.com>
|
||||
* Author: Jon Ashburn <jon@lunarg.com>
|
||||
@@ -107,13 +100,19 @@
|
||||
#define DEFAULT_VK_ELAYERS_INFO \
|
||||
LOCAL_ELAYERS_INFO \
|
||||
"/" SYSCONFDIR VULKAN_ELAYERCONF_DIR ":" \
|
||||
"/usr/" DATADIR VULKAN_ELAYERCONF_DIR ":"
|
||||
"/usr/" DATADIR VULKAN_ELAYERCONF_DIR
|
||||
#define DEFAULT_VK_ILAYERS_INFO \
|
||||
LOCAL_ILAYERS_INFO \
|
||||
"/" SYSCONFDIR VULKAN_ILAYERCONF_DIR ":" \
|
||||
"/usr/" DATADIR VULKAN_ILAYERCONF_DIR
|
||||
#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
|
||||
|
||||
// C99:
|
||||
#define PRINTF_SIZE_T_SPECIFIER "%zu"
|
||||
@@ -251,12 +250,19 @@ using namespace std;
|
||||
#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_PATH "C:\\Windows\\System32;C:\\Windows\\SysWow64"
|
||||
#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_LAYERS_PATH "C:\\Windows\\System32;C:\\Windows\\SysWow64"
|
||||
#if !defined(DEFAULT_VK_LAYERS_PATH)
|
||||
#define DEFAULT_VK_LAYERS_PATH ""
|
||||
#endif
|
||||
#if !defined(LAYERS_SOURCE_PATH)
|
||||
#define LAYERS_SOURCE_PATH NULL
|
||||
#endif
|
||||
#define LAYERS_PATH_ENV "VK_LAYER_PATH"
|
||||
|
||||
#define HOME_VK_DRIVERS_INFO ""
|
||||
#define HOME_VK_ELAYERS_INFO ""
|
||||
#define HOME_VK_ILAYERS_INFO ""
|
||||
#define PRINTF_SIZE_T_SPECIFIER "%Iu"
|
||||
|
||||
// File IO
|
||||
|
||||
816
third_party/vulkan/loader/wsi.c
vendored
816
third_party/vulkan/loader/wsi.c
vendored
File diff suppressed because it is too large
Load Diff
137
third_party/vulkan/loader/wsi.h
vendored
137
third_party/vulkan/loader/wsi.h
vendored
@@ -3,24 +3,17 @@
|
||||
* Copyright (c) 2015-2016 Valve Corporation
|
||||
* Copyright (c) 2015-2016 LunarG, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and/or associated documentation files (the "Materials"), to
|
||||
* deal in the Materials without restriction, including without limitation the
|
||||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
* sell copies of the Materials, and to permit persons to whom the Materials are
|
||||
* furnished to do so, subject to the following conditions:
|
||||
* 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
|
||||
*
|
||||
* The above copyright notice(s) and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Materials.
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
*
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE
|
||||
* USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
* 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: Ian Elliott <ian@lunarg.com>
|
||||
*
|
||||
@@ -31,90 +24,114 @@
|
||||
|
||||
bool wsi_swapchain_instance_gpa(struct loader_instance *ptr_instance,
|
||||
const char *name, void **addr);
|
||||
void wsi_add_instance_extensions(const struct loader_instance *inst,
|
||||
struct loader_extension_list *ext_list);
|
||||
|
||||
void wsi_create_instance(struct loader_instance *ptr_instance,
|
||||
const VkInstanceCreateInfo *pCreateInfo);
|
||||
bool wsi_unsupported_instance_extension(const VkExtensionProperties *ext_prop);
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL
|
||||
loader_DestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface,
|
||||
const VkAllocationCallbacks *pAllocator);
|
||||
terminator_DestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface,
|
||||
const VkAllocationCallbacks *pAllocator);
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
loader_GetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevice physicalDevice,
|
||||
uint32_t queueFamilyIndex,
|
||||
VkSurfaceKHR surface,
|
||||
VkBool32 *pSupported);
|
||||
terminator_GetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevice physicalDevice,
|
||||
uint32_t queueFamilyIndex,
|
||||
VkSurfaceKHR surface,
|
||||
VkBool32 *pSupported);
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL loader_GetPhysicalDeviceSurfaceCapabilitiesKHR(
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
terminator_GetPhysicalDeviceSurfaceCapabilitiesKHR(
|
||||
VkPhysicalDevice physicalDevice, VkSurfaceKHR surface,
|
||||
VkSurfaceCapabilitiesKHR *pSurfaceCapabilities);
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
loader_GetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice physicalDevice,
|
||||
VkSurfaceKHR surface,
|
||||
uint32_t *pSurfaceFormatCount,
|
||||
VkSurfaceFormatKHR *pSurfaceFormats);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSurfaceFormatsKHR(
|
||||
VkPhysicalDevice physicalDevice, VkSurfaceKHR surface,
|
||||
uint32_t *pSurfaceFormatCount, VkSurfaceFormatKHR *pSurfaceFormats);
|
||||
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
loader_GetPhysicalDeviceSurfacePresentModesKHR(VkPhysicalDevice physicalDevice,
|
||||
VkSurfaceKHR surface,
|
||||
uint32_t *pPresentModeCount,
|
||||
VkPresentModeKHR *pPresentModes);
|
||||
terminator_GetPhysicalDeviceSurfacePresentModesKHR(
|
||||
VkPhysicalDevice physicalDevice, VkSurfaceKHR surface,
|
||||
uint32_t *pPresentModeCount, VkPresentModeKHR *pPresentModes);
|
||||
|
||||
#ifdef VK_USE_PLATFORM_WIN32_KHR
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
loader_CreateWin32SurfaceKHR(VkInstance instance,
|
||||
const VkWin32SurfaceCreateInfoKHR *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
VkSurfaceKHR *pSurface);
|
||||
terminator_CreateWin32SurfaceKHR(VkInstance instance,
|
||||
const VkWin32SurfaceCreateInfoKHR *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
VkSurfaceKHR *pSurface);
|
||||
VKAPI_ATTR VkBool32 VKAPI_CALL
|
||||
loader_GetPhysicalDeviceWin32PresentationSupportKHR(
|
||||
terminator_GetPhysicalDeviceWin32PresentationSupportKHR(
|
||||
VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex);
|
||||
#endif
|
||||
#ifdef VK_USE_PLATFORM_MIR_KHR
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
loader_CreateMirSurfaceKHR(VkInstance instance,
|
||||
const VkMirSurfaceCreateInfoKHR *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
VkSurfaceKHR *pSurface);
|
||||
terminator_CreateMirSurfaceKHR(VkInstance instance,
|
||||
const VkMirSurfaceCreateInfoKHR *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
VkSurfaceKHR *pSurface);
|
||||
VKAPI_ATTR VkBool32 VKAPI_CALL
|
||||
loader_GetPhysicalDeviceMirPresentationSupportKHR(
|
||||
terminator_GetPhysicalDeviceMirPresentationSupportKHR(
|
||||
VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex,
|
||||
MirConnection *connection);
|
||||
#endif
|
||||
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
loader_CreateWaylandSurfaceKHR(VkInstance instance,
|
||||
const VkWaylandSurfaceCreateInfoKHR *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
VkSurfaceKHR *pSurface);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateWaylandSurfaceKHR(
|
||||
VkInstance instance, const VkWaylandSurfaceCreateInfoKHR *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface);
|
||||
VKAPI_ATTR VkBool32 VKAPI_CALL
|
||||
loader_GetPhysicalDeviceWaylandPresentationSupportKHR(
|
||||
terminator_GetPhysicalDeviceWaylandPresentationSupportKHR(
|
||||
VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex,
|
||||
struct wl_display *display);
|
||||
#endif
|
||||
#ifdef VK_USE_PLATFORM_XCB_KHR
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
loader_CreateXcbSurfaceKHR(VkInstance instance,
|
||||
const VkXcbSurfaceCreateInfoKHR *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
VkSurfaceKHR *pSurface);
|
||||
terminator_CreateXcbSurfaceKHR(VkInstance instance,
|
||||
const VkXcbSurfaceCreateInfoKHR *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
VkSurfaceKHR *pSurface);
|
||||
|
||||
VKAPI_ATTR VkBool32 VKAPI_CALL
|
||||
loader_GetPhysicalDeviceXcbPresentationSupportKHR(
|
||||
terminator_GetPhysicalDeviceXcbPresentationSupportKHR(
|
||||
VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex,
|
||||
xcb_connection_t *connection, xcb_visualid_t visual_id);
|
||||
#endif
|
||||
#ifdef VK_USE_PLATFORM_XLIB_KHR
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
loader_CreateXlibSurfaceKHR(VkInstance instance,
|
||||
const VkXlibSurfaceCreateInfoKHR *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
VkSurfaceKHR *pSurface);
|
||||
terminator_CreateXlibSurfaceKHR(VkInstance instance,
|
||||
const VkXlibSurfaceCreateInfoKHR *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
VkSurfaceKHR *pSurface);
|
||||
VKAPI_ATTR VkBool32 VKAPI_CALL
|
||||
loader_GetPhysicalDeviceXlibPresentationSupportKHR(
|
||||
terminator_GetPhysicalDeviceXlibPresentationSupportKHR(
|
||||
VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, Display *dpy,
|
||||
VisualID visualID);
|
||||
#endif
|
||||
VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceDisplayPropertiesKHR(
|
||||
VkPhysicalDevice physicalDevice, uint32_t *pPropertyCount,
|
||||
VkDisplayPropertiesKHR *pProperties);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
terminator_GetPhysicalDeviceDisplayPlanePropertiesKHR(
|
||||
VkPhysicalDevice physicalDevice, uint32_t *pPropertyCount,
|
||||
VkDisplayPlanePropertiesKHR *pProperties);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
terminator_GetDisplayPlaneSupportedDisplaysKHR(VkPhysicalDevice physicalDevice,
|
||||
uint32_t planeIndex,
|
||||
uint32_t *pDisplayCount,
|
||||
VkDisplayKHR *pDisplays);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
terminator_GetDisplayModePropertiesKHR(VkPhysicalDevice physicalDevice,
|
||||
VkDisplayKHR display,
|
||||
uint32_t *pPropertyCount,
|
||||
VkDisplayModePropertiesKHR *pProperties);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL
|
||||
terminator_CreateDisplayModeKHR(VkPhysicalDevice physicalDevice,
|
||||
VkDisplayKHR display,
|
||||
const VkDisplayModeCreateInfoKHR *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator,
|
||||
VkDisplayModeKHR *pMode);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL terminator_GetDisplayPlaneCapabilitiesKHR(
|
||||
VkPhysicalDevice physicalDevice, VkDisplayModeKHR mode, uint32_t planeIndex,
|
||||
VkDisplayPlaneCapabilitiesKHR *pCapabilities);
|
||||
VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDisplayPlaneSurfaceKHR(
|
||||
VkInstance instance, const VkDisplaySurfaceCreateInfoKHR *pCreateInfo,
|
||||
const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface);
|
||||
|
||||
Reference in New Issue
Block a user