blob: ac6e23eae47e427e334f50447a48d3a47e9026a9 [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
39typedef enum _DEV_LIMITS_ERROR
40{
41 DEVLIMITS_NONE, // Used for INFO & other non-error messages
42 DEVLIMITS_INVALID_INSTANCE, // Invalid instance used
43 DEVLIMITS_INVALID_PHYSICAL_DEVICE, // Invalid physical device used
44 DEVLIMITS_MUST_QUERY_COUNT, // Failed to make initial call to an API to query the count
Mark Lobodzinski6f2274e2015-09-22 09:33:21 -060045 DEVLIMITS_MUST_QUERY_PROPERTIES, // Failed to make initial call to an API to query properties
Tobin Ehlis9da65002015-09-24 15:25:16 -060046 DEVLIMITS_INVALID_CALL_SEQUENCE, // Flag generic case of an invalid call sequence by the app
47 DEVLIMITS_INVALID_FEATURE_REQUESTED, // App requested a feature not supported by physical device
Tobin Ehlisb5fc4fb2015-09-03 09:50:06 -060048 DEVLIMITS_COUNT_MISMATCH, // App requesting a count value different than actual value
49 DEVLIMITS_INVALID_QUEUE_CREATE_REQUEST, // Invalid queue requested based on queue family properties
Mark Lobodzinski6f2274e2015-09-22 09:33:21 -060050 DEVLIMITS_LIMITS_VIOLATION, // Driver-specified limits/properties were exceeded
Mark Lobodzinski941aea92016-01-13 10:23:15 -070051 DEVLIMITS_INVALID_UNIFORM_BUFFER_OFFSET, // Uniform buffer offset violates device limit granularity
52 DEVLIMITS_INVALID_STORAGE_BUFFER_OFFSET, // Storage buffer offset violates device limit granularity
Tobin Ehlisb5fc4fb2015-09-03 09:50:06 -060053} DEV_LIMITS_ERROR;
54
55typedef enum _CALL_STATE
56{
57 UNCALLED, // Function has not been called
58 QUERY_COUNT, // Function called once to query a count
59 QUERY_DETAILS, // Function called w/ a count to query details
60} CALL_STATE;
61
62typedef struct _INSTANCE_STATE
63{
64 // Track the call state and array size for physical devices
65 CALL_STATE vkEnumeratePhysicalDevicesState;
66 uint32_t physicalDevicesCount;
67 _INSTANCE_STATE():vkEnumeratePhysicalDevicesState(UNCALLED), physicalDevicesCount(0) {};
68} INSTANCE_STATE;
69
70typedef struct _PHYSICAL_DEVICE_STATE
71{
72 // Track the call state and array sizes for various query functions
73 CALL_STATE vkGetPhysicalDeviceQueueFamilyPropertiesState;
74 uint32_t queueFamilyPropertiesCount;
Tobin Ehlis9da65002015-09-24 15:25:16 -060075 CALL_STATE vkGetPhysicalDeviceLayerPropertiesState;
76 uint32_t deviceLayerCount;
77 CALL_STATE vkGetPhysicalDeviceExtensionPropertiesState;
78 uint32_t deviceExtensionCount;
79 CALL_STATE vkGetPhysicalDeviceFeaturesState;
80 _PHYSICAL_DEVICE_STATE():vkGetPhysicalDeviceQueueFamilyPropertiesState(UNCALLED), queueFamilyPropertiesCount(0),
81 vkGetPhysicalDeviceLayerPropertiesState(UNCALLED), deviceLayerCount(0),
82 vkGetPhysicalDeviceExtensionPropertiesState(UNCALLED), deviceExtensionCount(0),
83 vkGetPhysicalDeviceFeaturesState(UNCALLED) {};
Tobin Ehlisb5fc4fb2015-09-03 09:50:06 -060084} PHYSICAL_DEVICE_STATE;
85