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/vulkan/vulkan_util.h"
#include "xenia/ui/window.h" #include "xenia/ui/window.h"
#define VK_API_VERSION VK_API_VERSION_1_0
namespace xe { namespace xe {
namespace ui { namespace ui {
namespace vulkan { namespace vulkan {

View File

@ -343,7 +343,7 @@ static const char *parse_string(cJSON *item, const char *str) {
*--ptr2 = ((uc | 0x80) & 0xBF); *--ptr2 = ((uc | 0x80) & 0xBF);
uc >>= 6; uc >>= 6;
case 1: case 1:
*--ptr2 = (uc | firstByteMark[len]); *--ptr2 = ((unsigned char)uc | firstByteMark[len]);
} }
ptr2 += len; ptr2 += len;
break; break;
@ -423,7 +423,6 @@ static char *print_string_ptr(const char *str, printbuffer *p) {
if ((unsigned char)*ptr > 31 && *ptr != '\"' && *ptr != '\\') if ((unsigned char)*ptr > 31 && *ptr != '\"' && *ptr != '\\')
*ptr2++ = *ptr++; *ptr2++ = *ptr++;
else { else {
*ptr2++ = '\\';
switch (token = *ptr++) { switch (token = *ptr++) {
case '\\': case '\\':
*ptr2++ = '\\'; *ptr2++ = '\\';
@ -432,19 +431,19 @@ static char *print_string_ptr(const char *str, printbuffer *p) {
*ptr2++ = '\"'; *ptr2++ = '\"';
break; break;
case '\b': case '\b':
*ptr2++ = 'b'; *ptr2++ = '\b';
break; break;
case '\f': case '\f':
*ptr2++ = 'f'; *ptr2++ = '\f';
break; break;
case '\n': case '\n':
*ptr2++ = 'n'; *ptr2++ = '\n';
break; break;
case '\r': case '\r':
*ptr2++ = 'r'; *ptr2++ = '\r';
break; break;
case '\t': case '\t':
*ptr2++ = 't'; *ptr2++ = '\t';
break; break;
default: default:
sprintf(ptr2, "u%04x", token); sprintf(ptr2, "u%04x", token);
@ -521,7 +520,6 @@ char *cJSON_PrintBuffered(cJSON *item, int prebuffer, int fmt) {
p.length = prebuffer; p.length = prebuffer;
p.offset = 0; p.offset = 0;
return print_value(item, 0, fmt, &p); return print_value(item, 0, fmt, &p);
return p.buffer;
} }
/* Parser core - when encountering text, process appropriately. */ /* Parser core - when encountering text, process appropriately. */

View File

@ -57,9 +57,8 @@ typedef struct cJSON {
int valueint; /* The item's number, if type==cJSON_Number */ int valueint; /* The item's number, if type==cJSON_Number */
double valuedouble; /* The item's number, if type==cJSON_Number */ double valuedouble; /* The item's number, if type==cJSON_Number */
char * char *string; /* The item's name string, if this item is the child of, or is
string; /* The item's name string, if this item is the child of, or is in the list of subitems of an object. */
in the list of subitems of an object. */
} cJSON; } cJSON;
typedef struct cJSON_Hooks { typedef struct cJSON_Hooks {

View File

@ -4,24 +4,17 @@
* Copyright (c) 2015-2016 LunarG, Inc. * Copyright (c) 2015-2016 LunarG, Inc.
* Copyright (C) 2015-2016 Google Inc. * Copyright (C) 2015-2016 Google Inc.
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Licensed under the Apache License, Version 2.0 (the "License");
* of this software and/or associated documentation files (the "Materials"), to * you may not use this file except in compliance with the License.
* deal in the Materials without restriction, including without limitation the * You may obtain a copy of the License at
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Materials, and to permit persons to whom the Materials are
* furnished to do so, subject to the following conditions:
* *
* The above copyright notice(s) and this permission notice shall be included in * http://www.apache.org/licenses/LICENSE-2.0
* all copies or substantial portions of the Materials.
* *
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * Unless required by applicable law or agreed to in writing, software
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * distributed under the License is distributed on an "AS IS" BASIS,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * See the License for the specific language governing permissions and
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * limitations under the License.
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE
* USE OR OTHER DEALINGS IN THE MATERIALS.
* *
* Author: Courtney Goeltzenleuchter <courtney@LunarG.com> * Author: Courtney Goeltzenleuchter <courtney@LunarG.com>
* Author: Jon Ashburn <jon@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 static VKAPI_ATTR void VKAPI_CALL
debug_report_DestroyDebugReportCallback(VkInstance instance, debug_report_DestroyDebugReportCallback(VkInstance instance,
VkDebugReportCallbackEXT callback, VkDebugReportCallbackEXT callback,
@ -185,14 +271,14 @@ static VKAPI_ATTR void VKAPI_CALL debug_report_DebugReportMessage(
* for CreateDebugReportCallback * for CreateDebugReportCallback
*/ */
VKAPI_ATTR VkResult VKAPI_CALL loader_CreateDebugReportCallback( VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDebugReportCallback(
VkInstance instance, const VkDebugReportCallbackCreateInfoEXT *pCreateInfo, VkInstance instance, const VkDebugReportCallbackCreateInfoEXT *pCreateInfo,
const VkAllocationCallbacks *pAllocator, const VkAllocationCallbacks *pAllocator,
VkDebugReportCallbackEXT *pCallback) { VkDebugReportCallbackEXT *pCallback) {
VkDebugReportCallbackEXT *icd_info; VkDebugReportCallbackEXT *icd_info;
const struct loader_icd *icd; const struct loader_icd *icd;
struct loader_instance *inst = (struct loader_instance *)instance; struct loader_instance *inst = (struct loader_instance *)instance;
VkResult res; VkResult res = VK_SUCCESS;
uint32_t storage_idx; uint32_t storage_idx;
icd_info = calloc(sizeof(VkDebugReportCallbackEXT), inst->total_icd_count); icd_info = calloc(sizeof(VkDebugReportCallbackEXT), inst->total_icd_count);
@ -219,6 +305,10 @@ VKAPI_ATTR VkResult VKAPI_CALL loader_CreateDebugReportCallback(
if (icd) { if (icd) {
storage_idx = 0; storage_idx = 0;
for (icd = inst->icds; icd; icd = icd->next) { for (icd = inst->icds; icd; icd = icd->next) {
if (NULL == icd->DestroyDebugReportCallbackEXT) {
continue;
}
if (icd_info[storage_idx]) { if (icd_info[storage_idx]) {
icd->DestroyDebugReportCallbackEXT( icd->DestroyDebugReportCallbackEXT(
icd->instance, icd_info[storage_idx], pAllocator); icd->instance, icd_info[storage_idx], pAllocator);
@ -239,9 +329,9 @@ VKAPI_ATTR VkResult VKAPI_CALL loader_CreateDebugReportCallback(
* for DestroyDebugReportCallback * for DestroyDebugReportCallback
*/ */
VKAPI_ATTR void VKAPI_CALL VKAPI_ATTR void VKAPI_CALL
loader_DestroyDebugReportCallback(VkInstance instance, terminator_DestroyDebugReportCallback(VkInstance instance,
VkDebugReportCallbackEXT callback, VkDebugReportCallbackEXT callback,
const VkAllocationCallbacks *pAllocator) { const VkAllocationCallbacks *pAllocator) {
uint32_t storage_idx; uint32_t storage_idx;
VkDebugReportCallbackEXT *icd_info; VkDebugReportCallbackEXT *icd_info;
const struct loader_icd *icd; const struct loader_icd *icd;
@ -250,6 +340,10 @@ loader_DestroyDebugReportCallback(VkInstance instance,
icd_info = *(VkDebugReportCallbackEXT **)&callback; icd_info = *(VkDebugReportCallbackEXT **)&callback;
storage_idx = 0; storage_idx = 0;
for (icd = inst->icds; icd; icd = icd->next) { for (icd = inst->icds; icd; icd = icd->next) {
if (NULL == icd->DestroyDebugReportCallbackEXT) {
continue;
}
if (icd_info[storage_idx]) { if (icd_info[storage_idx]) {
icd->DestroyDebugReportCallbackEXT( icd->DestroyDebugReportCallbackEXT(
icd->instance, icd_info[storage_idx], pAllocator); icd->instance, icd_info[storage_idx], pAllocator);
@ -263,10 +357,10 @@ loader_DestroyDebugReportCallback(VkInstance instance,
* for DebugReportMessage * for DebugReportMessage
*/ */
VKAPI_ATTR void VKAPI_CALL VKAPI_ATTR void VKAPI_CALL
loader_DebugReportMessage(VkInstance instance, VkDebugReportFlagsEXT flags, terminator_DebugReportMessage(VkInstance instance, VkDebugReportFlagsEXT flags,
VkDebugReportObjectTypeEXT objType, uint64_t object, VkDebugReportObjectTypeEXT objType,
size_t location, int32_t msgCode, uint64_t object, size_t location, int32_t msgCode,
const char *pLayerPrefix, const char *pMsg) { const char *pLayerPrefix, const char *pMsg) {
const struct loader_icd *icd; const struct loader_icd *icd;
struct loader_instance *inst = (struct loader_instance *)instance; struct loader_instance *inst = (struct loader_instance *)instance;

View File

@ -4,24 +4,17 @@
* Copyright (c) 2015-2016 LunarG, Inc. * Copyright (c) 2015-2016 LunarG, Inc.
* Copyright (C) 2015-2016 Google Inc. * Copyright (C) 2015-2016 Google Inc.
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Licensed under the Apache License, Version 2.0 (the "License");
* of this software and/or associated documentation files (the "Materials"), to * you may not use this file except in compliance with the License.
* deal in the Materials without restriction, including without limitation the * You may obtain a copy of the License at
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Materials, and to permit persons to whom the Materials are
* furnished to do so, subject to the following conditions:
* *
* The above copyright notice(s) and this permission notice shall be included in * http://www.apache.org/licenses/LICENSE-2.0
* all copies or substantial portions of the Materials.
* *
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * Unless required by applicable law or agreed to in writing, software
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * distributed under the License is distributed on an "AS IS" BASIS,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * See the License for the specific language governing permissions and
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * limitations under the License.
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE
* USE OR OTHER DEALINGS IN THE MATERIALS.
* *
* Author: Courtney Goeltzenleuchter <courtney@LunarG.com> * Author: Courtney Goeltzenleuchter <courtney@LunarG.com>
* Author: Jon Ashburn <jon@lunarg.com> * Author: Jon Ashburn <jon@lunarg.com>
@ -116,21 +109,21 @@ void debug_report_create_instance(struct loader_instance *ptr_instance,
bool debug_report_instance_gpa(struct loader_instance *ptr_instance, bool debug_report_instance_gpa(struct loader_instance *ptr_instance,
const char *name, void **addr); const char *name, void **addr);
VKAPI_ATTR VkResult VKAPI_CALL loader_CreateDebugReportCallback( VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDebugReportCallback(
VkInstance instance, const VkDebugReportCallbackCreateInfoEXT *pCreateInfo, VkInstance instance, const VkDebugReportCallbackCreateInfoEXT *pCreateInfo,
const VkAllocationCallbacks *pAllocator, const VkAllocationCallbacks *pAllocator,
VkDebugReportCallbackEXT *pCallback); VkDebugReportCallbackEXT *pCallback);
VKAPI_ATTR void VKAPI_CALL VKAPI_ATTR void VKAPI_CALL
loader_DestroyDebugReportCallback(VkInstance instance, terminator_DestroyDebugReportCallback(VkInstance instance,
VkDebugReportCallbackEXT callback, VkDebugReportCallbackEXT callback,
const VkAllocationCallbacks *pAllocator); const VkAllocationCallbacks *pAllocator);
VKAPI_ATTR void VKAPI_CALL VKAPI_ATTR void VKAPI_CALL
loader_DebugReportMessage(VkInstance instance, VkDebugReportFlagsEXT flags, terminator_DebugReportMessage(VkInstance instance, VkDebugReportFlagsEXT flags,
VkDebugReportObjectTypeEXT objType, uint64_t object, VkDebugReportObjectTypeEXT objType,
size_t location, int32_t msgCode, uint64_t object, size_t location, int32_t msgCode,
const char *pLayerPrefix, const char *pMsg); const char *pLayerPrefix, const char *pMsg);
VkResult VkResult
util_CreateDebugReportCallback(struct loader_instance *inst, util_CreateDebugReportCallback(struct loader_instance *inst,
@ -142,6 +135,23 @@ void util_DestroyDebugReportCallback(struct loader_instance *inst,
VkDebugReportCallbackEXT callback, VkDebugReportCallbackEXT callback,
const VkAllocationCallbacks *pAllocator); 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, VkBool32 util_DebugReportMessage(const struct loader_instance *inst,
VkFlags msgFlags, VkFlags msgFlags,
VkDebugReportObjectTypeEXT objectType, VkDebugReportObjectTypeEXT objectType,

View File

@ -3,24 +3,17 @@
* Copyright (c) 2015-2016 Valve Corporation * Copyright (c) 2015-2016 Valve Corporation
* Copyright (c) 2015-2016 LunarG, Inc. * Copyright (c) 2015-2016 LunarG, Inc.
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Licensed under the Apache License, Version 2.0 (the "License");
* of this software and/or associated documentation files (the "Materials"), to * you may not use this file except in compliance with the License.
* deal in the Materials without restriction, including without limitation the * You may obtain a copy of the License at
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Materials, and to permit persons to whom the Materials are
* furnished to do so, subject to the following conditions:
* *
* The above copyright notice(s) and this permission notice shall be included in * http://www.apache.org/licenses/LICENSE-2.0
* all copies or substantial portions of the Materials.
* *
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * Unless required by applicable law or agreed to in writing, software
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * distributed under the License is distributed on an "AS IS" BASIS,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * See the License for the specific language governing permissions and
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * limitations under the License.
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE
* USE OR OTHER DEALINGS IN THE MATERIALS.
* *
* Author: Jon Ashburn <jon@lunarg.com> * Author: Jon Ashburn <jon@lunarg.com>
*/ */

View File

@ -7,7 +7,7 @@
Rights: See end of file. Rights: See end of file.
*/ */
#include <dirent_on_windows.h> #include "dirent_on_windows.h"
#include <errno.h> #include <errno.h>
#include <io.h> /* _findfirst and _findnext set errno iff they return -1 */ #include <io.h> /* _findfirst and _findnext set errno iff they return -1 */
#include <stdlib.h> #include <stdlib.h>

View File

@ -4,24 +4,17 @@
* Copyright (c) 2015 Valve Corporation * Copyright (c) 2015 Valve Corporation
* Copyright (c) 2015 LunarG, Inc. * Copyright (c) 2015 LunarG, Inc.
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Licensed under the Apache License, Version 2.0 (the "License");
* of this software and/or associated documentation files (the "Materials"), to * you may not use this file except in compliance with the License.
* deal in the Materials without restriction, including without limitation the * You may obtain a copy of the License at
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Materials, and to permit persons to whom the Materials are
* furnished to do so, subject to the following conditions:
* *
* The above copyright notice(s) and this permission notice shall be included in * http://www.apache.org/licenses/LICENSE-2.0
* all copies or substantial portions of the Materials.
* *
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * Unless required by applicable law or agreed to in writing, software
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * distributed under the License is distributed on an "AS IS" BASIS,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * See the License for the specific language governing permissions and
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * limitations under the License.
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE
* USE OR OTHER DEALINGS IN THE MATERIALS.
* *
* Author: Jon Ashburn <jon@lunarg.com> * Author: 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) 2014-2016 LunarG, Inc.
* Copyright (C) 2015 Google Inc. * Copyright (C) 2015 Google Inc.
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Licensed under the Apache License, Version 2.0 (the "License");
* of this software and/or associated documentation files (the "Materials"), to * you may not use this file except in compliance with the License.
* deal in the Materials without restriction, including without limitation the * You may obtain a copy of the License at
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Materials, and to permit persons to whom the Materials are
* furnished to do so, subject to the following conditions:
* *
* The above copyright notice(s) and this permission notice shall be included in * http://www.apache.org/licenses/LICENSE-2.0
* all copies or substantial portions of the Materials.
* *
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * Unless required by applicable law or agreed to in writing, software
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * distributed under the License is distributed on an "AS IS" BASIS,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * See the License for the specific language governing permissions and
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * limitations under the License.
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE
* USE OR OTHER DEALINGS IN THE MATERIALS.
* *
* Author: Jon Ashburn <jon@lunarg.com> * Author: Jon Ashburn <jon@lunarg.com>
* Author: Courtney Goeltzenleuchter <courtney@LunarG.com> * Author: Courtney Goeltzenleuchter <courtney@LunarG.com>
@ -36,10 +29,10 @@
#define LOADER_H #define LOADER_H
#include <vulkan/vulkan.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_layer.h>
#include <vulkan/vk_icd.h> #include <vulkan/vk_icd.h>
#include <assert.h> #include <assert.h>
@ -57,13 +50,9 @@
#define VK_PATCH(version) (version & 0xfff) #define VK_PATCH(version) (version & 0xfff)
enum layer_type { enum layer_type {
VK_LAYER_TYPE_DEVICE_EXPLICIT = 0x1, VK_LAYER_TYPE_INSTANCE_EXPLICIT = 0x1,
VK_LAYER_TYPE_INSTANCE_EXPLICIT = 0x2, VK_LAYER_TYPE_INSTANCE_IMPLICIT = 0x2,
VK_LAYER_TYPE_GLOBAL_EXPLICIT = 0x3, // instance and device layer, bitwise VK_LAYER_TYPE_META_EXPLICT = 0x4,
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,
}; };
typedef enum VkStringErrorFlagBits { 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_CODE = 0x80;
static const char UTF8_DATA_BYTE_MASK = 0xC0; static const char UTF8_DATA_BYTE_MASK = 0xC0;
static const char std_validation_names[9][VK_MAX_EXTENSION_NAME_SIZE] = { static const char std_validation_names[8][VK_MAX_EXTENSION_NAME_SIZE] = {
"VK_LAYER_LUNARG_threading", "VK_LAYER_LUNARG_param_checker", "VK_LAYER_GOOGLE_threading", "VK_LAYER_LUNARG_parameter_validation",
"VK_LAYER_LUNARG_device_limits", "VK_LAYER_LUNARG_object_tracker", "VK_LAYER_LUNARG_device_limits", "VK_LAYER_LUNARG_object_tracker",
"VK_LAYER_LUNARG_image", "VK_LAYER_LUNARG_mem_tracker", "VK_LAYER_LUNARG_image", "VK_LAYER_LUNARG_core_validation",
"VK_LAYER_LUNARG_draw_state", "VK_LAYER_LUNARG_swapchain", "VK_LAYER_LUNARG_swapchain", "VK_LAYER_GOOGLE_unique_objects"};
"VK_LAYER_GOOGLE_unique_objects"};
// form of all dynamic lists/arrays // form of all dynamic lists/arrays
// only the list element should be changed // only the list element should be changed
@ -121,12 +109,6 @@ struct loader_name_value {
char value[MAX_STRING_SIZE]; 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 { struct loader_layer_functions {
char str_gipa[MAX_STRING_SIZE]; char str_gipa[MAX_STRING_SIZE];
char str_gdpa[MAX_STRING_SIZE]; char str_gdpa[MAX_STRING_SIZE];
@ -138,6 +120,7 @@ struct loader_layer_properties {
VkLayerProperties info; VkLayerProperties info;
enum layer_type type; enum layer_type type;
char lib_name[MAX_STRING_SIZE]; char lib_name[MAX_STRING_SIZE];
loader_platform_dl_handle lib_handle;
struct loader_layer_functions functions; struct loader_layer_functions functions;
struct loader_extension_list instance_extension_list; struct loader_extension_list instance_extension_list;
struct loader_device_extension_list device_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_properties *list;
}; };
struct loader_layer_library_list {
size_t capacity;
uint32_t count;
struct loader_lib_info *list;
};
struct loader_dispatch_hash_list { struct loader_dispatch_hash_list {
size_t capacity; size_t capacity;
uint32_t count; uint32_t count;
@ -201,7 +178,6 @@ struct loader_icd {
// pointers to find other structs // pointers to find other structs
const struct loader_scanned_icds *this_icd_lib; const struct loader_scanned_icds *this_icd_lib;
const struct loader_instance *this_instance; const struct loader_instance *this_instance;
struct loader_device *logical_device_list; struct loader_device *logical_device_list;
VkInstance instance; // instance object from the icd VkInstance instance; // instance object from the icd
PFN_vkGetDeviceProcAddr GetDeviceProcAddr; PFN_vkGetDeviceProcAddr GetDeviceProcAddr;
@ -248,7 +224,17 @@ struct loader_icd {
PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR
GetPhysicalDeviceXlibPresentationSupportKHR; GetPhysicalDeviceXlibPresentationSupportKHR;
#endif #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; struct loader_icd *next;
}; };
@ -263,25 +249,29 @@ struct loader_icd_libs {
struct loader_instance { struct loader_instance {
VkLayerInstanceDispatchTable *disp; // must be first entry in structure VkLayerInstanceDispatchTable *disp; // must be first entry in structure
uint32_t total_gpu_count; uint32_t total_gpu_count; // count of the next two arrays
struct loader_physical_device *phys_devs; struct loader_physical_device *phys_devs_term;
struct loader_physical_device_tramp *
phys_devs; // tramp wrapped physDev obj list
uint32_t total_icd_count; uint32_t total_icd_count;
struct loader_icd *icds; struct loader_icd *icds;
struct loader_instance *next; struct loader_instance *next;
struct loader_extension_list ext_list; // icds and loaders extensions struct loader_extension_list ext_list; // icds and loaders extensions
struct loader_icd_libs icd_libs; struct loader_icd_libs icd_libs;
struct loader_layer_list instance_layer_list; 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_dispatch_hash_entry disp_hash[MAX_NUM_DEV_EXTS];
struct loader_msg_callback_map_entry *icd_msg_callback_map; struct loader_msg_callback_map_entry *icd_msg_callback_map;
struct loader_layer_list activated_layer_list; struct loader_layer_list activated_layer_list;
bool activated_layers_are_std_val;
VkInstance instance; VkInstance instance; // layers/ICD instance returned to trampoline
bool debug_report_enabled; bool debug_report_enabled;
VkLayerDbgFunctionNode *DbgFunctionHead; VkLayerDbgFunctionNode *DbgFunctionHead;
uint32_t num_tmp_callbacks;
VkDebugReportCallbackCreateInfoEXT *tmp_dbg_create_infos;
VkDebugReportCallbackEXT *tmp_callbacks;
VkAllocationCallbacks alloc_callbacks; VkAllocationCallbacks alloc_callbacks;
@ -304,36 +294,45 @@ struct loader_instance {
#ifdef VK_USE_PLATFORM_ANDROID_KHR #ifdef VK_USE_PLATFORM_ANDROID_KHR
bool wsi_android_surface_enabled; bool wsi_android_surface_enabled;
#endif #endif
bool wsi_display_enabled;
}; };
/* per enumerated PhysicalDevice structure */ /* VkPhysicalDevice requires special treatment by loader. Firstly, terminator
struct loader_physical_device { * 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 VkLayerInstanceDispatchTable *disp; // must be first entry in structure
struct loader_instance *this_instance; 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; struct loader_icd *this_icd;
VkPhysicalDevice phys_dev; // object from 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_struct {
struct loader_instance *instances; 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 { struct loader_scanned_icds {
char *lib_name; char *lib_name;
loader_platform_dl_handle handle; loader_platform_dl_handle handle;
uint32_t api_version; uint32_t api_version;
uint32_t interface_version;
PFN_vkGetInstanceProcAddr GetInstanceProcAddr; PFN_vkGetInstanceProcAddr GetInstanceProcAddr;
PFN_vkCreateInstance CreateInstance; PFN_vkCreateInstance CreateInstance;
PFN_vkEnumerateInstanceExtensionProperties PFN_vkEnumerateInstanceExtensionProperties
@ -344,6 +343,13 @@ static inline struct loader_instance *loader_instance(VkInstance instance) {
return (struct loader_instance *)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) { static inline void loader_set_dispatch(void *obj, const void *data) {
*((const void **)obj) = data; *((const void **)obj) = data;
} }
@ -386,8 +392,18 @@ struct loader_msg_callback_map_entry {
VkDebugReportCallbackEXT loader_obj; 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, void loader_log(const struct loader_instance *inst, VkFlags msg_type,
int32_t msg_code, const char *format, ...); int32_t msg_code, const char *format, ...);
bool compare_vk_extension_properties(const VkExtensionProperties *op1, bool compare_vk_extension_properties(const VkExtensionProperties *op1,
const VkExtensionProperties *op2); const VkExtensionProperties *op2);
@ -403,76 +419,10 @@ VkResult loader_validate_instance_extensions(
const struct loader_layer_list *instance_layer, const struct loader_layer_list *instance_layer,
const VkInstanceCreateInfo *pCreateInfo); 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_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, bool has_vk_extension_property_array(const VkExtensionProperties *vk_ext_prop,
const uint32_t count, const uint32_t count,
const VkExtensionProperties *ext_array); 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, struct loader_extension_list *ext_list,
uint32_t prop_list_count, uint32_t prop_list_count,
const VkExtensionProperties *props); 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, void loader_destroy_generic_list(const struct loader_instance *inst,
struct loader_generic_list *list); 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, void loader_delete_layer_properties(const struct loader_instance *inst,
struct loader_layer_list *layer_list); 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( 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, uint32_t expand_count,
const char expand_names[][VK_MAX_EXTENSION_NAME_SIZE], const char expand_names[][VK_MAX_EXTENSION_NAME_SIZE],
uint32_t *layer_count, char ***ppp_layer_names); uint32_t *layer_count, char const *const **ppp_layer_names);
void loader_unexpand_dev_layer_names(const struct loader_instance *inst, void loader_init_std_validation_props(struct loader_layer_properties *props);
uint32_t layer_count, char **layer_names, void loader_delete_shadow_dev_layer_names(const struct loader_instance *inst,
char **layer_ptr, const VkDeviceCreateInfo *orig,
const VkDeviceCreateInfo *pCreateInfo); VkDeviceCreateInfo *ours);
void loader_unexpand_inst_layer_names(const struct loader_instance *inst, void loader_delete_shadow_inst_layer_names(const struct loader_instance *inst,
uint32_t layer_count, char **layer_names, const VkInstanceCreateInfo *orig,
char **layer_ptr, VkInstanceCreateInfo *ours);
const VkInstanceCreateInfo *pCreateInfo);
void loader_add_to_layer_list(const struct loader_instance *inst, void loader_add_to_layer_list(const struct loader_instance *inst,
struct loader_layer_list *list, struct loader_layer_list *list,
uint32_t prop_list_count, uint32_t prop_list_count,
const struct loader_layer_properties *props); 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, void loader_scanned_icd_clear(const struct loader_instance *inst,
struct loader_icd_libs *icd_libs); struct loader_icd_libs *icd_libs);
void loader_icd_scan(const struct loader_instance *inst, void loader_icd_scan(const struct loader_instance *inst,
struct loader_icd_libs *icds); struct loader_icd_libs *icds);
void loader_layer_scan(const struct loader_instance *inst, void loader_layer_scan(const struct loader_instance *inst,
struct loader_layer_list *instance_layers, struct loader_layer_list *instance_layers);
struct loader_layer_list *device_layers); void loader_implicit_layer_scan(const struct loader_instance *inst,
struct loader_layer_list *instance_layers);
void loader_get_icd_loader_instance_extensions( void loader_get_icd_loader_instance_extensions(
const struct loader_instance *inst, struct loader_icd_libs *icd_libs, const struct loader_instance *inst, struct loader_icd_libs *icd_libs,
struct loader_extension_list *inst_exts); struct loader_extension_list *inst_exts);
struct loader_icd *loader_get_icd_and_device(const VkDevice device, struct loader_icd *loader_get_icd_and_device(const VkDevice device,
struct loader_device **found_dev); 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_dev_ext_gpa(struct loader_instance *inst, const char *funcName);
void *loader_get_dev_ext_trampoline(uint32_t index); void *loader_get_dev_ext_trampoline(uint32_t index);
struct loader_instance *loader_get_instance(const VkInstance instance); 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, void loader_remove_logical_device(const struct loader_instance *inst,
struct loader_icd *icd, struct loader_icd *icd,
struct loader_device *found_dev); 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, void loader_activate_instance_layer_extensions(struct loader_instance *inst,
VkInstance created_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, VkResult
VkSystemAllocationScope allocationScope); 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, VkStringErrorFlags vk_string_validate(const int max_length,
const char *char_array); const char *char_array);

View File

@ -5,24 +5,17 @@
* Copyright (c) 2015-2016 LunarG, Inc. * Copyright (c) 2015-2016 LunarG, Inc.
* Copyright (C) 2016 Google Inc. * Copyright (C) 2016 Google Inc.
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Licensed under the Apache License, Version 2.0 (the "License");
* of this software and/or associated documentation files (the "Materials"), to * you may not use this file except in compliance with the License.
* deal in the Materials without restriction, including without limitation the * You may obtain a copy of the License at
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Materials, and to permit persons to whom the Materials are
* furnished to do so, subject to the following conditions:
* *
* The above copyright notice(s) and this permission notice shall be included in * http://www.apache.org/licenses/LICENSE-2.0
* all copies or substantial portions of the Materials.
* *
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * Unless required by applicable law or agreed to in writing, software
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * distributed under the License is distributed on an "AS IS" BASIS,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * See the License for the specific language governing permissions and
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * limitations under the License.
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE
* USE OR OTHER DEALINGS IN THE MATERIALS.
* *
* Author: Courtney Goeltzenleuchter <courtney@lunarg.com> * Author: Courtney Goeltzenleuchter <courtney@lunarg.com>
* Author: Jon Ashburn <jon@lunarg.com> * Author: Jon Ashburn <jon@lunarg.com>
@ -626,14 +619,36 @@ static inline void loader_init_instance_extension_dispatch_table(
(PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR)gpa( (PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR)gpa(
inst, "vkGetPhysicalDeviceXlibPresentationSupportKHR"); inst, "vkGetPhysicalDeviceXlibPresentationSupportKHR");
#endif #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 * static inline void *
loader_lookup_instance_dispatch_table(const VkLayerInstanceDispatchTable *table, loader_lookup_instance_dispatch_table(const VkLayerInstanceDispatchTable *table,
const char *name) { const char *name, bool *found_name) {
if (!name || name[0] != 'v' || name[1] != 'k') if (!name || name[0] != 'v' || name[1] != 'k') {
*found_name = false;
return NULL; return NULL;
}
*found_name = true;
name += 2; name += 2;
if (!strcmp(name, "DestroyInstance")) if (!strcmp(name, "DestroyInstance"))
return (void *)table->DestroyInstance; return (void *)table->DestroyInstance;
@ -699,6 +714,21 @@ loader_lookup_instance_dispatch_table(const VkLayerInstanceDispatchTable *table,
if (!strcmp(name, "GetPhysicalDeviceXlibPresentationSupportKHR")) if (!strcmp(name, "GetPhysicalDeviceXlibPresentationSupportKHR"))
return (void *)table->GetPhysicalDeviceXlibPresentationSupportKHR; return (void *)table->GetPhysicalDeviceXlibPresentationSupportKHR;
#endif #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")) if (!strcmp(name, "CreateDebugReportCallbackEXT"))
return (void *)table->CreateDebugReportCallbackEXT; return (void *)table->CreateDebugReportCallbackEXT;
if (!strcmp(name, "DestroyDebugReportCallbackEXT")) if (!strcmp(name, "DestroyDebugReportCallbackEXT"))
@ -706,5 +736,6 @@ loader_lookup_instance_dispatch_table(const VkLayerInstanceDispatchTable *table,
if (!strcmp(name, "DebugReportMessageEXT")) if (!strcmp(name, "DebugReportMessageEXT"))
return (void *)table->DebugReportMessageEXT; return (void *)table->DebugReportMessageEXT;
*found_name = false;
return NULL; return NULL;
} }

View File

@ -5,24 +5,17 @@
* Copyright (c) 2015-2016 LunarG, Inc. * Copyright (c) 2015-2016 LunarG, Inc.
* Copyright (C) 2015 Google Inc. * Copyright (C) 2015 Google Inc.
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Licensed under the Apache License, Version 2.0 (the "License");
* of this software and/or associated documentation files (the "Materials"), to * you may not use this file except in compliance with the License.
* deal in the Materials without restriction, including without limitation the * You may obtain a copy of the License at
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Materials, and to permit persons to whom the Materials are
* furnished to do so, subject to the following conditions:
* *
* The above copyright notice(s) and this permission notice shall be included in * http://www.apache.org/licenses/LICENSE-2.0
* all copies or substantial portions of the Materials.
* *
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * Unless required by applicable law or agreed to in writing, software
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * distributed under the License is distributed on an "AS IS" BASIS,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * See the License for the specific language governing permissions and
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * limitations under the License.
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE
* USE OR OTHER DEALINGS IN THE MATERIALS.
* *
* Author: Courtney Goeltzenleuchter <courtney@lunarg.com> * Author: Courtney Goeltzenleuchter <courtney@lunarg.com>
* Author: Jon Ashburn <jon@lunarg.com> * Author: Jon Ashburn <jon@lunarg.com>
@ -37,8 +30,236 @@
#include "loader.h" #include "loader.h"
#include "debug_report.h" #include "debug_report.h"
#include "wsi.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 LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
vkCreateInstance(const VkInstanceCreateInfo *pCreateInfo, vkCreateInstance(const VkInstanceCreateInfo *pCreateInfo,
const VkAllocationCallbacks *pAllocator, const VkAllocationCallbacks *pAllocator,
@ -46,11 +267,10 @@ vkCreateInstance(const VkInstanceCreateInfo *pCreateInfo,
struct loader_instance *ptr_instance = NULL; struct loader_instance *ptr_instance = NULL;
VkInstance created_instance = VK_NULL_HANDLE; VkInstance created_instance = VK_NULL_HANDLE;
VkResult res = VK_ERROR_INITIALIZATION_FAILED; 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); loader_platform_thread_once(&once_init, loader_initialize);
//TODO start handling the pAllocators again
#if 0 #if 0
if (pAllocator) { if (pAllocator) {
ptr_instance = (struct loader_instance *) pAllocator->pfnAllocation( ptr_instance = (struct loader_instance *) pAllocator->pfnAllocation(
@ -77,32 +297,44 @@ vkCreateInstance(const VkInstanceCreateInfo *pCreateInfo,
#endif #endif
/* /*
* Look for a debug report create info structure * Look for one or more debug report create info structures
* and setup a callback if found. * and setup a callback(s) for each one found.
*/ */
while (pNext) { ptr_instance->num_tmp_callbacks = 0;
if (((VkInstanceCreateInfo *)pNext)->sType == ptr_instance->tmp_dbg_create_infos = NULL;
VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT) { ptr_instance->tmp_callbacks = NULL;
instance_callback = (VkDebugReportCallbackEXT)ptr_instance; if (util_CopyDebugReportCreateInfos(pCreateInfo->pNext, pAllocator,
if (util_CreateDebugReportCallback(ptr_instance, pNext, NULL, &ptr_instance->num_tmp_callbacks,
instance_callback)) { &ptr_instance->tmp_dbg_create_infos,
loader_heap_free(ptr_instance, ptr_instance); &ptr_instance->tmp_callbacks)) {
loader_platform_thread_unlock_mutex(&loader_lock); // One or more were found, but allocation failed. Therefore, clean up
return VK_ERROR_OUT_OF_HOST_MEMORY; // 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 /* Due to implicit layers need to get layer list even if
* enabledLayerCount == 0 and VK_INSTANCE_LAYERS is unset. For now always * 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, memset(&ptr_instance->instance_layer_list, 0,
sizeof(ptr_instance->instance_layer_list)); sizeof(ptr_instance->instance_layer_list));
memset(&ptr_instance->device_layer_list, 0, loader_layer_scan(ptr_instance, &ptr_instance->instance_layer_list);
sizeof(ptr_instance->device_layer_list));
loader_layer_scan(ptr_instance, &ptr_instance->instance_layer_list,
&ptr_instance->device_layer_list);
/* validate the app requested layers to be enabled */ /* validate the app requested layers to be enabled */
if (pCreateInfo->enabledLayerCount > 0) { if (pCreateInfo->enabledLayerCount > 0) {
@ -111,8 +343,12 @@ vkCreateInstance(const VkInstanceCreateInfo *pCreateInfo,
pCreateInfo->ppEnabledLayerNames, pCreateInfo->ppEnabledLayerNames,
&ptr_instance->instance_layer_list); &ptr_instance->instance_layer_list);
if (res != VK_SUCCESS) { if (res != VK_SUCCESS) {
util_DestroyDebugReportCallback(ptr_instance, instance_callback, util_DestroyDebugReportCallbacks(ptr_instance, pAllocator,
NULL); 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_heap_free(ptr_instance, ptr_instance);
loader_platform_thread_unlock_mutex(&loader_lock); loader_platform_thread_unlock_mutex(&loader_lock);
return res; return res;
@ -120,21 +356,11 @@ vkCreateInstance(const VkInstanceCreateInfo *pCreateInfo,
} }
/* convert any meta layers to the actual layers makes a copy of layer name*/ /* convert any meta layers to the actual layers makes a copy of layer name*/
uint32_t saved_layer_count = pCreateInfo->enabledLayerCount; VkInstanceCreateInfo ici = *pCreateInfo;
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;
loader_expand_layer_names( loader_expand_layer_names(
ptr_instance, std_validation_str, ptr_instance, std_validation_str,
sizeof(std_validation_names) / sizeof(std_validation_names[0]), sizeof(std_validation_names) / sizeof(std_validation_names[0]),
std_validation_names, (uint32_t *)&pCreateInfo->enabledLayerCount, std_validation_names, &ici.enabledLayerCount, &ici.ppEnabledLayerNames);
(char ***)&pCreateInfo->ppEnabledLayerNames);
/* Scan/discover all ICD libraries */ /* Scan/discover all ICD libraries */
memset(&ptr_instance->icd_libs, 0, sizeof(ptr_instance->icd_libs)); 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); ptr_instance, &ptr_instance->icd_libs, &ptr_instance->ext_list);
res = loader_validate_instance_extensions( res = loader_validate_instance_extensions(
ptr_instance, &ptr_instance->ext_list, ptr_instance, &ptr_instance->ext_list,
&ptr_instance->instance_layer_list, pCreateInfo); &ptr_instance->instance_layer_list, &ici);
if (res != VK_SUCCESS) { if (res != VK_SUCCESS) {
loader_unexpand_inst_layer_names(ptr_instance, saved_layer_count, loader_delete_shadow_inst_layer_names(ptr_instance, pCreateInfo, &ici);
saved_layer_names, saved_layer_ptr,
pCreateInfo);
loader_delete_layer_properties(ptr_instance,
&ptr_instance->device_layer_list);
loader_delete_layer_properties(ptr_instance, loader_delete_layer_properties(ptr_instance,
&ptr_instance->instance_layer_list); &ptr_instance->instance_layer_list);
loader_scanned_icd_clear(ptr_instance, &ptr_instance->icd_libs); loader_scanned_icd_clear(ptr_instance, &ptr_instance->icd_libs);
loader_destroy_generic_list( loader_destroy_generic_list(
ptr_instance, ptr_instance,
(struct loader_generic_list *)&ptr_instance->ext_list); (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_platform_thread_unlock_mutex(&loader_lock);
loader_heap_free(ptr_instance, ptr_instance); loader_heap_free(ptr_instance, ptr_instance);
return res; return res;
@ -168,18 +395,20 @@ vkCreateInstance(const VkInstanceCreateInfo *pCreateInfo,
loader_heap_alloc(ptr_instance, sizeof(VkLayerInstanceDispatchTable), loader_heap_alloc(ptr_instance, sizeof(VkLayerInstanceDispatchTable),
VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
if (ptr_instance->disp == NULL) { if (ptr_instance->disp == NULL) {
loader_unexpand_inst_layer_names(ptr_instance, saved_layer_count, loader_delete_shadow_inst_layer_names(ptr_instance, pCreateInfo, &ici);
saved_layer_names, saved_layer_ptr,
pCreateInfo);
loader_delete_layer_properties(ptr_instance,
&ptr_instance->device_layer_list);
loader_delete_layer_properties(ptr_instance, loader_delete_layer_properties(ptr_instance,
&ptr_instance->instance_layer_list); &ptr_instance->instance_layer_list);
loader_scanned_icd_clear(ptr_instance, &ptr_instance->icd_libs); loader_scanned_icd_clear(ptr_instance, &ptr_instance->icd_libs);
loader_destroy_generic_list( loader_destroy_generic_list(
ptr_instance, ptr_instance,
(struct loader_generic_list *)&ptr_instance->ext_list); (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_platform_thread_unlock_mutex(&loader_lock);
loader_heap_free(ptr_instance, ptr_instance); loader_heap_free(ptr_instance, ptr_instance);
return VK_ERROR_OUT_OF_HOST_MEMORY; return VK_ERROR_OUT_OF_HOST_MEMORY;
@ -189,14 +418,10 @@ vkCreateInstance(const VkInstanceCreateInfo *pCreateInfo,
loader.instances = ptr_instance; loader.instances = ptr_instance;
/* activate any layers on instance chain */ /* 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); &ptr_instance->instance_layer_list);
if (res != VK_SUCCESS) { if (res != VK_SUCCESS) {
loader_unexpand_inst_layer_names(ptr_instance, saved_layer_count, loader_delete_shadow_inst_layer_names(ptr_instance, pCreateInfo, &ici);
saved_layer_names, saved_layer_ptr,
pCreateInfo);
loader_delete_layer_properties(ptr_instance,
&ptr_instance->device_layer_list);
loader_delete_layer_properties(ptr_instance, loader_delete_layer_properties(ptr_instance,
&ptr_instance->instance_layer_list); &ptr_instance->instance_layer_list);
loader_scanned_icd_clear(ptr_instance, &ptr_instance->icd_libs); loader_scanned_icd_clear(ptr_instance, &ptr_instance->icd_libs);
@ -204,7 +429,12 @@ vkCreateInstance(const VkInstanceCreateInfo *pCreateInfo,
ptr_instance, ptr_instance,
(struct loader_generic_list *)&ptr_instance->ext_list); (struct loader_generic_list *)&ptr_instance->ext_list);
loader.instances = ptr_instance->next; 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_platform_thread_unlock_mutex(&loader_lock);
loader_heap_free(ptr_instance, ptr_instance->disp); loader_heap_free(ptr_instance, ptr_instance->disp);
loader_heap_free(ptr_instance, ptr_instance); loader_heap_free(ptr_instance, ptr_instance);
@ -212,12 +442,12 @@ vkCreateInstance(const VkInstanceCreateInfo *pCreateInfo,
} }
created_instance = (VkInstance)ptr_instance; 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); &created_instance);
if (res == VK_SUCCESS) { if (res == VK_SUCCESS) {
wsi_create_instance(ptr_instance, pCreateInfo); wsi_create_instance(ptr_instance, &ici);
debug_report_create_instance(ptr_instance, pCreateInfo); debug_report_create_instance(ptr_instance, &ici);
*pInstance = created_instance; *pInstance = created_instance;
@ -233,10 +463,10 @@ vkCreateInstance(const VkInstanceCreateInfo *pCreateInfo,
} }
/* Remove temporary debug_report callback */ /* Remove temporary debug_report callback */
util_DestroyDebugReportCallback(ptr_instance, instance_callback, NULL); util_DestroyDebugReportCallbacks(ptr_instance, pAllocator,
loader_unexpand_inst_layer_names(ptr_instance, saved_layer_count, ptr_instance->num_tmp_callbacks,
saved_layer_names, saved_layer_ptr, ptr_instance->tmp_callbacks);
pCreateInfo); loader_delete_shadow_inst_layer_names(ptr_instance, pCreateInfo, &ici);
loader_platform_thread_unlock_mutex(&loader_lock); loader_platform_thread_unlock_mutex(&loader_lock);
return res; return res;
} }
@ -246,16 +476,41 @@ vkDestroyInstance(VkInstance instance,
const VkAllocationCallbacks *pAllocator) { const VkAllocationCallbacks *pAllocator) {
const VkLayerInstanceDispatchTable *disp; const VkLayerInstanceDispatchTable *disp;
struct loader_instance *ptr_instance = NULL; struct loader_instance *ptr_instance = NULL;
bool callback_setup = false;
if (instance == VK_NULL_HANDLE) {
return;
}
disp = loader_get_instance_dispatch(instance); disp = loader_get_instance_dispatch(instance);
loader_platform_thread_lock_mutex(&loader_lock); 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); 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); 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->disp);
loader_heap_free(ptr_instance, ptr_instance); loader_heap_free(ptr_instance, ptr_instance);
loader_platform_thread_unlock_mutex(&loader_lock); loader_platform_thread_unlock_mutex(&loader_lock);
@ -266,31 +521,79 @@ vkEnumeratePhysicalDevices(VkInstance instance, uint32_t *pPhysicalDeviceCount,
VkPhysicalDevice *pPhysicalDevices) { VkPhysicalDevice *pPhysicalDevices) {
const VkLayerInstanceDispatchTable *disp; const VkLayerInstanceDispatchTable *disp;
VkResult res; VkResult res;
uint32_t count, i;
struct loader_instance *inst;
disp = loader_get_instance_dispatch(instance); disp = loader_get_instance_dispatch(instance);
loader_platform_thread_lock_mutex(&loader_lock); loader_platform_thread_lock_mutex(&loader_lock);
res = disp->EnumeratePhysicalDevices(instance, pPhysicalDeviceCount, res = disp->EnumeratePhysicalDevices(instance, pPhysicalDeviceCount,
pPhysicalDevices); 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); loader_platform_thread_unlock_mutex(&loader_lock);
return res; return res;
} }
LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
vkGetPhysicalDeviceFeatures(VkPhysicalDevice gpu, vkGetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice,
VkPhysicalDeviceFeatures *pFeatures) { VkPhysicalDeviceFeatures *pFeatures) {
const VkLayerInstanceDispatchTable *disp; const VkLayerInstanceDispatchTable *disp;
VkPhysicalDevice unwrapped_phys_dev =
disp = loader_get_instance_dispatch(gpu); loader_unwrap_physical_device(physicalDevice);
disp->GetPhysicalDeviceFeatures(gpu, pFeatures); disp = loader_get_instance_dispatch(physicalDevice);
disp->GetPhysicalDeviceFeatures(unwrapped_phys_dev, pFeatures);
} }
LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
vkGetPhysicalDeviceFormatProperties(VkPhysicalDevice gpu, VkFormat format, vkGetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice,
VkFormat format,
VkFormatProperties *pFormatInfo) { VkFormatProperties *pFormatInfo) {
const VkLayerInstanceDispatchTable *disp; const VkLayerInstanceDispatchTable *disp;
VkPhysicalDevice unwrapped_pd =
disp = loader_get_instance_dispatch(gpu); loader_unwrap_physical_device(physicalDevice);
disp->GetPhysicalDeviceFormatProperties(gpu, format, pFormatInfo); disp = loader_get_instance_dispatch(physicalDevice);
disp->GetPhysicalDeviceFormatProperties(unwrapped_pd, format, pFormatInfo);
} }
LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
@ -299,49 +602,124 @@ vkGetPhysicalDeviceImageFormatProperties(
VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags,
VkImageFormatProperties *pImageFormatProperties) { VkImageFormatProperties *pImageFormatProperties) {
const VkLayerInstanceDispatchTable *disp; const VkLayerInstanceDispatchTable *disp;
VkPhysicalDevice unwrapped_phys_dev =
loader_unwrap_physical_device(physicalDevice);
disp = loader_get_instance_dispatch(physicalDevice); disp = loader_get_instance_dispatch(physicalDevice);
return disp->GetPhysicalDeviceImageFormatProperties( return disp->GetPhysicalDeviceImageFormatProperties(
physicalDevice, format, type, tiling, usage, flags, unwrapped_phys_dev, format, type, tiling, usage, flags,
pImageFormatProperties); pImageFormatProperties);
} }
LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
vkGetPhysicalDeviceProperties(VkPhysicalDevice gpu, vkGetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice,
VkPhysicalDeviceProperties *pProperties) { VkPhysicalDeviceProperties *pProperties) {
const VkLayerInstanceDispatchTable *disp; const VkLayerInstanceDispatchTable *disp;
VkPhysicalDevice unwrapped_phys_dev =
disp = loader_get_instance_dispatch(gpu); loader_unwrap_physical_device(physicalDevice);
disp->GetPhysicalDeviceProperties(gpu, pProperties); disp = loader_get_instance_dispatch(physicalDevice);
disp->GetPhysicalDeviceProperties(unwrapped_phys_dev, pProperties);
} }
LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
vkGetPhysicalDeviceQueueFamilyProperties( vkGetPhysicalDeviceQueueFamilyProperties(
VkPhysicalDevice gpu, uint32_t *pQueueFamilyPropertyCount, VkPhysicalDevice physicalDevice, uint32_t *pQueueFamilyPropertyCount,
VkQueueFamilyProperties *pQueueProperties) { VkQueueFamilyProperties *pQueueProperties) {
const VkLayerInstanceDispatchTable *disp; const VkLayerInstanceDispatchTable *disp;
VkPhysicalDevice unwrapped_phys_dev =
disp = loader_get_instance_dispatch(gpu); loader_unwrap_physical_device(physicalDevice);
disp->GetPhysicalDeviceQueueFamilyProperties(gpu, pQueueFamilyPropertyCount, disp = loader_get_instance_dispatch(physicalDevice);
pQueueProperties); disp->GetPhysicalDeviceQueueFamilyProperties(
unwrapped_phys_dev, pQueueFamilyPropertyCount, pQueueProperties);
} }
LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceMemoryProperties( LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceMemoryProperties(
VkPhysicalDevice gpu, VkPhysicalDeviceMemoryProperties *pMemoryProperties) { VkPhysicalDevice physicalDevice,
VkPhysicalDeviceMemoryProperties *pMemoryProperties) {
const VkLayerInstanceDispatchTable *disp; const VkLayerInstanceDispatchTable *disp;
VkPhysicalDevice unwrapped_phys_dev =
disp = loader_get_instance_dispatch(gpu); loader_unwrap_physical_device(physicalDevice);
disp->GetPhysicalDeviceMemoryProperties(gpu, pMemoryProperties); disp = loader_get_instance_dispatch(physicalDevice);
disp->GetPhysicalDeviceMemoryProperties(unwrapped_phys_dev,
pMemoryProperties);
} }
LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
vkCreateDevice(VkPhysicalDevice gpu, const VkDeviceCreateInfo *pCreateInfo, vkCreateDevice(VkPhysicalDevice physicalDevice,
const VkDeviceCreateInfo *pCreateInfo,
const VkAllocationCallbacks *pAllocator, VkDevice *pDevice) { const VkAllocationCallbacks *pAllocator, VkDevice *pDevice) {
VkResult res; 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); 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); loader_platform_thread_unlock_mutex(&loader_lock);
return res; return res;
@ -352,6 +730,10 @@ vkDestroyDevice(VkDevice device, const VkAllocationCallbacks *pAllocator) {
const VkLayerDispatchTable *disp; const VkLayerDispatchTable *disp;
struct loader_device *dev; struct loader_device *dev;
if (device == VK_NULL_HANDLE) {
return;
}
loader_platform_thread_lock_mutex(&loader_lock); loader_platform_thread_lock_mutex(&loader_lock);
struct loader_icd *icd = loader_get_icd_and_device(device, &dev); struct loader_icd *icd = loader_get_icd_and_device(device, &dev);
@ -370,7 +752,9 @@ vkEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice,
const char *pLayerName, const char *pLayerName,
uint32_t *pPropertyCount, uint32_t *pPropertyCount,
VkExtensionProperties *pProperties) { 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); loader_platform_thread_lock_mutex(&loader_lock);
@ -383,10 +767,78 @@ vkEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice,
disp = loader_get_instance_dispatch(physicalDevice); disp = loader_get_instance_dispatch(physicalDevice);
res = disp->EnumerateDeviceExtensionProperties( res = disp->EnumerateDeviceExtensionProperties(
physicalDevice, NULL, pPropertyCount, pProperties); phys_dev->phys_dev, NULL, pPropertyCount, pProperties);
} else { } 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); loader_platform_thread_unlock_mutex(&loader_lock);
@ -397,16 +849,82 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL
vkEnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice, vkEnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice,
uint32_t *pPropertyCount, uint32_t *pPropertyCount,
VkLayerProperties *pProperties) { 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); loader_platform_thread_lock_mutex(&loader_lock);
/* Don't dispatch this call down the instance chain, want all device layers /* Don't dispatch this call down the instance chain, want all device layers
enumerated and instance chain may not contain all device layers */ enumerated and instance chain may not contain all device layers */
res = loader_EnumerateDeviceLayerProperties(physicalDevice, pPropertyCount, // TODO re-evaluate the above statement we maybe able to start calling
pProperties); // down the chain
phys_dev = (struct loader_physical_device_tramp *)physicalDevice;
const struct loader_instance *inst = phys_dev->this_instance;
uint32_t count = inst->activated_layer_list.count;
if (inst->activated_layers_are_std_val)
count = count - std_val_count + 1;
if (pProperties == NULL) {
*pPropertyCount = count;
loader_platform_thread_unlock_mutex(&loader_lock);
return VK_SUCCESS;
}
/* make sure to enumerate standard_validation if that is what was used
at the instance layer enablement */
if (inst->activated_layers_are_std_val) {
enabled_layers = &layers_list;
enabled_layers->count = count;
enabled_layers->capacity = enabled_layers->count *
sizeof(struct loader_layer_properties);
enabled_layers->list = loader_heap_alloc(inst, enabled_layers->capacity,
VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE);
if (!enabled_layers->list)
return VK_ERROR_OUT_OF_HOST_MEMORY;
uint32_t j = 0;
for (uint32_t i = 0; i < inst->activated_layer_list.count; j++) {
if (loader_find_layer_name_array(
inst->activated_layer_list.list[i].info.layerName,
std_val_count, std_validation_names)) {
struct loader_layer_properties props;
loader_init_std_validation_props(&props);
loader_copy_layer_properties(inst,
&enabled_layers->list[j], &props);
i += std_val_count;
}
else {
loader_copy_layer_properties(inst,
&enabled_layers->list[j],
&inst->activated_layer_list.list[i++]);
}
}
}
else {
enabled_layers = (struct loader_layer_list *) &inst->activated_layer_list;
}
copy_size = (*pPropertyCount < count) ? *pPropertyCount : count;
for (uint32_t i = 0; i < copy_size; i++) {
memcpy(&pProperties[i], &(enabled_layers->list[i].info),
sizeof(VkLayerProperties));
}
*pPropertyCount = copy_size;
if (inst->activated_layers_are_std_val)
loader_delete_layer_properties(inst, enabled_layers);
if (copy_size < count) {
loader_platform_thread_unlock_mutex(&loader_lock);
return VK_INCOMPLETE;
}
loader_platform_thread_unlock_mutex(&loader_lock); loader_platform_thread_unlock_mutex(&loader_lock);
return res; return VK_SUCCESS;
} }
LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL LOADER_EXPORT VKAPI_ATTR void VKAPI_CALL
@ -577,12 +1095,13 @@ vkGetPhysicalDeviceSparseImageFormatProperties(
VkImageTiling tiling, uint32_t *pPropertyCount, VkImageTiling tiling, uint32_t *pPropertyCount,
VkSparseImageFormatProperties *pProperties) { VkSparseImageFormatProperties *pProperties) {
const VkLayerInstanceDispatchTable *disp; const VkLayerInstanceDispatchTable *disp;
VkPhysicalDevice unwrapped_phys_dev =
loader_unwrap_physical_device(physicalDevice);
disp = loader_get_instance_dispatch(physicalDevice); disp = loader_get_instance_dispatch(physicalDevice);
disp->GetPhysicalDeviceSparseImageFormatProperties( disp->GetPhysicalDeviceSparseImageFormatProperties(
physicalDevice, format, type, samples, usage, tiling, pPropertyCount, unwrapped_phys_dev, format, type, samples, usage, tiling,
pProperties); pPropertyCount, pProperties);
} }
LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL

View File

@ -4,24 +4,17 @@
* Copyright (c) 2015-2016 Valve Corporation * Copyright (c) 2015-2016 Valve Corporation
* Copyright (c) 2015-2016 LunarG, Inc. * Copyright (c) 2015-2016 LunarG, Inc.
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Licensed under the Apache License, Version 2.0 (the "License");
* of this software and/or associated documentation files (the "Materials"), to * you may not use this file except in compliance with the License.
* deal in the Materials without restriction, including without limitation the * You may obtain a copy of the License at
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Materials, and to permit persons to whom the Materials are
* furnished to do so, subject to the following conditions:
* *
* The above copyright notice(s) and this permission notice shall be included in * http://www.apache.org/licenses/LICENSE-2.0
* all copies or substantial portions of the Materials.
* *
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * Unless required by applicable law or agreed to in writing, software
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * distributed under the License is distributed on an "AS IS" BASIS,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * See the License for the specific language governing permissions and
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * limitations under the License.
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE
* USE OR OTHER DEALINGS IN THE MATERIALS.
* *
* Author: Ian Elliot <ian@lunarg.com> * Author: Ian Elliot <ian@lunarg.com>
* Author: Jon Ashburn <jon@lunarg.com> * Author: Jon Ashburn <jon@lunarg.com>
@ -107,13 +100,19 @@
#define DEFAULT_VK_ELAYERS_INFO \ #define DEFAULT_VK_ELAYERS_INFO \
LOCAL_ELAYERS_INFO \ LOCAL_ELAYERS_INFO \
"/" SYSCONFDIR VULKAN_ELAYERCONF_DIR ":" \ "/" SYSCONFDIR VULKAN_ELAYERCONF_DIR ":" \
"/usr/" DATADIR VULKAN_ELAYERCONF_DIR ":" "/usr/" DATADIR VULKAN_ELAYERCONF_DIR
#define DEFAULT_VK_ILAYERS_INFO \ #define DEFAULT_VK_ILAYERS_INFO \
LOCAL_ILAYERS_INFO \ LOCAL_ILAYERS_INFO \
"/" SYSCONFDIR VULKAN_ILAYERCONF_DIR ":" \ "/" SYSCONFDIR VULKAN_ILAYERCONF_DIR ":" \
"/usr/" DATADIR VULKAN_ILAYERCONF_DIR "/usr/" DATADIR VULKAN_ILAYERCONF_DIR
#define DEFAULT_VK_LAYERS_PATH "" #define DEFAULT_VK_LAYERS_PATH ""
#if !defined(LAYERS_SOURCE_PATH)
#define LAYERS_SOURCE_PATH NULL
#endif
#define LAYERS_PATH_ENV "VK_LAYER_PATH" #define 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: // C99:
#define PRINTF_SIZE_T_SPECIFIER "%zu" #define PRINTF_SIZE_T_SPECIFIER "%zu"
@ -251,12 +250,19 @@ using namespace std;
#define DEFAULT_VK_REGISTRY_HIVE HKEY_LOCAL_MACHINE #define DEFAULT_VK_REGISTRY_HIVE HKEY_LOCAL_MACHINE
#define DEFAULT_VK_DRIVERS_INFO "SOFTWARE\\Khronos\\Vulkan\\Drivers" #define DEFAULT_VK_DRIVERS_INFO "SOFTWARE\\Khronos\\Vulkan\\Drivers"
// TODO: Are these the correct paths // 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_ELAYERS_INFO "SOFTWARE\\Khronos\\Vulkan\\ExplicitLayers"
#define DEFAULT_VK_ILAYERS_INFO "SOFTWARE\\Khronos\\Vulkan\\ImplicitLayers" #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 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" #define PRINTF_SIZE_T_SPECIFIER "%Iu"
// File IO // 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 Valve Corporation
* Copyright (c) 2015-2016 LunarG, Inc. * Copyright (c) 2015-2016 LunarG, Inc.
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Licensed under the Apache License, Version 2.0 (the "License");
* of this software and/or associated documentation files (the "Materials"), to * you may not use this file except in compliance with the License.
* deal in the Materials without restriction, including without limitation the * You may obtain a copy of the License at
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Materials, and to permit persons to whom the Materials are
* furnished to do so, subject to the following conditions:
* *
* The above copyright notice(s) and this permission notice shall be included in * http://www.apache.org/licenses/LICENSE-2.0
* all copies or substantial portions of the Materials.
* *
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * Unless required by applicable law or agreed to in writing, software
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * distributed under the License is distributed on an "AS IS" BASIS,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * See the License for the specific language governing permissions and
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * limitations under the License.
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE
* USE OR OTHER DEALINGS IN THE MATERIALS.
* *
* Author: Ian Elliott <ian@lunarg.com> * Author: Ian Elliott <ian@lunarg.com>
* *
@ -31,90 +24,114 @@
bool wsi_swapchain_instance_gpa(struct loader_instance *ptr_instance, bool wsi_swapchain_instance_gpa(struct loader_instance *ptr_instance,
const char *name, void **addr); 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, void wsi_create_instance(struct loader_instance *ptr_instance,
const VkInstanceCreateInfo *pCreateInfo); const VkInstanceCreateInfo *pCreateInfo);
bool wsi_unsupported_instance_extension(const VkExtensionProperties *ext_prop);
VKAPI_ATTR void VKAPI_CALL VKAPI_ATTR void VKAPI_CALL
loader_DestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface, terminator_DestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface,
const VkAllocationCallbacks *pAllocator); const VkAllocationCallbacks *pAllocator);
VKAPI_ATTR VkResult VKAPI_CALL VKAPI_ATTR VkResult VKAPI_CALL
loader_GetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevice physicalDevice, terminator_GetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevice physicalDevice,
uint32_t queueFamilyIndex, uint32_t queueFamilyIndex,
VkSurfaceKHR surface, VkSurfaceKHR surface,
VkBool32 *pSupported); VkBool32 *pSupported);
VKAPI_ATTR VkResult VKAPI_CALL loader_GetPhysicalDeviceSurfaceCapabilitiesKHR( VKAPI_ATTR VkResult VKAPI_CALL
terminator_GetPhysicalDeviceSurfaceCapabilitiesKHR(
VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, VkPhysicalDevice physicalDevice, VkSurfaceKHR surface,
VkSurfaceCapabilitiesKHR *pSurfaceCapabilities); VkSurfaceCapabilitiesKHR *pSurfaceCapabilities);
VKAPI_ATTR VkResult VKAPI_CALL VKAPI_ATTR VkResult VKAPI_CALL terminator_GetPhysicalDeviceSurfaceFormatsKHR(
loader_GetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice physicalDevice, VkPhysicalDevice physicalDevice, VkSurfaceKHR surface,
VkSurfaceKHR surface, uint32_t *pSurfaceFormatCount, VkSurfaceFormatKHR *pSurfaceFormats);
uint32_t *pSurfaceFormatCount,
VkSurfaceFormatKHR *pSurfaceFormats);
VKAPI_ATTR VkResult VKAPI_CALL VKAPI_ATTR VkResult VKAPI_CALL
loader_GetPhysicalDeviceSurfacePresentModesKHR(VkPhysicalDevice physicalDevice, terminator_GetPhysicalDeviceSurfacePresentModesKHR(
VkSurfaceKHR surface, VkPhysicalDevice physicalDevice, VkSurfaceKHR surface,
uint32_t *pPresentModeCount, uint32_t *pPresentModeCount, VkPresentModeKHR *pPresentModes);
VkPresentModeKHR *pPresentModes);
#ifdef VK_USE_PLATFORM_WIN32_KHR #ifdef VK_USE_PLATFORM_WIN32_KHR
VKAPI_ATTR VkResult VKAPI_CALL VKAPI_ATTR VkResult VKAPI_CALL
loader_CreateWin32SurfaceKHR(VkInstance instance, terminator_CreateWin32SurfaceKHR(VkInstance instance,
const VkWin32SurfaceCreateInfoKHR *pCreateInfo, const VkWin32SurfaceCreateInfoKHR *pCreateInfo,
const VkAllocationCallbacks *pAllocator, const VkAllocationCallbacks *pAllocator,
VkSurfaceKHR *pSurface); VkSurfaceKHR *pSurface);
VKAPI_ATTR VkBool32 VKAPI_CALL VKAPI_ATTR VkBool32 VKAPI_CALL
loader_GetPhysicalDeviceWin32PresentationSupportKHR( terminator_GetPhysicalDeviceWin32PresentationSupportKHR(
VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex); VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex);
#endif #endif
#ifdef VK_USE_PLATFORM_MIR_KHR #ifdef VK_USE_PLATFORM_MIR_KHR
VKAPI_ATTR VkResult VKAPI_CALL VKAPI_ATTR VkResult VKAPI_CALL
loader_CreateMirSurfaceKHR(VkInstance instance, terminator_CreateMirSurfaceKHR(VkInstance instance,
const VkMirSurfaceCreateInfoKHR *pCreateInfo, const VkMirSurfaceCreateInfoKHR *pCreateInfo,
const VkAllocationCallbacks *pAllocator, const VkAllocationCallbacks *pAllocator,
VkSurfaceKHR *pSurface); VkSurfaceKHR *pSurface);
VKAPI_ATTR VkBool32 VKAPI_CALL VKAPI_ATTR VkBool32 VKAPI_CALL
loader_GetPhysicalDeviceMirPresentationSupportKHR( terminator_GetPhysicalDeviceMirPresentationSupportKHR(
VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex,
MirConnection *connection); MirConnection *connection);
#endif #endif
#ifdef VK_USE_PLATFORM_WAYLAND_KHR #ifdef VK_USE_PLATFORM_WAYLAND_KHR
VKAPI_ATTR VkResult VKAPI_CALL VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateWaylandSurfaceKHR(
loader_CreateWaylandSurfaceKHR(VkInstance instance, VkInstance instance, const VkWaylandSurfaceCreateInfoKHR *pCreateInfo,
const VkWaylandSurfaceCreateInfoKHR *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface);
const VkAllocationCallbacks *pAllocator,
VkSurfaceKHR *pSurface);
VKAPI_ATTR VkBool32 VKAPI_CALL VKAPI_ATTR VkBool32 VKAPI_CALL
loader_GetPhysicalDeviceWaylandPresentationSupportKHR( terminator_GetPhysicalDeviceWaylandPresentationSupportKHR(
VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex,
struct wl_display *display); struct wl_display *display);
#endif #endif
#ifdef VK_USE_PLATFORM_XCB_KHR #ifdef VK_USE_PLATFORM_XCB_KHR
VKAPI_ATTR VkResult VKAPI_CALL VKAPI_ATTR VkResult VKAPI_CALL
loader_CreateXcbSurfaceKHR(VkInstance instance, terminator_CreateXcbSurfaceKHR(VkInstance instance,
const VkXcbSurfaceCreateInfoKHR *pCreateInfo, const VkXcbSurfaceCreateInfoKHR *pCreateInfo,
const VkAllocationCallbacks *pAllocator, const VkAllocationCallbacks *pAllocator,
VkSurfaceKHR *pSurface); VkSurfaceKHR *pSurface);
VKAPI_ATTR VkBool32 VKAPI_CALL VKAPI_ATTR VkBool32 VKAPI_CALL
loader_GetPhysicalDeviceXcbPresentationSupportKHR( terminator_GetPhysicalDeviceXcbPresentationSupportKHR(
VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex,
xcb_connection_t *connection, xcb_visualid_t visual_id); xcb_connection_t *connection, xcb_visualid_t visual_id);
#endif #endif
#ifdef VK_USE_PLATFORM_XLIB_KHR #ifdef VK_USE_PLATFORM_XLIB_KHR
VKAPI_ATTR VkResult VKAPI_CALL VKAPI_ATTR VkResult VKAPI_CALL
loader_CreateXlibSurfaceKHR(VkInstance instance, terminator_CreateXlibSurfaceKHR(VkInstance instance,
const VkXlibSurfaceCreateInfoKHR *pCreateInfo, const VkXlibSurfaceCreateInfoKHR *pCreateInfo,
const VkAllocationCallbacks *pAllocator, const VkAllocationCallbacks *pAllocator,
VkSurfaceKHR *pSurface); VkSurfaceKHR *pSurface);
VKAPI_ATTR VkBool32 VKAPI_CALL VKAPI_ATTR VkBool32 VKAPI_CALL
loader_GetPhysicalDeviceXlibPresentationSupportKHR( terminator_GetPhysicalDeviceXlibPresentationSupportKHR(
VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, Display *dpy, VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, Display *dpy,
VisualID visualID); VisualID visualID);
#endif #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 Valve Corporation
* Copyright (c) 2015-2016 LunarG, Inc. * Copyright (c) 2015-2016 LunarG, Inc.
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Licensed under the Apache License, Version 2.0 (the "License");
* of this software and/or associated documentation files (the "Materials"), to * you may not use this file except in compliance with the License.
* deal in the Materials without restriction, including without limitation the * You may obtain a copy of the License at
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Materials, and to permit persons to whom the Materials are
* furnished to do so, subject to the following conditions:
* *
* The above copyright notice(s) and this permission notice shall be included in * http://www.apache.org/licenses/LICENSE-2.0
* all copies or substantial portions of the Materials.
* *
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * Unless required by applicable law or agreed to in writing, software
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * distributed under the License is distributed on an "AS IS" BASIS,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * See the License for the specific language governing permissions and
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * limitations under the License.
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE
* USE OR OTHER DEALINGS IN THE MATERIALS.
* *
*/ */
#ifndef VKICD_H #ifndef VKICD_H
#define 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 * The ICD must reserve space for a pointer for the loader's dispatch
* table, at the start of <each object>. * table, at the start of <each object>.
@ -40,7 +39,7 @@
#define ICD_LOADER_MAGIC 0x01CDC0DE #define ICD_LOADER_MAGIC 0x01CDC0DE
typedef union _VK_LOADER_DATA { typedef union {
uintptr_t loaderMagic; uintptr_t loaderMagic;
void *loaderData; void *loaderData;
} VK_LOADER_DATA; } 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 * Windows and Linux ICDs will treat VkSurfaceKHR as a pointer to a struct that
* contains the platform-specific connection and surface information. * contains the platform-specific connection and surface information.
*/ */
typedef enum _VkIcdWsiPlatform { typedef enum {
VK_ICD_WSI_PLATFORM_MIR, VK_ICD_WSI_PLATFORM_MIR,
VK_ICD_WSI_PLATFORM_WAYLAND, VK_ICD_WSI_PLATFORM_WAYLAND,
VK_ICD_WSI_PLATFORM_WIN32, VK_ICD_WSI_PLATFORM_WIN32,
VK_ICD_WSI_PLATFORM_XCB, VK_ICD_WSI_PLATFORM_XCB,
VK_ICD_WSI_PLATFORM_XLIB, VK_ICD_WSI_PLATFORM_XLIB,
VK_ICD_WSI_PLATFORM_DISPLAY
} VkIcdWsiPlatform; } VkIcdWsiPlatform;
typedef struct _VkIcdSurfaceBase { typedef struct {
VkIcdWsiPlatform platform; VkIcdWsiPlatform platform;
} VkIcdSurfaceBase; } VkIcdSurfaceBase;
#ifdef VK_USE_PLATFORM_MIR_KHR #ifdef VK_USE_PLATFORM_MIR_KHR
typedef struct _VkIcdSurfaceMir { typedef struct {
VkIcdSurfaceBase base; VkIcdSurfaceBase base;
MirConnection *connection; MirConnection *connection;
MirSurface *mirSurface; MirSurface *mirSurface;
@ -80,7 +80,7 @@ typedef struct _VkIcdSurfaceMir {
#endif // VK_USE_PLATFORM_MIR_KHR #endif // VK_USE_PLATFORM_MIR_KHR
#ifdef VK_USE_PLATFORM_WAYLAND_KHR #ifdef VK_USE_PLATFORM_WAYLAND_KHR
typedef struct _VkIcdSurfaceWayland { typedef struct {
VkIcdSurfaceBase base; VkIcdSurfaceBase base;
struct wl_display *display; struct wl_display *display;
struct wl_surface *surface; struct wl_surface *surface;
@ -88,7 +88,7 @@ typedef struct _VkIcdSurfaceWayland {
#endif // VK_USE_PLATFORM_WAYLAND_KHR #endif // VK_USE_PLATFORM_WAYLAND_KHR
#ifdef VK_USE_PLATFORM_WIN32_KHR #ifdef VK_USE_PLATFORM_WIN32_KHR
typedef struct _VkIcdSurfaceWin32 { typedef struct {
VkIcdSurfaceBase base; VkIcdSurfaceBase base;
HINSTANCE hinstance; HINSTANCE hinstance;
HWND hwnd; HWND hwnd;
@ -96,7 +96,7 @@ typedef struct _VkIcdSurfaceWin32 {
#endif // VK_USE_PLATFORM_WIN32_KHR #endif // VK_USE_PLATFORM_WIN32_KHR
#ifdef VK_USE_PLATFORM_XCB_KHR #ifdef VK_USE_PLATFORM_XCB_KHR
typedef struct _VkIcdSurfaceXcb { typedef struct {
VkIcdSurfaceBase base; VkIcdSurfaceBase base;
xcb_connection_t *connection; xcb_connection_t *connection;
xcb_window_t window; xcb_window_t window;
@ -104,11 +104,21 @@ typedef struct _VkIcdSurfaceXcb {
#endif // VK_USE_PLATFORM_XCB_KHR #endif // VK_USE_PLATFORM_XCB_KHR
#ifdef VK_USE_PLATFORM_XLIB_KHR #ifdef VK_USE_PLATFORM_XLIB_KHR
typedef struct _VkIcdSurfaceXlib { typedef struct {
VkIcdSurfaceBase base; VkIcdSurfaceBase base;
Display *dpy; Display *dpy;
Window window; Window window;
} VkIcdSurfaceXlib; } VkIcdSurfaceXlib;
#endif // VK_USE_PLATFORM_XLIB_KHR #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 #endif // VKICD_H

View File

@ -6,24 +6,17 @@
* Copyright (c) 2015-2016 Valve Corporation * Copyright (c) 2015-2016 Valve Corporation
* Copyright (c) 2015-2016 LunarG, Inc. * Copyright (c) 2015-2016 LunarG, Inc.
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Licensed under the Apache License, Version 2.0 (the "License");
* of this software and/or associated documentation files (the "Materials"), to * you may not use this file except in compliance with the License.
* deal in the Materials without restriction, including without limitation the * You may obtain a copy of the License at
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Materials, and to permit persons to whom the Materials are
* furnished to do so, subject to the following conditions:
* *
* The above copyright notice(s) and this permission notice shall be included in * http://www.apache.org/licenses/LICENSE-2.0
* all copies or substantial portions of the Materials.
* *
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * Unless required by applicable law or agreed to in writing, software
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * distributed under the License is distributed on an "AS IS" BASIS,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * See the License for the specific language governing permissions and
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * limitations under the License.
* 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.
* *
*/ */
@ -34,7 +27,6 @@
#pragma once #pragma once
#include "vulkan.h" #include "vulkan.h"
#include "vk_lunarg_debug_marker.h"
#if defined(__GNUC__) && __GNUC__ >= 4 #if defined(__GNUC__) && __GNUC__ >= 4
#define VK_LAYER_EXPORT __attribute__((visibility("default"))) #define VK_LAYER_EXPORT __attribute__((visibility("default")))
#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590) #elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)
@ -226,46 +218,35 @@ typedef struct VkLayerInstanceDispatchTable_ {
#ifdef VK_USE_PLATFORM_ANDROID_KHR #ifdef VK_USE_PLATFORM_ANDROID_KHR
PFN_vkCreateAndroidSurfaceKHR CreateAndroidSurfaceKHR; PFN_vkCreateAndroidSurfaceKHR CreateAndroidSurfaceKHR;
#endif #endif
PFN_vkGetPhysicalDeviceDisplayPropertiesKHR
GetPhysicalDeviceDisplayPropertiesKHR;
PFN_vkGetPhysicalDeviceDisplayPlanePropertiesKHR
GetPhysicalDeviceDisplayPlanePropertiesKHR;
PFN_vkGetDisplayPlaneSupportedDisplaysKHR
GetDisplayPlaneSupportedDisplaysKHR;
PFN_vkGetDisplayModePropertiesKHR
GetDisplayModePropertiesKHR;
PFN_vkCreateDisplayModeKHR
CreateDisplayModeKHR;
PFN_vkGetDisplayPlaneCapabilitiesKHR
GetDisplayPlaneCapabilitiesKHR;
PFN_vkCreateDisplayPlaneSurfaceKHR
CreateDisplayPlaneSurfaceKHR;
} VkLayerInstanceDispatchTable; } 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 // 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_ { typedef enum VkLayerFunction_ {
VK_LAYER_LINK_INFO = 0, VK_LAYER_LINK_INFO = 0,
VK_LAYER_DEVICE_INFO = 1, VK_LOADER_DATA_CALLBACK = 1
VK_LAYER_INSTANCE_INFO = 2
} VkLayerFunction; } 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_ { typedef struct VkLayerInstanceLink_ {
struct VkLayerInstanceLink_ *pNext; struct VkLayerInstanceLink_ *pNext;
PFN_vkGetInstanceProcAddr pfnNextGetInstanceProcAddr; PFN_vkGetInstanceProcAddr pfnNextGetInstanceProcAddr;
@ -283,13 +264,18 @@ typedef struct VkLayerDeviceInfo_ {
PFN_vkGetInstanceProcAddr pfnNextGetInstanceProcAddr; PFN_vkGetInstanceProcAddr pfnNextGetInstanceProcAddr;
} VkLayerDeviceInfo; } VkLayerDeviceInfo;
typedef VkResult (VKAPI_PTR *PFN_vkSetInstanceLoaderData)(VkInstance instance,
void *object);
typedef VkResult (VKAPI_PTR *PFN_vkSetDeviceLoaderData)(VkDevice device,
void *object);
typedef struct { typedef struct {
VkStructureType sType; // VK_STRUCTURE_TYPE_LAYER_INSTANCE_CREATE_INFO VkStructureType sType; // VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO
const void *pNext; const void *pNext;
VkLayerFunction function; VkLayerFunction function;
union { union {
VkLayerInstanceLink *pLayerInfo; VkLayerInstanceLink *pLayerInfo;
VkLayerInstanceInfo instanceInfo; PFN_vkSetInstanceLoaderData pfnSetInstanceLoaderData;
} u; } u;
} VkLayerInstanceCreateInfo; } VkLayerInstanceCreateInfo;
@ -300,14 +286,12 @@ typedef struct VkLayerDeviceLink_ {
} VkLayerDeviceLink; } VkLayerDeviceLink;
typedef struct { typedef struct {
VkStructureType sType; // VK_STRUCTURE_TYPE_LAYER_DEVICE_CREATE_INFO VkStructureType sType; // VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO
const void *pNext; const void *pNext;
VkLayerFunction function; VkLayerFunction function;
union { union {
VkLayerDeviceLink *pLayerInfo; VkLayerDeviceLink *pLayerInfo;
VkLayerDeviceInfo deviceInfo; PFN_vkSetDeviceLoaderData pfnSetDeviceLoaderData;
} u; } u;
} VkLayerDeviceCreateInfo; } VkLayerDeviceCreateInfo;
// ------------------------------------------------------------------------------------------------
// API functions

View File

@ -4,29 +4,22 @@
/* /*
** Copyright (c) 2014-2015 The Khronos Group Inc. ** Copyright (c) 2014-2015 The Khronos Group Inc.
** **
** Permission is hereby granted, free of charge, to any person obtaining a ** Licensed under the Apache License, Version 2.0 (the "License");
** copy of this software and/or associated documentation files (the ** you may not use this file except in compliance with the License.
** "Materials"), to deal in the Materials without restriction, including ** You may obtain a copy of the License at
** without limitation the rights to use, copy, modify, merge, publish,
** distribute, sublicense, and/or sell copies of the Materials, and to
** permit persons to whom the Materials are furnished to do so, subject to
** the following conditions:
** **
** The above copyright notice and this permission notice shall be included ** http://www.apache.org/licenses/LICENSE-2.0
** in all copies or substantial portions of the Materials.
** **
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ** Unless required by applicable law or agreed to in writing, software
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ** distributed under the License is distributed on an "AS IS" BASIS,
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY ** See the License for the specific language governing permissions and
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, ** limitations under the License.
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
*/ */
#ifndef __VK_PLATFORM_H__ #ifndef VK_PLATFORM_H_
#define __VK_PLATFORM_H__ #define VK_PLATFORM_H_
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
@ -124,4 +117,4 @@ extern "C"
#include <xcb/xcb.h> #include <xcb/xcb.h>
#endif #endif
#endif // __VK_PLATFORM_H__ #endif

View File

@ -6,24 +6,17 @@
* Copyright (c) 2015-2016 Valve Corporation * Copyright (c) 2015-2016 Valve Corporation
* Copyright (c) 2015-2016 LunarG, Inc. * Copyright (c) 2015-2016 LunarG, Inc.
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Licensed under the Apache License, Version 2.0 (the "License");
* of this software and/or associated documentation files (the "Materials"), to * you may not use this file except in compliance with the License.
* deal in the Materials without restriction, including without limitation the * You may obtain a copy of the License at
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Materials, and to permit persons to whom the Materials are
* furnished to do so, subject to the following conditions:
* *
* The above copyright notice(s) and this permission notice shall be included in * http://www.apache.org/licenses/LICENSE-2.0
* all copies or substantial portions of the Materials.
* *
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * Unless required by applicable law or agreed to in writing, software
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * distributed under the License is distributed on an "AS IS" BASIS,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * See the License for the specific language governing permissions and
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * limitations under the License.
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE
* USE OR OTHER DEALINGS IN THE MATERIALS.
*/ */
#ifndef VK_SDK_PLATFORM_H #ifndef VK_SDK_PLATFORM_H

View File

@ -1,5 +1,5 @@
#ifndef __vulkan_h_ #ifndef VULKAN_H_
#define __vulkan_h_ 1 #define VULKAN_H_ 1
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@ -8,24 +8,17 @@ extern "C" {
/* /*
** Copyright (c) 2015-2016 The Khronos Group Inc. ** Copyright (c) 2015-2016 The Khronos Group Inc.
** **
** Permission is hereby granted, free of charge, to any person obtaining a ** Licensed under the Apache License, Version 2.0 (the "License");
** copy of this software and/or associated documentation files (the ** you may not use this file except in compliance with the License.
** "Materials"), to deal in the Materials without restriction, including ** You may obtain a copy of the License at
** without limitation the rights to use, copy, modify, merge, publish,
** distribute, sublicense, and/or sell copies of the Materials, and to
** permit persons to whom the Materials are furnished to do so, subject to
** the following conditions:
** **
** The above copyright notice and this permission notice shall be included ** http://www.apache.org/licenses/LICENSE-2.0
** in all copies or substantial portions of the Materials.
** **
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ** Unless required by applicable law or agreed to in writing, software
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ** distributed under the License is distributed on an "AS IS" BASIS,
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY ** See the License for the specific language governing permissions and
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, ** limitations under the License.
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
*/ */
/* /*
@ -40,12 +33,18 @@ extern "C" {
#define VK_MAKE_VERSION(major, minor, patch) \ #define VK_MAKE_VERSION(major, minor, patch) \
(((major) << 22) | ((minor) << 12) | (patch)) (((major) << 22) | ((minor) << 12) | (patch))
// Vulkan API version supported by this file // 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, 3) //#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_MAJOR(version) ((uint32_t)(version) >> 22)
#define VK_VERSION_MINOR(version) (((uint32_t)(version) >> 12) & 0x3ff) #define VK_VERSION_MINOR(version) (((uint32_t)(version) >> 12) & 0x3ff)
#define VK_VERSION_PATCH(version) ((uint32_t)(version) & 0xfff) #define VK_VERSION_PATCH(version) ((uint32_t)(version) & 0xfff)
// Version of this file
#define VK_HEADER_VERSION 16
#define VK_NULL_HANDLE 0 #define VK_NULL_HANDLE 0
@ -142,6 +141,7 @@ typedef enum VkResult {
VK_ERROR_OUT_OF_DATE_KHR = -1000001004, VK_ERROR_OUT_OF_DATE_KHR = -1000001004,
VK_ERROR_INCOMPATIBLE_DISPLAY_KHR = -1000003001, VK_ERROR_INCOMPATIBLE_DISPLAY_KHR = -1000003001,
VK_ERROR_VALIDATION_FAILED_EXT = -1000011001, VK_ERROR_VALIDATION_FAILED_EXT = -1000011001,
VK_ERROR_INVALID_SHADER_NV = -1000012000,
VK_RESULT_BEGIN_RANGE = VK_ERROR_FORMAT_NOT_SUPPORTED, VK_RESULT_BEGIN_RANGE = VK_ERROR_FORMAT_NOT_SUPPORTED,
VK_RESULT_END_RANGE = VK_INCOMPLETE, VK_RESULT_END_RANGE = VK_INCOMPLETE,
VK_RESULT_RANGE_SIZE = (VK_INCOMPLETE - VK_ERROR_FORMAT_NOT_SUPPORTED + 1), VK_RESULT_RANGE_SIZE = (VK_INCOMPLETE - VK_ERROR_FORMAT_NOT_SUPPORTED + 1),
@ -209,7 +209,11 @@ typedef enum VkStructureType {
VK_STRUCTURE_TYPE_MIR_SURFACE_CREATE_INFO_KHR = 1000007000, VK_STRUCTURE_TYPE_MIR_SURFACE_CREATE_INFO_KHR = 1000007000,
VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR = 1000008000, VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR = 1000008000,
VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR = 1000009000, 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_BEGIN_RANGE = VK_STRUCTURE_TYPE_APPLICATION_INFO,
VK_STRUCTURE_TYPE_END_RANGE = VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_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), 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 { typedef enum VkFilter {
VK_FILTER_NEAREST = 0, VK_FILTER_NEAREST = 0,
VK_FILTER_LINEAR = 1, VK_FILTER_LINEAR = 1,
VK_FILTER_CUBIC_IMG = 1000015000,
VK_FILTER_BEGIN_RANGE = VK_FILTER_NEAREST, VK_FILTER_BEGIN_RANGE = VK_FILTER_NEAREST,
VK_FILTER_END_RANGE = VK_FILTER_LINEAR, VK_FILTER_END_RANGE = VK_FILTER_LINEAR,
VK_FILTER_RANGE_SIZE = (VK_FILTER_LINEAR - VK_FILTER_NEAREST + 1), 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_CLAMP_TO_BORDER = 3,
VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE = 4, VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE = 4,
VK_SAMPLER_ADDRESS_MODE_BEGIN_RANGE = VK_SAMPLER_ADDRESS_MODE_REPEAT, 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_END_RANGE = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER,
VK_SAMPLER_ADDRESS_MODE_RANGE_SIZE = (VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE - VK_SAMPLER_ADDRESS_MODE_REPEAT + 1), 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 VK_SAMPLER_ADDRESS_MODE_MAX_ENUM = 0x7FFFFFFF
} VkSamplerAddressMode; } VkSamplerAddressMode;
@ -808,6 +813,8 @@ typedef enum VkFormatFeatureFlagBits {
VK_FORMAT_FEATURE_BLIT_SRC_BIT = 0x00000400, VK_FORMAT_FEATURE_BLIT_SRC_BIT = 0x00000400,
VK_FORMAT_FEATURE_BLIT_DST_BIT = 0x00000800, VK_FORMAT_FEATURE_BLIT_DST_BIT = 0x00000800,
VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT = 0x00001000, 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; } VkFormatFeatureFlagBits;
typedef VkFlags VkFormatFeatureFlags; typedef VkFlags VkFormatFeatureFlags;
@ -820,6 +827,7 @@ typedef enum VkImageUsageFlagBits {
VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT = 0x00000020, VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT = 0x00000020,
VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT = 0x00000040, VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT = 0x00000040,
VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT = 0x00000080, VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT = 0x00000080,
VK_IMAGE_USAGE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkImageUsageFlagBits; } VkImageUsageFlagBits;
typedef VkFlags VkImageUsageFlags; typedef VkFlags VkImageUsageFlags;
@ -829,6 +837,7 @@ typedef enum VkImageCreateFlagBits {
VK_IMAGE_CREATE_SPARSE_ALIASED_BIT = 0x00000004, VK_IMAGE_CREATE_SPARSE_ALIASED_BIT = 0x00000004,
VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT = 0x00000008, VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT = 0x00000008,
VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT = 0x00000010, VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT = 0x00000010,
VK_IMAGE_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkImageCreateFlagBits; } VkImageCreateFlagBits;
typedef VkFlags VkImageCreateFlags; typedef VkFlags VkImageCreateFlags;
@ -840,6 +849,7 @@ typedef enum VkSampleCountFlagBits {
VK_SAMPLE_COUNT_16_BIT = 0x00000010, VK_SAMPLE_COUNT_16_BIT = 0x00000010,
VK_SAMPLE_COUNT_32_BIT = 0x00000020, VK_SAMPLE_COUNT_32_BIT = 0x00000020,
VK_SAMPLE_COUNT_64_BIT = 0x00000040, VK_SAMPLE_COUNT_64_BIT = 0x00000040,
VK_SAMPLE_COUNT_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkSampleCountFlagBits; } VkSampleCountFlagBits;
typedef VkFlags VkSampleCountFlags; typedef VkFlags VkSampleCountFlags;
@ -848,6 +858,7 @@ typedef enum VkQueueFlagBits {
VK_QUEUE_COMPUTE_BIT = 0x00000002, VK_QUEUE_COMPUTE_BIT = 0x00000002,
VK_QUEUE_TRANSFER_BIT = 0x00000004, VK_QUEUE_TRANSFER_BIT = 0x00000004,
VK_QUEUE_SPARSE_BINDING_BIT = 0x00000008, VK_QUEUE_SPARSE_BINDING_BIT = 0x00000008,
VK_QUEUE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkQueueFlagBits; } VkQueueFlagBits;
typedef VkFlags VkQueueFlags; typedef VkFlags VkQueueFlags;
@ -857,11 +868,13 @@ typedef enum VkMemoryPropertyFlagBits {
VK_MEMORY_PROPERTY_HOST_COHERENT_BIT = 0x00000004, VK_MEMORY_PROPERTY_HOST_COHERENT_BIT = 0x00000004,
VK_MEMORY_PROPERTY_HOST_CACHED_BIT = 0x00000008, VK_MEMORY_PROPERTY_HOST_CACHED_BIT = 0x00000008,
VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT = 0x00000010, VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT = 0x00000010,
VK_MEMORY_PROPERTY_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkMemoryPropertyFlagBits; } VkMemoryPropertyFlagBits;
typedef VkFlags VkMemoryPropertyFlags; typedef VkFlags VkMemoryPropertyFlags;
typedef enum VkMemoryHeapFlagBits { typedef enum VkMemoryHeapFlagBits {
VK_MEMORY_HEAP_DEVICE_LOCAL_BIT = 0x00000001, VK_MEMORY_HEAP_DEVICE_LOCAL_BIT = 0x00000001,
VK_MEMORY_HEAP_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkMemoryHeapFlagBits; } VkMemoryHeapFlagBits;
typedef VkFlags VkMemoryHeapFlags; typedef VkFlags VkMemoryHeapFlags;
typedef VkFlags VkDeviceCreateFlags; typedef VkFlags VkDeviceCreateFlags;
@ -885,6 +898,7 @@ typedef enum VkPipelineStageFlagBits {
VK_PIPELINE_STAGE_HOST_BIT = 0x00004000, VK_PIPELINE_STAGE_HOST_BIT = 0x00004000,
VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT = 0x00008000, VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT = 0x00008000,
VK_PIPELINE_STAGE_ALL_COMMANDS_BIT = 0x00010000, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT = 0x00010000,
VK_PIPELINE_STAGE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkPipelineStageFlagBits; } VkPipelineStageFlagBits;
typedef VkFlags VkPipelineStageFlags; typedef VkFlags VkPipelineStageFlags;
typedef VkFlags VkMemoryMapFlags; typedef VkFlags VkMemoryMapFlags;
@ -894,6 +908,7 @@ typedef enum VkImageAspectFlagBits {
VK_IMAGE_ASPECT_DEPTH_BIT = 0x00000002, VK_IMAGE_ASPECT_DEPTH_BIT = 0x00000002,
VK_IMAGE_ASPECT_STENCIL_BIT = 0x00000004, VK_IMAGE_ASPECT_STENCIL_BIT = 0x00000004,
VK_IMAGE_ASPECT_METADATA_BIT = 0x00000008, VK_IMAGE_ASPECT_METADATA_BIT = 0x00000008,
VK_IMAGE_ASPECT_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkImageAspectFlagBits; } VkImageAspectFlagBits;
typedef VkFlags VkImageAspectFlags; typedef VkFlags VkImageAspectFlags;
@ -901,16 +916,19 @@ typedef enum VkSparseImageFormatFlagBits {
VK_SPARSE_IMAGE_FORMAT_SINGLE_MIPTAIL_BIT = 0x00000001, VK_SPARSE_IMAGE_FORMAT_SINGLE_MIPTAIL_BIT = 0x00000001,
VK_SPARSE_IMAGE_FORMAT_ALIGNED_MIP_SIZE_BIT = 0x00000002, VK_SPARSE_IMAGE_FORMAT_ALIGNED_MIP_SIZE_BIT = 0x00000002,
VK_SPARSE_IMAGE_FORMAT_NONSTANDARD_BLOCK_SIZE_BIT = 0x00000004, VK_SPARSE_IMAGE_FORMAT_NONSTANDARD_BLOCK_SIZE_BIT = 0x00000004,
VK_SPARSE_IMAGE_FORMAT_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkSparseImageFormatFlagBits; } VkSparseImageFormatFlagBits;
typedef VkFlags VkSparseImageFormatFlags; typedef VkFlags VkSparseImageFormatFlags;
typedef enum VkSparseMemoryBindFlagBits { typedef enum VkSparseMemoryBindFlagBits {
VK_SPARSE_MEMORY_BIND_METADATA_BIT = 0x00000001, VK_SPARSE_MEMORY_BIND_METADATA_BIT = 0x00000001,
VK_SPARSE_MEMORY_BIND_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkSparseMemoryBindFlagBits; } VkSparseMemoryBindFlagBits;
typedef VkFlags VkSparseMemoryBindFlags; typedef VkFlags VkSparseMemoryBindFlags;
typedef enum VkFenceCreateFlagBits { typedef enum VkFenceCreateFlagBits {
VK_FENCE_CREATE_SIGNALED_BIT = 0x00000001, VK_FENCE_CREATE_SIGNALED_BIT = 0x00000001,
VK_FENCE_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkFenceCreateFlagBits; } VkFenceCreateFlagBits;
typedef VkFlags VkFenceCreateFlags; typedef VkFlags VkFenceCreateFlags;
typedef VkFlags VkSemaphoreCreateFlags; 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_CONTROL_SHADER_PATCHES_BIT = 0x00000100,
VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_EVALUATION_SHADER_INVOCATIONS_BIT = 0x00000200, VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_EVALUATION_SHADER_INVOCATIONS_BIT = 0x00000200,
VK_QUERY_PIPELINE_STATISTIC_COMPUTE_SHADER_INVOCATIONS_BIT = 0x00000400, VK_QUERY_PIPELINE_STATISTIC_COMPUTE_SHADER_INVOCATIONS_BIT = 0x00000400,
VK_QUERY_PIPELINE_STATISTIC_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkQueryPipelineStatisticFlagBits; } VkQueryPipelineStatisticFlagBits;
typedef VkFlags VkQueryPipelineStatisticFlags; typedef VkFlags VkQueryPipelineStatisticFlags;
@ -937,6 +956,7 @@ typedef enum VkQueryResultFlagBits {
VK_QUERY_RESULT_WAIT_BIT = 0x00000002, VK_QUERY_RESULT_WAIT_BIT = 0x00000002,
VK_QUERY_RESULT_WITH_AVAILABILITY_BIT = 0x00000004, VK_QUERY_RESULT_WITH_AVAILABILITY_BIT = 0x00000004,
VK_QUERY_RESULT_PARTIAL_BIT = 0x00000008, VK_QUERY_RESULT_PARTIAL_BIT = 0x00000008,
VK_QUERY_RESULT_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkQueryResultFlagBits; } VkQueryResultFlagBits;
typedef VkFlags VkQueryResultFlags; typedef VkFlags VkQueryResultFlags;
@ -944,6 +964,7 @@ typedef enum VkBufferCreateFlagBits {
VK_BUFFER_CREATE_SPARSE_BINDING_BIT = 0x00000001, VK_BUFFER_CREATE_SPARSE_BINDING_BIT = 0x00000001,
VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT = 0x00000002, VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT = 0x00000002,
VK_BUFFER_CREATE_SPARSE_ALIASED_BIT = 0x00000004, VK_BUFFER_CREATE_SPARSE_ALIASED_BIT = 0x00000004,
VK_BUFFER_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkBufferCreateFlagBits; } VkBufferCreateFlagBits;
typedef VkFlags VkBufferCreateFlags; typedef VkFlags VkBufferCreateFlags;
@ -957,6 +978,7 @@ typedef enum VkBufferUsageFlagBits {
VK_BUFFER_USAGE_INDEX_BUFFER_BIT = 0x00000040, VK_BUFFER_USAGE_INDEX_BUFFER_BIT = 0x00000040,
VK_BUFFER_USAGE_VERTEX_BUFFER_BIT = 0x00000080, VK_BUFFER_USAGE_VERTEX_BUFFER_BIT = 0x00000080,
VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT = 0x00000100, VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT = 0x00000100,
VK_BUFFER_USAGE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkBufferUsageFlagBits; } VkBufferUsageFlagBits;
typedef VkFlags VkBufferUsageFlags; typedef VkFlags VkBufferUsageFlags;
typedef VkFlags VkBufferViewCreateFlags; typedef VkFlags VkBufferViewCreateFlags;
@ -968,6 +990,7 @@ typedef enum VkPipelineCreateFlagBits {
VK_PIPELINE_CREATE_DISABLE_OPTIMIZATION_BIT = 0x00000001, VK_PIPELINE_CREATE_DISABLE_OPTIMIZATION_BIT = 0x00000001,
VK_PIPELINE_CREATE_ALLOW_DERIVATIVES_BIT = 0x00000002, VK_PIPELINE_CREATE_ALLOW_DERIVATIVES_BIT = 0x00000002,
VK_PIPELINE_CREATE_DERIVATIVE_BIT = 0x00000004, VK_PIPELINE_CREATE_DERIVATIVE_BIT = 0x00000004,
VK_PIPELINE_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkPipelineCreateFlagBits; } VkPipelineCreateFlagBits;
typedef VkFlags VkPipelineCreateFlags; typedef VkFlags VkPipelineCreateFlags;
typedef VkFlags VkPipelineShaderStageCreateFlags; typedef VkFlags VkPipelineShaderStageCreateFlags;
@ -979,8 +1002,9 @@ typedef enum VkShaderStageFlagBits {
VK_SHADER_STAGE_GEOMETRY_BIT = 0x00000008, VK_SHADER_STAGE_GEOMETRY_BIT = 0x00000008,
VK_SHADER_STAGE_FRAGMENT_BIT = 0x00000010, VK_SHADER_STAGE_FRAGMENT_BIT = 0x00000010,
VK_SHADER_STAGE_COMPUTE_BIT = 0x00000020, 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_ALL = 0x7FFFFFFF,
VK_SHADER_STAGE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkShaderStageFlagBits; } VkShaderStageFlagBits;
typedef VkFlags VkPipelineVertexInputStateCreateFlags; typedef VkFlags VkPipelineVertexInputStateCreateFlags;
typedef VkFlags VkPipelineInputAssemblyStateCreateFlags; typedef VkFlags VkPipelineInputAssemblyStateCreateFlags;
@ -992,7 +1016,8 @@ typedef enum VkCullModeFlagBits {
VK_CULL_MODE_NONE = 0, VK_CULL_MODE_NONE = 0,
VK_CULL_MODE_FRONT_BIT = 0x00000001, VK_CULL_MODE_FRONT_BIT = 0x00000001,
VK_CULL_MODE_BACK_BIT = 0x00000002, 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; } VkCullModeFlagBits;
typedef VkFlags VkCullModeFlags; typedef VkFlags VkCullModeFlags;
typedef VkFlags VkPipelineMultisampleStateCreateFlags; typedef VkFlags VkPipelineMultisampleStateCreateFlags;
@ -1004,6 +1029,7 @@ typedef enum VkColorComponentFlagBits {
VK_COLOR_COMPONENT_G_BIT = 0x00000002, VK_COLOR_COMPONENT_G_BIT = 0x00000002,
VK_COLOR_COMPONENT_B_BIT = 0x00000004, VK_COLOR_COMPONENT_B_BIT = 0x00000004,
VK_COLOR_COMPONENT_A_BIT = 0x00000008, VK_COLOR_COMPONENT_A_BIT = 0x00000008,
VK_COLOR_COMPONENT_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkColorComponentFlagBits; } VkColorComponentFlagBits;
typedef VkFlags VkColorComponentFlags; typedef VkFlags VkColorComponentFlags;
typedef VkFlags VkPipelineDynamicStateCreateFlags; typedef VkFlags VkPipelineDynamicStateCreateFlags;
@ -1014,6 +1040,7 @@ typedef VkFlags VkDescriptorSetLayoutCreateFlags;
typedef enum VkDescriptorPoolCreateFlagBits { typedef enum VkDescriptorPoolCreateFlagBits {
VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT = 0x00000001, VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT = 0x00000001,
VK_DESCRIPTOR_POOL_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkDescriptorPoolCreateFlagBits; } VkDescriptorPoolCreateFlagBits;
typedef VkFlags VkDescriptorPoolCreateFlags; typedef VkFlags VkDescriptorPoolCreateFlags;
typedef VkFlags VkDescriptorPoolResetFlags; typedef VkFlags VkDescriptorPoolResetFlags;
@ -1022,6 +1049,7 @@ typedef VkFlags VkRenderPassCreateFlags;
typedef enum VkAttachmentDescriptionFlagBits { typedef enum VkAttachmentDescriptionFlagBits {
VK_ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT = 0x00000001, VK_ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT = 0x00000001,
VK_ATTACHMENT_DESCRIPTION_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkAttachmentDescriptionFlagBits; } VkAttachmentDescriptionFlagBits;
typedef VkFlags VkAttachmentDescriptionFlags; typedef VkFlags VkAttachmentDescriptionFlags;
typedef VkFlags VkSubpassDescriptionFlags; typedef VkFlags VkSubpassDescriptionFlags;
@ -1044,22 +1072,26 @@ typedef enum VkAccessFlagBits {
VK_ACCESS_HOST_WRITE_BIT = 0x00004000, VK_ACCESS_HOST_WRITE_BIT = 0x00004000,
VK_ACCESS_MEMORY_READ_BIT = 0x00008000, VK_ACCESS_MEMORY_READ_BIT = 0x00008000,
VK_ACCESS_MEMORY_WRITE_BIT = 0x00010000, VK_ACCESS_MEMORY_WRITE_BIT = 0x00010000,
VK_ACCESS_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkAccessFlagBits; } VkAccessFlagBits;
typedef VkFlags VkAccessFlags; typedef VkFlags VkAccessFlags;
typedef enum VkDependencyFlagBits { typedef enum VkDependencyFlagBits {
VK_DEPENDENCY_BY_REGION_BIT = 0x00000001, VK_DEPENDENCY_BY_REGION_BIT = 0x00000001,
VK_DEPENDENCY_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkDependencyFlagBits; } VkDependencyFlagBits;
typedef VkFlags VkDependencyFlags; typedef VkFlags VkDependencyFlags;
typedef enum VkCommandPoolCreateFlagBits { typedef enum VkCommandPoolCreateFlagBits {
VK_COMMAND_POOL_CREATE_TRANSIENT_BIT = 0x00000001, VK_COMMAND_POOL_CREATE_TRANSIENT_BIT = 0x00000001,
VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT = 0x00000002, VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT = 0x00000002,
VK_COMMAND_POOL_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkCommandPoolCreateFlagBits; } VkCommandPoolCreateFlagBits;
typedef VkFlags VkCommandPoolCreateFlags; typedef VkFlags VkCommandPoolCreateFlags;
typedef enum VkCommandPoolResetFlagBits { typedef enum VkCommandPoolResetFlagBits {
VK_COMMAND_POOL_RESET_RELEASE_RESOURCES_BIT = 0x00000001, VK_COMMAND_POOL_RESET_RELEASE_RESOURCES_BIT = 0x00000001,
VK_COMMAND_POOL_RESET_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkCommandPoolResetFlagBits; } VkCommandPoolResetFlagBits;
typedef VkFlags VkCommandPoolResetFlags; typedef VkFlags VkCommandPoolResetFlags;
@ -1067,23 +1099,27 @@ typedef enum VkCommandBufferUsageFlagBits {
VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT = 0x00000001, VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT = 0x00000001,
VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT = 0x00000002, VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT = 0x00000002,
VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT = 0x00000004, VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT = 0x00000004,
VK_COMMAND_BUFFER_USAGE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkCommandBufferUsageFlagBits; } VkCommandBufferUsageFlagBits;
typedef VkFlags VkCommandBufferUsageFlags; typedef VkFlags VkCommandBufferUsageFlags;
typedef enum VkQueryControlFlagBits { typedef enum VkQueryControlFlagBits {
VK_QUERY_CONTROL_PRECISE_BIT = 0x00000001, VK_QUERY_CONTROL_PRECISE_BIT = 0x00000001,
VK_QUERY_CONTROL_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkQueryControlFlagBits; } VkQueryControlFlagBits;
typedef VkFlags VkQueryControlFlags; typedef VkFlags VkQueryControlFlags;
typedef enum VkCommandBufferResetFlagBits { typedef enum VkCommandBufferResetFlagBits {
VK_COMMAND_BUFFER_RESET_RELEASE_RESOURCES_BIT = 0x00000001, VK_COMMAND_BUFFER_RESET_RELEASE_RESOURCES_BIT = 0x00000001,
VK_COMMAND_BUFFER_RESET_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
} VkCommandBufferResetFlagBits; } VkCommandBufferResetFlagBits;
typedef VkFlags VkCommandBufferResetFlags; typedef VkFlags VkCommandBufferResetFlags;
typedef enum VkStencilFaceFlagBits { typedef enum VkStencilFaceFlagBits {
VK_STENCIL_FACE_FRONT_BIT = 0x00000001, VK_STENCIL_FACE_FRONT_BIT = 0x00000001,
VK_STENCIL_FACE_BACK_BIT = 0x00000002, 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; } VkStencilFaceFlagBits;
typedef VkFlags VkStencilFaceFlags; typedef VkFlags VkStencilFaceFlags;
@ -3136,14 +3172,15 @@ VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSurfaceKHR)
#define VK_KHR_SURFACE_SPEC_VERSION 25 #define VK_KHR_SURFACE_SPEC_VERSION 25
#define VK_KHR_SURFACE_EXTENSION_NAME "VK_KHR_surface" #define VK_KHR_SURFACE_EXTENSION_NAME "VK_KHR_surface"
#define VK_COLORSPACE_SRGB_NONLINEAR_KHR VK_COLOR_SPACE_SRGB_NONLINEAR_KHR
typedef enum VkColorSpaceKHR { typedef enum VkColorSpaceKHR {
VK_COLORSPACE_SRGB_NONLINEAR_KHR = 0, VK_COLOR_SPACE_SRGB_NONLINEAR_KHR = 0,
VK_COLORSPACE_BEGIN_RANGE = VK_COLORSPACE_SRGB_NONLINEAR_KHR, VK_COLOR_SPACE_BEGIN_RANGE_KHR = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR,
VK_COLORSPACE_END_RANGE = VK_COLORSPACE_SRGB_NONLINEAR_KHR, VK_COLOR_SPACE_END_RANGE_KHR = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR,
VK_COLORSPACE_RANGE_SIZE = (VK_COLORSPACE_SRGB_NONLINEAR_KHR - VK_COLORSPACE_SRGB_NONLINEAR_KHR + 1), VK_COLOR_SPACE_RANGE_SIZE_KHR = (VK_COLOR_SPACE_SRGB_NONLINEAR_KHR - VK_COLOR_SPACE_SRGB_NONLINEAR_KHR + 1),
VK_COLORSPACE_MAX_ENUM = 0x7FFFFFFF VK_COLOR_SPACE_MAX_ENUM_KHR = 0x7FFFFFFF
} VkColorSpaceKHR; } VkColorSpaceKHR;
typedef enum VkPresentModeKHR { typedef enum VkPresentModeKHR {
@ -3151,10 +3188,10 @@ typedef enum VkPresentModeKHR {
VK_PRESENT_MODE_MAILBOX_KHR = 1, VK_PRESENT_MODE_MAILBOX_KHR = 1,
VK_PRESENT_MODE_FIFO_KHR = 2, VK_PRESENT_MODE_FIFO_KHR = 2,
VK_PRESENT_MODE_FIFO_RELAXED_KHR = 3, VK_PRESENT_MODE_FIFO_RELAXED_KHR = 3,
VK_PRESENT_MODE_BEGIN_RANGE = VK_PRESENT_MODE_IMMEDIATE_KHR, VK_PRESENT_MODE_BEGIN_RANGE_KHR = VK_PRESENT_MODE_IMMEDIATE_KHR,
VK_PRESENT_MODE_END_RANGE = VK_PRESENT_MODE_FIFO_RELAXED_KHR, VK_PRESENT_MODE_END_RANGE_KHR = 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_RANGE_SIZE_KHR = (VK_PRESENT_MODE_FIFO_RELAXED_KHR - VK_PRESENT_MODE_IMMEDIATE_KHR + 1),
VK_PRESENT_MODE_MAX_ENUM = 0x7FFFFFFF VK_PRESENT_MODE_MAX_ENUM_KHR = 0x7FFFFFFF
} VkPresentModeKHR; } VkPresentModeKHR;
@ -3168,6 +3205,7 @@ typedef enum VkSurfaceTransformFlagBitsKHR {
VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_180_BIT_KHR = 0x00000040, VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_180_BIT_KHR = 0x00000040,
VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_270_BIT_KHR = 0x00000080, VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_270_BIT_KHR = 0x00000080,
VK_SURFACE_TRANSFORM_INHERIT_BIT_KHR = 0x00000100, VK_SURFACE_TRANSFORM_INHERIT_BIT_KHR = 0x00000100,
VK_SURFACE_TRANSFORM_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF
} VkSurfaceTransformFlagBitsKHR; } VkSurfaceTransformFlagBitsKHR;
typedef VkFlags VkSurfaceTransformFlagsKHR; typedef VkFlags VkSurfaceTransformFlagsKHR;
@ -3176,6 +3214,7 @@ typedef enum VkCompositeAlphaFlagBitsKHR {
VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR = 0x00000002, VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR = 0x00000002,
VK_COMPOSITE_ALPHA_POST_MULTIPLIED_BIT_KHR = 0x00000004, VK_COMPOSITE_ALPHA_POST_MULTIPLIED_BIT_KHR = 0x00000004,
VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR = 0x00000008, VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR = 0x00000008,
VK_COMPOSITE_ALPHA_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF
} VkCompositeAlphaFlagBitsKHR; } VkCompositeAlphaFlagBitsKHR;
typedef VkFlags VkCompositeAlphaFlagsKHR; typedef VkFlags VkCompositeAlphaFlagsKHR;
@ -3237,7 +3276,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfacePresentModesKHR(
#define VK_KHR_swapchain 1 #define VK_KHR_swapchain 1
VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSwapchainKHR) 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" #define VK_KHR_SWAPCHAIN_EXTENSION_NAME "VK_KHR_swapchain"
typedef VkFlags VkSwapchainCreateFlagsKHR; typedef VkFlags VkSwapchainCreateFlagsKHR;
@ -3325,9 +3364,10 @@ typedef enum VkDisplayPlaneAlphaFlagBitsKHR {
VK_DISPLAY_PLANE_ALPHA_GLOBAL_BIT_KHR = 0x00000002, VK_DISPLAY_PLANE_ALPHA_GLOBAL_BIT_KHR = 0x00000002,
VK_DISPLAY_PLANE_ALPHA_PER_PIXEL_BIT_KHR = 0x00000004, VK_DISPLAY_PLANE_ALPHA_PER_PIXEL_BIT_KHR = 0x00000004,
VK_DISPLAY_PLANE_ALPHA_PER_PIXEL_PREMULTIPLIED_BIT_KHR = 0x00000008, VK_DISPLAY_PLANE_ALPHA_PER_PIXEL_PREMULTIPLIED_BIT_KHR = 0x00000008,
VK_DISPLAY_PLANE_ALPHA_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF
} VkDisplayPlaneAlphaFlagBitsKHR; } VkDisplayPlaneAlphaFlagBitsKHR;
typedef VkFlags VkDisplayModeCreateFlagsKHR;
typedef VkFlags VkDisplayPlaneAlphaFlagsKHR; typedef VkFlags VkDisplayPlaneAlphaFlagsKHR;
typedef VkFlags VkDisplayModeCreateFlagsKHR;
typedef VkFlags VkDisplaySurfaceCreateFlagsKHR; typedef VkFlags VkDisplaySurfaceCreateFlagsKHR;
typedef struct VkDisplayPropertiesKHR { 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_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_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_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_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); 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
#endif /* VK_USE_PLATFORM_WIN32_KHR */ #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 #define VK_EXT_debug_report 1
VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDebugReportCallbackEXT) 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_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 { typedef enum VkDebugReportObjectTypeEXT {
@ -3704,11 +3750,19 @@ typedef enum VkDebugReportObjectTypeEXT {
VK_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT = 26, VK_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT = 26,
VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT = 27, VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT = 27,
VK_DEBUG_REPORT_OBJECT_TYPE_DEBUG_REPORT_EXT = 28, 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; } VkDebugReportObjectTypeEXT;
typedef enum VkDebugReportErrorEXT { typedef enum VkDebugReportErrorEXT {
VK_DEBUG_REPORT_ERROR_NONE_EXT = 0, VK_DEBUG_REPORT_ERROR_NONE_EXT = 0,
VK_DEBUG_REPORT_ERROR_CALLBACK_REF_EXT = 1, 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; } VkDebugReportErrorEXT;
@ -3718,6 +3772,7 @@ typedef enum VkDebugReportFlagBitsEXT {
VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT = 0x00000004, VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT = 0x00000004,
VK_DEBUG_REPORT_ERROR_BIT_EXT = 0x00000008, VK_DEBUG_REPORT_ERROR_BIT_EXT = 0x00000008,
VK_DEBUG_REPORT_DEBUG_BIT_EXT = 0x00000010, VK_DEBUG_REPORT_DEBUG_BIT_EXT = 0x00000010,
VK_DEBUG_REPORT_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF
} VkDebugReportFlagBitsEXT; } VkDebugReportFlagBitsEXT;
typedef VkFlags VkDebugReportFlagsEXT; typedef VkFlags VkDebugReportFlagsEXT;
@ -3768,6 +3823,110 @@ VKAPI_ATTR void VKAPI_CALL vkDebugReportMessageEXT(
const char* pMessage); const char* pMessage);
#endif #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 #ifdef __cplusplus
} }
#endif #endif