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 | * |
Jon Ashburn | 3ebf125 | 2016-04-19 11:30:31 -0600 | [diff] [blame] | 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | * you may not use this file except in compliance with the License. |
| 7 | * You may obtain a copy of the License at |
Tobin Ehlis | b5fc4fb | 2015-09-03 09:50:06 -0600 | [diff] [blame] | 8 | * |
Jon Ashburn | 3ebf125 | 2016-04-19 11:30:31 -0600 | [diff] [blame] | 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
Tobin Ehlis | b5fc4fb | 2015-09-03 09:50:06 -0600 | [diff] [blame] | 10 | * |
Jon Ashburn | 3ebf125 | 2016-04-19 11:30:31 -0600 | [diff] [blame] | 11 | * Unless required by applicable law or agreed to in writing, software |
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | * See the License for the specific language governing permissions and |
| 15 | * limitations under the License. |
Courtney Goeltzenleuchter | 0555952 | 2015-10-30 11:14:30 -0600 | [diff] [blame] | 16 | * |
| 17 | * Author: Tobin Ehlis <tobin@lunarg.com> |
Mark Lobodzinski | 6eda00a | 2016-02-02 15:55:36 -0700 | [diff] [blame] | 18 | * Author: Mark Lobodzinski <mark@lunarg.com> |
Tobin Ehlis | b5fc4fb | 2015-09-03 09:50:06 -0600 | [diff] [blame] | 19 | */ |
Mark Lobodzinski | 6eda00a | 2016-02-02 15:55:36 -0700 | [diff] [blame] | 20 | |
David Pinedo | 9316d3b | 2015-11-06 12:54:48 -0700 | [diff] [blame] | 21 | #include "vulkan/vk_layer.h" |
Tobin Ehlis | b5fc4fb | 2015-09-03 09:50:06 -0600 | [diff] [blame] | 22 | #include <vector> |
Tobin Ehlis | b5fc4fb | 2015-09-03 09:50:06 -0600 | [diff] [blame] | 23 | |
| 24 | using namespace std; |
| 25 | |
| 26 | // Device Limits ERROR codes |
Mark Lobodzinski | 48eee0d | 2016-05-19 17:10:58 -0600 | [diff] [blame] | 27 | enum DEV_LIMITS_ERROR { |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 28 | DEVLIMITS_NONE, // Used for INFO & other non-error messages |
| 29 | DEVLIMITS_INVALID_INSTANCE, // Invalid instance used |
| 30 | DEVLIMITS_INVALID_PHYSICAL_DEVICE, // Invalid physical device used |
| 31 | DEVLIMITS_INVALID_INHERITED_QUERY, // Invalid use of inherited query |
Michael Lentine | 20e4c19 | 2016-04-06 17:40:22 -0500 | [diff] [blame] | 32 | DEVLIMITS_INVALID_ATTACHMENT_COUNT, // Invalid value for the number of attachments |
Jan-Harald Fredriksen | 4f57fd1 | 2016-06-08 18:51:52 +0200 | [diff] [blame] | 33 | DEVLIMITS_MISSING_QUERY_COUNT, // Did not make initial call to an API to query the count |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 34 | DEVLIMITS_MUST_QUERY_COUNT, // Failed to make initial call to an API to query the count |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 35 | DEVLIMITS_INVALID_CALL_SEQUENCE, // Flag generic case of an invalid call sequence by the app |
| 36 | DEVLIMITS_INVALID_FEATURE_REQUESTED, // App requested a feature not supported by physical device |
| 37 | DEVLIMITS_COUNT_MISMATCH, // App requesting a count value different than actual value |
| 38 | DEVLIMITS_INVALID_QUEUE_CREATE_REQUEST, // Invalid queue requested based on queue family properties |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 39 | DEVLIMITS_INVALID_UNIFORM_BUFFER_OFFSET, // Uniform buffer offset violates device limit granularity |
| 40 | DEVLIMITS_INVALID_STORAGE_BUFFER_OFFSET, // Storage buffer offset violates device limit granularity |
Mark Lobodzinski | 48eee0d | 2016-05-19 17:10:58 -0600 | [diff] [blame] | 41 | }; |
Tobin Ehlis | b5fc4fb | 2015-09-03 09:50:06 -0600 | [diff] [blame] | 42 | |
Mark Lobodzinski | 48eee0d | 2016-05-19 17:10:58 -0600 | [diff] [blame] | 43 | enum CALL_STATE{ |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 44 | UNCALLED, // Function has not been called |
| 45 | QUERY_COUNT, // Function called once to query a count |
| 46 | QUERY_DETAILS, // Function called w/ a count to query details |
Mark Lobodzinski | 48eee0d | 2016-05-19 17:10:58 -0600 | [diff] [blame] | 47 | }; |
Tobin Ehlis | b5fc4fb | 2015-09-03 09:50:06 -0600 | [diff] [blame] | 48 | |
Mark Lobodzinski | 48eee0d | 2016-05-19 17:10:58 -0600 | [diff] [blame] | 49 | struct INSTANCE_STATE { |
Tobin Ehlis | b5fc4fb | 2015-09-03 09:50:06 -0600 | [diff] [blame] | 50 | // Track the call state and array size for physical devices |
| 51 | CALL_STATE vkEnumeratePhysicalDevicesState; |
| 52 | uint32_t physicalDevicesCount; |
Mark Lobodzinski | 48eee0d | 2016-05-19 17:10:58 -0600 | [diff] [blame] | 53 | INSTANCE_STATE() : vkEnumeratePhysicalDevicesState(UNCALLED), physicalDevicesCount(0){}; |
| 54 | }; |
Tobin Ehlis | b5fc4fb | 2015-09-03 09:50:06 -0600 | [diff] [blame] | 55 | |
Mark Lobodzinski | 48eee0d | 2016-05-19 17:10:58 -0600 | [diff] [blame] | 56 | struct PHYSICAL_DEVICE_STATE { |
Tobin Ehlis | b5fc4fb | 2015-09-03 09:50:06 -0600 | [diff] [blame] | 57 | // Track the call state and array sizes for various query functions |
| 58 | CALL_STATE vkGetPhysicalDeviceQueueFamilyPropertiesState; |
| 59 | uint32_t queueFamilyPropertiesCount; |
Tobin Ehlis | 9da6500 | 2015-09-24 15:25:16 -0600 | [diff] [blame] | 60 | CALL_STATE vkGetPhysicalDeviceLayerPropertiesState; |
| 61 | uint32_t deviceLayerCount; |
| 62 | CALL_STATE vkGetPhysicalDeviceExtensionPropertiesState; |
| 63 | uint32_t deviceExtensionCount; |
| 64 | CALL_STATE vkGetPhysicalDeviceFeaturesState; |
Mark Lobodzinski | 48eee0d | 2016-05-19 17:10:58 -0600 | [diff] [blame] | 65 | PHYSICAL_DEVICE_STATE() |
Jon Ashburn | 5484e0c | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 66 | : vkGetPhysicalDeviceQueueFamilyPropertiesState(UNCALLED), queueFamilyPropertiesCount(0), |
| 67 | vkGetPhysicalDeviceLayerPropertiesState(UNCALLED), deviceLayerCount(0), |
| 68 | vkGetPhysicalDeviceExtensionPropertiesState(UNCALLED), deviceExtensionCount(0), |
| 69 | vkGetPhysicalDeviceFeaturesState(UNCALLED){}; |
Mark Lobodzinski | 48eee0d | 2016-05-19 17:10:58 -0600 | [diff] [blame] | 70 | }; |