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