layers: Clang-format changes for files in layers dir of repo
diff --git a/layers/mem_tracker.h b/layers/mem_tracker.h
index ae4f0b8..a52e2e3 100644
--- a/layers/mem_tracker.h
+++ b/layers/mem_tracker.h
@@ -41,34 +41,41 @@
#endif
// Mem Tracker ERROR codes
-typedef enum _MEM_TRACK_ERROR
-{
- MEMTRACK_NONE, // Used for INFO & other non-error messages
- MEMTRACK_INVALID_CB, // Cmd Buffer invalid
- MEMTRACK_INVALID_MEM_OBJ, // Invalid Memory Object
- MEMTRACK_INVALID_ALIASING, // Invalid Memory Aliasing
- MEMTRACK_INVALID_LAYOUT, // Invalid Layout
- MEMTRACK_INTERNAL_ERROR, // Bug in Mem Track Layer internal data structures
- MEMTRACK_FREED_MEM_REF, // MEM Obj freed while it still has obj and/or CB refs
- MEMTRACK_MEM_OBJ_CLEAR_EMPTY_BINDINGS, // Clearing bindings on mem obj that doesn't have any bindings
- MEMTRACK_MISSING_MEM_BINDINGS, // Trying to retrieve mem bindings, but none found (may be internal error)
- MEMTRACK_INVALID_OBJECT, // Attempting to reference generic VK Object that is invalid
- MEMTRACK_MEMORY_BINDING_ERROR, // Error during one of many calls that bind memory to object or CB
- MEMTRACK_MEMORY_LEAK, // Failure to call vkFreeMemory on Mem Obj prior to DestroyDevice
- MEMTRACK_INVALID_STATE, // Memory not in the correct state
- MEMTRACK_RESET_CB_WHILE_IN_FLIGHT, // vkResetCommandBuffer() called on a CB that hasn't completed
- MEMTRACK_INVALID_FENCE_STATE, // Invalid Fence State signaled or used
- MEMTRACK_REBIND_OBJECT, // Non-sparse object bindings are immutable
- MEMTRACK_INVALID_USAGE_FLAG, // Usage flags specified at image/buffer create conflict w/ use of object
- MEMTRACK_INVALID_MAP, // Size flag specified at alloc is too small for mapping range
+typedef enum _MEM_TRACK_ERROR {
+ MEMTRACK_NONE, // Used for INFO & other non-error messages
+ MEMTRACK_INVALID_CB, // Cmd Buffer invalid
+ MEMTRACK_INVALID_MEM_OBJ, // Invalid Memory Object
+ MEMTRACK_INVALID_ALIASING, // Invalid Memory Aliasing
+ MEMTRACK_INVALID_LAYOUT, // Invalid Layout
+ MEMTRACK_INTERNAL_ERROR, // Bug in Mem Track Layer internal data structures
+ MEMTRACK_FREED_MEM_REF, // MEM Obj freed while it still has obj and/or CB
+ // refs
+ MEMTRACK_MEM_OBJ_CLEAR_EMPTY_BINDINGS, // Clearing bindings on mem obj that
+ // doesn't have any bindings
+ MEMTRACK_MISSING_MEM_BINDINGS, // Trying to retrieve mem bindings, but none
+ // found (may be internal error)
+ MEMTRACK_INVALID_OBJECT, // Attempting to reference generic VK Object that
+ // is invalid
+ MEMTRACK_MEMORY_BINDING_ERROR, // Error during one of many calls that bind
+ // memory to object or CB
+ MEMTRACK_MEMORY_LEAK, // Failure to call vkFreeMemory on Mem Obj prior to
+ // DestroyDevice
+ MEMTRACK_INVALID_STATE, // Memory not in the correct state
+ MEMTRACK_RESET_CB_WHILE_IN_FLIGHT, // vkResetCommandBuffer() called on a CB
+ // that hasn't completed
+ MEMTRACK_INVALID_FENCE_STATE, // Invalid Fence State signaled or used
+ MEMTRACK_REBIND_OBJECT, // Non-sparse object bindings are immutable
+ MEMTRACK_INVALID_USAGE_FLAG, // Usage flags specified at image/buffer create
+ // conflict w/ use of object
+ MEMTRACK_INVALID_MAP, // Size flag specified at alloc is too small for
+ // mapping range
} MEM_TRACK_ERROR;
// MemTracker Semaphore states
-typedef enum _MtSemaphoreState
-{
- MEMTRACK_SEMAPHORE_STATE_UNSET, // Semaphore is in an undefined state
- MEMTRACK_SEMAPHORE_STATE_SIGNALLED, // Semaphore has is in signalled state
- MEMTRACK_SEMAPHORE_STATE_WAIT, // Semaphore is in wait state
+typedef enum _MtSemaphoreState {
+ MEMTRACK_SEMAPHORE_STATE_UNSET, // Semaphore is in an undefined state
+ MEMTRACK_SEMAPHORE_STATE_SIGNALLED, // Semaphore has is in signalled state
+ MEMTRACK_SEMAPHORE_STATE_WAIT, // Semaphore is in wait state
} MtSemaphoreState;
struct MemRange {
@@ -97,40 +104,51 @@
* 2. Mem Objects
* CREATION - Add object,structure to map
* OBJ BIND - Add obj structure to list container for that mem node
- * CMB BIND - If mem-related add CB structure to list container for that mem node
+ * CMB BIND - If mem-related add CB structure to list container for that mem
+ *node
* DESTROY - Flag as errors any remaining refs and remove from map
* 3. Generic Objects
- * MEM BIND - DESTROY any previous binding, Add obj node w/ ref to map, add obj ref to list container for that mem node
- * DESTROY - If mem bound, remove reference list container for that memInfo, remove object ref from map
+ * MEM BIND - DESTROY any previous binding, Add obj node w/ ref to map, add
+ *obj ref to list container for that mem node
+ * DESTROY - If mem bound, remove reference list container for that memInfo,
+ *remove object ref from map
*/
-// TODO : Is there a way to track when Cmd Buffer finishes & remove mem references at that point?
-// TODO : Could potentially store a list of freed mem allocs to flag when they're incorrectly used
+// TODO : Is there a way to track when Cmd Buffer finishes & remove mem
+// references at that point?
+// TODO : Could potentially store a list of freed mem allocs to flag when
+// they're incorrectly used
-// Simple struct to hold handle and type of object so they can be uniquely identified and looked up in appropriate map
+// Simple struct to hold handle and type of object so they can be uniquely
+// identified and looked up in appropriate map
struct MT_OBJ_HANDLE_TYPE {
- uint64_t handle;
+ uint64_t handle;
VkDebugReportObjectTypeEXT type;
};
// Data struct for tracking memory object
struct MT_MEM_OBJ_INFO {
- void* object; // Dispatchable object used to create this memory (device of swapchain)
- uint32_t refCount; // Count of references (obj bindings or CB use)
- bool valid; // Stores if the memory has valid data or not
- VkDeviceMemory mem;
- VkMemoryAllocateInfo allocInfo;
- list<MT_OBJ_HANDLE_TYPE> pObjBindings; // list container of objects bound to this memory
- list<VkCommandBuffer> pCommandBufferBindings; // list container of cmd buffers that reference this mem object
- MemRange memRange;
- void *pData, *pDriverData;
+ void *object; // Dispatchable object used to create this memory (device of
+ // swapchain)
+ uint32_t refCount; // Count of references (obj bindings or CB use)
+ bool valid; // Stores if the memory has valid data or not
+ VkDeviceMemory mem;
+ VkMemoryAllocateInfo allocInfo;
+ list<MT_OBJ_HANDLE_TYPE>
+ pObjBindings; // list container of objects bound to this memory
+ list<VkCommandBuffer> pCommandBufferBindings; // list container of cmd
+ // buffers that reference this
+ // mem object
+ MemRange memRange;
+ void *pData, *pDriverData;
};
// This only applies to Buffers and Images, which can have memory bound to them
struct MT_OBJ_BINDING_INFO {
VkDeviceMemory mem;
- bool valid; //If this is a swapchain image backing memory is not a MT_MEM_OBJ_INFO so store it here.
+ bool valid; // If this is a swapchain image backing memory is not a
+ // MT_MEM_OBJ_INFO so store it here.
union create_info {
- VkImageCreateInfo image;
+ VkImageCreateInfo image;
VkBufferCreateInfo buffer;
} create_info;
};
@@ -138,24 +156,28 @@
// Track all command buffers
typedef struct _MT_CB_INFO {
VkCommandBufferAllocateInfo createInfo;
- VkPipeline pipelines[VK_PIPELINE_BIND_POINT_RANGE_SIZE];
- uint32_t attachmentCount;
- VkCommandBuffer commandBuffer;
- uint64_t fenceId;
- VkFence lastSubmittedFence;
- VkQueue lastSubmittedQueue;
- VkRenderPass pass;
- vector<std::function<VkBool32()> > validate_functions;
+ VkPipeline pipelines[VK_PIPELINE_BIND_POINT_RANGE_SIZE];
+ uint32_t attachmentCount;
+ VkCommandBuffer commandBuffer;
+ uint64_t fenceId;
+ VkFence lastSubmittedFence;
+ VkQueue lastSubmittedQueue;
+ VkRenderPass pass;
+ vector<std::function<VkBool32()>> validate_functions;
// Order dependent, stl containers must be at end of struct
- list<VkDeviceMemory> pMemObjList; // List container of Mem objs referenced by this CB
+ list<VkDeviceMemory>
+ pMemObjList; // List container of Mem objs referenced by this CB
// Constructor
- _MT_CB_INFO():createInfo{},pipelines{},attachmentCount(0),fenceId(0),lastSubmittedFence{},lastSubmittedQueue{} {};
+ _MT_CB_INFO()
+ : createInfo{}, pipelines{}, attachmentCount(0), fenceId(0),
+ lastSubmittedFence{}, lastSubmittedQueue{} {};
} MT_CB_INFO;
// Track command pools and their command buffers
typedef struct _MT_CMD_POOL_INFO {
- VkCommandPoolCreateFlags createFlags;
- list<VkCommandBuffer> pCommandBuffers; // list container of cmd buffers allocated from this pool
+ VkCommandPoolCreateFlags createFlags;
+ list<VkCommandBuffer> pCommandBuffers; // list container of cmd buffers
+ // allocated from this pool
} MT_CMD_POOL_INFO;
struct MT_IMAGE_VIEW_INFO {
@@ -172,9 +194,9 @@
};
struct MT_PASS_ATTACHMENT_INFO {
- uint32_t attachment;
- VkAttachmentLoadOp load_op;
- VkAttachmentStoreOp store_op;
+ uint32_t attachment;
+ VkAttachmentLoadOp load_op;
+ VkAttachmentStoreOp store_op;
};
struct MT_PASS_INFO {
@@ -186,24 +208,25 @@
// Associate fenceId with a fence object
struct MT_FENCE_INFO {
- uint64_t fenceId; // Sequence number for fence at last submit
- VkQueue queue; // Queue that this fence is submitted against or NULL
- VkBool32 firstTimeFlag; // Fence was created in signaled state, avoid warnings for first use
+ uint64_t fenceId; // Sequence number for fence at last submit
+ VkQueue queue; // Queue that this fence is submitted against or NULL
+ VkBool32 firstTimeFlag; // Fence was created in signaled state, avoid
+ // warnings for first use
VkFenceCreateInfo createInfo;
};
// Track Queue information
struct MT_QUEUE_INFO {
- uint64_t lastRetiredId;
- uint64_t lastSubmittedId;
- list<VkCommandBuffer> pQueueCommandBuffers;
- list<VkDeviceMemory> pMemRefList;
+ uint64_t lastRetiredId;
+ uint64_t lastSubmittedId;
+ list<VkCommandBuffer> pQueueCommandBuffers;
+ list<VkDeviceMemory> pMemRefList;
};
// Track Swapchain Information
struct MT_SWAP_CHAIN_INFO {
- VkSwapchainCreateInfoKHR createInfo;
- std::vector<VkImage> images;
+ VkSwapchainCreateInfoKHR createInfo;
+ std::vector<VkImage> images;
};
struct MEMORY_RANGE {