blob: 1439f12f72a5282fda981ed270912c233f5c4a93 [file] [log] [blame]
Mark Lobodzinski288e4f72016-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 Ehlisc345b8b2015-09-03 09:50:06 -06004 *
Mark Lobodzinski288e4f72016-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 Ehlisc345b8b2015-09-03 09:50:06 -060011 *
Mark Lobodzinski288e4f72016-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 Ehlisc345b8b2015-09-03 09:50:06 -060014 *
Mark Lobodzinski288e4f72016-02-02 15:55:36 -070015 * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
Tobin Ehlisc345b8b2015-09-03 09:50:06 -060016 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
Mark Lobodzinski288e4f72016-02-02 15:55:36 -070017 * 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 Goeltzenleuchter96cd7952015-10-30 11:14:30 -060023 *
24 * Author: Tobin Ehlis <tobin@lunarg.com>
Mark Lobodzinski288e4f72016-02-02 15:55:36 -070025 * Author: Mark Lobodzinski <mark@lunarg.com>
Tobin Ehlisc345b8b2015-09-03 09:50:06 -060026 */
Mark Lobodzinski288e4f72016-02-02 15:55:36 -070027
David Pinedo329ca9e2015-11-06 12:54:48 -070028#include "vulkan/vk_layer.h"
Tobin Ehlisc345b8b2015-09-03 09:50:06 -060029#include <vector>
Tobin Ehlisc345b8b2015-09-03 09:50:06 -060030
31using namespace std;
32
33// Device Limits ERROR codes
Jon Ashburn491a3cd2016-03-08 17:48:44 -070034typedef 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 Lentined0709972016-04-06 17:40:22 -050039 DEVLIMITS_INVALID_ATTACHMENT_COUNT, // Invalid value for the number of attachments
Jon Ashburn491a3cd2016-03-08 17:48:44 -070040 DEVLIMITS_MUST_QUERY_COUNT, // Failed to make initial call to an API to query the count
Jon Ashburn491a3cd2016-03-08 17:48:44 -070041 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 Ashburn491a3cd2016-03-08 17:48:44 -070045 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 Forbes05752152016-04-07 12:00:33 +120047 DEVLIMITS_INVALID_BUFFER_UPDATE_ALIGNMENT, // Alignment requirement for buffer update is violated
Tobin Ehlisc345b8b2015-09-03 09:50:06 -060048} DEV_LIMITS_ERROR;
49
Jon Ashburn491a3cd2016-03-08 17:48:44 -070050typedef 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 Ehlisc345b8b2015-09-03 09:50:06 -060054} CALL_STATE;
55
Jon Ashburn491a3cd2016-03-08 17:48:44 -070056typedef struct _INSTANCE_STATE {
Tobin Ehlisc345b8b2015-09-03 09:50:06 -060057 // Track the call state and array size for physical devices
58 CALL_STATE vkEnumeratePhysicalDevicesState;
59 uint32_t physicalDevicesCount;
Jon Ashburn491a3cd2016-03-08 17:48:44 -070060 _INSTANCE_STATE() : vkEnumeratePhysicalDevicesState(UNCALLED), physicalDevicesCount(0){};
Tobin Ehlisc345b8b2015-09-03 09:50:06 -060061} INSTANCE_STATE;
62
Jon Ashburn491a3cd2016-03-08 17:48:44 -070063typedef struct _PHYSICAL_DEVICE_STATE {
Tobin Ehlisc345b8b2015-09-03 09:50:06 -060064 // Track the call state and array sizes for various query functions
65 CALL_STATE vkGetPhysicalDeviceQueueFamilyPropertiesState;
66 uint32_t queueFamilyPropertiesCount;
Tobin Ehlis8a10b1b2015-09-24 15:25:16 -060067 CALL_STATE vkGetPhysicalDeviceLayerPropertiesState;
68 uint32_t deviceLayerCount;
69 CALL_STATE vkGetPhysicalDeviceExtensionPropertiesState;
70 uint32_t deviceExtensionCount;
71 CALL_STATE vkGetPhysicalDeviceFeaturesState;
Jon Ashburn491a3cd2016-03-08 17:48:44 -070072 _PHYSICAL_DEVICE_STATE()
73 : vkGetPhysicalDeviceQueueFamilyPropertiesState(UNCALLED), queueFamilyPropertiesCount(0),
74 vkGetPhysicalDeviceLayerPropertiesState(UNCALLED), deviceLayerCount(0),
75 vkGetPhysicalDeviceExtensionPropertiesState(UNCALLED), deviceExtensionCount(0),
76 vkGetPhysicalDeviceFeaturesState(UNCALLED){};
Tobin Ehlisc345b8b2015-09-03 09:50:06 -060077} PHYSICAL_DEVICE_STATE;