Update the vulkan loader and headers.

This commit is contained in:
Dr. Chat 2016-06-17 19:32:21 -05:00
parent 27c16b1936
commit 2e34a98cef
20 changed files with 3278 additions and 2306 deletions

View File

@ -26,6 +26,8 @@
#include "xenia/ui/vulkan/vulkan_util.h"
#include "xenia/ui/window.h"
#define VK_API_VERSION VK_API_VERSION_1_0
namespace xe {
namespace ui {
namespace vulkan {

View File

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

View File

@ -57,8 +57,7 @@ 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
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;

View File

@ -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,7 +329,7 @@ VKAPI_ATTR VkResult VKAPI_CALL loader_CreateDebugReportCallback(
* for DestroyDebugReportCallback
*/
VKAPI_ATTR void VKAPI_CALL
loader_DestroyDebugReportCallback(VkInstance instance,
terminator_DestroyDebugReportCallback(VkInstance instance,
VkDebugReportCallbackEXT callback,
const VkAllocationCallbacks *pAllocator) {
uint32_t storage_idx;
@ -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,9 +357,9 @@ 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,
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;

View File

@ -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,20 +109,20 @@ 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,
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,
terminator_DebugReportMessage(VkInstance instance, VkDebugReportFlagsEXT flags,
VkDebugReportObjectTypeEXT objType,
uint64_t object, size_t location, int32_t msgCode,
const char *pLayerPrefix, const char *pMsg);
VkResult
@ -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,

View File

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

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

@ -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,6 +392,16 @@ 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, ...);
@ -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);

View File

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

View File

@ -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)) {
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 res;
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 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

View File

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

File diff suppressed because it is too large Load Diff

View File

@ -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,
terminator_DestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface,
const VkAllocationCallbacks *pAllocator);
VKAPI_ATTR VkResult VKAPI_CALL
loader_GetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevice physicalDevice,
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,
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,
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,
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,
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);

View File

@ -6,32 +6,31 @@
* 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.
*
*/
#ifndef VKICD_H
#define VKICD_H
#include "vk_platform.h"
#include "vulkan.h"
/*
* Loader-ICD version negotiation API
*/
#define CURRENT_LOADER_ICD_INTERFACE_VERSION 2
#define MIN_SUPPORTED_LOADER_ICD_INTERFACE_VERSION 0
typedef VkResult (VKAPI_PTR *PFN_vkNegotiateLoaderICDInterfaceVersion)(uint32_t *pVersion);
/*
* The ICD must reserve space for a pointer for the loader's dispatch
* table, at the start of <each object>.
@ -40,7 +39,7 @@
#define ICD_LOADER_MAGIC 0x01CDC0DE
typedef union _VK_LOADER_DATA {
typedef union {
uintptr_t loaderMagic;
void *loaderData;
} VK_LOADER_DATA;
@ -59,20 +58,21 @@ static inline bool valid_loader_magic_value(void *pNewObject) {
* Windows and Linux ICDs will treat VkSurfaceKHR as a pointer to a struct that
* contains the platform-specific connection and surface information.
*/
typedef enum _VkIcdWsiPlatform {
typedef enum {
VK_ICD_WSI_PLATFORM_MIR,
VK_ICD_WSI_PLATFORM_WAYLAND,
VK_ICD_WSI_PLATFORM_WIN32,
VK_ICD_WSI_PLATFORM_XCB,
VK_ICD_WSI_PLATFORM_XLIB,
VK_ICD_WSI_PLATFORM_DISPLAY
} VkIcdWsiPlatform;
typedef struct _VkIcdSurfaceBase {
typedef struct {
VkIcdWsiPlatform platform;
} VkIcdSurfaceBase;
#ifdef VK_USE_PLATFORM_MIR_KHR
typedef struct _VkIcdSurfaceMir {
typedef struct {
VkIcdSurfaceBase base;
MirConnection *connection;
MirSurface *mirSurface;
@ -80,7 +80,7 @@ typedef struct _VkIcdSurfaceMir {
#endif // VK_USE_PLATFORM_MIR_KHR
#ifdef VK_USE_PLATFORM_WAYLAND_KHR
typedef struct _VkIcdSurfaceWayland {
typedef struct {
VkIcdSurfaceBase base;
struct wl_display *display;
struct wl_surface *surface;
@ -88,7 +88,7 @@ typedef struct _VkIcdSurfaceWayland {
#endif // VK_USE_PLATFORM_WAYLAND_KHR
#ifdef VK_USE_PLATFORM_WIN32_KHR
typedef struct _VkIcdSurfaceWin32 {
typedef struct {
VkIcdSurfaceBase base;
HINSTANCE hinstance;
HWND hwnd;
@ -96,7 +96,7 @@ typedef struct _VkIcdSurfaceWin32 {
#endif // VK_USE_PLATFORM_WIN32_KHR
#ifdef VK_USE_PLATFORM_XCB_KHR
typedef struct _VkIcdSurfaceXcb {
typedef struct {
VkIcdSurfaceBase base;
xcb_connection_t *connection;
xcb_window_t window;
@ -104,11 +104,21 @@ typedef struct _VkIcdSurfaceXcb {
#endif // VK_USE_PLATFORM_XCB_KHR
#ifdef VK_USE_PLATFORM_XLIB_KHR
typedef struct _VkIcdSurfaceXlib {
typedef struct {
VkIcdSurfaceBase base;
Display *dpy;
Window window;
} VkIcdSurfaceXlib;
#endif // VK_USE_PLATFORM_XLIB_KHR
typedef struct {
VkIcdSurfaceBase base;
VkDisplayModeKHR displayMode;
uint32_t planeIndex;
uint32_t planeStackIndex;
VkSurfaceTransformFlagBitsKHR transform;
float globalAlpha;
VkDisplayPlaneAlphaFlagBitsKHR alphaMode;
VkExtent2D imageExtent;
} VkIcdSurfaceDisplay;
#endif // VKICD_H

View File

@ -6,24 +6,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.
*
*/
@ -34,7 +27,6 @@
#pragma once
#include "vulkan.h"
#include "vk_lunarg_debug_marker.h"
#if defined(__GNUC__) && __GNUC__ >= 4
#define VK_LAYER_EXPORT __attribute__((visibility("default")))
#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)
@ -226,46 +218,35 @@ typedef struct VkLayerInstanceDispatchTable_ {
#ifdef VK_USE_PLATFORM_ANDROID_KHR
PFN_vkCreateAndroidSurfaceKHR CreateAndroidSurfaceKHR;
#endif
PFN_vkGetPhysicalDeviceDisplayPropertiesKHR
GetPhysicalDeviceDisplayPropertiesKHR;
PFN_vkGetPhysicalDeviceDisplayPlanePropertiesKHR
GetPhysicalDeviceDisplayPlanePropertiesKHR;
PFN_vkGetDisplayPlaneSupportedDisplaysKHR
GetDisplayPlaneSupportedDisplaysKHR;
PFN_vkGetDisplayModePropertiesKHR
GetDisplayModePropertiesKHR;
PFN_vkCreateDisplayModeKHR
CreateDisplayModeKHR;
PFN_vkGetDisplayPlaneCapabilitiesKHR
GetDisplayPlaneCapabilitiesKHR;
PFN_vkCreateDisplayPlaneSurfaceKHR
CreateDisplayPlaneSurfaceKHR;
} VkLayerInstanceDispatchTable;
// LL node for tree of dbg callback functions
typedef struct VkLayerDbgFunctionNode_ {
VkDebugReportCallbackEXT msgCallback;
PFN_vkDebugReportCallbackEXT pfnMsgCallback;
VkFlags msgFlags;
void *pUserData;
struct VkLayerDbgFunctionNode_ *pNext;
} VkLayerDbgFunctionNode;
typedef enum VkLayerDbgAction_ {
VK_DBG_LAYER_ACTION_IGNORE = 0x0,
VK_DBG_LAYER_ACTION_CALLBACK = 0x1,
VK_DBG_LAYER_ACTION_LOG_MSG = 0x2,
VK_DBG_LAYER_ACTION_BREAK = 0x4,
VK_DBG_LAYER_ACTION_DEBUG_OUTPUT = 0x8,
} VkLayerDbgAction;
// ------------------------------------------------------------------------------------------------
// CreateInstance and CreateDevice support structures
/* Sub type of structure for instance and device loader ext of CreateInfo.
* When sType == VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO
* or sType == VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO
* then VkLayerFunction indicates struct type pointed to by pNext
*/
typedef enum VkLayerFunction_ {
VK_LAYER_LINK_INFO = 0,
VK_LAYER_DEVICE_INFO = 1,
VK_LAYER_INSTANCE_INFO = 2
VK_LOADER_DATA_CALLBACK = 1
} VkLayerFunction;
/*
* When creating the device chain the loader needs to pass
* down information about it's device structure needed at
* the end of the chain. Passing the data via the
* VkLayerInstanceInfo avoids issues with finding the
* exact instance being used.
*/
typedef struct VkLayerInstanceInfo_ {
void *instance_info;
PFN_vkGetInstanceProcAddr pfnNextGetInstanceProcAddr;
} VkLayerInstanceInfo;
typedef struct VkLayerInstanceLink_ {
struct VkLayerInstanceLink_ *pNext;
PFN_vkGetInstanceProcAddr pfnNextGetInstanceProcAddr;
@ -283,13 +264,18 @@ typedef struct VkLayerDeviceInfo_ {
PFN_vkGetInstanceProcAddr pfnNextGetInstanceProcAddr;
} VkLayerDeviceInfo;
typedef VkResult (VKAPI_PTR *PFN_vkSetInstanceLoaderData)(VkInstance instance,
void *object);
typedef VkResult (VKAPI_PTR *PFN_vkSetDeviceLoaderData)(VkDevice device,
void *object);
typedef struct {
VkStructureType sType; // VK_STRUCTURE_TYPE_LAYER_INSTANCE_CREATE_INFO
VkStructureType sType; // VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO
const void *pNext;
VkLayerFunction function;
union {
VkLayerInstanceLink *pLayerInfo;
VkLayerInstanceInfo instanceInfo;
PFN_vkSetInstanceLoaderData pfnSetInstanceLoaderData;
} u;
} VkLayerInstanceCreateInfo;
@ -300,14 +286,12 @@ typedef struct VkLayerDeviceLink_ {
} VkLayerDeviceLink;
typedef struct {
VkStructureType sType; // VK_STRUCTURE_TYPE_LAYER_DEVICE_CREATE_INFO
VkStructureType sType; // VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO
const void *pNext;
VkLayerFunction function;
union {
VkLayerDeviceLink *pLayerInfo;
VkLayerDeviceInfo deviceInfo;
PFN_vkSetDeviceLoaderData pfnSetDeviceLoaderData;
} u;
} VkLayerDeviceCreateInfo;
// ------------------------------------------------------------------------------------------------
// API functions

View File

@ -4,29 +4,22 @@
/*
** Copyright (c) 2014-2015 The Khronos Group Inc.
**
** Permission is hereby granted, free of charge, to any person obtaining a
** copy of this software and/or associated documentation files (the
** "Materials"), to deal in the Materials without restriction, including
** without limitation the rights to use, copy, modify, merge, publish,
** distribute, sublicense, and/or sell copies of the Materials, and to
** permit persons to whom the Materials are furnished to do so, subject to
** the following conditions:
** 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 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.
*/
#ifndef __VK_PLATFORM_H__
#define __VK_PLATFORM_H__
#ifndef VK_PLATFORM_H_
#define VK_PLATFORM_H_
#ifdef __cplusplus
extern "C"
@ -124,4 +117,4 @@ extern "C"
#include <xcb/xcb.h>
#endif
#endif // __VK_PLATFORM_H__
#endif

View File

@ -6,24 +6,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.
*/
#ifndef VK_SDK_PLATFORM_H

View File

@ -1,5 +1,5 @@
#ifndef __vulkan_h_
#define __vulkan_h_ 1
#ifndef VULKAN_H_
#define VULKAN_H_ 1
#ifdef __cplusplus
extern "C" {
@ -8,24 +8,17 @@ extern "C" {
/*
** Copyright (c) 2015-2016 The Khronos Group Inc.
**
** Permission is hereby granted, free of charge, to any person obtaining a
** copy of this software and/or associated documentation files (the
** "Materials"), to deal in the Materials without restriction, including
** without limitation the rights to use, copy, modify, merge, publish,
** distribute, sublicense, and/or sell copies of the Materials, and to
** permit persons to whom the Materials are furnished to do so, subject to
** the following conditions:
** 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 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.
*/
/*
@ -40,12 +33,18 @@ extern "C" {
#define VK_MAKE_VERSION(major, minor, patch) \
(((major) << 22) | ((minor) << 12) | (patch))
// Vulkan API version supported by this file
#define VK_API_VERSION VK_MAKE_VERSION(1, 0, 3)
// DEPRECATED: This define has been removed. Specific version defines (e.g. VK_API_VERSION_1_0), or the VK_MAKE_VERSION macro, should be used instead.
//#define VK_API_VERSION VK_MAKE_VERSION(1, 0, 0)
// Vulkan 1.0 version number
#define VK_API_VERSION_1_0 VK_MAKE_VERSION(1, 0, 0)
#define VK_VERSION_MAJOR(version) ((uint32_t)(version) >> 22)
#define VK_VERSION_MINOR(version) (((uint32_t)(version) >> 12) & 0x3ff)
#define VK_VERSION_PATCH(version) ((uint32_t)(version) & 0xfff)
// Version of this file
#define VK_HEADER_VERSION 16
#define VK_NULL_HANDLE 0
@ -142,6 +141,7 @@ typedef enum VkResult {
VK_ERROR_OUT_OF_DATE_KHR = -1000001004,
VK_ERROR_INCOMPATIBLE_DISPLAY_KHR = -1000003001,
VK_ERROR_VALIDATION_FAILED_EXT = -1000011001,
VK_ERROR_INVALID_SHADER_NV = -1000012000,
VK_RESULT_BEGIN_RANGE = VK_ERROR_FORMAT_NOT_SUPPORTED,
VK_RESULT_END_RANGE = VK_INCOMPLETE,
VK_RESULT_RANGE_SIZE = (VK_INCOMPLETE - VK_ERROR_FORMAT_NOT_SUPPORTED + 1),
@ -209,7 +209,11 @@ typedef enum VkStructureType {
VK_STRUCTURE_TYPE_MIR_SURFACE_CREATE_INFO_KHR = 1000007000,
VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR = 1000008000,
VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR = 1000009000,
VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT = 1000011000,
VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT = 1000011000,
VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_RASTERIZATION_ORDER_AMD = 1000018000,
VK_STRUCTURE_TYPE_DEBUG_MARKER_OBJECT_NAME_INFO_EXT = 1000022000,
VK_STRUCTURE_TYPE_DEBUG_MARKER_OBJECT_TAG_INFO_EXT = 1000022001,
VK_STRUCTURE_TYPE_DEBUG_MARKER_MARKER_INFO_EXT = 1000022002,
VK_STRUCTURE_TYPE_BEGIN_RANGE = VK_STRUCTURE_TYPE_APPLICATION_INFO,
VK_STRUCTURE_TYPE_END_RANGE = VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO,
VK_STRUCTURE_TYPE_RANGE_SIZE = (VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO - VK_STRUCTURE_TYPE_APPLICATION_INFO + 1),
@ -679,6 +683,7 @@ typedef enum VkDynamicState {
typedef enum VkFilter {
VK_FILTER_NEAREST = 0,
VK_FILTER_LINEAR = 1,
VK_FILTER_CUBIC_IMG = 1000015000,
VK_FILTER_BEGIN_RANGE = VK_FILTER_NEAREST,
VK_FILTER_END_RANGE = VK_FILTER_LINEAR,
VK_FILTER_RANGE_SIZE = (VK_FILTER_LINEAR - VK_FILTER_NEAREST + 1),
@ -701,8 +706,8 @@ typedef enum VkSamplerAddressMode {
VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER = 3,
VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE = 4,
VK_SAMPLER_ADDRESS_MODE_BEGIN_RANGE = VK_SAMPLER_ADDRESS_MODE_REPEAT,
VK_SAMPLER_ADDRESS_MODE_END_RANGE = VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE,
VK_SAMPLER_ADDRESS_MODE_RANGE_SIZE = (VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE - VK_SAMPLER_ADDRESS_MODE_REPEAT + 1),
VK_SAMPLER_ADDRESS_MODE_END_RANGE = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER,
VK_SAMPLER_ADDRESS_MODE_RANGE_SIZE = (VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER - VK_SAMPLER_ADDRESS_MODE_REPEAT + 1),
VK_SAMPLER_ADDRESS_MODE_MAX_ENUM = 0x7FFFFFFF
} VkSamplerAddressMode;
@ -808,6 +813,8 @@ typedef enum VkFormatFeatureFlagBits {
VK_FORMAT_FEATURE_BLIT_SRC_BIT = 0x00000400,
VK_FORMAT_FEATURE_BLIT_DST_BIT = 0x00000800,
VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT = 0x00001000,
VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_IMG = 0x00002000,
VK_FORMAT_FEATURE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkFormatFeatureFlagBits;
typedef VkFlags VkFormatFeatureFlags;
@ -820,6 +827,7 @@ typedef enum VkImageUsageFlagBits {
VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT = 0x00000020,
VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT = 0x00000040,
VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT = 0x00000080,
VK_IMAGE_USAGE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkImageUsageFlagBits;
typedef VkFlags VkImageUsageFlags;
@ -829,6 +837,7 @@ typedef enum VkImageCreateFlagBits {
VK_IMAGE_CREATE_SPARSE_ALIASED_BIT = 0x00000004,
VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT = 0x00000008,
VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT = 0x00000010,
VK_IMAGE_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkImageCreateFlagBits;
typedef VkFlags VkImageCreateFlags;
@ -840,6 +849,7 @@ typedef enum VkSampleCountFlagBits {
VK_SAMPLE_COUNT_16_BIT = 0x00000010,
VK_SAMPLE_COUNT_32_BIT = 0x00000020,
VK_SAMPLE_COUNT_64_BIT = 0x00000040,
VK_SAMPLE_COUNT_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkSampleCountFlagBits;
typedef VkFlags VkSampleCountFlags;
@ -848,6 +858,7 @@ typedef enum VkQueueFlagBits {
VK_QUEUE_COMPUTE_BIT = 0x00000002,
VK_QUEUE_TRANSFER_BIT = 0x00000004,
VK_QUEUE_SPARSE_BINDING_BIT = 0x00000008,
VK_QUEUE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkQueueFlagBits;
typedef VkFlags VkQueueFlags;
@ -857,11 +868,13 @@ typedef enum VkMemoryPropertyFlagBits {
VK_MEMORY_PROPERTY_HOST_COHERENT_BIT = 0x00000004,
VK_MEMORY_PROPERTY_HOST_CACHED_BIT = 0x00000008,
VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT = 0x00000010,
VK_MEMORY_PROPERTY_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkMemoryPropertyFlagBits;
typedef VkFlags VkMemoryPropertyFlags;
typedef enum VkMemoryHeapFlagBits {
VK_MEMORY_HEAP_DEVICE_LOCAL_BIT = 0x00000001,
VK_MEMORY_HEAP_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkMemoryHeapFlagBits;
typedef VkFlags VkMemoryHeapFlags;
typedef VkFlags VkDeviceCreateFlags;
@ -885,6 +898,7 @@ typedef enum VkPipelineStageFlagBits {
VK_PIPELINE_STAGE_HOST_BIT = 0x00004000,
VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT = 0x00008000,
VK_PIPELINE_STAGE_ALL_COMMANDS_BIT = 0x00010000,
VK_PIPELINE_STAGE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkPipelineStageFlagBits;
typedef VkFlags VkPipelineStageFlags;
typedef VkFlags VkMemoryMapFlags;
@ -894,6 +908,7 @@ typedef enum VkImageAspectFlagBits {
VK_IMAGE_ASPECT_DEPTH_BIT = 0x00000002,
VK_IMAGE_ASPECT_STENCIL_BIT = 0x00000004,
VK_IMAGE_ASPECT_METADATA_BIT = 0x00000008,
VK_IMAGE_ASPECT_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkImageAspectFlagBits;
typedef VkFlags VkImageAspectFlags;
@ -901,16 +916,19 @@ typedef enum VkSparseImageFormatFlagBits {
VK_SPARSE_IMAGE_FORMAT_SINGLE_MIPTAIL_BIT = 0x00000001,
VK_SPARSE_IMAGE_FORMAT_ALIGNED_MIP_SIZE_BIT = 0x00000002,
VK_SPARSE_IMAGE_FORMAT_NONSTANDARD_BLOCK_SIZE_BIT = 0x00000004,
VK_SPARSE_IMAGE_FORMAT_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkSparseImageFormatFlagBits;
typedef VkFlags VkSparseImageFormatFlags;
typedef enum VkSparseMemoryBindFlagBits {
VK_SPARSE_MEMORY_BIND_METADATA_BIT = 0x00000001,
VK_SPARSE_MEMORY_BIND_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkSparseMemoryBindFlagBits;
typedef VkFlags VkSparseMemoryBindFlags;
typedef enum VkFenceCreateFlagBits {
VK_FENCE_CREATE_SIGNALED_BIT = 0x00000001,
VK_FENCE_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkFenceCreateFlagBits;
typedef VkFlags VkFenceCreateFlags;
typedef VkFlags VkSemaphoreCreateFlags;
@ -929,6 +947,7 @@ typedef enum VkQueryPipelineStatisticFlagBits {
VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_CONTROL_SHADER_PATCHES_BIT = 0x00000100,
VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_EVALUATION_SHADER_INVOCATIONS_BIT = 0x00000200,
VK_QUERY_PIPELINE_STATISTIC_COMPUTE_SHADER_INVOCATIONS_BIT = 0x00000400,
VK_QUERY_PIPELINE_STATISTIC_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkQueryPipelineStatisticFlagBits;
typedef VkFlags VkQueryPipelineStatisticFlags;
@ -937,6 +956,7 @@ typedef enum VkQueryResultFlagBits {
VK_QUERY_RESULT_WAIT_BIT = 0x00000002,
VK_QUERY_RESULT_WITH_AVAILABILITY_BIT = 0x00000004,
VK_QUERY_RESULT_PARTIAL_BIT = 0x00000008,
VK_QUERY_RESULT_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkQueryResultFlagBits;
typedef VkFlags VkQueryResultFlags;
@ -944,6 +964,7 @@ typedef enum VkBufferCreateFlagBits {
VK_BUFFER_CREATE_SPARSE_BINDING_BIT = 0x00000001,
VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT = 0x00000002,
VK_BUFFER_CREATE_SPARSE_ALIASED_BIT = 0x00000004,
VK_BUFFER_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkBufferCreateFlagBits;
typedef VkFlags VkBufferCreateFlags;
@ -957,6 +978,7 @@ typedef enum VkBufferUsageFlagBits {
VK_BUFFER_USAGE_INDEX_BUFFER_BIT = 0x00000040,
VK_BUFFER_USAGE_VERTEX_BUFFER_BIT = 0x00000080,
VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT = 0x00000100,
VK_BUFFER_USAGE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkBufferUsageFlagBits;
typedef VkFlags VkBufferUsageFlags;
typedef VkFlags VkBufferViewCreateFlags;
@ -968,6 +990,7 @@ typedef enum VkPipelineCreateFlagBits {
VK_PIPELINE_CREATE_DISABLE_OPTIMIZATION_BIT = 0x00000001,
VK_PIPELINE_CREATE_ALLOW_DERIVATIVES_BIT = 0x00000002,
VK_PIPELINE_CREATE_DERIVATIVE_BIT = 0x00000004,
VK_PIPELINE_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkPipelineCreateFlagBits;
typedef VkFlags VkPipelineCreateFlags;
typedef VkFlags VkPipelineShaderStageCreateFlags;
@ -979,8 +1002,9 @@ typedef enum VkShaderStageFlagBits {
VK_SHADER_STAGE_GEOMETRY_BIT = 0x00000008,
VK_SHADER_STAGE_FRAGMENT_BIT = 0x00000010,
VK_SHADER_STAGE_COMPUTE_BIT = 0x00000020,
VK_SHADER_STAGE_ALL_GRAPHICS = 0x1F,
VK_SHADER_STAGE_ALL_GRAPHICS = 0x0000001F,
VK_SHADER_STAGE_ALL = 0x7FFFFFFF,
VK_SHADER_STAGE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkShaderStageFlagBits;
typedef VkFlags VkPipelineVertexInputStateCreateFlags;
typedef VkFlags VkPipelineInputAssemblyStateCreateFlags;
@ -992,7 +1016,8 @@ typedef enum VkCullModeFlagBits {
VK_CULL_MODE_NONE = 0,
VK_CULL_MODE_FRONT_BIT = 0x00000001,
VK_CULL_MODE_BACK_BIT = 0x00000002,
VK_CULL_MODE_FRONT_AND_BACK = 0x3,
VK_CULL_MODE_FRONT_AND_BACK = 0x00000003,
VK_CULL_MODE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkCullModeFlagBits;
typedef VkFlags VkCullModeFlags;
typedef VkFlags VkPipelineMultisampleStateCreateFlags;
@ -1004,6 +1029,7 @@ typedef enum VkColorComponentFlagBits {
VK_COLOR_COMPONENT_G_BIT = 0x00000002,
VK_COLOR_COMPONENT_B_BIT = 0x00000004,
VK_COLOR_COMPONENT_A_BIT = 0x00000008,
VK_COLOR_COMPONENT_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkColorComponentFlagBits;
typedef VkFlags VkColorComponentFlags;
typedef VkFlags VkPipelineDynamicStateCreateFlags;
@ -1014,6 +1040,7 @@ typedef VkFlags VkDescriptorSetLayoutCreateFlags;
typedef enum VkDescriptorPoolCreateFlagBits {
VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT = 0x00000001,
VK_DESCRIPTOR_POOL_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkDescriptorPoolCreateFlagBits;
typedef VkFlags VkDescriptorPoolCreateFlags;
typedef VkFlags VkDescriptorPoolResetFlags;
@ -1022,6 +1049,7 @@ typedef VkFlags VkRenderPassCreateFlags;
typedef enum VkAttachmentDescriptionFlagBits {
VK_ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT = 0x00000001,
VK_ATTACHMENT_DESCRIPTION_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkAttachmentDescriptionFlagBits;
typedef VkFlags VkAttachmentDescriptionFlags;
typedef VkFlags VkSubpassDescriptionFlags;
@ -1044,22 +1072,26 @@ typedef enum VkAccessFlagBits {
VK_ACCESS_HOST_WRITE_BIT = 0x00004000,
VK_ACCESS_MEMORY_READ_BIT = 0x00008000,
VK_ACCESS_MEMORY_WRITE_BIT = 0x00010000,
VK_ACCESS_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkAccessFlagBits;
typedef VkFlags VkAccessFlags;
typedef enum VkDependencyFlagBits {
VK_DEPENDENCY_BY_REGION_BIT = 0x00000001,
VK_DEPENDENCY_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkDependencyFlagBits;
typedef VkFlags VkDependencyFlags;
typedef enum VkCommandPoolCreateFlagBits {
VK_COMMAND_POOL_CREATE_TRANSIENT_BIT = 0x00000001,
VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT = 0x00000002,
VK_COMMAND_POOL_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkCommandPoolCreateFlagBits;
typedef VkFlags VkCommandPoolCreateFlags;
typedef enum VkCommandPoolResetFlagBits {
VK_COMMAND_POOL_RESET_RELEASE_RESOURCES_BIT = 0x00000001,
VK_COMMAND_POOL_RESET_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkCommandPoolResetFlagBits;
typedef VkFlags VkCommandPoolResetFlags;
@ -1067,23 +1099,27 @@ typedef enum VkCommandBufferUsageFlagBits {
VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT = 0x00000001,
VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT = 0x00000002,
VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT = 0x00000004,
VK_COMMAND_BUFFER_USAGE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkCommandBufferUsageFlagBits;
typedef VkFlags VkCommandBufferUsageFlags;
typedef enum VkQueryControlFlagBits {
VK_QUERY_CONTROL_PRECISE_BIT = 0x00000001,
VK_QUERY_CONTROL_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkQueryControlFlagBits;
typedef VkFlags VkQueryControlFlags;
typedef enum VkCommandBufferResetFlagBits {
VK_COMMAND_BUFFER_RESET_RELEASE_RESOURCES_BIT = 0x00000001,
VK_COMMAND_BUFFER_RESET_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkCommandBufferResetFlagBits;
typedef VkFlags VkCommandBufferResetFlags;
typedef enum VkStencilFaceFlagBits {
VK_STENCIL_FACE_FRONT_BIT = 0x00000001,
VK_STENCIL_FACE_BACK_BIT = 0x00000002,
VK_STENCIL_FRONT_AND_BACK = 0x3,
VK_STENCIL_FRONT_AND_BACK = 0x00000003,
VK_STENCIL_FACE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkStencilFaceFlagBits;
typedef VkFlags VkStencilFaceFlags;
@ -3136,14 +3172,15 @@ VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSurfaceKHR)
#define VK_KHR_SURFACE_SPEC_VERSION 25
#define VK_KHR_SURFACE_EXTENSION_NAME "VK_KHR_surface"
#define VK_COLORSPACE_SRGB_NONLINEAR_KHR VK_COLOR_SPACE_SRGB_NONLINEAR_KHR
typedef enum VkColorSpaceKHR {
VK_COLORSPACE_SRGB_NONLINEAR_KHR = 0,
VK_COLORSPACE_BEGIN_RANGE = VK_COLORSPACE_SRGB_NONLINEAR_KHR,
VK_COLORSPACE_END_RANGE = VK_COLORSPACE_SRGB_NONLINEAR_KHR,
VK_COLORSPACE_RANGE_SIZE = (VK_COLORSPACE_SRGB_NONLINEAR_KHR - VK_COLORSPACE_SRGB_NONLINEAR_KHR + 1),
VK_COLORSPACE_MAX_ENUM = 0x7FFFFFFF
VK_COLOR_SPACE_SRGB_NONLINEAR_KHR = 0,
VK_COLOR_SPACE_BEGIN_RANGE_KHR = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR,
VK_COLOR_SPACE_END_RANGE_KHR = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR,
VK_COLOR_SPACE_RANGE_SIZE_KHR = (VK_COLOR_SPACE_SRGB_NONLINEAR_KHR - VK_COLOR_SPACE_SRGB_NONLINEAR_KHR + 1),
VK_COLOR_SPACE_MAX_ENUM_KHR = 0x7FFFFFFF
} VkColorSpaceKHR;
typedef enum VkPresentModeKHR {
@ -3151,10 +3188,10 @@ typedef enum VkPresentModeKHR {
VK_PRESENT_MODE_MAILBOX_KHR = 1,
VK_PRESENT_MODE_FIFO_KHR = 2,
VK_PRESENT_MODE_FIFO_RELAXED_KHR = 3,
VK_PRESENT_MODE_BEGIN_RANGE = VK_PRESENT_MODE_IMMEDIATE_KHR,
VK_PRESENT_MODE_END_RANGE = VK_PRESENT_MODE_FIFO_RELAXED_KHR,
VK_PRESENT_MODE_RANGE_SIZE = (VK_PRESENT_MODE_FIFO_RELAXED_KHR - VK_PRESENT_MODE_IMMEDIATE_KHR + 1),
VK_PRESENT_MODE_MAX_ENUM = 0x7FFFFFFF
VK_PRESENT_MODE_BEGIN_RANGE_KHR = VK_PRESENT_MODE_IMMEDIATE_KHR,
VK_PRESENT_MODE_END_RANGE_KHR = VK_PRESENT_MODE_FIFO_RELAXED_KHR,
VK_PRESENT_MODE_RANGE_SIZE_KHR = (VK_PRESENT_MODE_FIFO_RELAXED_KHR - VK_PRESENT_MODE_IMMEDIATE_KHR + 1),
VK_PRESENT_MODE_MAX_ENUM_KHR = 0x7FFFFFFF
} VkPresentModeKHR;
@ -3168,6 +3205,7 @@ typedef enum VkSurfaceTransformFlagBitsKHR {
VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_180_BIT_KHR = 0x00000040,
VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_270_BIT_KHR = 0x00000080,
VK_SURFACE_TRANSFORM_INHERIT_BIT_KHR = 0x00000100,
VK_SURFACE_TRANSFORM_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF
} VkSurfaceTransformFlagBitsKHR;
typedef VkFlags VkSurfaceTransformFlagsKHR;
@ -3176,6 +3214,7 @@ typedef enum VkCompositeAlphaFlagBitsKHR {
VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR = 0x00000002,
VK_COMPOSITE_ALPHA_POST_MULTIPLIED_BIT_KHR = 0x00000004,
VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR = 0x00000008,
VK_COMPOSITE_ALPHA_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF
} VkCompositeAlphaFlagBitsKHR;
typedef VkFlags VkCompositeAlphaFlagsKHR;
@ -3237,7 +3276,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfacePresentModesKHR(
#define VK_KHR_swapchain 1
VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSwapchainKHR)
#define VK_KHR_SWAPCHAIN_SPEC_VERSION 67
#define VK_KHR_SWAPCHAIN_SPEC_VERSION 68
#define VK_KHR_SWAPCHAIN_EXTENSION_NAME "VK_KHR_swapchain"
typedef VkFlags VkSwapchainCreateFlagsKHR;
@ -3325,9 +3364,10 @@ typedef enum VkDisplayPlaneAlphaFlagBitsKHR {
VK_DISPLAY_PLANE_ALPHA_GLOBAL_BIT_KHR = 0x00000002,
VK_DISPLAY_PLANE_ALPHA_PER_PIXEL_BIT_KHR = 0x00000004,
VK_DISPLAY_PLANE_ALPHA_PER_PIXEL_PREMULTIPLIED_BIT_KHR = 0x00000008,
VK_DISPLAY_PLANE_ALPHA_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF
} VkDisplayPlaneAlphaFlagBitsKHR;
typedef VkFlags VkDisplayModeCreateFlagsKHR;
typedef VkFlags VkDisplayPlaneAlphaFlagsKHR;
typedef VkFlags VkDisplayModeCreateFlagsKHR;
typedef VkFlags VkDisplaySurfaceCreateFlagsKHR;
typedef struct VkDisplayPropertiesKHR {
@ -3392,7 +3432,7 @@ typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceDisplayPropertiesKHR)(VkPhys
typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceDisplayPlanePropertiesKHR)(VkPhysicalDevice physicalDevice, uint32_t* pPropertyCount, VkDisplayPlanePropertiesKHR* pProperties);
typedef VkResult (VKAPI_PTR *PFN_vkGetDisplayPlaneSupportedDisplaysKHR)(VkPhysicalDevice physicalDevice, uint32_t planeIndex, uint32_t* pDisplayCount, VkDisplayKHR* pDisplays);
typedef VkResult (VKAPI_PTR *PFN_vkGetDisplayModePropertiesKHR)(VkPhysicalDevice physicalDevice, VkDisplayKHR display, uint32_t* pPropertyCount, VkDisplayModePropertiesKHR* pProperties);
typedef VkResult (VKAPI_PTR *PFN_vkCreateDisplayModeKHR)(VkPhysicalDevice physicalDevice, VkDisplayKHR display, const VkDisplayModeCreateInfoKHR*pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDisplayModeKHR* pMode);
typedef VkResult (VKAPI_PTR *PFN_vkCreateDisplayModeKHR)(VkPhysicalDevice physicalDevice, VkDisplayKHR display, const VkDisplayModeCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDisplayModeKHR* pMode);
typedef VkResult (VKAPI_PTR *PFN_vkGetDisplayPlaneCapabilitiesKHR)(VkPhysicalDevice physicalDevice, VkDisplayModeKHR mode, uint32_t planeIndex, VkDisplayPlaneCapabilitiesKHR* pCapabilities);
typedef VkResult (VKAPI_PTR *PFN_vkCreateDisplayPlaneSurfaceKHR)(VkInstance instance, const VkDisplaySurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface);
@ -3667,11 +3707,17 @@ VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceWin32PresentationSupportKHR(
#endif
#endif /* VK_USE_PLATFORM_WIN32_KHR */
#define VK_KHR_sampler_mirror_clamp_to_edge 1
#define VK_KHR_SAMPLER_MIRROR_CLAMP_TO_EDGE_SPEC_VERSION 1
#define VK_KHR_SAMPLER_MIRROR_CLAMP_TO_EDGE_EXTENSION_NAME "VK_KHR_sampler_mirror_clamp_to_edge"
#define VK_EXT_debug_report 1
VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDebugReportCallbackEXT)
#define VK_EXT_DEBUG_REPORT_SPEC_VERSION 1
#define VK_EXT_DEBUG_REPORT_SPEC_VERSION 2
#define VK_EXT_DEBUG_REPORT_EXTENSION_NAME "VK_EXT_debug_report"
#define VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT
typedef enum VkDebugReportObjectTypeEXT {
@ -3704,11 +3750,19 @@ typedef enum VkDebugReportObjectTypeEXT {
VK_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT = 26,
VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT = 27,
VK_DEBUG_REPORT_OBJECT_TYPE_DEBUG_REPORT_EXT = 28,
VK_DEBUG_REPORT_OBJECT_TYPE_BEGIN_RANGE_EXT = VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT,
VK_DEBUG_REPORT_OBJECT_TYPE_END_RANGE_EXT = VK_DEBUG_REPORT_OBJECT_TYPE_DEBUG_REPORT_EXT,
VK_DEBUG_REPORT_OBJECT_TYPE_RANGE_SIZE_EXT = (VK_DEBUG_REPORT_OBJECT_TYPE_DEBUG_REPORT_EXT - VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT + 1),
VK_DEBUG_REPORT_OBJECT_TYPE_MAX_ENUM_EXT = 0x7FFFFFFF
} VkDebugReportObjectTypeEXT;
typedef enum VkDebugReportErrorEXT {
VK_DEBUG_REPORT_ERROR_NONE_EXT = 0,
VK_DEBUG_REPORT_ERROR_CALLBACK_REF_EXT = 1,
VK_DEBUG_REPORT_ERROR_BEGIN_RANGE_EXT = VK_DEBUG_REPORT_ERROR_NONE_EXT,
VK_DEBUG_REPORT_ERROR_END_RANGE_EXT = VK_DEBUG_REPORT_ERROR_CALLBACK_REF_EXT,
VK_DEBUG_REPORT_ERROR_RANGE_SIZE_EXT = (VK_DEBUG_REPORT_ERROR_CALLBACK_REF_EXT - VK_DEBUG_REPORT_ERROR_NONE_EXT + 1),
VK_DEBUG_REPORT_ERROR_MAX_ENUM_EXT = 0x7FFFFFFF
} VkDebugReportErrorEXT;
@ -3718,6 +3772,7 @@ typedef enum VkDebugReportFlagBitsEXT {
VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT = 0x00000004,
VK_DEBUG_REPORT_ERROR_BIT_EXT = 0x00000008,
VK_DEBUG_REPORT_DEBUG_BIT_EXT = 0x00000010,
VK_DEBUG_REPORT_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF
} VkDebugReportFlagBitsEXT;
typedef VkFlags VkDebugReportFlagsEXT;
@ -3768,6 +3823,110 @@ VKAPI_ATTR void VKAPI_CALL vkDebugReportMessageEXT(
const char* pMessage);
#endif
#define VK_NV_glsl_shader 1
#define VK_NV_GLSL_SHADER_SPEC_VERSION 1
#define VK_NV_GLSL_SHADER_EXTENSION_NAME "VK_NV_glsl_shader"
#define VK_IMG_filter_cubic 1
#define VK_IMG_FILTER_CUBIC_SPEC_VERSION 1
#define VK_IMG_FILTER_CUBIC_EXTENSION_NAME "VK_IMG_filter_cubic"
#define VK_AMD_rasterization_order 1
#define VK_AMD_RASTERIZATION_ORDER_SPEC_VERSION 1
#define VK_AMD_RASTERIZATION_ORDER_EXTENSION_NAME "VK_AMD_rasterization_order"
typedef enum VkRasterizationOrderAMD {
VK_RASTERIZATION_ORDER_STRICT_AMD = 0,
VK_RASTERIZATION_ORDER_RELAXED_AMD = 1,
VK_RASTERIZATION_ORDER_BEGIN_RANGE_AMD = VK_RASTERIZATION_ORDER_STRICT_AMD,
VK_RASTERIZATION_ORDER_END_RANGE_AMD = VK_RASTERIZATION_ORDER_RELAXED_AMD,
VK_RASTERIZATION_ORDER_RANGE_SIZE_AMD = (VK_RASTERIZATION_ORDER_RELAXED_AMD - VK_RASTERIZATION_ORDER_STRICT_AMD + 1),
VK_RASTERIZATION_ORDER_MAX_ENUM_AMD = 0x7FFFFFFF
} VkRasterizationOrderAMD;
typedef struct VkPipelineRasterizationStateRasterizationOrderAMD {
VkStructureType sType;
const void* pNext;
VkRasterizationOrderAMD rasterizationOrder;
} VkPipelineRasterizationStateRasterizationOrderAMD;
#define VK_AMD_shader_trinary_minmax 1
#define VK_AMD_SHADER_TRINARY_MINMAX_SPEC_VERSION 1
#define VK_AMD_SHADER_TRINARY_MINMAX_EXTENSION_NAME "VK_AMD_shader_trinary_minmax"
#define VK_AMD_shader_explicit_vertex_parameter 1
#define VK_AMD_SHADER_EXPLICIT_VERTEX_PARAMETER_SPEC_VERSION 1
#define VK_AMD_SHADER_EXPLICIT_VERTEX_PARAMETER_EXTENSION_NAME "VK_AMD_shader_explicit_vertex_parameter"
#define VK_EXT_debug_marker 1
#define VK_EXT_DEBUG_MARKER_SPEC_VERSION 3
#define VK_EXT_DEBUG_MARKER_EXTENSION_NAME "VK_EXT_debug_marker"
typedef struct VkDebugMarkerObjectNameInfoEXT {
VkStructureType sType;
const void* pNext;
VkDebugReportObjectTypeEXT objectType;
uint64_t object;
const char* pObjectName;
} VkDebugMarkerObjectNameInfoEXT;
typedef struct VkDebugMarkerObjectTagInfoEXT {
VkStructureType sType;
const void* pNext;
VkDebugReportObjectTypeEXT objectType;
uint64_t object;
uint64_t tagName;
size_t tagSize;
const void* pTag;
} VkDebugMarkerObjectTagInfoEXT;
typedef struct VkDebugMarkerMarkerInfoEXT {
VkStructureType sType;
const void* pNext;
const char* pMarkerName;
float color[4];
} VkDebugMarkerMarkerInfoEXT;
typedef VkResult (VKAPI_PTR *PFN_vkDebugMarkerSetObjectTagEXT)(VkDevice device, VkDebugMarkerObjectTagInfoEXT* pTagInfo);
typedef VkResult (VKAPI_PTR *PFN_vkDebugMarkerSetObjectNameEXT)(VkDevice device, VkDebugMarkerObjectNameInfoEXT* pNameInfo);
typedef void (VKAPI_PTR *PFN_vkCmdDebugMarkerBeginEXT)(VkCommandBuffer commandBuffer, VkDebugMarkerMarkerInfoEXT* pMarkerInfo);
typedef void (VKAPI_PTR *PFN_vkCmdDebugMarkerEndEXT)(VkCommandBuffer commandBuffer);
typedef void (VKAPI_PTR *PFN_vkCmdDebugMarkerInsertEXT)(VkCommandBuffer commandBuffer, VkDebugMarkerMarkerInfoEXT* pMarkerInfo);
#ifndef VK_NO_PROTOTYPES
VKAPI_ATTR VkResult VKAPI_CALL vkDebugMarkerSetObjectTagEXT(
VkDevice device,
VkDebugMarkerObjectTagInfoEXT* pTagInfo);
VKAPI_ATTR VkResult VKAPI_CALL vkDebugMarkerSetObjectNameEXT(
VkDevice device,
VkDebugMarkerObjectNameInfoEXT* pNameInfo);
VKAPI_ATTR void VKAPI_CALL vkCmdDebugMarkerBeginEXT(
VkCommandBuffer commandBuffer,
VkDebugMarkerMarkerInfoEXT* pMarkerInfo);
VKAPI_ATTR void VKAPI_CALL vkCmdDebugMarkerEndEXT(
VkCommandBuffer commandBuffer);
VKAPI_ATTR void VKAPI_CALL vkCmdDebugMarkerInsertEXT(
VkCommandBuffer commandBuffer,
VkDebugMarkerMarkerInfoEXT* pMarkerInfo);
#endif
#define VK_AMD_gcn_shader 1
#define VK_AMD_GCN_SHADER_SPEC_VERSION 1
#define VK_AMD_GCN_SHADER_EXTENSION_NAME "VK_AMD_gcn_shader"
#ifdef __cplusplus
}
#endif