Mark Lobodzinski | 6eda00a | 2016-02-02 15:55:36 -0700 | [diff] [blame] | 1 | /* Copyright (c) 2015-2016 The Khronos Group Inc. |
| 2 | * Copyright (c) 2015-2016 Valve Corporation |
| 3 | * Copyright (c) 2015-2016 LunarG, Inc. |
Tobin Ehlis | b5fc4fb | 2015-09-03 09:50:06 -0600 | [diff] [blame] | 4 | * |
Mark Lobodzinski | 6eda00a | 2016-02-02 15:55:36 -0700 | [diff] [blame] | 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 6 | * of this software and/or associated documentation files (the "Materials"), to |
| 7 | * deal in the Materials without restriction, including without limitation the |
| 8 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
| 9 | * sell copies of the Materials, and to permit persons to whom the Materials |
| 10 | * are furnished to do so, subject to the following conditions: |
Tobin Ehlis | b5fc4fb | 2015-09-03 09:50:06 -0600 | [diff] [blame] | 11 | * |
Mark Lobodzinski | 6eda00a | 2016-02-02 15:55:36 -0700 | [diff] [blame] | 12 | * The above copyright notice(s) and this permission notice shall be included |
| 13 | * in all copies or substantial portions of the Materials. |
Tobin Ehlis | b5fc4fb | 2015-09-03 09:50:06 -0600 | [diff] [blame] | 14 | * |
Mark Lobodzinski | 6eda00a | 2016-02-02 15:55:36 -0700 | [diff] [blame] | 15 | * The Materials are Confidential Information as defined by the Khronos |
| 16 | * Membership Agreement until designated non-confidential by Khronos, at which |
| 17 | * point this condition clause shall be removed. |
Tobin Ehlis | b5fc4fb | 2015-09-03 09:50:06 -0600 | [diff] [blame] | 18 | * |
Mark Lobodzinski | 6eda00a | 2016-02-02 15:55:36 -0700 | [diff] [blame] | 19 | * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
Tobin Ehlis | b5fc4fb | 2015-09-03 09:50:06 -0600 | [diff] [blame] | 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
Mark Lobodzinski | 6eda00a | 2016-02-02 15:55:36 -0700 | [diff] [blame] | 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
| 22 | * |
| 23 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
| 24 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR |
| 25 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE |
| 26 | * USE OR OTHER DEALINGS IN THE MATERIALS |
Courtney Goeltzenleuchter | 0555952 | 2015-10-30 11:14:30 -0600 | [diff] [blame] | 27 | * |
| 28 | * Author: Tobin Ehlis <tobin@lunarg.com> |
Mark Lobodzinski | 6eda00a | 2016-02-02 15:55:36 -0700 | [diff] [blame] | 29 | * Author: Mark Lobodzinski <mark@lunarg.com> |
Tobin Ehlis | b5fc4fb | 2015-09-03 09:50:06 -0600 | [diff] [blame] | 30 | */ |
Mark Lobodzinski | 6eda00a | 2016-02-02 15:55:36 -0700 | [diff] [blame] | 31 | |
David Pinedo | 9316d3b | 2015-11-06 12:54:48 -0700 | [diff] [blame] | 32 | #include "vulkan/vk_layer.h" |
Tobin Ehlis | b5fc4fb | 2015-09-03 09:50:06 -0600 | [diff] [blame] | 33 | #include <vector> |
Courtney Goeltzenleuchter | 7415d5a | 2015-12-09 15:48:16 -0700 | [diff] [blame] | 34 | #include "vulkan/vk_ext_debug_report.h" |
Tobin Ehlis | b5fc4fb | 2015-09-03 09:50:06 -0600 | [diff] [blame] | 35 | |
| 36 | using namespace std; |
| 37 | |
| 38 | // Device Limits ERROR codes |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame^] | 39 | typedef enum _DEV_LIMITS_ERROR { |
| 40 | DEVLIMITS_NONE, // Used for INFO & other non-error messages |
| 41 | DEVLIMITS_INVALID_INSTANCE, // Invalid instance used |
| 42 | DEVLIMITS_INVALID_PHYSICAL_DEVICE, // Invalid physical device used |
| 43 | DEVLIMITS_MUST_QUERY_COUNT, // Failed to make initial call to an API to |
| 44 | // query the count |
| 45 | DEVLIMITS_MUST_QUERY_PROPERTIES, // Failed to make initial call to an API to |
| 46 | // query properties |
| 47 | DEVLIMITS_INVALID_CALL_SEQUENCE, // Flag generic case of an invalid call |
| 48 | // sequence by the app |
| 49 | DEVLIMITS_INVALID_FEATURE_REQUESTED, // App requested a feature not |
| 50 | // supported by physical device |
| 51 | DEVLIMITS_COUNT_MISMATCH, // App requesting a count value different than |
| 52 | // actual value |
| 53 | DEVLIMITS_INVALID_QUEUE_CREATE_REQUEST, // Invalid queue requested based on |
| 54 | // queue family properties |
| 55 | DEVLIMITS_LIMITS_VIOLATION, // Driver-specified limits/properties were |
| 56 | // exceeded |
| 57 | DEVLIMITS_INVALID_UNIFORM_BUFFER_OFFSET, // Uniform buffer offset violates |
| 58 | // device limit granularity |
| 59 | DEVLIMITS_INVALID_STORAGE_BUFFER_OFFSET, // Storage buffer offset violates |
| 60 | // device limit granularity |
Tobin Ehlis | b5fc4fb | 2015-09-03 09:50:06 -0600 | [diff] [blame] | 61 | } DEV_LIMITS_ERROR; |
| 62 | |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame^] | 63 | typedef enum _CALL_STATE { |
| 64 | UNCALLED, // Function has not been called |
| 65 | QUERY_COUNT, // Function called once to query a count |
| 66 | QUERY_DETAILS, // Function called w/ a count to query details |
Tobin Ehlis | b5fc4fb | 2015-09-03 09:50:06 -0600 | [diff] [blame] | 67 | } CALL_STATE; |
| 68 | |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame^] | 69 | typedef struct _INSTANCE_STATE { |
Tobin Ehlis | b5fc4fb | 2015-09-03 09:50:06 -0600 | [diff] [blame] | 70 | // Track the call state and array size for physical devices |
| 71 | CALL_STATE vkEnumeratePhysicalDevicesState; |
| 72 | uint32_t physicalDevicesCount; |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame^] | 73 | _INSTANCE_STATE() |
| 74 | : vkEnumeratePhysicalDevicesState(UNCALLED), physicalDevicesCount(0){}; |
Tobin Ehlis | b5fc4fb | 2015-09-03 09:50:06 -0600 | [diff] [blame] | 75 | } INSTANCE_STATE; |
| 76 | |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame^] | 77 | typedef struct _PHYSICAL_DEVICE_STATE { |
Tobin Ehlis | b5fc4fb | 2015-09-03 09:50:06 -0600 | [diff] [blame] | 78 | // Track the call state and array sizes for various query functions |
| 79 | CALL_STATE vkGetPhysicalDeviceQueueFamilyPropertiesState; |
| 80 | uint32_t queueFamilyPropertiesCount; |
Tobin Ehlis | 9da6500 | 2015-09-24 15:25:16 -0600 | [diff] [blame] | 81 | CALL_STATE vkGetPhysicalDeviceLayerPropertiesState; |
| 82 | uint32_t deviceLayerCount; |
| 83 | CALL_STATE vkGetPhysicalDeviceExtensionPropertiesState; |
| 84 | uint32_t deviceExtensionCount; |
| 85 | CALL_STATE vkGetPhysicalDeviceFeaturesState; |
Mark Lobodzinski | b39d9e6 | 2016-02-02 17:06:29 -0700 | [diff] [blame^] | 86 | _PHYSICAL_DEVICE_STATE() |
| 87 | : vkGetPhysicalDeviceQueueFamilyPropertiesState(UNCALLED), |
| 88 | queueFamilyPropertiesCount(0), |
| 89 | vkGetPhysicalDeviceLayerPropertiesState(UNCALLED), |
| 90 | deviceLayerCount(0), |
| 91 | vkGetPhysicalDeviceExtensionPropertiesState(UNCALLED), |
| 92 | deviceExtensionCount(0), vkGetPhysicalDeviceFeaturesState(UNCALLED){}; |
Tobin Ehlis | b5fc4fb | 2015-09-03 09:50:06 -0600 | [diff] [blame] | 93 | } PHYSICAL_DEVICE_STATE; |