Mark Lobodzinski | 288e4f7 | 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 | c345b8b | 2015-09-03 09:50:06 -0600 | [diff] [blame] | 4 | * |
Mark Lobodzinski | 288e4f7 | 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 | c345b8b | 2015-09-03 09:50:06 -0600 | [diff] [blame] | 11 | * |
Mark Lobodzinski | 288e4f7 | 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 | c345b8b | 2015-09-03 09:50:06 -0600 | [diff] [blame] | 14 | * |
Mark Lobodzinski | 288e4f7 | 2016-02-02 15:55:36 -0700 | [diff] [blame] | 15 | * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
Tobin Ehlis | c345b8b | 2015-09-03 09:50:06 -0600 | [diff] [blame] | 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
Mark Lobodzinski | 288e4f7 | 2016-02-02 15:55:36 -0700 | [diff] [blame] | 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
| 18 | * |
| 19 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, |
| 20 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR |
| 21 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE |
| 22 | * USE OR OTHER DEALINGS IN THE MATERIALS |
Courtney Goeltzenleuchter | 96cd795 | 2015-10-30 11:14:30 -0600 | [diff] [blame] | 23 | * |
| 24 | * Author: Tobin Ehlis <tobin@lunarg.com> |
Mark Lobodzinski | 288e4f7 | 2016-02-02 15:55:36 -0700 | [diff] [blame] | 25 | * Author: Mark Lobodzinski <mark@lunarg.com> |
Tobin Ehlis | c345b8b | 2015-09-03 09:50:06 -0600 | [diff] [blame] | 26 | */ |
Mark Lobodzinski | 288e4f7 | 2016-02-02 15:55:36 -0700 | [diff] [blame] | 27 | |
David Pinedo | 329ca9e | 2015-11-06 12:54:48 -0700 | [diff] [blame] | 28 | #include "vulkan/vk_layer.h" |
Tobin Ehlis | c345b8b | 2015-09-03 09:50:06 -0600 | [diff] [blame] | 29 | #include <vector> |
Tobin Ehlis | c345b8b | 2015-09-03 09:50:06 -0600 | [diff] [blame] | 30 | |
| 31 | using namespace std; |
| 32 | |
| 33 | // Device Limits ERROR codes |
Jon Ashburn | 491a3cd | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 34 | typedef enum _DEV_LIMITS_ERROR { |
| 35 | DEVLIMITS_NONE, // Used for INFO & other non-error messages |
| 36 | DEVLIMITS_INVALID_INSTANCE, // Invalid instance used |
| 37 | DEVLIMITS_INVALID_PHYSICAL_DEVICE, // Invalid physical device used |
| 38 | DEVLIMITS_INVALID_INHERITED_QUERY, // Invalid use of inherited query |
Michael Lentine | d070997 | 2016-04-06 17:40:22 -0500 | [diff] [blame] | 39 | DEVLIMITS_INVALID_ATTACHMENT_COUNT, // Invalid value for the number of attachments |
Jon Ashburn | 491a3cd | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 40 | DEVLIMITS_MUST_QUERY_COUNT, // Failed to make initial call to an API to query the count |
Jon Ashburn | 491a3cd | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 41 | DEVLIMITS_INVALID_CALL_SEQUENCE, // Flag generic case of an invalid call sequence by the app |
| 42 | DEVLIMITS_INVALID_FEATURE_REQUESTED, // App requested a feature not supported by physical device |
| 43 | DEVLIMITS_COUNT_MISMATCH, // App requesting a count value different than actual value |
| 44 | DEVLIMITS_INVALID_QUEUE_CREATE_REQUEST, // Invalid queue requested based on queue family properties |
Jon Ashburn | 491a3cd | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 45 | DEVLIMITS_INVALID_UNIFORM_BUFFER_OFFSET, // Uniform buffer offset violates device limit granularity |
| 46 | DEVLIMITS_INVALID_STORAGE_BUFFER_OFFSET, // Storage buffer offset violates device limit granularity |
Chris Forbes | 0575215 | 2016-04-07 12:00:33 +1200 | [diff] [blame] | 47 | DEVLIMITS_INVALID_BUFFER_UPDATE_ALIGNMENT, // Alignment requirement for buffer update is violated |
Tobin Ehlis | c345b8b | 2015-09-03 09:50:06 -0600 | [diff] [blame] | 48 | } DEV_LIMITS_ERROR; |
| 49 | |
Jon Ashburn | 491a3cd | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 50 | typedef enum _CALL_STATE { |
| 51 | UNCALLED, // Function has not been called |
| 52 | QUERY_COUNT, // Function called once to query a count |
| 53 | QUERY_DETAILS, // Function called w/ a count to query details |
Tobin Ehlis | c345b8b | 2015-09-03 09:50:06 -0600 | [diff] [blame] | 54 | } CALL_STATE; |
| 55 | |
Jon Ashburn | 491a3cd | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 56 | typedef struct _INSTANCE_STATE { |
Tobin Ehlis | c345b8b | 2015-09-03 09:50:06 -0600 | [diff] [blame] | 57 | // Track the call state and array size for physical devices |
| 58 | CALL_STATE vkEnumeratePhysicalDevicesState; |
| 59 | uint32_t physicalDevicesCount; |
Jon Ashburn | 491a3cd | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 60 | _INSTANCE_STATE() : vkEnumeratePhysicalDevicesState(UNCALLED), physicalDevicesCount(0){}; |
Tobin Ehlis | c345b8b | 2015-09-03 09:50:06 -0600 | [diff] [blame] | 61 | } INSTANCE_STATE; |
| 62 | |
Jon Ashburn | 491a3cd | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 63 | typedef struct _PHYSICAL_DEVICE_STATE { |
Tobin Ehlis | c345b8b | 2015-09-03 09:50:06 -0600 | [diff] [blame] | 64 | // Track the call state and array sizes for various query functions |
| 65 | CALL_STATE vkGetPhysicalDeviceQueueFamilyPropertiesState; |
| 66 | uint32_t queueFamilyPropertiesCount; |
Tobin Ehlis | 8a10b1b | 2015-09-24 15:25:16 -0600 | [diff] [blame] | 67 | CALL_STATE vkGetPhysicalDeviceLayerPropertiesState; |
| 68 | uint32_t deviceLayerCount; |
| 69 | CALL_STATE vkGetPhysicalDeviceExtensionPropertiesState; |
| 70 | uint32_t deviceExtensionCount; |
| 71 | CALL_STATE vkGetPhysicalDeviceFeaturesState; |
Jon Ashburn | 491a3cd | 2016-03-08 17:48:44 -0700 | [diff] [blame] | 72 | _PHYSICAL_DEVICE_STATE() |
| 73 | : vkGetPhysicalDeviceQueueFamilyPropertiesState(UNCALLED), queueFamilyPropertiesCount(0), |
| 74 | vkGetPhysicalDeviceLayerPropertiesState(UNCALLED), deviceLayerCount(0), |
| 75 | vkGetPhysicalDeviceExtensionPropertiesState(UNCALLED), deviceExtensionCount(0), |
| 76 | vkGetPhysicalDeviceFeaturesState(UNCALLED){}; |
Tobin Ehlis | c345b8b | 2015-09-03 09:50:06 -0600 | [diff] [blame] | 77 | } PHYSICAL_DEVICE_STATE; |