blob: f0de0e917efb408d35c17e8c9fe1922d0507daaf [file] [log] [blame]
Peter Lohrmannd67314b2015-03-24 16:14:01 -07001/*
2 * GLAVE & vulkan
3 *
4 * Copyright (C) 2015 LunarG, Inc. and Valve Corporation
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 */
24
Courtney Goeltzenleuchterf53c3cb2015-04-14 14:55:44 -060025#include "vkLayer.h"
Peter Lohrmann0582ed32015-03-24 17:15:03 -070026
27// Glave Snapshot ERROR codes
28typedef enum _GLAVE_SNAPSHOT_ERROR
Peter Lohrmannd67314b2015-03-24 16:14:01 -070029{
Peter Lohrmann0582ed32015-03-24 17:15:03 -070030 GLVSNAPSHOT_NONE, // Used for INFO & other non-error messages
31 GLVSNAPSHOT_UNKNOWN_OBJECT, // Updating uses of object that's not in global object list
32 GLVSNAPSHOT_INTERNAL_ERROR, // Bug with data tracking within the layer
33 GLVSNAPSHOT_DESTROY_OBJECT_FAILED, // Couldn't find object to be destroyed
34 GLVSNAPSHOT_MISSING_OBJECT, // Attempted look-up on object that isn't in global object list
35 GLVSNAPSHOT_OBJECT_LEAK, // OBJECT was not correctly freed/destroyed
36 GLVSNAPSHOT_OBJCOUNT_MAX_EXCEEDED, // Request for Object data in excess of max obj count
37 GLVSNAPSHOT_INVALID_FENCE, // Requested status of unsubmitted fence object
38 GLVSNAPSHOT_VIEWPORT_NOT_BOUND, // Draw submitted with no viewport state object bound
39 GLVSNAPSHOT_RASTER_NOT_BOUND, // Draw submitted with no raster state object bound
40 GLVSNAPSHOT_COLOR_BLEND_NOT_BOUND, // Draw submitted with no color blend state object bound
41 GLVSNAPSHOT_DEPTH_STENCIL_NOT_BOUND, // Draw submitted with no depth-stencil state object bound
42 GLVSNAPSHOT_GPU_MEM_MAPPED, // Mem object ref'd in cmd buff is still mapped
43 GLVSNAPSHOT_GETGPUINFO_NOT_CALLED, // Gpu Information has not been requested before drawing
44 GLVSNAPSHOT_MEMREFCOUNT_MAX_EXCEEDED, // Number of QueueSubmit memory references exceeds GPU maximum
Peter Lohrmann1ea12712015-03-25 10:35:03 -070045 GLVSNAPSHOT_SNAPSHOT_DATA, // Message being printed is actually snapshot data
Peter Lohrmann0582ed32015-03-24 17:15:03 -070046} GLAVE_SNAPSHOT_ERROR;
Peter Lohrmannd67314b2015-03-24 16:14:01 -070047
48// Object Status -- used to track state of individual objects
49typedef enum _OBJECT_STATUS
50{
51 OBJSTATUS_NONE = 0x00000000, // No status is set
52 OBJSTATUS_FENCE_IS_SUBMITTED = 0x00000001, // Fence has been submitted
53 OBJSTATUS_VIEWPORT_BOUND = 0x00000002, // Viewport state object has been bound
54 OBJSTATUS_RASTER_BOUND = 0x00000004, // Viewport state object has been bound
55 OBJSTATUS_COLOR_BLEND_BOUND = 0x00000008, // Viewport state object has been bound
56 OBJSTATUS_DEPTH_STENCIL_BOUND = 0x00000010, // Viewport state object has been bound
57 OBJSTATUS_GPU_MEM_MAPPED = 0x00000020, // Memory object is currently mapped
58} OBJECT_STATUS;
Peter Lohrmann0582ed32015-03-24 17:15:03 -070059
Peter Lohrmannd67314b2015-03-24 16:14:01 -070060// Object type enum
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -060061typedef enum _VK_OBJECT_TYPE
Peter Lohrmannd67314b2015-03-24 16:14:01 -070062{
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -060063 VK_OBJECT_TYPE_UNKNOWN,
64 VK_OBJECT_TYPE_SAMPLER,
65 VK_OBJECT_TYPE_DYNAMIC_DS_STATE_OBJECT,
66 VK_OBJECT_TYPE_DESCRIPTOR_SET,
67 VK_OBJECT_TYPE_DESCRIPTOR_POOL,
68 VK_OBJECT_TYPE_DYNAMIC_CB_STATE_OBJECT,
69 VK_OBJECT_TYPE_IMAGE_VIEW,
70 VK_OBJECT_TYPE_QUEUE_SEMAPHORE,
71 VK_OBJECT_TYPE_SHADER,
72 VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT,
73 VK_OBJECT_TYPE_BUFFER,
74 VK_OBJECT_TYPE_PIPELINE,
75 VK_OBJECT_TYPE_DEVICE,
76 VK_OBJECT_TYPE_QUERY_POOL,
77 VK_OBJECT_TYPE_EVENT,
78 VK_OBJECT_TYPE_QUEUE,
79 VK_OBJECT_TYPE_PHYSICAL_GPU,
80 VK_OBJECT_TYPE_RENDER_PASS,
81 VK_OBJECT_TYPE_FRAMEBUFFER,
82 VK_OBJECT_TYPE_IMAGE,
83 VK_OBJECT_TYPE_BUFFER_VIEW,
84 VK_OBJECT_TYPE_DEPTH_STENCIL_VIEW,
85 VK_OBJECT_TYPE_INSTANCE,
86 VK_OBJECT_TYPE_PIPELINE_DELTA,
87 VK_OBJECT_TYPE_DYNAMIC_VP_STATE_OBJECT,
88 VK_OBJECT_TYPE_COLOR_ATTACHMENT_VIEW,
89 VK_OBJECT_TYPE_GPU_MEMORY,
90 VK_OBJECT_TYPE_DYNAMIC_RS_STATE_OBJECT,
91 VK_OBJECT_TYPE_FENCE,
92 VK_OBJECT_TYPE_CMD_BUFFER,
93 VK_OBJECT_TYPE_PRESENTABLE_IMAGE_MEMORY,
Peter Lohrmannd67314b2015-03-24 16:14:01 -070094
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -060095 VK_NUM_OBJECT_TYPE,
96 VK_OBJECT_TYPE_ANY, // Allow global object list to be queried/retrieved
97} VK_OBJECT_TYPE;
Peter Lohrmannd67314b2015-03-24 16:14:01 -070098
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -060099static const char* string_VK_OBJECT_TYPE(VK_OBJECT_TYPE type) {
Peter Lohrmannd67314b2015-03-24 16:14:01 -0700100 switch (type)
101 {
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600102 case VK_OBJECT_TYPE_DEVICE:
Peter Lohrmannd67314b2015-03-24 16:14:01 -0700103 return "DEVICE";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600104 case VK_OBJECT_TYPE_PIPELINE:
Peter Lohrmannd67314b2015-03-24 16:14:01 -0700105 return "PIPELINE";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600106 case VK_OBJECT_TYPE_FENCE:
Peter Lohrmannd67314b2015-03-24 16:14:01 -0700107 return "FENCE";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600108 case VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT:
Peter Lohrmannd67314b2015-03-24 16:14:01 -0700109 return "DESCRIPTOR_SET_LAYOUT";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600110 case VK_OBJECT_TYPE_GPU_MEMORY:
Peter Lohrmannd67314b2015-03-24 16:14:01 -0700111 return "GPU_MEMORY";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600112 case VK_OBJECT_TYPE_QUEUE:
Peter Lohrmannd67314b2015-03-24 16:14:01 -0700113 return "QUEUE";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600114 case VK_OBJECT_TYPE_IMAGE:
Peter Lohrmannd67314b2015-03-24 16:14:01 -0700115 return "IMAGE";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600116 case VK_OBJECT_TYPE_CMD_BUFFER:
Peter Lohrmannd67314b2015-03-24 16:14:01 -0700117 return "CMD_BUFFER";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600118 case VK_OBJECT_TYPE_QUEUE_SEMAPHORE:
Peter Lohrmannd67314b2015-03-24 16:14:01 -0700119 return "QUEUE_SEMAPHORE";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600120 case VK_OBJECT_TYPE_FRAMEBUFFER:
Peter Lohrmannd67314b2015-03-24 16:14:01 -0700121 return "FRAMEBUFFER";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600122 case VK_OBJECT_TYPE_SAMPLER:
Peter Lohrmannd67314b2015-03-24 16:14:01 -0700123 return "SAMPLER";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600124 case VK_OBJECT_TYPE_COLOR_ATTACHMENT_VIEW:
Peter Lohrmannd67314b2015-03-24 16:14:01 -0700125 return "COLOR_ATTACHMENT_VIEW";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600126 case VK_OBJECT_TYPE_BUFFER_VIEW:
Peter Lohrmannd67314b2015-03-24 16:14:01 -0700127 return "BUFFER_VIEW";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600128 case VK_OBJECT_TYPE_DESCRIPTOR_SET:
Peter Lohrmannd67314b2015-03-24 16:14:01 -0700129 return "DESCRIPTOR_SET";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600130 case VK_OBJECT_TYPE_PHYSICAL_GPU:
Peter Lohrmannd67314b2015-03-24 16:14:01 -0700131 return "PHYSICAL_GPU";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600132 case VK_OBJECT_TYPE_IMAGE_VIEW:
Peter Lohrmannd67314b2015-03-24 16:14:01 -0700133 return "IMAGE_VIEW";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600134 case VK_OBJECT_TYPE_BUFFER:
Peter Lohrmannd67314b2015-03-24 16:14:01 -0700135 return "BUFFER";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600136 case VK_OBJECT_TYPE_PIPELINE_DELTA:
Peter Lohrmannd67314b2015-03-24 16:14:01 -0700137 return "PIPELINE_DELTA";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600138 case VK_OBJECT_TYPE_DYNAMIC_RS_STATE_OBJECT:
Peter Lohrmannd67314b2015-03-24 16:14:01 -0700139 return "DYNAMIC_RS_STATE_OBJECT";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600140 case VK_OBJECT_TYPE_EVENT:
Peter Lohrmannd67314b2015-03-24 16:14:01 -0700141 return "EVENT";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600142 case VK_OBJECT_TYPE_DEPTH_STENCIL_VIEW:
Peter Lohrmannd67314b2015-03-24 16:14:01 -0700143 return "DEPTH_STENCIL_VIEW";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600144 case VK_OBJECT_TYPE_SHADER:
Peter Lohrmannd67314b2015-03-24 16:14:01 -0700145 return "SHADER";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600146 case VK_OBJECT_TYPE_DYNAMIC_DS_STATE_OBJECT:
Peter Lohrmannd67314b2015-03-24 16:14:01 -0700147 return "DYNAMIC_DS_STATE_OBJECT";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600148 case VK_OBJECT_TYPE_DYNAMIC_VP_STATE_OBJECT:
Peter Lohrmannd67314b2015-03-24 16:14:01 -0700149 return "DYNAMIC_VP_STATE_OBJECT";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600150 case VK_OBJECT_TYPE_DYNAMIC_CB_STATE_OBJECT:
Peter Lohrmannd67314b2015-03-24 16:14:01 -0700151 return "DYNAMIC_CB_STATE_OBJECT";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600152 case VK_OBJECT_TYPE_INSTANCE:
Peter Lohrmannd67314b2015-03-24 16:14:01 -0700153 return "INSTANCE";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600154 case VK_OBJECT_TYPE_RENDER_PASS:
Peter Lohrmannd67314b2015-03-24 16:14:01 -0700155 return "RENDER_PASS";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600156 case VK_OBJECT_TYPE_QUERY_POOL:
Peter Lohrmannd67314b2015-03-24 16:14:01 -0700157 return "QUERY_POOL";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600158 case VK_OBJECT_TYPE_DESCRIPTOR_POOL:
Jon Ashburn2112d6b2015-04-01 13:30:06 -0600159 return "DESCRIPTOR_POOL";
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600160 case VK_OBJECT_TYPE_PRESENTABLE_IMAGE_MEMORY:
Peter Lohrmannb6b4ce22015-03-24 16:31:39 -0700161 return "PRESENTABLE_IMAGE_MEMORY";
Peter Lohrmannd67314b2015-03-24 16:14:01 -0700162 default:
163 return "UNKNOWN";
164 }
165}
166
Peter Lohrmann6d849232015-04-01 13:54:18 -0700167//=============================================================================
168// Helper structure for a GLAVE vulkan snapshot.
169// These can probably be auto-generated at some point.
170//=============================================================================
171
172void glv_vk_malloc_and_copy(void** ppDest, size_t size, const void* pSrc);
173
174typedef struct _GLV_VK_SNAPSHOT_CREATEDEVICE_PARAMS
175{
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600176 VkPhysicalGpu gpu;
Courtney Goeltzenleuchter95487bc2015-04-14 18:48:46 -0600177 VkDeviceCreateInfo* pCreateInfo;
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600178 VkDevice* pDevice;
Peter Lohrmann6d849232015-04-01 13:54:18 -0700179} GLV_VK_SNAPSHOT_CREATEDEVICE_PARAMS;
180
Courtney Goeltzenleuchter95487bc2015-04-14 18:48:46 -0600181VkDeviceCreateInfo* glv_deepcopy_xgl_device_create_info(const VkDeviceCreateInfo* pSrcCreateInfo);void glv_deepfree_xgl_device_create_info(VkDeviceCreateInfo* pCreateInfo);
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600182void glv_vk_snapshot_copy_createdevice_params(GLV_VK_SNAPSHOT_CREATEDEVICE_PARAMS* pDest, VkPhysicalGpu gpu, const VkDeviceCreateInfo* pCreateInfo, VkDevice* pDevice);
Peter Lohrmann6d849232015-04-01 13:54:18 -0700183void glv_vk_snapshot_destroy_createdevice_params(GLV_VK_SNAPSHOT_CREATEDEVICE_PARAMS* pSrc);
184
185//=============================================================================
186// Glave Snapshot helper structs
187//=============================================================================
188
Peter Lohrmann623be4e2015-03-26 20:38:12 -0700189// Node that stores information about an object
190typedef struct _GLV_VK_SNAPSHOT_OBJECT_NODE {
Peter Lohrmann05069502015-03-30 12:58:50 -0700191 void* pVkObject;
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600192 VK_OBJECT_TYPE objType;
Peter Lohrmannd67314b2015-03-24 16:14:01 -0700193 uint64_t numUses;
194 OBJECT_STATUS status;
Peter Lohrmann05069502015-03-30 12:58:50 -0700195 void* pStruct; //< optionally points to a device-specific struct (ie, GLV_VK_SNAPSHOT_DEVICE_NODE)
Peter Lohrmann623be4e2015-03-26 20:38:12 -0700196} GLV_VK_SNAPSHOT_OBJECT_NODE;
Peter Lohrmannd67314b2015-03-24 16:14:01 -0700197
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600198// Node that stores information about an VkDevice
Peter Lohrmann623be4e2015-03-26 20:38:12 -0700199typedef struct _GLV_VK_SNAPSHOT_DEVICE_NODE {
Peter Lohrmann623be4e2015-03-26 20:38:12 -0700200 // This object
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600201 VkDevice device;
Peter Lohrmann623be4e2015-03-26 20:38:12 -0700202
203 // CreateDevice parameters
Peter Lohrmann6d849232015-04-01 13:54:18 -0700204 GLV_VK_SNAPSHOT_CREATEDEVICE_PARAMS params;
Peter Lohrmann623be4e2015-03-26 20:38:12 -0700205
206 // Other information a device needs to store.
207 // TODO: anything?
208} GLV_VK_SNAPSHOT_DEVICE_NODE;
209
210// Linked-List node that stores information about an object
211// We maintain a "Global" list which links every object and a
212// per-Object list which just links objects of a given type
213// The object node has both pointers so the actual nodes are shared between the two lists
214typedef struct _GLV_VK_SNAPSHOT_LL_NODE {
215 struct _GLV_VK_SNAPSHOT_LL_NODE *pNextObj;
216 struct _GLV_VK_SNAPSHOT_LL_NODE *pNextGlobal;
217 GLV_VK_SNAPSHOT_OBJECT_NODE obj;
218} GLV_VK_SNAPSHOT_LL_NODE;
219
Peter Lohrmann05069502015-03-30 12:58:50 -0700220// Linked-List node to identify an object that has been deleted,
221// but the delta snapshot never saw it get created.
222typedef struct _GLV_VK_SNAPSHOT_DELETED_OBJ_NODE {
223 struct _GLV_VK_SNAPSHOT_DELETED_OBJ_NODE* pNextObj;
224 void* pVkObject;
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600225 VK_OBJECT_TYPE objType;
Peter Lohrmann05069502015-03-30 12:58:50 -0700226} GLV_VK_SNAPSHOT_DELETED_OBJ_NODE;
227
Peter Lohrmann623be4e2015-03-26 20:38:12 -0700228//=============================================================================
229// Main structure for a GLAVE vulkan snapshot.
230//=============================================================================
231typedef struct _GLV_VK_SNAPSHOT {
232 // Stores a list of all the objects known by this snapshot.
233 // This may be used as a shortcut to more easily find objects.
234 uint64_t globalObjCount;
235 GLV_VK_SNAPSHOT_LL_NODE* pGlobalObjs;
236
237 // TEMPORARY: Keep track of all objects of each type
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600238 uint64_t numObjs[VK_NUM_OBJECT_TYPE];
239 GLV_VK_SNAPSHOT_LL_NODE *pObjectHead[VK_NUM_OBJECT_TYPE];
Peter Lohrmann623be4e2015-03-26 20:38:12 -0700240
Peter Lohrmann623be4e2015-03-26 20:38:12 -0700241 // List of created devices and [potentially] hierarchical tree of the objects on it.
242 // This is used to represent ownership of the objects
243 uint64_t deviceCount;
Peter Lohrmann05069502015-03-30 12:58:50 -0700244 GLV_VK_SNAPSHOT_LL_NODE* pDevices;
Peter Lohrmann623be4e2015-03-26 20:38:12 -0700245
246 // This is used to support snapshot deltas.
247 uint64_t deltaDeletedObjectCount;
Peter Lohrmann05069502015-03-30 12:58:50 -0700248 GLV_VK_SNAPSHOT_DELETED_OBJ_NODE* pDeltaDeletedObjects;
Peter Lohrmann623be4e2015-03-26 20:38:12 -0700249} GLV_VK_SNAPSHOT;
250
Peter Lohrmann623be4e2015-03-26 20:38:12 -0700251//=============================================================================
Peter Lohrmannd67314b2015-03-24 16:14:01 -0700252// prototype for extension functions
Peter Lohrmann623be4e2015-03-26 20:38:12 -0700253//=============================================================================
254// The snapshot functionality should work similar to a stopwatch.
255// 1) 'StartTracking()' is like starting the stopwatch. This causes the snapshot
256// to start tracking the creation of objects and state. In general, this
257// should happen at the very beginning, to track all objects. During this
258// tracking time, all creations and deletions are tracked on the
259// 'deltaSnapshot'.
260// NOTE: This entrypoint currently does nothing, as tracking is implied
261// by enabling the layer.
262// 2) 'GetDelta()' is analogous to looking at the stopwatch and seeing the
263// current lap time - A copy of the 'deltaSnapshot' will be returned to the
264// caller, but nothings changes within the snapshot layer. All creations
265// and deletions continue to be applied to the 'deltaSnapshot'.
266// NOTE: This will involve a deep copy of the delta, so there may be a
267// performance hit.
268// 3) 'GetSnapshot()' is similar to hitting the 'Lap' button on a stopwatch.
269// The 'deltaSnapshot' is merged into the 'masterSnapshot', the 'deltaSnapshot'
270// is cleared, and the 'masterSnapshot' is returned. All creations and
271// deletions continue to be applied to the 'deltaSnapshot'.
272// NOTE: This will involve a deep copy of the snapshot, so there may be a
273// performance hit.
274// 4) 'PrintDelta()' will cause the delta to be output by the layer's msgCallback.
275// 5) Steps 2, 3, and 4 can happen as often as needed.
276// 6) 'StopTracking()' is like stopping the stopwatch.
277// NOTE: This entrypoint currently does nothing, as tracking is implied
278// by disabling the layer.
279// 7) 'Clear()' will clear the 'deltaSnapshot' and the 'masterSnapshot'.
280//=============================================================================
281
282void glvSnapshotStartTracking(void);
283GLV_VK_SNAPSHOT glvSnapshotGetDelta(void);
284GLV_VK_SNAPSHOT glvSnapshotGetSnapshot(void);
285void glvSnapshotPrintDelta(void);
286void glvSnapshotStopTracking(void);
287void glvSnapshotClear(void);
288
289// utility
290// merge a delta into a snapshot and return the updated snapshot
291GLV_VK_SNAPSHOT glvSnapshotMerge(const GLV_VK_SNAPSHOT * const pDelta, const GLV_VK_SNAPSHOT * const pSnapshot);
292
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600293uint64_t glvSnapshotGetObjectCount(VK_OBJECT_TYPE type);
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600294VkResult glvSnapshotGetObjects(VK_OBJECT_TYPE type, uint64_t objCount, GLV_VK_SNAPSHOT_OBJECT_NODE* pObjNodeArray);
Peter Lohrmann0582ed32015-03-24 17:15:03 -0700295void glvSnapshotPrintObjects(void);
Peter Lohrmannd67314b2015-03-24 16:14:01 -0700296
297// Func ptr typedefs
Courtney Goeltzenleuchterd8e229c2015-04-08 15:36:08 -0600298typedef uint64_t (*GLVSNAPSHOT_GET_OBJECT_COUNT)(VK_OBJECT_TYPE);
Courtney Goeltzenleuchterfb4efc62015-04-10 08:34:15 -0600299typedef VkResult (*GLVSNAPSHOT_GET_OBJECTS)(VK_OBJECT_TYPE, uint64_t, GLV_VK_SNAPSHOT_OBJECT_NODE*);
Peter Lohrmann0582ed32015-03-24 17:15:03 -0700300typedef void (*GLVSNAPSHOT_PRINT_OBJECTS)(void);
Peter Lohrmann623be4e2015-03-26 20:38:12 -0700301typedef void (*GLVSNAPSHOT_START_TRACKING)(void);
302typedef GLV_VK_SNAPSHOT (*GLVSNAPSHOT_GET_DELTA)(void);
303typedef GLV_VK_SNAPSHOT (*GLVSNAPSHOT_GET_SNAPSHOT)(void);
304typedef void (*GLVSNAPSHOT_PRINT_DELTA)(void);
305typedef void (*GLVSNAPSHOT_STOP_TRACKING)(void);
306typedef void (*GLVSNAPSHOT_CLEAR)(void);