blob: a91f0a6fc72762507958dbd3a45db7f113d70e1b [file] [log] [blame]
Tony-LunarGd36f5f32022-01-20 11:49:59 -07001/* Copyright (c) 2015-2022 The Khronos Group Inc.
2 * Copyright (c) 2015-2022 Valve Corporation
3 * Copyright (c) 2015-2022 LunarG, Inc.
4 * Modifications Copyright (C) 2020-2022 Advanced Micro Devices, Inc. All rights reserved.
Camdeneaa86ea2019-07-26 11:00:09 -06005 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 *
18 * Author: Camden Stocker <camden@lunarg.com>
Nadav Geva41c12a22021-05-21 13:14:05 -040019 * Author: Nadav Geva <nadav.geva@amd.com>
Camdeneaa86ea2019-07-26 11:00:09 -060020 */
21
22#pragma once
23
24#include "chassis.h"
Camden Stocker9738af92019-10-16 13:54:03 -070025#include "state_tracker.h"
Nathaniel Cesario39152e62021-07-02 13:04:16 -060026#include "image_state.h"
Jeremy Gebben7c2cd8b2021-08-11 15:40:38 -060027#include "cmd_buffer_state.h"
Camden5b184be2019-08-13 07:50:19 -060028#include <string>
Rodrigo Locattid5b54f52022-03-16 19:12:45 -030029#include <chrono>
Camden5b184be2019-08-13 07:50:19 -060030
31static const uint32_t kMemoryObjectWarningLimit = 250;
Camdeneaa86ea2019-07-26 11:00:09 -060032
Attilio Provenzano1d9a8362020-02-27 12:23:51 +000033// Maximum number of instanced vertex buffers which should be used
34static const uint32_t kMaxInstancedVertexBuffers = 1;
35
Attilio Provenzanof31788e2020-02-27 12:00:36 +000036// Recommended allocation size for vkAllocateMemory
37static const VkDeviceSize kMinDeviceAllocationSize = 256 * 1024;
38
39// If a buffer or image is allocated and it consumes an entire VkDeviceMemory, it should at least be this large.
40// This is slightly different from minDeviceAllocationSize since the 256K buffer can still be sensibly
41// suballocated from. If we consume an entire allocation with one image or buffer, it should at least be for a
42// very large allocation.
43static const VkDeviceSize kMinDedicatedAllocationSize = 1024 * 1024;
44
Nadav Gevaf0808442021-05-21 13:51:25 -040045// AMD best practices
46// Note: These are initial ball park numbers for good performance
47// We expect to adjust them as we get more data on layer usage
48// Avoid small command buffers
49static const uint32_t kMinRecommendedCommandBufferSizeAMD = 10;
50// Avoid small secondary command buffers
51static const uint32_t kMinRecommendedDrawsInSecondaryCommandBufferSizeAMD = 10;
52// Idealy, only 1 fence per frame, so 3 for triple buffering
53static const uint32_t kMaxRecommendedFenceObjectsSizeAMD = 3;
54// Avoid excessive sempahores
55static const uint32_t kMaxRecommendedSemaphoreObjectsSizeAMD = 10;
56// Avoid excessive barriers
57static const uint32_t kMaxRecommendedBarriersSizeAMD = 500;
58// Avoid excessive pipelines
59static const uint32_t kMaxRecommendedNumberOfPSOAMD = 5000;
60// Unlikely that the user needs all the dynamic states enabled at the same time, and they encur a cost
61static const uint32_t kDynamicStatesWarningLimitAMD = 7;
62// Too many dynamic descriptor sets can cause a large pipeline layout
63static const uint32_t kPipelineLayoutSizeWarningLimitAMD = 13;
64// Check that the user is submitting excessivly to a queue
65static const uint32_t kNumberOfSubmissionWarningLimitAMD = 20;
66// Check that there is enough work per vertex stream change
67static const float kVertexStreamToDrawRatioWarningLimitAMD = 0.8f;
68// Check that there is enough work per pipeline change
69static const float kDrawsPerPipelineRatioWarningLimitAMD = 5.f;
70// Check that command buffers are used with an appropriatly sized pool
71static const float kCmdBufferToCmdPoolRatioWarningLimitAMD = 0.1f;
Rodrigo Locatti12f6ffc2022-03-15 18:29:11 -030072// Size for fast descriptor reads on modern NVIDIA devices
73static const uint32_t kPipelineLayoutFastDescriptorSpaceNVIDIA = 256;
Rodrigo Locattid5b54f52022-03-16 19:12:45 -030074// Time threshold for flagging allocations that could have been reused
75static const auto kAllocateMemoryReuseTimeThresholdNVIDIA = std::chrono::seconds{5};
Rodrigo Locattia5eaf6e2022-04-01 18:05:23 -030076// Number of switches in tessellation, gemetry, and mesh shader state before signalling a message
77static const uint32_t kNumBindPipelineTessGeometryMeshSwitchesThresholdNVIDIA = 4;
Rodrigo Locatti0b16cda2022-04-01 17:59:53 -030078// Ratio where the Z-cull direction starts being considered balanced
79static const int kZcullDirectionBalanceRatioNVIDIA = 20;
Rodrigo Locattie4c08a02022-04-04 18:12:18 -030080// Maximum number of custom clear colors
81static const size_t kMaxRecommendedNumberOfClearColorsNVIDIA = 16;
Nadav Gevaf0808442021-05-21 13:51:25 -040082
Jeremy Gebben485a3ee2022-03-01 13:38:18 -070083// How many small indexed drawcalls in a command buffer before a warning is thrown
84static const uint32_t kMaxSmallIndexedDrawcalls = 10;
85
86// How many indices make a small indexed drawcall
87static const int kSmallIndexedDrawcallIndices = 10;
88
89// Minimum number of vertices/indices to take into account when doing depth pre-pass checks for Arm Mali GPUs
90static const int kDepthPrePassMinDrawCountArm = 500;
91
92// Minimum, number of draw calls in order to trigger depth pre-pass warnings for Arm Mali GPUs
93static const int kDepthPrePassNumDrawCallsArm = 20;
94
95// Maximum sample count for full throughput on Mali GPUs
96static const VkSampleCountFlagBits kMaxEfficientSamplesArm = VK_SAMPLE_COUNT_4_BIT;
97
98// On Arm Mali architectures, it's generally best to align work group dimensions to 4.
99static const uint32_t kThreadGroupDispatchCountAlignmentArm = 4;
100
101// Maximum number of threads which can efficiently be part of a compute workgroup when using thread group barriers.
102static const uint32_t kMaxEfficientWorkGroupThreadCountArm = 64;
103
LawG4b21485c2022-02-28 13:46:48 +0000104// Minimum number of vertices/indices a draw needs to have before considering it in depth prepass warnings on PowerVR
105static const int kDepthPrePassMinDrawCountIMG = 300;
106
107// Minimum, number of draw calls matching the above criteria before triggerring a depth prepass warning on PowerVR
108static const int kDepthPrePassNumDrawCallsIMG = 10;
109
LawG4ba113892022-02-23 14:39:02 +0000110// Maximum sample count on PowerVR before showing a warning
111static const VkSampleCountFlagBits kMaxEfficientSamplesImg = VK_SAMPLE_COUNT_4_BIT;
112
Jeremy Gebben485a3ee2022-03-01 13:38:18 -0700113
Nathaniel Cesariod867d212021-06-11 18:06:18 -0600114enum ExtDeprecationReason {
Mark Lobodzinski6167e102020-02-24 17:03:55 -0700115 kExtPromoted,
116 kExtObsoleted,
117 kExtDeprecated,
Nathaniel Cesariod867d212021-06-11 18:06:18 -0600118};
Mark Lobodzinski6167e102020-02-24 17:03:55 -0700119
Nathaniel Cesariod867d212021-06-11 18:06:18 -0600120struct DeprecationData {
Mark Lobodzinski6167e102020-02-24 17:03:55 -0700121 ExtDeprecationReason reason;
122 std::string target;
Nathaniel Cesariod867d212021-06-11 18:06:18 -0600123};
Mark Lobodzinski6167e102020-02-24 17:03:55 -0700124
LawG475463092022-02-22 10:45:54 +0000125struct SpecialUseVUIDs {
Hannes Harnisch607d1d92021-07-10 18:44:56 +0200126 const char* cadsupport;
127 const char* d3demulation;
128 const char* devtools;
129 const char* debugging;
130 const char* glemulation;
131};
132
Attilio Provenzano19d6a982020-02-27 12:41:41 +0000133typedef enum {
134 kBPVendorArm = 0x00000001,
Nadav Geva41c12a22021-05-21 13:14:05 -0400135 kBPVendorAMD = 0x00000002,
LawG475463092022-02-22 10:45:54 +0000136 kBPVendorIMG = 0x00000004,
Rodrigo Locattic779cb32022-02-25 19:26:31 -0300137 kBPVendorNVIDIA = 0x00000008,
Attilio Provenzano19d6a982020-02-27 12:41:41 +0000138} BPVendorFlagBits;
139typedef VkFlags BPVendorFlags;
140
Nathaniel Cesario24184fe2020-10-06 12:46:12 -0600141enum CALL_STATE {
142 UNCALLED, // Function has not been called
143 QUERY_COUNT, // Function called once to query a count
144 QUERY_DETAILS, // Function called w/ a count to query details
145};
146
Hans-Kristian Arntzen5b466db2021-03-18 13:59:46 +0100147enum IMAGE_SUBRESOURCE_USAGE_BP {
148 UNDEFINED, // If it has never been used
149 RENDER_PASS_CLEARED,
150 RENDER_PASS_READ_TO_TILE,
151 CLEARED,
Hans-Kristian Arntzendd8acbb2021-03-22 13:41:47 +0100152 DESCRIPTOR_ACCESS,
Hans-Kristian Arntzen5b466db2021-03-18 13:59:46 +0100153 RENDER_PASS_STORED,
154 RENDER_PASS_DISCARDED,
155 BLIT_READ,
Hans-Kristian Arntzendd8acbb2021-03-22 13:41:47 +0100156 BLIT_WRITE,
157 RESOLVE_READ,
158 RESOLVE_WRITE,
159 COPY_READ,
160 COPY_WRITE
Hans-Kristian Arntzen5b466db2021-03-18 13:59:46 +0100161};
162
Jeremy Gebben20da7a12022-02-25 14:07:46 -0700163class BestPractices;
164
165namespace bp_state {
166class Image : public IMAGE_STATE {
167 public:
168 Image(const ValidationStateTracker* dev_data, VkImage img, const VkImageCreateInfo* pCreateInfo,
169 VkFormatFeatureFlags2KHR features)
170 : IMAGE_STATE(dev_data, img, pCreateInfo, features) {
171 SetupUsages();
172 }
173
174 Image(const ValidationStateTracker* dev_data, VkImage img, const VkImageCreateInfo* pCreateInfo, VkSwapchainKHR swapchain,
175 uint32_t swapchain_index, VkFormatFeatureFlags2KHR features)
176 : IMAGE_STATE(dev_data, img, pCreateInfo, swapchain, swapchain_index, features) {
177 SetupUsages();
178 }
179
paul-lunarg86eaf792022-09-13 18:12:45 +0200180 struct Usage {
181 IMAGE_SUBRESOURCE_USAGE_BP type;
182 uint32_t queue_family_index;
183 };
184
185 Usage UpdateUsage(uint32_t array_layer, uint32_t mip_level, IMAGE_SUBRESOURCE_USAGE_BP usage, uint32_t queue_family) {
186 auto last_usage = usages_[array_layer][mip_level];
187 usages_[array_layer][mip_level].type = usage;
188 usages_[array_layer][mip_level].queue_family_index = queue_family;
Jeremy Gebben20da7a12022-02-25 14:07:46 -0700189 return last_usage;
190 }
191
paul-lunarg86eaf792022-09-13 18:12:45 +0200192 Usage GetUsage(uint32_t array_layer, uint32_t mip_level) const { return usages_[array_layer][mip_level]; }
paul-lunarg5eb52062022-06-27 18:57:15 +0200193
paul-lunarg86eaf792022-09-13 18:12:45 +0200194 IMAGE_SUBRESOURCE_USAGE_BP GetUsageType(uint32_t array_layer, uint32_t mip_level) const {
195 return GetUsage(array_layer, mip_level).type;
196 }
197
198 uint32_t GetLastQueueFamily(uint32_t array_layer, uint32_t mip_level) const {
199 return GetUsage(array_layer, mip_level).queue_family_index;
200 }
paul-lunarg5e5d7402022-09-07 16:23:10 +0200201
Jeremy Gebben20da7a12022-02-25 14:07:46 -0700202 private:
203 void SetupUsages() {
204 usages_.resize(createInfo.arrayLayers);
205 for (auto& mip_vec : usages_) {
paul-lunarg86eaf792022-09-13 18:12:45 +0200206 mip_vec.resize(createInfo.mipLevels, {IMAGE_SUBRESOURCE_USAGE_BP::UNDEFINED, VK_QUEUE_FAMILY_IGNORED});
Jeremy Gebben20da7a12022-02-25 14:07:46 -0700207 }
208 }
Hans-Kristian Arntzen5b466db2021-03-18 13:59:46 +0100209 // A 2d vector for all the array layers and mip levels.
210 // This does not split usages per aspect.
211 // Aspects are generally read and written together,
212 // and tracking them independently could be misleading.
paul-lunarg0c47ef02022-09-07 19:23:56 +0200213 // second/uint32_t is last queue family usage
paul-lunarg86eaf792022-09-13 18:12:45 +0200214 std::vector<std::vector<Usage>> usages_;
Hans-Kristian Arntzen5b466db2021-03-18 13:59:46 +0100215};
216
Aitor Camacho3294edd2022-05-16 22:34:19 +0200217using ImageNoBinding = MEMORY_TRACKED_RESOURCE_STATE<Image, BindableNoMemoryTracker>;
218using ImageLinear = MEMORY_TRACKED_RESOURCE_STATE<Image, BindableLinearMemoryTracker>;
219template <bool IS_RESIDENT>
220using ImageSparse = MEMORY_TRACKED_RESOURCE_STATE<Image, BindableSparseMemoryTracker<IS_RESIDENT>>;
221template <unsigned PLANE_COUNT>
222using ImageMultiplanar = MEMORY_TRACKED_RESOURCE_STATE<Image, BindableMultiplanarMemoryTracker<PLANE_COUNT>>;
223
Jeremy Gebben20da7a12022-02-25 14:07:46 -0700224class PhysicalDevice : public PHYSICAL_DEVICE_STATE {
225 public:
226 PhysicalDevice(VkPhysicalDevice phys_dev) : PHYSICAL_DEVICE_STATE(phys_dev) {}
Jeremy Gebben383b9a32021-09-08 16:31:33 -0600227
Nathaniel Cesario24184fe2020-10-06 12:46:12 -0600228 // Track the call state and array sizes for various query functions
229 CALL_STATE vkGetPhysicalDeviceQueueFamilyPropertiesState = UNCALLED;
Nathaniel Cesario56a96652020-12-30 13:23:42 -0700230 CALL_STATE vkGetPhysicalDeviceQueueFamilyProperties2State = UNCALLED;
231 CALL_STATE vkGetPhysicalDeviceQueueFamilyProperties2KHRState = UNCALLED;
Nathaniel Cesario24184fe2020-10-06 12:46:12 -0600232 CALL_STATE vkGetPhysicalDeviceLayerPropertiesState = UNCALLED; // Currently unused
233 CALL_STATE vkGetPhysicalDeviceExtensionPropertiesState = UNCALLED; // Currently unused
234 CALL_STATE vkGetPhysicalDeviceFeaturesState = UNCALLED;
235 CALL_STATE vkGetPhysicalDeviceSurfaceCapabilitiesKHRState = UNCALLED;
236 CALL_STATE vkGetPhysicalDeviceSurfacePresentModesKHRState = UNCALLED;
237 CALL_STATE vkGetPhysicalDeviceSurfaceFormatsKHRState = UNCALLED;
Jeremy Gebbenc7a834a2021-09-08 18:39:30 -0600238 uint32_t surface_formats_count = 0;
Nathaniel Cesario24184fe2020-10-06 12:46:12 -0600239 CALL_STATE vkGetPhysicalDeviceDisplayPlanePropertiesKHRState = UNCALLED;
240};
241
Jeremy Gebben20da7a12022-02-25 14:07:46 -0700242class Swapchain : public SWAPCHAIN_NODE {
Nathaniel Cesario39152e62021-07-02 13:04:16 -0600243 public:
Jeremy Gebben20da7a12022-02-25 14:07:46 -0700244 Swapchain(ValidationStateTracker* dev_data, const VkSwapchainCreateInfoKHR* pCreateInfo, VkSwapchainKHR swapchain)
Jeremy Gebben62c3bf42021-07-21 15:38:24 -0600245 : SWAPCHAIN_NODE(dev_data, pCreateInfo, swapchain) {}
Jeremy Gebben20da7a12022-02-25 14:07:46 -0700246
Nathaniel Cesario24184fe2020-10-06 12:46:12 -0600247 CALL_STATE vkGetSwapchainImagesKHRState = UNCALLED;
248};
249
Rodrigo Locatti37ddb022022-03-15 17:27:42 -0300250class DeviceMemory : public DEVICE_MEMORY_STATE {
251 public:
252 DeviceMemory(VkDeviceMemory mem, const VkMemoryAllocateInfo* p_alloc_info, uint64_t fake_address,
253 const VkMemoryType& memory_type, const VkMemoryHeap& memory_heap,
254 layer_data::optional<DedicatedBinding>&& dedicated_binding, uint32_t physical_device_count)
255 : DEVICE_MEMORY_STATE(mem, p_alloc_info, fake_address, memory_type, memory_heap, std::move(dedicated_binding),
256 physical_device_count) {}
257
258 layer_data::optional<float> dynamic_priority; // VK_EXT_pageable_device_local_memory priority
259};
260
Jeremy Gebben7c2cd8b2021-08-11 15:40:38 -0600261struct AttachmentInfo {
262 uint32_t framebufferAttachment;
263 VkImageAspectFlags aspects;
264};
265
266// used to track state regarding render pass heuristic checks
267struct RenderPassState {
268 bool depthAttachment = false;
269 bool colorAttachment = false;
270 bool depthOnly = false;
271 bool depthEqualComparison = false;
272 uint32_t numDrawCallsDepthOnly = 0;
273 uint32_t numDrawCallsDepthEqualCompare = 0;
274
275 // For secondaries, we need to keep this around for execute commands.
276 struct ClearInfo {
277 uint32_t framebufferAttachment;
278 uint32_t colorAttachment;
279 VkImageAspectFlags aspects;
280 std::vector<VkClearRect> rects;
281 };
282
283 std::vector<ClearInfo> earlyClearAttachments;
284 std::vector<AttachmentInfo> touchesAttachments;
285 std::vector<AttachmentInfo> nextDrawTouchesAttachments;
286 bool drawTouchAttachments = false;
287};
288
Rodrigo Locattia5eaf6e2022-04-01 18:05:23 -0300289struct CommandBufferStateNV {
290 struct TessGeometryMesh {
291 enum class State {
292 Unknown,
293 Disabled,
294 Enabled,
295 };
296
297 uint32_t num_switches = 0;
298 State state = State::Unknown;
299 bool threshold_signaled = false;
300 };
Rodrigo Locatti0b16cda2022-04-01 17:59:53 -0300301 enum class ZcullDirection {
302 Unknown,
303 Less,
304 Greater,
305 };
306 struct ZcullResourceState {
307 ZcullDirection direction = ZcullDirection::Unknown;
308 uint64_t num_less_draws = 0;
309 uint64_t num_greater_draws = 0;
310 };
311 struct ZcullTree {
312 std::vector<ZcullResourceState> states;
313 uint32_t mip_levels = 0;
314 uint32_t array_layers = 0;
315
316 const ZcullResourceState& GetState(uint32_t layer, uint32_t level) const {
317 return states[layer * mip_levels + level];
318 }
319
320 ZcullResourceState& GetState(uint32_t layer, uint32_t level) {
321 return states[layer * mip_levels + level];
322 }
323 };
324 struct ZcullScope {
325 VkImage image = VK_NULL_HANDLE;
326 VkImageSubresourceRange range{};
327 ZcullTree* tree = nullptr;
328 };
Rodrigo Locattia5eaf6e2022-04-01 18:05:23 -0300329
330 TessGeometryMesh tess_geometry_mesh;
Rodrigo Locatti0b16cda2022-04-01 17:59:53 -0300331
332 std::unordered_map<VkImage, ZcullTree> zcull_per_image;
333 ZcullScope zcull_scope;
334 ZcullDirection zcull_direction = ZcullDirection::Unknown;
335
336 VkCompareOp depth_compare_op = VK_COMPARE_OP_NEVER;
337 bool depth_test_enable = false;
Rodrigo Locattia5eaf6e2022-04-01 18:05:23 -0300338};
339
Jeremy Gebben20da7a12022-02-25 14:07:46 -0700340class CommandBuffer : public CMD_BUFFER_STATE {
Jeremy Gebben7c2cd8b2021-08-11 15:40:38 -0600341 public:
Jeremy Gebben20da7a12022-02-25 14:07:46 -0700342 CommandBuffer(BestPractices* bp, VkCommandBuffer cb, const VkCommandBufferAllocateInfo* pCreateInfo,
343 const COMMAND_POOL_STATE* pool);
Jeremy Gebben7c2cd8b2021-08-11 15:40:38 -0600344
Jeremy Gebben20da7a12022-02-25 14:07:46 -0700345 RenderPassState render_pass_state;
Rodrigo Locattia5eaf6e2022-04-01 18:05:23 -0300346 CommandBufferStateNV nv;
Rodrigo Locattic789fe82022-07-06 17:42:19 -0300347 uint64_t num_submits = 0;
348 bool is_one_time_submit = false;
Jeremy Gebben7c2cd8b2021-08-11 15:40:38 -0600349};
350
Jeremy Gebben20da7a12022-02-25 14:07:46 -0700351class DescriptorPool : public DESCRIPTOR_POOL_STATE {
352 public:
353 DescriptorPool(ValidationStateTracker* dev, const VkDescriptorPool pool, const VkDescriptorPoolCreateInfo* pCreateInfo)
354 : DESCRIPTOR_POOL_STATE(dev, pool, pCreateInfo) {}
355
356 uint32_t freed_count{0};
357};
358
359class Pipeline : public PIPELINE_STATE {
360 public:
361 Pipeline(const ValidationStateTracker* state_data, const VkGraphicsPipelineCreateInfo* pCreateInfo,
362 std::shared_ptr<const RENDER_PASS_STATE>&& rpstate, std::shared_ptr<const PIPELINE_LAYOUT_STATE>&& layout);
363
364 const std::vector<AttachmentInfo> access_framebuffer_attachments;
365};
366} // namespace bp_state
367
368VALSTATETRACK_DERIVED_STATE_OBJECT(VkPhysicalDevice, bp_state::PhysicalDevice, PHYSICAL_DEVICE_STATE);
369VALSTATETRACK_DERIVED_STATE_OBJECT(VkCommandBuffer, bp_state::CommandBuffer, CMD_BUFFER_STATE);
370VALSTATETRACK_DERIVED_STATE_OBJECT(VkSwapchainKHR, bp_state::Swapchain, SWAPCHAIN_NODE);
371VALSTATETRACK_DERIVED_STATE_OBJECT(VkImage, bp_state::Image, IMAGE_STATE);
372VALSTATETRACK_DERIVED_STATE_OBJECT(VkDescriptorPool, bp_state::DescriptorPool, DESCRIPTOR_POOL_STATE);
373VALSTATETRACK_DERIVED_STATE_OBJECT(VkPipeline, bp_state::Pipeline, PIPELINE_STATE);
Jeremy Gebben78684b12022-02-23 17:31:56 -0700374
Camden83a9c372019-08-14 11:41:38 -0600375class BestPractices : public ValidationStateTracker {
Petr Kraus4ed81e32019-09-02 23:41:19 +0200376 public:
Camden83a9c372019-08-14 11:41:38 -0600377 using StateTracker = ValidationStateTracker;
378
Mark Lobodzinski0dcb87d2020-03-30 16:09:24 -0600379 BestPractices() { container_type = LayerObjectTypeBestPractices; }
380
Jeremy Gebben20da7a12022-02-25 14:07:46 -0700381 ReadLockGuard ReadLock() override;
382 WriteLockGuard WriteLock() override;
383
Jeff Bolz46c0ea02019-10-09 13:06:29 -0500384 std::string GetAPIVersionName(uint32_t version) const;
Camden5b184be2019-08-13 07:50:19 -0600385
Mark Lobodzinski4c4cf942019-12-20 11:09:51 -0700386 bool ValidateCmdDrawType(VkCommandBuffer cmd_buffer, const char* caller) const;
387
Sam Walls0961ec02020-03-31 16:39:15 +0100388 void RecordCmdDrawType(VkCommandBuffer cmd_buffer, uint32_t draw_count, const char* caller);
389
Mark Lobodzinski6167e102020-02-24 17:03:55 -0700390 bool ValidateDeprecatedExtensions(const char* api_name, const char* extension_name, uint32_t version, const char* vuid) const;
391
LawG4db16f802022-03-21 17:33:39 +0000392 bool ValidateSpecialUseExtensions(const char* api_name, const char* extension_name,
393 const SpecialUseVUIDs& special_use_vuids) const;
Mark Lobodzinski057724a2020-11-09 17:13:18 -0700394
Camden5b184be2019-08-13 07:50:19 -0600395 bool PreCallValidateCreateInstance(const VkInstanceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator,
Mark Lobodzinski2b967e72020-12-03 14:22:45 -0700396 VkInstance* pInstance) const override;
Camden5b184be2019-08-13 07:50:19 -0600397 bool PreCallValidateCreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo* pCreateInfo,
Mark Lobodzinski2b967e72020-12-03 14:22:45 -0700398 const VkAllocationCallbacks* pAllocator, VkDevice* pDevice) const override;
Camden5b184be2019-08-13 07:50:19 -0600399 bool PreCallValidateCreateBuffer(VkDevice device, const VkBufferCreateInfo* pCreateInfo,
Mark Lobodzinski2b967e72020-12-03 14:22:45 -0700400 const VkAllocationCallbacks* pAllocator, VkBuffer* pBuffer) const override;
Camden5b184be2019-08-13 07:50:19 -0600401 bool PreCallValidateCreateImage(VkDevice device, const VkImageCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator,
Mark Lobodzinski2b967e72020-12-03 14:22:45 -0700402 VkImage* pImage) const override;
Camden5b184be2019-08-13 07:50:19 -0600403 bool PreCallValidateCreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR* pCreateInfo,
Mark Lobodzinski2b967e72020-12-03 14:22:45 -0700404 const VkAllocationCallbacks* pAllocator, VkSwapchainKHR* pSwapchain) const override;
Camden5b184be2019-08-13 07:50:19 -0600405 bool PreCallValidateCreateSharedSwapchainsKHR(VkDevice device, uint32_t swapchainCount,
406 const VkSwapchainCreateInfoKHR* pCreateInfos,
Mark Lobodzinski2b967e72020-12-03 14:22:45 -0700407 const VkAllocationCallbacks* pAllocator,
408 VkSwapchainKHR* pSwapchains) const override;
Camden5b184be2019-08-13 07:50:19 -0600409 bool PreCallValidateCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo* pCreateInfo,
Mark Lobodzinski2b967e72020-12-03 14:22:45 -0700410 const VkAllocationCallbacks* pAllocator, VkRenderPass* pRenderPass) const override;
Tony-LunarG767180f2020-04-23 14:03:59 -0600411 bool ValidateAttachments(const VkRenderPassCreateInfo2* rpci, uint32_t attachmentCount, const VkImageView* image_views) const;
Attilio Provenzano1d9a8362020-02-27 12:23:51 +0000412 bool PreCallValidateCreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo* pCreateInfo,
Mark Lobodzinski2b967e72020-12-03 14:22:45 -0700413 const VkAllocationCallbacks* pAllocator, VkFramebuffer* pFramebuffer) const override;
Sam Wallse746d522020-03-16 21:20:23 +0000414 bool PreCallValidateAllocateDescriptorSets(VkDevice device, const VkDescriptorSetAllocateInfo* pAllocateInfo,
Mark Lobodzinski2b967e72020-12-03 14:22:45 -0700415 VkDescriptorSet* pDescriptorSets, void* ads_state_data) const override;
Mark Lobodzinski84101d72020-04-24 09:43:48 -0600416 void ManualPostCallRecordAllocateDescriptorSets(VkDevice device, const VkDescriptorSetAllocateInfo* pAllocateInfo,
417 VkDescriptorSet* pDescriptorSets, VkResult result, void* ads_state);
Sam Wallse746d522020-03-16 21:20:23 +0000418 void PostCallRecordFreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, uint32_t descriptorSetCount,
Mark Lobodzinski2b967e72020-12-03 14:22:45 -0700419 const VkDescriptorSet* pDescriptorSets, VkResult result) override;
Camden5b184be2019-08-13 07:50:19 -0600420 bool PreCallValidateAllocateMemory(VkDevice device, const VkMemoryAllocateInfo* pAllocateInfo,
Mark Lobodzinski2b967e72020-12-03 14:22:45 -0700421 const VkAllocationCallbacks* pAllocator, VkDeviceMemory* pMemory) const override;
Rodrigo Locattid5b54f52022-03-16 19:12:45 -0300422 void PreCallRecordAllocateMemory(VkDevice device, const VkMemoryAllocateInfo* pAllocateInfo,
423 const VkAllocationCallbacks* pAllocator, VkDeviceMemory* pMemory) override;
Mark Lobodzinski84101d72020-04-24 09:43:48 -0600424 void ManualPostCallRecordAllocateMemory(VkDevice device, const VkMemoryAllocateInfo* pAllocateInfo,
425 const VkAllocationCallbacks* pAllocator, VkDeviceMemory* pMemory, VkResult result);
Attilio Provenzanof31788e2020-02-27 12:00:36 +0000426 bool ValidateBindBufferMemory(VkBuffer buffer, VkDeviceMemory memory, const char* api_name) const;
Mark Lobodzinski2b967e72020-12-03 14:22:45 -0700427 bool PreCallValidateBindBufferMemory(VkDevice device, VkBuffer buffer, VkDeviceMemory memory,
428 VkDeviceSize memoryOffset) const override;
429 bool PreCallValidateBindBufferMemory2(VkDevice device, uint32_t bindInfoCount,
430 const VkBindBufferMemoryInfo* pBindInfos) const override;
Jeff Bolz5c801d12019-10-09 10:38:45 -0500431 bool PreCallValidateBindBufferMemory2KHR(VkDevice device, uint32_t bindInfoCount,
Mark Lobodzinski2b967e72020-12-03 14:22:45 -0700432 const VkBindBufferMemoryInfo* pBindInfos) const override;
Attilio Provenzanof31788e2020-02-27 12:00:36 +0000433 bool ValidateBindImageMemory(VkImage image, VkDeviceMemory memory, const char* api_name) const;
Mark Lobodzinski2b967e72020-12-03 14:22:45 -0700434 bool PreCallValidateBindImageMemory(VkDevice device, VkImage image, VkDeviceMemory memory,
435 VkDeviceSize memoryOffset) const override;
436 bool PreCallValidateBindImageMemory2(VkDevice device, uint32_t bindInfoCount,
437 const VkBindImageMemoryInfo* pBindInfos) const override;
438 bool PreCallValidateBindImageMemory2KHR(VkDevice device, uint32_t bindInfoCount,
439 const VkBindImageMemoryInfo* pBindInfos) const override;
Rodrigo Locatti66b23352022-03-15 17:28:32 -0300440 void PreCallRecordSetDeviceMemoryPriorityEXT(VkDevice device, VkDeviceMemory memory, float priority) override;
Attilio Provenzano746e43e2020-02-27 11:23:50 +0000441 bool PreCallValidateCreateCommandPool(VkDevice device, const VkCommandPoolCreateInfo* pCreateInfo,
Mark Lobodzinski2b967e72020-12-03 14:22:45 -0700442 const VkAllocationCallbacks* pAllocator, VkCommandPool* pCommandPool) const override;
Rodrigo Locattid5b54f52022-03-16 19:12:45 -0300443 void PreCallRecordFreeMemory(VkDevice device, VkDeviceMemory memory, const VkAllocationCallbacks* pAllocator) override;
Mark Lobodzinski2b967e72020-12-03 14:22:45 -0700444 bool PreCallValidateFreeMemory(VkDevice device, VkDeviceMemory memory, const VkAllocationCallbacks* pAllocator) const override;
Attilio Provenzano02859b22020-02-27 14:17:28 +0000445 bool ValidateMultisampledBlendingArm(uint32_t createInfoCount, const VkGraphicsPipelineCreateInfo* pCreateInfos) const;
Jeremy Gebben20da7a12022-02-25 14:07:46 -0700446
Camden5b184be2019-08-13 07:50:19 -0600447 bool PreCallValidateCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount,
448 const VkGraphicsPipelineCreateInfo* pCreateInfos,
Jeff Bolz5c801d12019-10-09 10:38:45 -0500449 const VkAllocationCallbacks* pAllocator, VkPipeline* pPipelines,
Mark Lobodzinski2b967e72020-12-03 14:22:45 -0700450 void* cgpl_state) const override;
Camden5b184be2019-08-13 07:50:19 -0600451 bool PreCallValidateCreateComputePipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount,
452 const VkComputePipelineCreateInfo* pCreateInfos,
Jeff Bolz5c801d12019-10-09 10:38:45 -0500453 const VkAllocationCallbacks* pAllocator, VkPipeline* pPipelines,
Mark Lobodzinski2b967e72020-12-03 14:22:45 -0700454 void* pipe_state) const override;
Sam Wallsd7ab6db2020-06-19 20:41:54 +0100455 bool ValidateCreateComputePipelineArm(const VkComputePipelineCreateInfo& createInfo) const;
Camden5b184be2019-08-13 07:50:19 -0600456
Jeremy Gebbena3705f42021-01-19 16:47:43 -0700457 bool CheckPipelineStageFlags(const std::string& api_name, VkPipelineStageFlags flags) const;
458 bool CheckPipelineStageFlags(const std::string& api_name, VkPipelineStageFlags2KHR flags) const;
459 bool CheckDependencyInfo(const std::string& api_name, const VkDependencyInfoKHR& dep_info) const;
Mark Lobodzinski2b967e72020-12-03 14:22:45 -0700460 bool PreCallValidateQueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo* pSubmits,
461 VkFence fence) const override;
Jeremy Gebbena3705f42021-01-19 16:47:43 -0700462 bool PreCallValidateQueueSubmit2KHR(VkQueue queue, uint32_t submitCount, const VkSubmitInfo2KHR* pSubmits,
463 VkFence fence) const override;
Tony-LunarGd36f5f32022-01-20 11:49:59 -0700464 bool PreCallValidateQueueSubmit2(VkQueue queue, uint32_t submitCount, const VkSubmitInfo2* pSubmits,
465 VkFence fence) const override;
Rodrigo Locattic789fe82022-07-06 17:42:19 -0300466 void PreCallRecordBeginCommandBuffer(VkCommandBuffer commandBuffer,
467 const VkCommandBufferBeginInfo* pBeginInfo) override;
Mark Lobodzinski2b967e72020-12-03 14:22:45 -0700468 bool PreCallValidateBeginCommandBuffer(VkCommandBuffer commandBuffer,
469 const VkCommandBufferBeginInfo* pBeginInfo) const override;
470 bool PreCallValidateCmdSetEvent(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask) const override;
Jeremy Gebbena3705f42021-01-19 16:47:43 -0700471 bool PreCallValidateCmdSetEvent2KHR(VkCommandBuffer commandBuffer, VkEvent event,
472 const VkDependencyInfoKHR* pDependencyInfo) const override;
Tony-LunarGd36f5f32022-01-20 11:49:59 -0700473 bool PreCallValidateCmdSetEvent2(VkCommandBuffer commandBuffer, VkEvent event,
474 const VkDependencyInfo* pDependencyInfo) const override;
Mark Lobodzinski2b967e72020-12-03 14:22:45 -0700475 bool PreCallValidateCmdResetEvent(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask) const override;
Jeremy Gebbena3705f42021-01-19 16:47:43 -0700476 bool PreCallValidateCmdResetEvent2KHR(VkCommandBuffer commandBuffer, VkEvent event,
477 VkPipelineStageFlags2KHR stageMask) const override;
Tony-LunarGd36f5f32022-01-20 11:49:59 -0700478 bool PreCallValidateCmdResetEvent2(VkCommandBuffer commandBuffer, VkEvent event,
479 VkPipelineStageFlags2 stageMask) const override;
Camden5b184be2019-08-13 07:50:19 -0600480 bool PreCallValidateCmdWaitEvents(VkCommandBuffer commandBuffer, uint32_t eventCount, const VkEvent* pEvents,
481 VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask,
482 uint32_t memoryBarrierCount, const VkMemoryBarrier* pMemoryBarriers,
483 uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier* pBufferMemoryBarriers,
Mark Lobodzinski2b967e72020-12-03 14:22:45 -0700484 uint32_t imageMemoryBarrierCount,
485 const VkImageMemoryBarrier* pImageMemoryBarriers) const override;
Jeremy Gebbena3705f42021-01-19 16:47:43 -0700486 bool PreCallValidateCmdWaitEvents2KHR(VkCommandBuffer commandBuffer, uint32_t eventCount, const VkEvent* pEvents,
487 const VkDependencyInfoKHR* pDependencyInfos) const override;
Tony-LunarGd36f5f32022-01-20 11:49:59 -0700488 bool PreCallValidateCmdWaitEvents2(VkCommandBuffer commandBuffer, uint32_t eventCount, const VkEvent* pEvents,
489 const VkDependencyInfo* pDependencyInfos) const override;
Camden5b184be2019-08-13 07:50:19 -0600490 bool PreCallValidateCmdPipelineBarrier(VkCommandBuffer commandBuffer, VkPipelineStageFlags srcStageMask,
491 VkPipelineStageFlags dstStageMask, VkDependencyFlags dependencyFlags,
492 uint32_t memoryBarrierCount, const VkMemoryBarrier* pMemoryBarriers,
493 uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier* pBufferMemoryBarriers,
Jeff Bolz5c801d12019-10-09 10:38:45 -0500494 uint32_t imageMemoryBarrierCount,
Mark Lobodzinski2b967e72020-12-03 14:22:45 -0700495 const VkImageMemoryBarrier* pImageMemoryBarriers) const override;
Jeremy Gebbena3705f42021-01-19 16:47:43 -0700496 bool PreCallValidateCmdPipelineBarrier2KHR(VkCommandBuffer commandBuffer,
497 const VkDependencyInfoKHR* pDependencyInfo) const override;
Tony-LunarGd36f5f32022-01-20 11:49:59 -0700498 bool PreCallValidateCmdPipelineBarrier2(VkCommandBuffer commandBuffer, const VkDependencyInfo* pDependencyInfo) const override;
Rodrigo Locatti0b16cda2022-04-01 17:59:53 -0300499
500 template <typename ImageMemoryBarrier>
501 bool ValidateCmdPipelineBarrierImageBarrier(VkCommandBuffer commandBuffer, const ImageMemoryBarrier& barrier) const;
502
Camden5b184be2019-08-13 07:50:19 -0600503 bool PreCallValidateCmdWriteTimestamp(VkCommandBuffer commandBuffer, VkPipelineStageFlagBits pipelineStage,
Mark Lobodzinski2b967e72020-12-03 14:22:45 -0700504 VkQueryPool queryPool, uint32_t query) const override;
Jeremy Gebbena3705f42021-01-19 16:47:43 -0700505 bool PreCallValidateCmdWriteTimestamp2KHR(VkCommandBuffer commandBuffer, VkPipelineStageFlags2KHR pipelineStage,
506 VkQueryPool queryPool, uint32_t query) const override;
Tony-LunarGd36f5f32022-01-20 11:49:59 -0700507 bool PreCallValidateCmdWriteTimestamp2(VkCommandBuffer commandBuffer, VkPipelineStageFlags2 pipelineStage,
508 VkQueryPool queryPool, uint32_t query) const override;
Rodrigo Locattia5eaf6e2022-04-01 18:05:23 -0300509 void PreCallRecordCmdBindPipeline(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint,
510 VkPipeline pipeline) override;
Mark Lobodzinski2b967e72020-12-03 14:22:45 -0700511 void PostCallRecordCmdBindPipeline(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint,
512 VkPipeline pipeline) override;
Rodrigo Locatti0b16cda2022-04-01 17:59:53 -0300513 void PreCallRecordCmdSetDepthCompareOp(VkCommandBuffer commandBuffer, VkCompareOp depthCompareOp) override;
514 void PreCallRecordCmdSetDepthCompareOpEXT(VkCommandBuffer commandBuffer, VkCompareOp depthCompareOp) override;
515 void PreCallRecordCmdSetDepthTestEnable(VkCommandBuffer commandBuffer, VkBool32 depthTestEnable) override;
516 void PreCallRecordCmdSetDepthTestEnableEXT(VkCommandBuffer commandBuffer, VkBool32 depthTestEnable) override;
Attilio Provenzano02859b22020-02-27 14:17:28 +0000517 bool ValidateCmdBeginRenderPass(VkCommandBuffer commandBuffer, RenderPassCreateVersion rp_version,
518 const VkRenderPassBeginInfo* pRenderPassBegin) const;
Rodrigo Locattie4c08a02022-04-04 18:12:18 -0300519 bool ValidateCmdBeginRendering(VkCommandBuffer commandBuffer, const VkRenderingInfo* pRenderingInfo) const;
ZandroFargnoli1ced2b62020-06-18 16:49:34 +0100520
521 void PreCallRecordCmdBeginRenderPass(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo* pRenderPassBegin,
Hans-Kristian Arntzena3cbffd2021-03-17 13:09:24 +0100522 VkSubpassContents contents) override;
Hans-Kristian Arntzend9941a92021-06-18 12:31:30 +0200523 void PreCallRecordCmdBeginRenderPass2(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo* pRenderPassBegin,
LawG4db16f802022-03-21 17:33:39 +0000524 const VkSubpassBeginInfo* pSubpassBeginInfo) override;
Hans-Kristian Arntzend9941a92021-06-18 12:31:30 +0200525 void PreCallRecordCmdBeginRenderPass2KHR(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo* pRenderPassBegin,
Rodrigo Locatti0b16cda2022-04-01 17:59:53 -0300526 const VkSubpassBeginInfo *pSubpassBeginInfo) override;
527 void PreCallRecordCmdBeginRendering(VkCommandBuffer commandBuffer, const VkRenderingInfo* pRenderingInfo) override;
528 void PreCallRecordCmdBeginRenderingKHR(VkCommandBuffer commandBuffer, const VkRenderingInfo* pRenderingInfo) override;
529
530 void PostCallRecordCmdNextSubpass(VkCommandBuffer commandBuffer, VkSubpassContents contents) override;
531
Hans-Kristian Arntzendd8acbb2021-03-22 13:41:47 +0100532 void PreCallRecordCmdEndRenderPass(VkCommandBuffer commandBuffer) override;
Rodrigo Locatti0b16cda2022-04-01 17:59:53 -0300533 void PreCallRecordCmdEndRenderPass2(VkCommandBuffer commandBuffer, const VkSubpassEndInfo *pSubpassEndInfo) override;
534 void PreCallRecordCmdEndRenderPass2KHR(VkCommandBuffer commandBuffer, const VkSubpassEndInfoKHR *pSubpassEndInfo) override;
535 void PreCallRecordCmdEndRendering(VkCommandBuffer commandBuffer) override;
536 void PreCallRecordCmdEndRenderingKHR(VkCommandBuffer commandBuffer) override;
537
Attilio Provenzano02859b22020-02-27 14:17:28 +0000538 bool PreCallValidateCmdBeginRenderPass(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo* pRenderPassBegin,
Mark Lobodzinski2b967e72020-12-03 14:22:45 -0700539 VkSubpassContents contents) const override;
Attilio Provenzano02859b22020-02-27 14:17:28 +0000540 bool PreCallValidateCmdBeginRenderPass2KHR(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo* pRenderPassBegin,
Mike Schuchardt2df08912020-12-15 16:28:09 -0800541 const VkSubpassBeginInfo* pSubpassBeginInfo) const override;
Attilio Provenzano02859b22020-02-27 14:17:28 +0000542 bool PreCallValidateCmdBeginRenderPass2(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo* pRenderPassBegin,
Mike Schuchardt2df08912020-12-15 16:28:09 -0800543 const VkSubpassBeginInfo* pSubpassBeginInfo) const override;
Rodrigo Locattie4c08a02022-04-04 18:12:18 -0300544 bool PreCallValidateCmdBeginRendering(VkCommandBuffer commandBuffer, const VkRenderingInfo* pRenderingInfo) const override;
545 bool PreCallValidateCmdBeginRenderingKHR(VkCommandBuffer commandBuffer, const VkRenderingInfo* pRenderingInfo) const override;
paul-lunarg5b863572022-09-19 19:27:13 +0200546 void ValidateBoundDescriptorSets(bp_state::CommandBuffer& commandBuffer, VkPipelineBindPoint bind_point,
547 const char* function_name);
Rodrigo Locatti0b16cda2022-04-01 17:59:53 -0300548 bool PreCallValidateCmdEndRendering(VkCommandBuffer commandBuffer) const override;
549 bool PreCallValidateCmdEndRenderingKHR(VkCommandBuffer commandBuffer) const override;
550
Sam Walls0961ec02020-03-31 16:39:15 +0100551 void RecordCmdBeginRenderPass(VkCommandBuffer commandBuffer, RenderPassCreateVersion rp_version,
552 const VkRenderPassBeginInfo* pRenderPassBegin);
553 void PostCallRecordCmdBeginRenderPass(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo* pRenderPassBegin,
Mark Lobodzinski2b967e72020-12-03 14:22:45 -0700554 VkSubpassContents contents) override;
Sam Walls0961ec02020-03-31 16:39:15 +0100555 void PostCallRecordCmdBeginRenderPass2(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo* pRenderPassBegin,
Mark Lobodzinski2b967e72020-12-03 14:22:45 -0700556 const VkSubpassBeginInfo* pSubpassBeginInfo) override;
Sam Walls0961ec02020-03-31 16:39:15 +0100557 void PostCallRecordCmdBeginRenderPass2KHR(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo* pRenderPassBegin,
Mark Lobodzinski2b967e72020-12-03 14:22:45 -0700558 const VkSubpassBeginInfo* pSubpassBeginInfo) override;
Camden5b184be2019-08-13 07:50:19 -0600559 bool PreCallValidateCmdDraw(VkCommandBuffer commandBuffer, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex,
Mark Lobodzinski2b967e72020-12-03 14:22:45 -0700560 uint32_t firstInstance) const override;
Sam Walls0961ec02020-03-31 16:39:15 +0100561 void PostCallRecordCmdDraw(VkCommandBuffer commandBuffer, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex,
Mark Lobodzinski2b967e72020-12-03 14:22:45 -0700562 uint32_t firstInstance) override;
Camden5b184be2019-08-13 07:50:19 -0600563 bool PreCallValidateCmdDrawIndexed(VkCommandBuffer commandBuffer, uint32_t indexCount, uint32_t instanceCount,
Mark Lobodzinski2b967e72020-12-03 14:22:45 -0700564 uint32_t firstIndex, int32_t vertexOffset, uint32_t firstInstance) const override;
Jeremy Gebben20da7a12022-02-25 14:07:46 -0700565 bool ValidateIndexBufferArm(const bp_state::CommandBuffer& cb_state, uint32_t indexCount, uint32_t instanceCount,
566 uint32_t firstIndex, int32_t vertexOffset, uint32_t firstInstance) const;
Attilio Provenzano02859b22020-02-27 14:17:28 +0000567 void PreCallRecordCmdDrawIndexed(VkCommandBuffer commandBuffer, uint32_t indexCount, uint32_t instanceCount,
Mark Lobodzinski2b967e72020-12-03 14:22:45 -0700568 uint32_t firstIndex, int32_t vertexOffset, uint32_t firstInstance) override;
Sam Walls0961ec02020-03-31 16:39:15 +0100569 void PostCallRecordCmdDrawIndexed(VkCommandBuffer commandBuffer, uint32_t indexCount, uint32_t instanceCount,
Mark Lobodzinski2b967e72020-12-03 14:22:45 -0700570 uint32_t firstIndex, int32_t vertexOffset, uint32_t firstInstance) override;
Camden5b184be2019-08-13 07:50:19 -0600571 bool PreCallValidateCmdDrawIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount,
Mark Lobodzinski2b967e72020-12-03 14:22:45 -0700572 uint32_t stride) const override;
Sam Walls0961ec02020-03-31 16:39:15 +0100573 void PostCallRecordCmdDrawIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t count,
Mark Lobodzinski2b967e72020-12-03 14:22:45 -0700574 uint32_t stride) override;
Camden5b184be2019-08-13 07:50:19 -0600575 bool PreCallValidateCmdDrawIndexedIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
Mark Lobodzinski2b967e72020-12-03 14:22:45 -0700576 uint32_t drawCount, uint32_t stride) const override;
Sam Walls0961ec02020-03-31 16:39:15 +0100577 void PostCallRecordCmdDrawIndexedIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t count,
Mark Lobodzinski2b967e72020-12-03 14:22:45 -0700578 uint32_t stride) override;
Rodrigo Locatti467344a2022-03-30 18:48:13 -0300579 bool PreCallValidateCmdDrawIndexedIndirectCount(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
580 VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount,
581 uint32_t stride) const override;
582 void PostCallRecordCmdDrawIndexedIndirectCount(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
583 VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount,
584 uint32_t stride) override;
585 bool PreCallValidateCmdDrawIndexedIndirectCountAMD(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
586 VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount,
587 uint32_t stride) const override;
588 void PostCallRecordCmdDrawIndexedIndirectCountAMD(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
589 VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount,
590 uint32_t stride) override;
591 bool PreCallValidateCmdDrawIndexedIndirectCountKHR(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
592 VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount,
593 uint32_t stride) const override;
594 void PostCallRecordCmdDrawIndexedIndirectCountKHR(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
595 VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount,
596 uint32_t stride) override;
597 bool PreCallValidateCmdDrawIndirectByteCountEXT(VkCommandBuffer commandBuffer, uint32_t instanceCount, uint32_t firstInstance,
598 VkBuffer counterBuffer, VkDeviceSize counterBufferOffset,
599 uint32_t counterOffset, uint32_t vertexStride) const override;
600 void PostCallRecordCmdDrawIndirectByteCountEXT(VkCommandBuffer commandBuffer, uint32_t instanceCount, uint32_t firstInstance,
601 VkBuffer counterBuffer, VkDeviceSize counterBufferOffset, uint32_t counterOffset,
602 uint32_t vertexStride) override;
603 bool PreCallValidateCmdDrawIndirectCount(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
604 VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount,
605 uint32_t stride) const override;
606 void PostCallRecordCmdDrawIndirectCount(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
607 VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount,
608 uint32_t stride) override;
609 bool PreCallValidateCmdDrawIndirectCountAMD(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
610 VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount,
611 uint32_t stride) const override;
612 void PostCallRecordCmdDrawIndirectCountAMD(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
613 VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount,
614 uint32_t stride) override;
615 bool PreCallValidateCmdDrawIndirectCountKHR(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
616 VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount,
617 uint32_t stride) const override;
618 void PostCallRecordCmdDrawIndirectCountKHR(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
619 VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount,
620 uint32_t stride) override;
621 bool PreCallValidateCmdDrawMeshTasksIndirectCountNV(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
622 VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount,
623 uint32_t stride) const override;
624 void PostCallRecordCmdDrawMeshTasksIndirectCountNV(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
625 VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount,
626 uint32_t stride) override;
627 bool PreCallValidateCmdDrawMeshTasksIndirectNV(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
628 uint32_t drawCount, uint32_t stride) const override;
629 void PostCallRecordCmdDrawMeshTasksIndirectNV(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
630 uint32_t drawCount, uint32_t strCmdDrawMeshTasksIndirectNVide) override;
631 bool PreCallValidateCmdDrawMeshTasksNV(VkCommandBuffer commandBuffer, uint32_t taskCount, uint32_t firstTask) const override;
632 void PostCallRecordCmdDrawMeshTasksNV(VkCommandBuffer commandBuffer, uint32_t taskCount, uint32_t firstTask) override;
633 bool PreCallValidateCmdDrawMultiIndexedEXT(VkCommandBuffer commandBuffer, uint32_t drawCount,
634 const VkMultiDrawIndexedInfoEXT* pIndexInfo, uint32_t instanceCount,
635 uint32_t firstInstance, uint32_t stride,
636 const int32_t* pVertexOffset) const override;
637 void PostCallRecordCmdDrawMultiIndexedEXT(VkCommandBuffer commandBuffer, uint32_t drawCount,
638 const VkMultiDrawIndexedInfoEXT* pIndexInfo, uint32_t instanceCount,
639 uint32_t firstInstance, uint32_t stride, const int32_t* pVertexOffset) override;
640 bool PreCallValidateCmdDrawMultiEXT(VkCommandBuffer commandBuffer, uint32_t drawCount, const VkMultiDrawInfoEXT* pVertexInfo,
641 uint32_t instanceCount, uint32_t firstInstance, uint32_t stride) const override;
642 void PostCallRecordCmdDrawMultiEXT(VkCommandBuffer commandBuffer, uint32_t drawCount, const VkMultiDrawInfoEXT* pVertexInfo,
643 uint32_t instanceCount, uint32_t firstInstance, uint32_t stride) override;
644
Camden5b184be2019-08-13 07:50:19 -0600645 bool PreCallValidateCmdDispatch(VkCommandBuffer commandBuffer, uint32_t groupCountX, uint32_t groupCountY,
Mark Lobodzinski2b967e72020-12-03 14:22:45 -0700646 uint32_t groupCountZ) const override;
647 bool PreCallValidateCmdEndRenderPass(VkCommandBuffer commandBuffer) const override;
LawG4db16f802022-03-21 17:33:39 +0000648 bool PreCallValidateCmdEndRenderPass2(VkCommandBuffer commandBuffer, const VkSubpassEndInfo* pSubpassEndInfo) const override;
649 bool PreCallValidateCmdEndRenderPass2KHR(VkCommandBuffer commandBuffer, const VkSubpassEndInfo* pSubpassEndInfo) const override;
ZandroFargnoli1ced2b62020-06-18 16:49:34 +0100650 void PreCallRecordCmdDraw(VkCommandBuffer commandBuffer, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex,
Hans-Kristian Arntzena3cbffd2021-03-17 13:09:24 +0100651 uint32_t firstInstance) override;
ZandroFargnoli1ced2b62020-06-18 16:49:34 +0100652 void PreCallRecordCmdDrawIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount,
Hans-Kristian Arntzena3cbffd2021-03-17 13:09:24 +0100653 uint32_t stride) override;
ZandroFargnoli1ced2b62020-06-18 16:49:34 +0100654 void PreCallRecordCmdDrawIndexedIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
Hans-Kristian Arntzena3cbffd2021-03-17 13:09:24 +0100655 uint32_t drawCount, uint32_t stride) override;
656 void PreCallRecordCmdDispatch(VkCommandBuffer commandBuffer, uint32_t x, uint32_t y, uint32_t z) override;
657 void PreCallRecordCmdDispatchIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset) override;
Camden Stocker9c051442019-11-06 14:28:43 -0800658 bool ValidateGetPhysicalDeviceDisplayPlanePropertiesKHRQuery(VkPhysicalDevice physicalDevice, const char* api_name) const;
Camden83a9c372019-08-14 11:41:38 -0600659 bool PreCallValidateGetDisplayPlaneSupportedDisplaysKHR(VkPhysicalDevice physicalDevice, uint32_t planeIndex,
Mark Lobodzinski2b967e72020-12-03 14:22:45 -0700660 uint32_t* pDisplayCount, VkDisplayKHR* pDisplays) const override;
Camden Stocker9c051442019-11-06 14:28:43 -0800661 bool PreCallValidateGetDisplayPlaneCapabilitiesKHR(VkPhysicalDevice physicalDevice, VkDisplayModeKHR mode, uint32_t planeIndex,
Mark Lobodzinski2b967e72020-12-03 14:22:45 -0700662 VkDisplayPlaneCapabilitiesKHR* pCapabilities) const override;
Camden Stocker9c051442019-11-06 14:28:43 -0800663 bool PreCallValidateGetDisplayPlaneCapabilities2KHR(VkPhysicalDevice physicalDevice,
664 const VkDisplayPlaneInfo2KHR* pDisplayPlaneInfo,
Mark Lobodzinski2b967e72020-12-03 14:22:45 -0700665 VkDisplayPlaneCapabilities2KHR* pCapabilities) const override;
Camden05de2d42019-08-19 10:23:56 -0600666 bool PreCallValidateGetSwapchainImagesKHR(VkDevice device, VkSwapchainKHR swapchain, uint32_t* pSwapchainImageCount,
Mark Lobodzinski2b967e72020-12-03 14:22:45 -0700667 VkImage* pSwapchainImages) const override;
Camden05de2d42019-08-19 10:23:56 -0600668 bool PreCallValidateGetPhysicalDeviceQueueFamilyProperties(VkPhysicalDevice physicalDevice, uint32_t* pQueueFamilyPropertyCount,
Mark Lobodzinski2b967e72020-12-03 14:22:45 -0700669 VkQueueFamilyProperties* pQueueFamilyProperties) const override;
Camden05de2d42019-08-19 10:23:56 -0600670 bool PreCallValidateGetPhysicalDeviceQueueFamilyProperties2(VkPhysicalDevice physicalDevice,
671 uint32_t* pQueueFamilyPropertyCount,
Mark Lobodzinski2b967e72020-12-03 14:22:45 -0700672 VkQueueFamilyProperties2* pQueueFamilyProperties) const override;
Camden05de2d42019-08-19 10:23:56 -0600673 bool PreCallValidateGetPhysicalDeviceQueueFamilyProperties2KHR(VkPhysicalDevice physicalDevice,
674 uint32_t* pQueueFamilyPropertyCount,
Mark Lobodzinski2b967e72020-12-03 14:22:45 -0700675 VkQueueFamilyProperties2* pQueueFamilyProperties) const override;
Camden05de2d42019-08-19 10:23:56 -0600676 bool PreCallValidateGetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface,
Jeff Bolz5c801d12019-10-09 10:38:45 -0500677 uint32_t* pSurfaceFormatCount,
Mark Lobodzinski2b967e72020-12-03 14:22:45 -0700678 VkSurfaceFormatKHR* pSurfaceFormats) const override;
Mark Lobodzinskib6e2a282020-01-29 16:03:26 -0700679 bool ValidateCommonGetPhysicalDeviceQueueFamilyProperties(const PHYSICAL_DEVICE_STATE* pd_state,
Nathaniel Cesario56a96652020-12-30 13:23:42 -0700680 uint32_t requested_queue_family_property_count,
681 const CALL_STATE call_state, const char* caller_name) const;
Camden Stocker82510582019-09-03 14:00:16 -0600682 bool PreCallValidateBindAccelerationStructureMemoryNV(VkDevice device, uint32_t bindInfoCount,
Mark Lobodzinski2b967e72020-12-03 14:22:45 -0700683 const VkBindAccelerationStructureMemoryInfoNV* pBindInfos) const override;
Jeff Bolz5c801d12019-10-09 10:38:45 -0500684 bool PreCallValidateQueueBindSparse(VkQueue queue, uint32_t bindInfoCount, const VkBindSparseInfo* pBindInfo,
Mark Lobodzinski2b967e72020-12-03 14:22:45 -0700685 VkFence fence) const override;
Mark Lobodzinski84101d72020-04-24 09:43:48 -0600686 void ManualPostCallRecordQueueBindSparse(VkQueue queue, uint32_t bindInfoCount, const VkBindSparseInfo* pBindInfo,
687 VkFence fence, VkResult result);
Camden Stocker0e0f89b2019-10-16 12:24:31 -0700688 bool PreCallValidateCmdClearAttachments(VkCommandBuffer commandBuffer, uint32_t attachmentCount,
Camden Stocker7a1fe4c2019-11-01 11:02:51 -0700689 const VkClearAttachment* pAttachments, uint32_t rectCount,
Mark Lobodzinski2b967e72020-12-03 14:22:45 -0700690 const VkClearRect* pRects) const override;
Mark Lobodzinskide15e582020-04-29 08:06:00 -0600691 void ValidateReturnCodes(const char* api_name, VkResult result, const std::vector<VkResult>& error_codes,
692 const std::vector<VkResult>& success_codes) const;
Attilio Provenzano02859b22020-02-27 14:17:28 +0000693 bool PreCallValidateCmdResolveImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout,
694 VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount,
Mark Lobodzinski2b967e72020-12-03 14:22:45 -0700695 const VkImageResolve* pRegions) const override;
696 bool PreCallValidateCmdResolveImage2KHR(VkCommandBuffer commandBuffer,
697 const VkResolveImageInfo2KHR* pResolveImageInfo) const override;
Tony-LunarGd36f5f32022-01-20 11:49:59 -0700698 bool PreCallValidateCmdResolveImage2(VkCommandBuffer commandBuffer,
699 const VkResolveImageInfo2* pResolveImageInfo) const override;
ZandroFargnoli1ced2b62020-06-18 16:49:34 +0100700
Jeremy Gebbene5361dd2021-11-18 14:23:56 -0700701 using QueueCallbacks = std::vector<CMD_BUFFER_STATE::QueueCallback>;
Hans-Kristian Arntzendd8acbb2021-03-22 13:41:47 +0100702
Hans-Kristian Arntzenc8b831c2021-04-28 15:29:49 +0200703 void QueueValidateImageView(QueueCallbacks &func, const char* function_name,
704 IMAGE_VIEW_STATE* view, IMAGE_SUBRESOURCE_USAGE_BP usage);
Jeremy Gebben20da7a12022-02-25 14:07:46 -0700705 void QueueValidateImage(QueueCallbacks& func, const char* function_name, std::shared_ptr<bp_state::Image>& state,
706 IMAGE_SUBRESOURCE_USAGE_BP usage, const VkImageSubresourceRange& subresource_range);
707 void QueueValidateImage(QueueCallbacks& func, const char* function_name, std::shared_ptr<bp_state::Image>& state,
708 IMAGE_SUBRESOURCE_USAGE_BP usage, const VkImageSubresourceLayers& range);
709 void QueueValidateImage(QueueCallbacks& func, const char* function_name, std::shared_ptr<bp_state::Image>& state,
710 IMAGE_SUBRESOURCE_USAGE_BP usage, uint32_t array_layer, uint32_t mip_level);
paul-lunarg670a5622022-09-09 13:48:22 +0200711 void ValidateImageInQueue(const QUEUE_STATE& qs, const CMD_BUFFER_STATE& cbs, const char* function_name, bp_state::Image& state,
712 IMAGE_SUBRESOURCE_USAGE_BP usage, uint32_t array_layer, uint32_t mip_level);
LawG44d414ba2022-02-23 15:35:41 +0000713 void ValidateImageInQueueArmImg(const char* function_name, const bp_state::Image& image, IMAGE_SUBRESOURCE_USAGE_BP last_usage,
Jeremy Gebben20da7a12022-02-25 14:07:46 -0700714 IMAGE_SUBRESOURCE_USAGE_BP usage, uint32_t array_layer, uint32_t mip_level);
ZandroFargnoli1ced2b62020-06-18 16:49:34 +0100715
716 void PreCallRecordCmdResolveImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout,
717 VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount,
Hans-Kristian Arntzena3cbffd2021-03-17 13:09:24 +0100718 const VkImageResolve* pRegions) override;
LawG4db16f802022-03-21 17:33:39 +0000719 void PreCallRecordCmdResolveImage2KHR(VkCommandBuffer commandBuffer, const VkResolveImageInfo2KHR* pResolveImageInfo) override;
Tony-LunarGd36f5f32022-01-20 11:49:59 -0700720 void PreCallRecordCmdResolveImage2(VkCommandBuffer commandBuffer, const VkResolveImageInfo2* pResolveImageInfo) override;
ZandroFargnoli1ced2b62020-06-18 16:49:34 +0100721 void PreCallRecordCmdClearColorImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout,
722 const VkClearColorValue* pColor, uint32_t rangeCount,
Hans-Kristian Arntzena3cbffd2021-03-17 13:09:24 +0100723 const VkImageSubresourceRange* pRanges) override;
ZandroFargnoli1ced2b62020-06-18 16:49:34 +0100724 void PreCallRecordCmdClearDepthStencilImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout,
725 const VkClearDepthStencilValue* pDepthStencil, uint32_t rangeCount,
Hans-Kristian Arntzena3cbffd2021-03-17 13:09:24 +0100726 const VkImageSubresourceRange* pRanges) override;
ZandroFargnoli1ced2b62020-06-18 16:49:34 +0100727 void PreCallRecordCmdCopyImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage,
Hans-Kristian Arntzena3cbffd2021-03-17 13:09:24 +0100728 VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageCopy* pRegions) override;
ZandroFargnoli1ced2b62020-06-18 16:49:34 +0100729 void PreCallRecordCmdCopyBufferToImage(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkImage dstImage,
LawG4db16f802022-03-21 17:33:39 +0000730 VkImageLayout dstImageLayout, uint32_t regionCount,
731 const VkBufferImageCopy* pRegions) override;
ZandroFargnoli1ced2b62020-06-18 16:49:34 +0100732 void PreCallRecordCmdCopyImageToBuffer(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout,
Hans-Kristian Arntzena3cbffd2021-03-17 13:09:24 +0100733 VkBuffer dstBuffer, uint32_t regionCount, const VkBufferImageCopy* pRegions) override;
ZandroFargnoli1ced2b62020-06-18 16:49:34 +0100734 void PreCallRecordCmdBlitImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage,
735 VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageBlit* pRegions,
Hans-Kristian Arntzena3cbffd2021-03-17 13:09:24 +0100736 VkFilter filter) override;
Attilio Provenzano02859b22020-02-27 14:17:28 +0000737 bool PreCallValidateCreateSampler(VkDevice device, const VkSamplerCreateInfo* pCreateInfo,
Mark Lobodzinski2b967e72020-12-03 14:22:45 -0700738 const VkAllocationCallbacks* pAllocator, VkSampler* pSampler) const override;
Mark Lobodzinski84101d72020-04-24 09:43:48 -0600739 void ManualPostCallRecordQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR* pPresentInfo, VkResult result);
Sam Walls0961ec02020-03-31 16:39:15 +0100740 void ManualPostCallRecordCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t count,
741 const VkGraphicsPipelineCreateInfo* pCreateInfos,
742 const VkAllocationCallbacks* pAllocator, VkPipeline* pPipelines,
743 VkResult result, void* cgpl_state_data);
Mark Lobodzinski205b7a02020-02-21 13:23:17 -0700744
Nathaniel Cesario24184fe2020-10-06 12:46:12 -0600745 bool PreCallValidateAcquireNextImageKHR(VkDevice device, VkSwapchainKHR swapchain, uint64_t timeout, VkSemaphore semaphore,
Mark Lobodzinski2b967e72020-12-03 14:22:45 -0700746 VkFence fence, uint32_t* pImageIndex) const override;
Nathaniel Cesario24184fe2020-10-06 12:46:12 -0600747
Nathaniel Cesario56a96652020-12-30 13:23:42 -0700748 void CommonPostCallRecordGetPhysicalDeviceQueueFamilyProperties(CALL_STATE& call_state, bool no_pointer);
Nathaniel Cesariof121d122020-10-08 13:09:46 -0600749 void PostCallRecordGetPhysicalDeviceQueueFamilyProperties(VkPhysicalDevice physicalDevice, uint32_t* pQueueFamilyPropertyCount,
Mark Lobodzinski2b967e72020-12-03 14:22:45 -0700750 VkQueueFamilyProperties* pQueueFamilyProperties) override;
Nathaniel Cesario24184fe2020-10-06 12:46:12 -0600751
Nathaniel Cesario56a96652020-12-30 13:23:42 -0700752 void PostCallRecordGetPhysicalDeviceQueueFamilyProperties2(VkPhysicalDevice physicalDevice, uint32_t* pQueueFamilyPropertyCount,
753 VkQueueFamilyProperties2* pQueueFamilyProperties) override;
754
755 void PostCallRecordGetPhysicalDeviceQueueFamilyProperties2KHR(VkPhysicalDevice physicalDevice,
756 uint32_t* pQueueFamilyPropertyCount,
757 VkQueueFamilyProperties2* pQueueFamilyProperties) override;
758
Mark Lobodzinski2b967e72020-12-03 14:22:45 -0700759 void PostCallRecordGetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures* pFeatures) override;
Nathaniel Cesario24184fe2020-10-06 12:46:12 -0600760
Mark Lobodzinski2b967e72020-12-03 14:22:45 -0700761 void PostCallRecordGetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures2* pFeatures) override;
Nathaniel Cesario24184fe2020-10-06 12:46:12 -0600762
Mark Lobodzinski2b967e72020-12-03 14:22:45 -0700763 void PostCallRecordGetPhysicalDeviceFeatures2KHR(VkPhysicalDevice physicalDevice,
764 VkPhysicalDeviceFeatures2* pFeatures) override;
Nathaniel Cesario24184fe2020-10-06 12:46:12 -0600765
766 void ManualPostCallRecordGetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface,
767 VkSurfaceCapabilitiesKHR* pSurfaceCapabilities,
768 VkResult result);
769
770 void ManualPostCallRecordGetPhysicalDeviceSurfaceCapabilities2KHR(VkPhysicalDevice physicalDevice,
771 const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo,
772 VkSurfaceCapabilities2KHR* pSurfaceCapabilities,
773 VkResult result);
774
775 void ManualPostCallRecordGetPhysicalDeviceSurfaceCapabilities2EXT(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface,
776 VkSurfaceCapabilities2EXT* pSurfaceCapabilities,
777 VkResult result);
778
779 void ManualPostCallRecordGetPhysicalDeviceSurfacePresentModesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface,
780 uint32_t* pPresentModeCount, VkPresentModeKHR* pPresentModes,
781 VkResult result);
782
783 void ManualPostCallRecordGetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface,
784 uint32_t* pSurfaceFormatCount, VkSurfaceFormatKHR* pSurfaceFormats,
785 VkResult result);
786
787 void ManualPostCallRecordGetPhysicalDeviceSurfaceFormats2KHR(VkPhysicalDevice physicalDevice,
788 const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo,
789 uint32_t* pSurfaceFormatCount,
790 VkSurfaceFormat2KHR* pSurfaceFormats, VkResult result);
791
792 void ManualPostCallRecordGetPhysicalDeviceDisplayPlanePropertiesKHR(VkPhysicalDevice physicalDevice, uint32_t* pPropertyCount,
793 VkDisplayPlanePropertiesKHR* pProperties, VkResult result);
794
Nathaniel Cesario24184fe2020-10-06 12:46:12 -0600795 void ManualPostCallRecordGetSwapchainImagesKHR(VkDevice device, VkSwapchainKHR swapchain, uint32_t* pSwapchainImageCount,
796 VkImage* pSwapchainImages, VkResult result);
797
Nadav Gevaf0808442021-05-21 13:51:25 -0400798 void ManualPostCallRecordQueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo* pSubmits, VkFence fence,
799 VkResult result);
800
801 void ManualPostCallRecordEndCommandBuffer(VkCommandBuffer commandBuffer, VkResult result);
802
Nadav Gevaf0808442021-05-21 13:51:25 -0400803 void ManualPostCallRecordCreateComputePipelines(VkDevice device, VkPipelineCache pipelineCache,
804 uint32_t createInfoCount,
805 const VkComputePipelineCreateInfo* pCreateInfos,
806 const VkAllocationCallbacks* pAllocator, VkPipeline* pPipelines,
807 VkResult result, void* state_data);
808
809 void PostCallRecordCmdPipelineBarrier(VkCommandBuffer commandBuffer, VkPipelineStageFlags srcStageMask,
810 VkPipelineStageFlags dstStageMask, VkDependencyFlags dependencyFlags,
811 uint32_t memoryBarrierCount, const VkMemoryBarrier* pMemoryBarriers,
812 uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier* pBufferMemoryBarriers,
LawG4db16f802022-03-21 17:33:39 +0000813 uint32_t imageMemoryBarrierCount,
814 const VkImageMemoryBarrier* pImageMemoryBarriers) override;
Rodrigo Locatti0b16cda2022-04-01 17:59:53 -0300815 void PostCallRecordCmdPipelineBarrier2(VkCommandBuffer commandBuffer, const VkDependencyInfo *pDependencyInfo) override;
816 void PostCallRecordCmdPipelineBarrier2KHR(VkCommandBuffer commandBuffer, const VkDependencyInfo *pDependencyInfo) override;
817 template <typename ImageMemoryBarrier>
818 void RecordCmdPipelineBarrierImageBarrier(VkCommandBuffer commandBuffer, const ImageMemoryBarrier& barrier);
Nadav Gevaf0808442021-05-21 13:51:25 -0400819
820 void PreCallRecordCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount,
821 const VkGraphicsPipelineCreateInfo* pCreateInfos,
822 const VkAllocationCallbacks* pAllocator, VkPipeline* pPipelines,
823 void* cgpl_state) override;
824
825 bool PreCallValidateUpdateDescriptorSets(VkDevice device, uint32_t descriptorWriteCount,
LawG4db16f802022-03-21 17:33:39 +0000826 const VkWriteDescriptorSet* pDescriptorWrites, uint32_t descriptorCopyCount,
Nadav Gevaf0808442021-05-21 13:51:25 -0400827 const VkCopyDescriptorSet* pDescriptorCopies) const override;
828 bool PreCallValidateCreateDescriptorUpdateTemplate(VkDevice device, const VkDescriptorUpdateTemplateCreateInfo* pCreateInfo,
829 const VkAllocationCallbacks* pAllocator,
830 VkDescriptorUpdateTemplate* pDescriptorUpdateTemplate) const override;
831 bool PreCallValidateCmdClearColorImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout,
832 const VkClearColorValue* pColor, uint32_t rangeCount,
833 const VkImageSubresourceRange* pRanges) const override;
834
835 bool PreCallValidateCmdClearDepthStencilImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout,
836 const VkClearDepthStencilValue* pDepthStencil, uint32_t rangeCount,
837 const VkImageSubresourceRange* pRanges) const override;
838
839 bool PreCallValidateCreatePipelineLayout(VkDevice device, const VkPipelineLayoutCreateInfo* pCreateInfo,
840 const VkAllocationCallbacks* pAllocator,
841 VkPipelineLayout* pPipelineLayout) const override;
842
843 bool PreCallValidateCmdCopyImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout,
844 VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount,
845 const VkImageCopy* pRegions) const override;
846
847 bool PreCallValidateCmdBindPipeline(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint,
848 VkPipeline pipeline) const override;
849
850 bool PreCallValidateQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR* pPresentInfo) const override;
851
852 bool PreCallValidateCreateSemaphore(VkDevice device, const VkSemaphoreCreateInfo* pCreateInfo,
853 const VkAllocationCallbacks* pAllocator, VkSemaphore* pSemaphore) const override;
854 bool PreCallValidateCreateFence(VkDevice device, const VkFenceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator,
855 VkFence* pFence) const override;
856
Hans-Kristian Arntzen66f4b522021-03-22 11:35:58 +0100857 void PreCallRecordQueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo* pSubmits, VkFence fence) override;
858
Hans-Kristian Arntzenb6586312021-07-05 11:43:39 +0200859 void PreCallRecordCmdClearAttachments(VkCommandBuffer commandBuffer, uint32_t attachmentCount,
LawG4db16f802022-03-21 17:33:39 +0000860 const VkClearAttachment* pClearAttachments, uint32_t rectCount,
861 const VkClearRect* pRects) override;
Hans-Kristian Arntzenb6586312021-07-05 11:43:39 +0200862
863 bool PreCallValidateCmdExecuteCommands(VkCommandBuffer commandBuffer, uint32_t commandBufferCount,
864 const VkCommandBuffer* pCommandBuffers) const override;
865 void PreCallRecordCmdExecuteCommands(VkCommandBuffer commandBuffer, uint32_t commandBufferCount,
866 const VkCommandBuffer* pCommandBuffers) override;
867
Rodrigo Locatti7d716e12022-03-09 19:15:17 -0300868 bool PreCallValidateCmdBuildAccelerationStructureNV(VkCommandBuffer commandBuffer, const VkAccelerationStructureInfoNV* pInfo,
869 VkBuffer instanceData, VkDeviceSize instanceOffset, VkBool32 update,
870 VkAccelerationStructureNV dst, VkAccelerationStructureNV src,
871 VkBuffer scratch, VkDeviceSize scratchOffset) const override;
872 bool PreCallValidateCmdBuildAccelerationStructuresIndirectKHR(VkCommandBuffer commandBuffer, uint32_t infoCount,
873 const VkAccelerationStructureBuildGeometryInfoKHR* pInfos,
874 const VkDeviceAddress* pIndirectDeviceAddresses,
875 const uint32_t* pIndirectStrides,
876 const uint32_t* const* ppMaxPrimitiveCounts) const override;
877 bool PreCallValidateCmdBuildAccelerationStructuresKHR(
878 VkCommandBuffer commandBuffer, uint32_t infoCount, const VkAccelerationStructureBuildGeometryInfoKHR* pInfos,
879 const VkAccelerationStructureBuildRangeInfoKHR* const* ppBuildRangeInfos) const override;
880
Jeremy Gebben20da7a12022-02-25 14:07:46 -0700881// Include code-generated functions
882#include "best_practices.h"
883 protected:
884 std::shared_ptr<CMD_BUFFER_STATE> CreateCmdBufferState(VkCommandBuffer cb, const VkCommandBufferAllocateInfo* create_info,
885 const COMMAND_POOL_STATE* pool) final;
Rodrigo Locatti7d716e12022-03-09 19:15:17 -0300886
Nathaniel Cesario39152e62021-07-02 13:04:16 -0600887 std::shared_ptr<SWAPCHAIN_NODE> CreateSwapchainState(const VkSwapchainCreateInfoKHR* create_info,
888 VkSwapchainKHR swapchain) final {
Jeremy Gebben20da7a12022-02-25 14:07:46 -0700889 return std::static_pointer_cast<SWAPCHAIN_NODE>(std::make_shared<bp_state::Swapchain>(this, create_info, swapchain));
Nathaniel Cesario39152e62021-07-02 13:04:16 -0600890 }
891
Jeremy Gebben383b9a32021-09-08 16:31:33 -0600892 std::shared_ptr<PHYSICAL_DEVICE_STATE> CreatePhysicalDeviceState(VkPhysicalDevice phys_dev) final {
Jeremy Gebben20da7a12022-02-25 14:07:46 -0700893 return std::static_pointer_cast<PHYSICAL_DEVICE_STATE>(std::make_shared<bp_state::PhysicalDevice>(phys_dev));
Jeremy Gebben383b9a32021-09-08 16:31:33 -0600894 }
895
Jeremy Gebben20da7a12022-02-25 14:07:46 -0700896 std::shared_ptr<IMAGE_STATE> CreateImageState(VkImage img, const VkImageCreateInfo* pCreateInfo,
897 VkFormatFeatureFlags2KHR features) final {
Aitor Camacho3294edd2022-05-16 22:34:19 +0200898 std::shared_ptr<bp_state::Image> state;
899
900 if (pCreateInfo->flags & VK_IMAGE_CREATE_SPARSE_BINDING_BIT) {
901 if (pCreateInfo->flags & VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT) {
902 state = std::make_shared<bp_state::ImageSparse<true>>(this, img, pCreateInfo, features);
903 } else {
904 state = std::make_shared<bp_state::ImageSparse<false>>(this, img, pCreateInfo, features);
905 }
906 } else if (pCreateInfo->flags & VK_IMAGE_CREATE_DISJOINT_BIT) {
907 uint32_t plane_count = FormatPlaneCount(pCreateInfo->format);
908 switch (plane_count) {
909 case 3:
910 state = std::make_shared<bp_state::ImageMultiplanar<3>>(this, img, pCreateInfo, features);
911 break;
912 case 2:
913 state = std::make_shared<bp_state::ImageMultiplanar<2>>(this, img, pCreateInfo, features);
914 break;
915 case 1:
916 state = std::make_shared<bp_state::ImageMultiplanar<1>>(this, img, pCreateInfo, features);
917 break;
918 default:
Shahbaz Youssefi7dc0d332022-06-06 11:31:08 -0400919 // Not supported
920 assert(false);
Aitor Camacho3294edd2022-05-16 22:34:19 +0200921 }
922 } else {
923 state = std::make_shared<bp_state::ImageLinear>(this, img, pCreateInfo, features);
924 }
925
926 return state;
Jeremy Gebben20da7a12022-02-25 14:07:46 -0700927 }
928
929 std::shared_ptr<IMAGE_STATE> CreateImageState(VkImage img, const VkImageCreateInfo* pCreateInfo, VkSwapchainKHR swapchain,
930 uint32_t swapchain_index, VkFormatFeatureFlags2KHR features) final {
931 return std::static_pointer_cast<IMAGE_STATE>(
Aitor Camacho3294edd2022-05-16 22:34:19 +0200932 std::make_shared<bp_state::ImageNoBinding>(this, img, pCreateInfo, swapchain, swapchain_index, features));
Jeremy Gebben20da7a12022-02-25 14:07:46 -0700933 }
934
935 std::shared_ptr<DESCRIPTOR_POOL_STATE> CreateDescriptorPoolState(VkDescriptorPool pool,
936 const VkDescriptorPoolCreateInfo* pCreateInfo) final {
937 return std::static_pointer_cast<DESCRIPTOR_POOL_STATE>(std::make_shared<bp_state::DescriptorPool>(this, pool, pCreateInfo));
938 }
939
Rodrigo Locatti37ddb022022-03-15 17:27:42 -0300940 std::shared_ptr<DEVICE_MEMORY_STATE> CreateDeviceMemoryState(VkDeviceMemory mem, const VkMemoryAllocateInfo* p_alloc_info,
941 uint64_t fake_address, const VkMemoryType& memory_type,
942 const VkMemoryHeap& memory_heap,
943 layer_data::optional<DedicatedBinding>&& dedicated_binding,
944 uint32_t physical_device_count) final {
945 return std::static_pointer_cast<DEVICE_MEMORY_STATE>(std::make_shared<bp_state::DeviceMemory>(
946 mem, p_alloc_info, fake_address, memory_type, memory_heap, std::move(dedicated_binding), physical_device_count));
947 }
948
Jeremy Gebben20da7a12022-02-25 14:07:46 -0700949 std::shared_ptr<PIPELINE_STATE> CreateGraphicsPipelineState(const VkGraphicsPipelineCreateInfo* pCreateInfo,
950 std::shared_ptr<const RENDER_PASS_STATE>&& render_pass,
951 std::shared_ptr<const PIPELINE_LAYOUT_STATE>&& layout) const final;
Camden5b184be2019-08-13 07:50:19 -0600952
Petr Kraus4ed81e32019-09-02 23:41:19 +0200953 private:
Jeremy Gebben20da7a12022-02-25 14:07:46 -0700954 // CacheEntry and PostTransformLRUCacheModel are used on the stack
Sam Walls8e77e4f2020-03-16 20:47:40 +0000955 struct CacheEntry {
956 uint32_t value;
957 uint32_t age;
958 };
959
960 class PostTransformLRUCacheModel {
961 public:
962 typedef std::vector<CacheEntry>::iterator cache_iterator;
963
964 void resize(size_t size);
965
966 // Returns true if there was a cache hit - also models LRU behavior which will effect subsequent calls.
967 bool query_cache(uint32_t value);
968
969 private:
970 std::vector<CacheEntry> _entries = {};
971 uint32_t iteration = 0;
972 };
Sam Walls0961ec02020-03-31 16:39:15 +0100973
Jeremy Gebben485a3ee2022-03-01 13:38:18 -0700974 // Check that vendor-specific checks are enabled for at least one of the vendors
975 bool VendorCheckEnabled(BPVendorFlags vendors) const;
Sam Walls0961ec02020-03-31 16:39:15 +0100976
Jeremy Gebben20da7a12022-02-25 14:07:46 -0700977 void RecordCmdDrawTypeArm(bp_state::CommandBuffer& cmd_state, uint32_t draw_count, const char* caller);
Rodrigo Locatti0b16cda2022-04-01 17:59:53 -0300978 void RecordCmdDrawTypeNVIDIA(bp_state::CommandBuffer& cmd_state);
Jeremy Gebben20da7a12022-02-25 14:07:46 -0700979
980 void AddDeferredQueueOperations(bp_state::CommandBuffer& cb);
Hans-Kristian Arntzen8abca1e2021-06-16 13:57:45 +0200981
Nathaniel Cesario24184fe2020-10-06 12:46:12 -0600982 // Get BestPractices-specific for the current instance
Jeremy Gebben20da7a12022-02-25 14:07:46 -0700983 bp_state::PhysicalDevice* GetPhysicalDeviceState() { return static_cast<bp_state::PhysicalDevice*>(physical_device_state); }
984 const bp_state::PhysicalDevice* GetPhysicalDeviceState() const {
985 return static_cast<const bp_state::PhysicalDevice*>(physical_device_state);
Jeremy Gebben383b9a32021-09-08 16:31:33 -0600986 }
Hans-Kristian Arntzen5b466db2021-03-18 13:59:46 +0100987
Jeremy Gebben20da7a12022-02-25 14:07:46 -0700988 void RecordAttachmentClearAttachments(bp_state::CommandBuffer& cmd_state, uint32_t fb_attachment, uint32_t color_attachment,
989 VkImageAspectFlags aspects, uint32_t rectCount, const VkClearRect* pRects);
990 void RecordAttachmentAccess(bp_state::CommandBuffer& cmd_state, uint32_t attachment, VkImageAspectFlags aspects);
991 bool ClearAttachmentsIsFullClear(const bp_state::CommandBuffer& cmd, uint32_t rectCount, const VkClearRect* pRects) const;
992 bool ValidateClearAttachment(const bp_state::CommandBuffer& cmd, uint32_t fb_attachment, uint32_t color_attachment,
993 VkImageAspectFlags aspects, bool secondary) const;
Hans-Kristian Arntzend9941a92021-06-18 12:31:30 +0200994
995 bool ValidateCmdEndRenderPass(VkCommandBuffer commandBuffer) const;
LawG4db16f802022-03-21 17:33:39 +0000996 void RecordCmdBeginRenderPass(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo* pRenderPassBegin);
Jeremy Gebben3d22d582021-08-11 15:37:58 -0600997
Rodrigo Locatti7d716e12022-03-09 19:15:17 -0300998 bool ValidateBuildAccelerationStructure(VkCommandBuffer commandBuffer) const;
999
Rodrigo Locatti66b23352022-03-15 17:28:32 -03001000 bool ValidateBindMemory(VkDevice device, VkDeviceMemory memory) const;
1001
Rodrigo Locatti0b16cda2022-04-01 17:59:53 -03001002 void RecordSetDepthTestState(bp_state::CommandBuffer& cmd_state, VkCompareOp new_depth_compare_op, bool new_depth_test_enable);
1003
1004 void RecordCmdBeginRenderingCommon(VkCommandBuffer commandBuffer);
1005 void RecordCmdEndRenderingCommon(VkCommandBuffer commandBuffer);
1006
1007 void RecordBindZcullScope(bp_state::CommandBuffer& cmd_state, VkImage depth_attachment, const VkImageSubresourceRange& subresource_range);
1008 void RecordUnbindZcullScope(bp_state::CommandBuffer& cmd_state);
1009 void RecordResetScopeZcullDirection(bp_state::CommandBuffer& cmd_state);
1010 void RecordResetZcullDirection(bp_state::CommandBuffer& cmd_state, VkImage depth_image, const VkImageSubresourceRange& subresource_range);
1011
1012 void RecordSetScopeZcullDirection(bp_state::CommandBuffer& cmd_state, bp_state::CommandBufferStateNV::ZcullDirection mode);
1013 void RecordSetZcullDirection(bp_state::CommandBuffer& cmd_state, VkImage depth_image,
1014 const VkImageSubresourceRange& subresource_range,
1015 bp_state::CommandBufferStateNV::ZcullDirection mode);
1016
1017 void RecordZcullDraw(bp_state::CommandBuffer& cmd_state);
1018
Mark Young0a6b48f2022-08-18 11:17:02 -06001019 bool ValidateZcullScope(const bp_state::CommandBuffer& cmd_state) const;
1020 bool ValidateZcull(const bp_state::CommandBuffer& cmd_state, VkImage image,
1021 const VkImageSubresourceRange& subresource_range) const;
Rodrigo Locatti0b16cda2022-04-01 17:59:53 -03001022
Rodrigo Locattie4c08a02022-04-04 18:12:18 -03001023 void RecordClearColor(VkFormat format, const VkClearColorValue& clear_value);
1024 bool ValidateClearColor(VkCommandBuffer commandBuffer, VkFormat format, const VkClearColorValue& clear_value) const;
1025
Jeremy Gebben20da7a12022-02-25 14:07:46 -07001026 void PipelineUsedInFrame(VkPipeline pipeline) {
1027 WriteLockGuard guard(pipeline_lock_);
1028 pipelines_used_in_frame_.insert(pipeline);
1029 }
Jeremy Gebben485a3ee2022-03-01 13:38:18 -07001030
Jeremy Gebben20da7a12022-02-25 14:07:46 -07001031 void ClearPipelinesUsedInFrame() {
1032 WriteLockGuard guard(pipeline_lock_);
1033 pipelines_used_in_frame_.clear();
1034 }
1035
1036 bool IsPipelineUsedInFrame(VkPipeline pipeline) const {
1037 ReadLockGuard guard(pipeline_lock_);
1038 return pipelines_used_in_frame_.count(pipeline) != 0;
1039 }
Jeremy Gebben485a3ee2022-03-01 13:38:18 -07001040
1041 // AMD tracked
Jeremy Gebben20da7a12022-02-25 14:07:46 -07001042 std::atomic<uint32_t> num_barriers_objects_{0};
1043 std::atomic<uint32_t> num_pso_{0};
1044 std::atomic<uint32_t> num_queue_submissions_{0};
Jeremy Gebben485a3ee2022-03-01 13:38:18 -07001045
Jeremy Gebben20da7a12022-02-25 14:07:46 -07001046 std::atomic<VkPipelineCache> pipeline_cache_{VK_NULL_HANDLE};
Jeremy Gebben485a3ee2022-03-01 13:38:18 -07001047
Rodrigo Locattid5b54f52022-03-16 19:12:45 -03001048 // NVIDIA tracked
1049 struct MemoryFreeEvent {
1050 typename std::chrono::high_resolution_clock::time_point time {};
1051 VkDeviceSize allocation_size = 0;
1052 uint32_t memory_type_index = 0;
1053 };
1054 std::deque<MemoryFreeEvent> memory_free_events_;
1055 mutable ReadWriteLock memory_free_events_lock_;
1056
Rodrigo Locattie4c08a02022-04-04 18:12:18 -03001057 std::set<std::array<uint32_t, 4>> clear_colors_;
1058 mutable ReadWriteLock clear_colors_lock_;
1059
Jeremy Gebben20da7a12022-02-25 14:07:46 -07001060 layer_data::unordered_set<VkPipeline> pipelines_used_in_frame_;
1061 mutable ReadWriteLock pipeline_lock_;
Camden3231dcc2019-08-05 11:28:57 -06001062};