blob: e35ef63cf0ee4defa9135eaa97416fe160b6bc12 [file] [log] [blame]
Mark Lobodzinski6eda00a2016-02-02 15:55:36 -07001/* Copyright (c) 2015-2016 The Khronos Group Inc.
2 * Copyright (c) 2015-2016 Valve Corporation
3 * Copyright (c) 2015-2016 LunarG, Inc.
Tobin Ehlisb5fc4fb2015-09-03 09:50:06 -06004 *
Mark Lobodzinski6eda00a2016-02-02 15:55:36 -07005 * 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 Ehlisb5fc4fb2015-09-03 09:50:06 -060011 *
Mark Lobodzinski6eda00a2016-02-02 15:55:36 -070012 * The above copyright notice(s) and this permission notice shall be included
13 * in all copies or substantial portions of the Materials.
Tobin Ehlisb5fc4fb2015-09-03 09:50:06 -060014 *
Mark Lobodzinski6eda00a2016-02-02 15:55:36 -070015 * The Materials are Confidential Information as defined by the Khronos
16 * Membership Agreement until designated non-confidential by Khronos, at which
17 * point this condition clause shall be removed.
Tobin Ehlisb5fc4fb2015-09-03 09:50:06 -060018 *
Mark Lobodzinski6eda00a2016-02-02 15:55:36 -070019 * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
Tobin Ehlisb5fc4fb2015-09-03 09:50:06 -060020 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
Mark Lobodzinski6eda00a2016-02-02 15:55:36 -070021 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22 *
23 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
24 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
25 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE
26 * USE OR OTHER DEALINGS IN THE MATERIALS
Courtney Goeltzenleuchter05559522015-10-30 11:14:30 -060027 *
28 * Author: Tobin Ehlis <tobin@lunarg.com>
Mark Lobodzinski6eda00a2016-02-02 15:55:36 -070029 * Author: Mark Lobodzinski <mark@lunarg.com>
Tobin Ehlisb5fc4fb2015-09-03 09:50:06 -060030 */
Mark Lobodzinski6eda00a2016-02-02 15:55:36 -070031
David Pinedo9316d3b2015-11-06 12:54:48 -070032#include "vulkan/vk_layer.h"
Tobin Ehlisb5fc4fb2015-09-03 09:50:06 -060033#include <vector>
Courtney Goeltzenleuchter7415d5a2015-12-09 15:48:16 -070034#include "vulkan/vk_ext_debug_report.h"
Tobin Ehlisb5fc4fb2015-09-03 09:50:06 -060035
36using namespace std;
37
38// Device Limits ERROR codes
Mark Lobodzinskib39d9e62016-02-02 17:06:29 -070039typedef enum _DEV_LIMITS_ERROR {
40 DEVLIMITS_NONE, // Used for INFO & other non-error messages
41 DEVLIMITS_INVALID_INSTANCE, // Invalid instance used
42 DEVLIMITS_INVALID_PHYSICAL_DEVICE, // Invalid physical device used
43 DEVLIMITS_MUST_QUERY_COUNT, // Failed to make initial call to an API to
44 // query the count
45 DEVLIMITS_MUST_QUERY_PROPERTIES, // Failed to make initial call to an API to
46 // query properties
47 DEVLIMITS_INVALID_CALL_SEQUENCE, // Flag generic case of an invalid call
48 // sequence by the app
49 DEVLIMITS_INVALID_FEATURE_REQUESTED, // App requested a feature not
50 // supported by physical device
51 DEVLIMITS_COUNT_MISMATCH, // App requesting a count value different than
52 // actual value
53 DEVLIMITS_INVALID_QUEUE_CREATE_REQUEST, // Invalid queue requested based on
54 // queue family properties
55 DEVLIMITS_LIMITS_VIOLATION, // Driver-specified limits/properties were
56 // exceeded
57 DEVLIMITS_INVALID_UNIFORM_BUFFER_OFFSET, // Uniform buffer offset violates
58 // device limit granularity
59 DEVLIMITS_INVALID_STORAGE_BUFFER_OFFSET, // Storage buffer offset violates
60 // device limit granularity
Tobin Ehlisb5fc4fb2015-09-03 09:50:06 -060061} DEV_LIMITS_ERROR;
62
Mark Lobodzinskib39d9e62016-02-02 17:06:29 -070063typedef enum _CALL_STATE {
64 UNCALLED, // Function has not been called
65 QUERY_COUNT, // Function called once to query a count
66 QUERY_DETAILS, // Function called w/ a count to query details
Tobin Ehlisb5fc4fb2015-09-03 09:50:06 -060067} CALL_STATE;
68
Mark Lobodzinskib39d9e62016-02-02 17:06:29 -070069typedef struct _INSTANCE_STATE {
Tobin Ehlisb5fc4fb2015-09-03 09:50:06 -060070 // Track the call state and array size for physical devices
71 CALL_STATE vkEnumeratePhysicalDevicesState;
72 uint32_t physicalDevicesCount;
Mark Lobodzinskib39d9e62016-02-02 17:06:29 -070073 _INSTANCE_STATE()
74 : vkEnumeratePhysicalDevicesState(UNCALLED), physicalDevicesCount(0){};
Tobin Ehlisb5fc4fb2015-09-03 09:50:06 -060075} INSTANCE_STATE;
76
Mark Lobodzinskib39d9e62016-02-02 17:06:29 -070077typedef struct _PHYSICAL_DEVICE_STATE {
Tobin Ehlisb5fc4fb2015-09-03 09:50:06 -060078 // Track the call state and array sizes for various query functions
79 CALL_STATE vkGetPhysicalDeviceQueueFamilyPropertiesState;
80 uint32_t queueFamilyPropertiesCount;
Tobin Ehlis9da65002015-09-24 15:25:16 -060081 CALL_STATE vkGetPhysicalDeviceLayerPropertiesState;
82 uint32_t deviceLayerCount;
83 CALL_STATE vkGetPhysicalDeviceExtensionPropertiesState;
84 uint32_t deviceExtensionCount;
85 CALL_STATE vkGetPhysicalDeviceFeaturesState;
Mark Lobodzinskib39d9e62016-02-02 17:06:29 -070086 _PHYSICAL_DEVICE_STATE()
87 : vkGetPhysicalDeviceQueueFamilyPropertiesState(UNCALLED),
88 queueFamilyPropertiesCount(0),
89 vkGetPhysicalDeviceLayerPropertiesState(UNCALLED),
90 deviceLayerCount(0),
91 vkGetPhysicalDeviceExtensionPropertiesState(UNCALLED),
92 deviceExtensionCount(0), vkGetPhysicalDeviceFeaturesState(UNCALLED){};
Tobin Ehlisb5fc4fb2015-09-03 09:50:06 -060093} PHYSICAL_DEVICE_STATE;