blob: b90f6e275c9a8fd69c5301f52119a827ff5614ef [file] [log] [blame]
Tobin Ehlisb5fc4fb2015-09-03 09:50:06 -06001/*
Tobin Ehlisb5fc4fb2015-09-03 09:50:06 -06002 *
3 * Copyright (C) 2015 LunarG, Inc.
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.
22 */
23#include "vk_layer.h"
24#include <vector>
Courtney Goeltzenleuchter319db132015-09-23 12:30:48 -060025#include "vk_debug_report_lunarg.h"
Tobin Ehlisb5fc4fb2015-09-03 09:50:06 -060026
27using namespace std;
28
29// Device Limits ERROR codes
30typedef enum _DEV_LIMITS_ERROR
31{
32 DEVLIMITS_NONE, // Used for INFO & other non-error messages
33 DEVLIMITS_INVALID_INSTANCE, // Invalid instance used
34 DEVLIMITS_INVALID_PHYSICAL_DEVICE, // Invalid physical device used
35 DEVLIMITS_MUST_QUERY_COUNT, // Failed to make initial call to an API to query the count
Mark Lobodzinski6f2274e2015-09-22 09:33:21 -060036 DEVLIMITS_MUST_QUERY_PROPERTIES, // Failed to make initial call to an API to query properties
Tobin Ehlis9da65002015-09-24 15:25:16 -060037 DEVLIMITS_INVALID_CALL_SEQUENCE, // Flag generic case of an invalid call sequence by the app
38 DEVLIMITS_INVALID_FEATURE_REQUESTED, // App requested a feature not supported by physical device
Tobin Ehlisb5fc4fb2015-09-03 09:50:06 -060039 DEVLIMITS_COUNT_MISMATCH, // App requesting a count value different than actual value
40 DEVLIMITS_INVALID_QUEUE_CREATE_REQUEST, // Invalid queue requested based on queue family properties
Mark Lobodzinski6f2274e2015-09-22 09:33:21 -060041 DEVLIMITS_LIMITS_VIOLATION, // Driver-specified limits/properties were exceeded
Tobin Ehlisb5fc4fb2015-09-03 09:50:06 -060042} DEV_LIMITS_ERROR;
43
44typedef enum _CALL_STATE
45{
46 UNCALLED, // Function has not been called
47 QUERY_COUNT, // Function called once to query a count
48 QUERY_DETAILS, // Function called w/ a count to query details
49} CALL_STATE;
50
51typedef struct _INSTANCE_STATE
52{
53 // Track the call state and array size for physical devices
54 CALL_STATE vkEnumeratePhysicalDevicesState;
55 uint32_t physicalDevicesCount;
56 _INSTANCE_STATE():vkEnumeratePhysicalDevicesState(UNCALLED), physicalDevicesCount(0) {};
57} INSTANCE_STATE;
58
59typedef struct _PHYSICAL_DEVICE_STATE
60{
61 // Track the call state and array sizes for various query functions
62 CALL_STATE vkGetPhysicalDeviceQueueFamilyPropertiesState;
63 uint32_t queueFamilyPropertiesCount;
Tobin Ehlis9da65002015-09-24 15:25:16 -060064 CALL_STATE vkGetPhysicalDeviceLayerPropertiesState;
65 uint32_t deviceLayerCount;
66 CALL_STATE vkGetPhysicalDeviceExtensionPropertiesState;
67 uint32_t deviceExtensionCount;
68 CALL_STATE vkGetPhysicalDeviceFeaturesState;
69 _PHYSICAL_DEVICE_STATE():vkGetPhysicalDeviceQueueFamilyPropertiesState(UNCALLED), queueFamilyPropertiesCount(0),
70 vkGetPhysicalDeviceLayerPropertiesState(UNCALLED), deviceLayerCount(0),
71 vkGetPhysicalDeviceExtensionPropertiesState(UNCALLED), deviceExtensionCount(0),
72 vkGetPhysicalDeviceFeaturesState(UNCALLED) {};
Tobin Ehlisb5fc4fb2015-09-03 09:50:06 -060073} PHYSICAL_DEVICE_STATE;
74