blob: 944d5b7188f47e09236c5b18c0b7eba89df82362 [file] [log] [blame]
Tobin Ehlisb5fc4fb2015-09-03 09:50:06 -06001/*
Tobin Ehlisb5fc4fb2015-09-03 09:50:06 -06002 *
Courtney Goeltzenleuchterfcbe16f2015-10-29 13:50:34 -06003 * Copyright (C) 2015 Valve Corporation
Tobin Ehlisb5fc4fb2015-09-03 09:50:06 -06004 *
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 Goeltzenleuchter05559522015-10-30 11:14:30 -060022 *
23 * Author: Tobin Ehlis <tobin@lunarg.com>
Tobin Ehlisb5fc4fb2015-09-03 09:50:06 -060024 */
David Pinedo9316d3b2015-11-06 12:54:48 -070025#include "vulkan/vk_layer.h"
Tobin Ehlisb5fc4fb2015-09-03 09:50:06 -060026#include <vector>
Courtney Goeltzenleuchter7415d5a2015-12-09 15:48:16 -070027#include "vulkan/vk_ext_debug_report.h"
Tobin Ehlisb5fc4fb2015-09-03 09:50:06 -060028
29using namespace std;
30
31// Device Limits ERROR codes
32typedef 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 Lobodzinski6f2274e2015-09-22 09:33:21 -060038 DEVLIMITS_MUST_QUERY_PROPERTIES, // Failed to make initial call to an API to query properties
Tobin Ehlis9da65002015-09-24 15:25:16 -060039 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 Ehlisb5fc4fb2015-09-03 09:50:06 -060041 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 Lobodzinski6f2274e2015-09-22 09:33:21 -060043 DEVLIMITS_LIMITS_VIOLATION, // Driver-specified limits/properties were exceeded
Tobin Ehlisb5fc4fb2015-09-03 09:50:06 -060044} DEV_LIMITS_ERROR;
45
46typedef 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
53typedef 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
61typedef 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 Ehlis9da65002015-09-24 15:25:16 -060066 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 Ehlisb5fc4fb2015-09-03 09:50:06 -060075} PHYSICAL_DEVICE_STATE;
76