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