blob: c4d3559a4ce450f455373ee4776e9bee1c54bb2d [file] [log] [blame]
Camdeneaa86ea2019-07-26 11:00:09 -06001/* Copyright (c) 2015-2019 The Khronos Group Inc.
2 * Copyright (c) 2015-2019 Valve Corporation
3 * Copyright (c) 2015-2019 LunarG, Inc.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 * Author: Camden Stocker <camden@lunarg.com>
18 */
19
Camden3231dcc2019-08-05 11:28:57 -060020#include "best_practices.h"
Camden5b184be2019-08-13 07:50:19 -060021#include "layer_chassis_dispatch.h"
Camden Stocker0a660ce2019-08-27 15:30:40 -060022#include "best_practices_error_enums.h"
Camden5b184be2019-08-13 07:50:19 -060023
24#include <string>
25#include <iomanip>
26
27// get the API name is proper format
28std::string BestPractices::GetAPIVersionName(uint32_t version) {
29 std::stringstream version_name;
30 uint32_t major = VK_VERSION_MAJOR(version);
31 uint32_t minor = VK_VERSION_MINOR(version);
32 uint32_t patch = VK_VERSION_PATCH(version);
33
34 version_name << major << "." << minor << "." << patch << " (0x" << std::setfill('0') << std::setw(8) << std::hex << version
35 << ")";
36
37 return version_name.str();
38}
39
40bool BestPractices::PreCallValidateCreateInstance(const VkInstanceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator,
41 VkInstance* pInstance) {
42 bool skip = false;
43
44 for (uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; i++) {
45 if (white_list(pCreateInfo->ppEnabledExtensionNames[i], kDeviceExtensionNames)) {
Camden Stockerb6dee342019-08-22 15:56:15 -060046 skip |= log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
47 kVUID_BestPractices_CreateInstance_ExtensionMismatch,
48 "vkCreateInstance(): Attempting to enable Device Extension %s at CreateInstance time.",
49 pCreateInfo->ppEnabledExtensionNames[i]);
Camden5b184be2019-08-13 07:50:19 -060050 }
51 }
52
53 return skip;
54}
55
56void BestPractices::PreCallRecordCreateInstance(const VkInstanceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator,
57 VkInstance* pInstance) {
58 instance_api_version = pCreateInfo->pApplicationInfo->apiVersion;
59}
60
61bool BestPractices::PreCallValidateCreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo* pCreateInfo,
62 const VkAllocationCallbacks* pAllocator, VkDevice* pDevice) {
63 bool skip = false;
64
65 // get API version of physical device passed when creating device.
66 VkPhysicalDeviceProperties physical_device_properties{};
67 DispatchGetPhysicalDeviceProperties(physicalDevice, &physical_device_properties);
68 device_api_version = physical_device_properties.apiVersion;
69
70 // check api versions and warn if instance api Version is higher than version on device.
71 if (instance_api_version > device_api_version) {
72 std::string inst_api_name = GetAPIVersionName(instance_api_version);
73 std::string dev_api_name = GetAPIVersionName(device_api_version);
74
Camden Stockerb6dee342019-08-22 15:56:15 -060075 skip |= log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
76 kVUID_BestPractices_CreateDevice_API_Mismatch,
77 "vkCreateDevice(): API Version of current instance, %s is higher than API Version on device, %s",
78 inst_api_name.c_str(), dev_api_name.c_str());
Camden5b184be2019-08-13 07:50:19 -060079 }
80
81 for (uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; i++) {
82 if (white_list(pCreateInfo->ppEnabledExtensionNames[i], kInstanceExtensionNames)) {
Camden Stockerb6dee342019-08-22 15:56:15 -060083 skip |= log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
84 kVUID_BestPractices_CreateInstance_ExtensionMismatch,
85 "vkCreateDevice(): Attempting to enable Instance Extension %s at CreateDevice time.",
86 pCreateInfo->ppEnabledExtensionNames[i]);
Camden5b184be2019-08-13 07:50:19 -060087 }
88 }
89
Camden83a9c372019-08-14 11:41:38 -060090 auto pd_state = GetPhysicalDeviceState(physicalDevice);
91 if ((pd_state->vkGetPhysicalDeviceSurfaceCapabilitiesKHRState == UNCALLED) && (pCreateInfo->pEnabledFeatures != NULL)) {
Camden Stockerb6dee342019-08-22 15:56:15 -060092 skip |= log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
93 kVUID_BestPractices_CreateDevice_PDFeaturesNotCalled,
94 "vkCreateDevice() called before getting physical device features from vkGetPhysicalDeviceFeatures().");
Camden83a9c372019-08-14 11:41:38 -060095 }
96
Camden5b184be2019-08-13 07:50:19 -060097 return skip;
98}
99
100bool BestPractices::PreCallValidateCreateBuffer(VkDevice device, const VkBufferCreateInfo* pCreateInfo,
101 const VkAllocationCallbacks* pAllocator, VkBuffer* pBuffer) {
102 bool skip = false;
103
104 if ((pCreateInfo->queueFamilyIndexCount > 1) && (pCreateInfo->sharingMode == VK_SHARING_MODE_EXCLUSIVE)) {
105 std::stringstream bufferHex;
106 bufferHex << "0x" << std::hex << HandleToUint64(pBuffer);
107
108 skip |=
Camden Stockerb6dee342019-08-22 15:56:15 -0600109 log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
110 kVUID_BestPractices_SharingModeExclusive,
Camden5b184be2019-08-13 07:50:19 -0600111 "Warning: Buffer (%s) specifies a sharing mode of VK_SHARING_MODE_EXCLUSIVE while specifying multiple queues "
112 "(queueFamilyIndexCount of %" PRIu32 ").",
113 bufferHex.str().c_str(), pCreateInfo->queueFamilyIndexCount);
114 }
115
116 return skip;
117}
118
119bool BestPractices::PreCallValidateCreateImage(VkDevice device, const VkImageCreateInfo* pCreateInfo,
120 const VkAllocationCallbacks* pAllocator, VkImage* pImage) {
121 bool skip = false;
122
123 if ((pCreateInfo->queueFamilyIndexCount > 1) && (pCreateInfo->sharingMode == VK_SHARING_MODE_EXCLUSIVE)) {
124 std::stringstream imageHex;
125 imageHex << "0x" << std::hex << HandleToUint64(pImage);
126
127 skip |=
Camden Stockerb6dee342019-08-22 15:56:15 -0600128 log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
129 kVUID_BestPractices_SharingModeExclusive,
Camden5b184be2019-08-13 07:50:19 -0600130 "Warning: Image (%s) specifies a sharing mode of VK_SHARING_MODE_EXCLUSIVE while specifying multiple queues "
131 "(queueFamilyIndexCount of %" PRIu32 ").",
132 imageHex.str().c_str(), pCreateInfo->queueFamilyIndexCount);
133 }
134
135 return skip;
136}
137
138bool BestPractices::PreCallValidateCreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR* pCreateInfo,
139 const VkAllocationCallbacks* pAllocator, VkSwapchainKHR* pSwapchain) {
140 bool skip = false;
141
Camden83a9c372019-08-14 11:41:38 -0600142 auto physical_device_state = GetPhysicalDeviceState();
143
144 if (physical_device_state->vkGetPhysicalDeviceSurfaceCapabilitiesKHRState == UNCALLED) {
145 skip |= log_msg(
Camden Stockerb6dee342019-08-22 15:56:15 -0600146 report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
147 kVUID_BestPractices_Swapchain_GetSurfaceNotCalled,
Camden83a9c372019-08-14 11:41:38 -0600148 "vkCreateSwapchainKHR() called before getting surface capabilities from vkGetPhysicalDeviceSurfaceCapabilitiesKHR().");
149 }
150
151 if (physical_device_state->vkGetPhysicalDeviceSurfacePresentModesKHRState != QUERY_DETAILS) {
Camden Stockerb6dee342019-08-22 15:56:15 -0600152 skip |= log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
153 kVUID_BestPractices_Swapchain_GetSurfaceNotCalled,
154 "vkCreateSwapchainKHR() called before getting surface present mode(s) from "
155 "vkGetPhysicalDeviceSurfacePresentModesKHR().");
Camden83a9c372019-08-14 11:41:38 -0600156 }
157
158 if (physical_device_state->vkGetPhysicalDeviceSurfaceFormatsKHRState != QUERY_DETAILS) {
159 skip |=
Camden Stockerb6dee342019-08-22 15:56:15 -0600160 log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
161 kVUID_BestPractices_Swapchain_GetSurfaceNotCalled,
Camden83a9c372019-08-14 11:41:38 -0600162 "vkCreateSwapchainKHR() called before getting surface format(s) from vkGetPhysicalDeviceSurfaceFormatsKHR().");
163 }
164
Camden5b184be2019-08-13 07:50:19 -0600165 if ((pCreateInfo->queueFamilyIndexCount > 1) && (pCreateInfo->imageSharingMode == VK_SHARING_MODE_EXCLUSIVE)) {
Camden Stockerb6dee342019-08-22 15:56:15 -0600166 skip |= log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
167 kVUID_BestPractices_SharingModeExclusive,
168 "Warning: A Swapchain is being created which specifies a sharing mode of VK_SHARING_MODE_EXCULSIVE while "
169 "specifying multiple queues (queueFamilyIndexCount of %" PRIu32 ").",
170 pCreateInfo->queueFamilyIndexCount);
Camden5b184be2019-08-13 07:50:19 -0600171 }
172
173 return skip;
174}
175
176bool BestPractices::PreCallValidateCreateSharedSwapchainsKHR(VkDevice device, uint32_t swapchainCount,
177 const VkSwapchainCreateInfoKHR* pCreateInfos,
178 const VkAllocationCallbacks* pAllocator, VkSwapchainKHR* pSwapchains) {
179 bool skip = false;
180
181 for (uint32_t i = 0; i < swapchainCount; i++) {
182 if ((pCreateInfos[i].queueFamilyIndexCount > 1) && (pCreateInfos[i].imageSharingMode == VK_SHARING_MODE_EXCLUSIVE)) {
Camden Stockerb6dee342019-08-22 15:56:15 -0600183 skip |=
184 log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
185 kVUID_BestPractices_SharingModeExclusive,
186 "Warning: A shared swapchain (index %" PRIu32
187 ") is being created which specifies a sharing mode of VK_SHARING_MODE_EXCLUSIVE while specifying multiple "
188 "queues (queueFamilyIndexCount of %" PRIu32 ").",
189 i, pCreateInfos[i].queueFamilyIndexCount);
Camden5b184be2019-08-13 07:50:19 -0600190 }
191 }
192
193 return skip;
194}
195
196bool BestPractices::PreCallValidateCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo* pCreateInfo,
197 const VkAllocationCallbacks* pAllocator, VkRenderPass* pRenderPass) {
198 bool skip = false;
199
200 for (uint32_t i = 0; i < pCreateInfo->attachmentCount; ++i) {
201 VkFormat format = pCreateInfo->pAttachments[i].format;
202 if (pCreateInfo->pAttachments[i].initialLayout == VK_IMAGE_LAYOUT_UNDEFINED) {
203 if ((FormatIsColor(format) || FormatHasDepth(format)) &&
204 pCreateInfo->pAttachments[i].loadOp == VK_ATTACHMENT_LOAD_OP_LOAD) {
205 skip |= log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
Camden Stockerb6dee342019-08-22 15:56:15 -0600206 kVUID_BestPractices_RenderPass_Attatchment,
Camden5b184be2019-08-13 07:50:19 -0600207 "Render pass has an attachment with loadOp == VK_ATTACHMENT_LOAD_OP_LOAD and "
208 "initialLayout == VK_IMAGE_LAYOUT_UNDEFINED. This is probably not what you "
209 "intended. Consider using VK_ATTACHMENT_LOAD_OP_DONT_CARE instead if the "
210 "image truely is undefined at the start of the render pass.");
211 }
212 if (FormatHasStencil(format) && pCreateInfo->pAttachments[i].stencilLoadOp == VK_ATTACHMENT_LOAD_OP_LOAD) {
213 skip |= log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
Camden Stockerb6dee342019-08-22 15:56:15 -0600214 kVUID_BestPractices_RenderPass_Attatchment,
Camden5b184be2019-08-13 07:50:19 -0600215 "Render pass has an attachment with stencilLoadOp == VK_ATTACHMENT_LOAD_OP_LOAD "
216 "and initialLayout == VK_IMAGE_LAYOUT_UNDEFINED. This is probably not what you "
217 "intended. Consider using VK_ATTACHMENT_LOAD_OP_DONT_CARE instead if the "
218 "image truely is undefined at the start of the render pass.");
219 }
220 }
221 }
222
223 for (uint32_t dependency = 0; dependency < pCreateInfo->dependencyCount; dependency++) {
224 skip |= CheckPipelineStageFlags("vkCreateRenderPass", pCreateInfo->pDependencies[dependency].srcStageMask);
225 skip |= CheckPipelineStageFlags("vkCreateRenderPass", pCreateInfo->pDependencies[dependency].dstStageMask);
226 }
227
228 return skip;
229}
230
231bool BestPractices::PreCallValidateAllocateMemory(VkDevice device, const VkMemoryAllocateInfo* pAllocateInfo,
232 const VkAllocationCallbacks* pAllocator, VkDeviceMemory* pMemory) {
233 bool skip = false;
234
235 num_mem_objects++;
236
237 if (num_mem_objects > kMemoryObjectWarningLimit) {
238 skip |= log_msg(report_data, VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
Camden Stockerb6dee342019-08-22 15:56:15 -0600239 kVUID_BestPractices_AllocateMemory_TooManyObjects,
240 "Performance Warning: This app has > %" PRIu32 " memory objects.", kMemoryObjectWarningLimit);
Camden5b184be2019-08-13 07:50:19 -0600241 }
242
Camden83a9c372019-08-14 11:41:38 -0600243 // TODO: Insert get check for GetPhysicalDeviceMemoryProperties once the state is tracked in the StateTracker
244
245 return skip;
246}
247
248bool BestPractices::PreCallValidateFreeMemory(VkDevice device, VkDeviceMemory memory, const VkAllocationCallbacks* pAllocator) {
249 bool skip = false;
250
251 DEVICE_MEMORY_STATE* mem_info = GetDevMemState(memory);
252
253 for (auto& obj : mem_info->obj_bindings) {
254 skip |= log_msg(report_data, VK_DEBUG_REPORT_INFORMATION_BIT_EXT, get_debug_report_enum[obj.type], 0, layer_name.c_str(),
255 "VK Object %s still has a reference to mem obj %s.", report_data->FormatHandle(obj).c_str(),
256 report_data->FormatHandle(mem_info->mem).c_str());
257 }
258
Camden5b184be2019-08-13 07:50:19 -0600259 return skip;
260}
261
262void BestPractices::PreCallRecordFreeMemory(VkDevice device, VkDeviceMemory memory, const VkAllocationCallbacks* pAllocator) {
263 if (memory != VK_NULL_HANDLE) {
264 num_mem_objects--;
265 }
266}
267
Camden Stockerb603cc82019-09-03 10:09:02 -0600268bool BestPractices::ValidateBindBufferMemory(VkBuffer buffer, const char* api_name) {
269 bool skip = false;
270 BUFFER_STATE* buffer_state = GetBufferState(buffer);
271
272 if (!buffer_state->memory_requirements_checked) {
273 skip |= log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
274 kVUID_BestPractices_BufferMemReqNotCalled,
275 "%s: Binding memory to %s but vkGetBufferMemoryRequirements() has not been called on that buffer.",
276 api_name, report_data->FormatHandle(buffer).c_str());
277 }
278
279 return skip;
280}
281
282bool BestPractices::PreCallValidateBindBufferMemory(VkDevice device, VkBuffer buffer, VkDeviceMemory memory,
283 VkDeviceSize memoryOffset) {
284 bool skip = false;
285 const char* api_name = "BindBufferMemory()";
286
287 skip |= ValidateBindBufferMemory(buffer, api_name);
288
289 return skip;
290}
291
292bool BestPractices::PreCallValidateBindBufferMemory2(VkDevice device, uint32_t bindInfoCount,
Camden Stocker8b798ab2019-09-03 10:33:28 -0600293 const VkBindBufferMemoryInfo* pBindInfos) {
294 char api_name[64];
295 bool skip = false;
296
297 for (uint32_t i = 0; i < bindInfoCount; i++) {
298 sprintf(api_name, "vkBindBufferMemory2() pBindInfos[%u]", i);
299 skip |= ValidateBindBufferMemory(pBindInfos[i].buffer, api_name);
300 }
301
302 return skip;
303}
Camden Stockerb603cc82019-09-03 10:09:02 -0600304
305bool BestPractices::PreCallValidateBindBufferMemory2KHR(VkDevice device, uint32_t bindInfoCount,
Camden Stocker8b798ab2019-09-03 10:33:28 -0600306 const VkBindBufferMemoryInfo* pBindInfos) {
307 char api_name[64];
308 bool skip = false;
Camden Stockerb603cc82019-09-03 10:09:02 -0600309
Camden Stocker8b798ab2019-09-03 10:33:28 -0600310 for (uint32_t i = 0; i < bindInfoCount; i++) {
311 sprintf(api_name, "vkBindBufferMemory2KHR() pBindInfos[%u]", i);
312 skip |= ValidateBindBufferMemory(pBindInfos[i].buffer, api_name);
313 }
314
315 return skip;
316}
317
318bool BestPractices::ValidateBindImageMemory(VkImage image, const char* api_name) {
319 bool skip = false;
320 IMAGE_STATE* image_state = GetImageState(image);
321
322 if (!image_state->memory_requirements_checked) {
323 skip |= log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
324 kVUID_BestPractices_ImageMemReqNotCalled,
325 "%s: Binding memory to %s but vkGetImageMemoryRequirements() has not been called on that image.", api_name,
326 report_data->FormatHandle(image).c_str());
327 }
328
329 return skip;
330}
331
332bool BestPractices::PreCallValidateBindImageMemory(VkDevice device, VkImage image, VkDeviceMemory memory,
333 VkDeviceSize memoryOffset) {
334 bool skip = false;
335 const char* api_name = "vkBindImageMemory()";
336
337 skip |= ValidateBindImageMemory(image, api_name);
338
339 return skip;
340}
341
342bool BestPractices::PreCallValidateBindImageMemory2(VkDevice device, uint32_t bindInfoCount,
343 const VkBindImageMemoryInfo* pBindInfos) {
344 char api_name[64];
345 bool skip = false;
346
347 for (uint32_t i = 0; i < bindInfoCount; i++) {
348 sprintf(api_name, "vkBindImageMemory2() pBindInfos[%u]", i);
349 skip |= ValidateBindImageMemory(pBindInfos[i].image, api_name);
350 }
351
352 return skip;
353}
354
355bool BestPractices::PreCallValidateBindImageMemory2KHR(VkDevice device, uint32_t bindInfoCount,
356 const VkBindImageMemoryInfo* pBindInfos) {
357 char api_name[64];
358 bool skip = false;
359
360 for (uint32_t i = 0; i < bindInfoCount; i++) {
361 sprintf(api_name, "vkBindImageMemory2KHR() pBindInfos[%u]", i);
362 skip |= ValidateBindImageMemory(pBindInfos[i].image, api_name);
363 }
364
365 return skip;
366}
Camden83a9c372019-08-14 11:41:38 -0600367
Camden5b184be2019-08-13 07:50:19 -0600368bool BestPractices::PreCallValidateCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount,
369 const VkGraphicsPipelineCreateInfo* pCreateInfos,
370 const VkAllocationCallbacks* pAllocator, VkPipeline* pPipelines) {
371 bool skip = false;
372
373 if ((createInfoCount > 1) && (!pipelineCache)) {
374 skip |=
375 log_msg(report_data, VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
Camden Stockerb6dee342019-08-22 15:56:15 -0600376 kVUID_BestPractices_CreatePipelines_MultiplePipelines,
Camden5b184be2019-08-13 07:50:19 -0600377 "Performance Warning: This vkCreateGraphicsPipelines call is creating multiple pipelines but is not using a "
378 "pipeline cache, which may help with performance");
379 }
380
381 return skip;
382}
383
384bool BestPractices::PreCallValidateCreateComputePipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount,
385 const VkComputePipelineCreateInfo* pCreateInfos,
386 const VkAllocationCallbacks* pAllocator, VkPipeline* pPipelines) {
387 bool skip = false;
388
389 if ((createInfoCount > 1) && (!pipelineCache)) {
390 skip |= log_msg(report_data, VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
Camden Stockerb6dee342019-08-22 15:56:15 -0600391 kVUID_BestPractices_CreatePipelines_MultiplePipelines,
Camden5b184be2019-08-13 07:50:19 -0600392 "Performance Warning: This vkCreateComputePipelines call is creating multiple pipelines but is not using a "
393 "pipeline cache, which may help with performance");
394 }
395
396 return skip;
397}
398
399bool BestPractices::CheckPipelineStageFlags(std::string api_name, const VkPipelineStageFlags flags) {
400 bool skip = false;
401
402 if (flags & VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT) {
Camden Stockerb6dee342019-08-22 15:56:15 -0600403 skip |= log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
404 kVUID_BestPractices_PipelineStageFlags,
405 "You are using VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT when %s is called\n", api_name.c_str());
Camden5b184be2019-08-13 07:50:19 -0600406 } else if (flags & VK_PIPELINE_STAGE_ALL_COMMANDS_BIT) {
Camden Stockerb6dee342019-08-22 15:56:15 -0600407 skip |= log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
408 kVUID_BestPractices_PipelineStageFlags,
409 "You are using VK_PIPELINE_STAGE_ALL_COMMANDS_BIT when %s is called\n", api_name.c_str());
Camden5b184be2019-08-13 07:50:19 -0600410 }
411
412 return skip;
413}
414
415bool BestPractices::PreCallValidateQueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo* pSubmits, VkFence fence) {
416 bool skip = false;
417
418 for (uint32_t submit = 0; submit < submitCount; submit++) {
419 for (uint32_t semaphore = 0; semaphore < pSubmits[submit].waitSemaphoreCount; semaphore++) {
420 skip |= CheckPipelineStageFlags("vkQueueSubmit", pSubmits[submit].pWaitDstStageMask[semaphore]);
421 }
422 }
423
424 return skip;
425}
426
427bool BestPractices::PreCallValidateCmdSetEvent(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask) {
428 bool skip = false;
429
430 skip |= CheckPipelineStageFlags("vkCmdSetEvent", stageMask);
431
432 return skip;
433}
434
435bool BestPractices::PreCallValidateCmdResetEvent(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask) {
436 bool skip = false;
437
438 skip |= CheckPipelineStageFlags("vkCmdResetEvent", stageMask);
439
440 return skip;
441}
442
443bool BestPractices::PreCallValidateCmdWaitEvents(VkCommandBuffer commandBuffer, uint32_t eventCount, const VkEvent* pEvents,
444 VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask,
445 uint32_t memoryBarrierCount, const VkMemoryBarrier* pMemoryBarriers,
446 uint32_t bufferMemoryBarrierCount,
447 const VkBufferMemoryBarrier* pBufferMemoryBarriers,
448 uint32_t imageMemoryBarrierCount,
449 const VkImageMemoryBarrier* pImageMemoryBarriers) {
450 bool skip = false;
451
452 skip |= CheckPipelineStageFlags("vkCmdWaitEvents", srcStageMask);
453 skip |= CheckPipelineStageFlags("vkCmdWaitEvents", dstStageMask);
454
455 return skip;
456}
457
458bool BestPractices::PreCallValidateCmdPipelineBarrier(VkCommandBuffer commandBuffer, VkPipelineStageFlags srcStageMask,
459 VkPipelineStageFlags dstStageMask, VkDependencyFlags dependencyFlags,
460 uint32_t memoryBarrierCount, const VkMemoryBarrier* pMemoryBarriers,
461 uint32_t bufferMemoryBarrierCount,
462 const VkBufferMemoryBarrier* pBufferMemoryBarriers,
463 uint32_t imageMemoryBarrierCount,
464 const VkImageMemoryBarrier* pImageMemoryBarriers) {
465 bool skip = false;
466
467 skip |= CheckPipelineStageFlags("vkCmdPipelineBarrier", srcStageMask);
468 skip |= CheckPipelineStageFlags("vkCmdPipelineBarrier", dstStageMask);
469
470 return skip;
471}
472
473bool BestPractices::PreCallValidateCmdWriteTimestamp(VkCommandBuffer commandBuffer, VkPipelineStageFlagBits pipelineStage,
474 VkQueryPool queryPool, uint32_t query) {
475 bool skip = false;
476
477 skip |= CheckPipelineStageFlags("vkCmdWriteTimestamp", pipelineStage);
478
479 return skip;
480}
481
482bool BestPractices::PreCallValidateCmdDraw(VkCommandBuffer commandBuffer, uint32_t vertexCount, uint32_t instanceCount,
483 uint32_t firstVertex, uint32_t firstInstance) {
484 bool skip = false;
485
486 if (instanceCount == 0) {
487 skip |= log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
Camden Stockerb6dee342019-08-22 15:56:15 -0600488 kVUID_BestPractices_CmdDraw_InstanceCountZero,
489 "Warning: You are calling vkCmdDraw() with an instanceCount of Zero.");
Camden5b184be2019-08-13 07:50:19 -0600490 }
491
492 return skip;
493}
494
495bool BestPractices::PreCallValidateCmdDrawIndexed(VkCommandBuffer commandBuffer, uint32_t indexCount, uint32_t instanceCount,
496 uint32_t firstIndex, int32_t vertexOffset, uint32_t firstInstance) {
497 bool skip = false;
498
499 if (instanceCount == 0) {
500 skip |= log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
Camden Stockerb6dee342019-08-22 15:56:15 -0600501 kVUID_BestPractices_CmdDraw_InstanceCountZero,
502 "Warning: You are calling vkCmdDrawIndexed() with an instanceCount of Zero.");
Camden5b184be2019-08-13 07:50:19 -0600503 }
504
505 return skip;
506}
507
508bool BestPractices::PreCallValidateCmdDrawIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
509 uint32_t drawCount, uint32_t stride) {
510 bool skip = false;
511
512 if (drawCount == 0) {
513 skip |= log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
Camden Stockerb6dee342019-08-22 15:56:15 -0600514 kVUID_BestPractices_CmdDraw_DrawCountZero,
515 "Warning: You are calling vkCmdDrawIndirect() with a drawCount of Zero.");
Camden5b184be2019-08-13 07:50:19 -0600516 }
517
518 return skip;
519}
520
521bool BestPractices::PreCallValidateCmdDrawIndexedIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset,
522 uint32_t drawCount, uint32_t stride) {
523 bool skip = false;
524
525 if (drawCount == 0) {
526 skip |= log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
Camden Stockerb6dee342019-08-22 15:56:15 -0600527 kVUID_BestPractices_CmdDraw_DrawCountZero,
528 "Warning: You are calling vkCmdDrawIndexedIndirect() with a drawCount of Zero.");
Camden5b184be2019-08-13 07:50:19 -0600529 }
530
531 return skip;
532}
533
534bool BestPractices::PreCallValidateCmdDispatch(VkCommandBuffer commandBuffer, uint32_t groupCountX, uint32_t groupCountY,
535 uint32_t groupCountZ) {
536 bool skip = false;
537
538 if ((groupCountX == 0) || (groupCountY == 0) || (groupCountZ == 0)) {
Camden Stockerb6dee342019-08-22 15:56:15 -0600539 skip |= log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
540 kVUID_BestPractices_CmdDispatch_GroupCountZero,
541 "Warning: You are calling vkCmdDispatch() while one or more groupCounts are zero (groupCountX = %" PRIu32
542 ", groupCountY = %" PRIu32 ", groupCountZ = %" PRIu32 ").",
543 groupCountX, groupCountY, groupCountZ);
Camden5b184be2019-08-13 07:50:19 -0600544 }
545
546 return skip;
547}
Camden83a9c372019-08-14 11:41:38 -0600548
549bool BestPractices::PreCallValidateGetDisplayPlaneSupportedDisplaysKHR(VkPhysicalDevice physicalDevice, uint32_t planeIndex,
550 uint32_t* pDisplayCount, VkDisplayKHR* pDisplays) {
551 bool skip = false;
552
553 auto physical_device_state = GetPhysicalDeviceState(physicalDevice);
554
555 if (physical_device_state->vkGetPhysicalDeviceDisplayPlanePropertiesKHRState != QUERY_DETAILS) {
Camden Stockerb6dee342019-08-22 15:56:15 -0600556 skip |= log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, 0,
557 kVUID_BestPractices_DisplayPlane_PropertiesNotCalled,
558 "vkGetDisplayPlaneSupportedDisplaysKHR() called before getting diplay plane properties from "
559 "vkGetPhysicalDeviceDisplayPlanePropertiesKHR().");
Camden83a9c372019-08-14 11:41:38 -0600560 }
561
562 return skip;
563}
Camden05de2d42019-08-19 10:23:56 -0600564
565bool BestPractices::PreCallValidateGetSwapchainImagesKHR(VkDevice device, VkSwapchainKHR swapchain, uint32_t* pSwapchainImageCount,
566 VkImage* pSwapchainImages) {
567 bool skip = false;
568
569 auto swapchain_state = GetSwapchainState(swapchain);
570
571 if (swapchain_state && pSwapchainImages) {
572 // Compare the preliminary value of *pSwapchainImageCount with the value this time:
573 if (swapchain_state->vkGetSwapchainImagesKHRState == UNCALLED) {
574 skip |= log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT,
575 HandleToUint64(device), kVUID_Core_Swapchain_PriorCount,
576 "vkGetSwapchainImagesKHR() called with non-NULL pSwapchainImageCount; but no prior positive value has "
577 "been seen for pSwapchainImages.");
578 }
579 }
580
581 return skip;
582}
583
584// Common function to handle validation for GetPhysicalDeviceQueueFamilyProperties & 2KHR version
585static bool ValidateCommonGetPhysicalDeviceQueueFamilyProperties(debug_report_data* report_data,
586 const PHYSICAL_DEVICE_STATE* pd_state,
587 uint32_t requested_queue_family_property_count, bool qfp_null,
588 const char* caller_name) {
589 bool skip = false;
590 if (!qfp_null) {
591 // Verify that for each physical device, this command is called first with NULL pQueueFamilyProperties in order to get count
592 if (UNCALLED == pd_state->vkGetPhysicalDeviceQueueFamilyPropertiesState) {
593 skip |= log_msg(
594 report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT,
595 HandleToUint64(pd_state->phys_device), kVUID_Core_DevLimit_MissingQueryCount,
596 "%s is called with non-NULL pQueueFamilyProperties before obtaining pQueueFamilyPropertyCount. It is recommended "
597 "to first call %s with NULL pQueueFamilyProperties in order to obtain the maximal pQueueFamilyPropertyCount.",
598 caller_name, caller_name);
599 // Then verify that pCount that is passed in on second call matches what was returned
600 } else if (pd_state->queue_family_known_count != requested_queue_family_property_count) {
601 skip |= log_msg(
602 report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT,
603 HandleToUint64(pd_state->phys_device), kVUID_Core_DevLimit_CountMismatch,
604 "%s is called with non-NULL pQueueFamilyProperties and pQueueFamilyPropertyCount value %" PRIu32
605 ", but the largest previously returned pQueueFamilyPropertyCount for this physicalDevice is %" PRIu32
606 ". It is recommended to instead receive all the properties by calling %s with pQueueFamilyPropertyCount that was "
607 "previously obtained by calling %s with NULL pQueueFamilyProperties.",
608 caller_name, requested_queue_family_property_count, pd_state->queue_family_known_count, caller_name, caller_name);
609 }
610 }
611
612 return skip;
613}
614
Camden Stocker82510582019-09-03 14:00:16 -0600615bool BestPractices::PreCallValidateBindAccelerationStructureMemoryNV(VkDevice device, uint32_t bindInfoCount,
616 const VkBindAccelerationStructureMemoryInfoNV* pBindInfos) {
617 bool skip = false;
618
619 for (uint32_t i = 0; i < bindInfoCount; i++) {
620 const ACCELERATION_STRUCTURE_STATE* as_state = GetAccelerationStructureState(pBindInfos[i].accelerationStructure);
621 if (!as_state->memory_requirements_checked) {
622 // There's not an explicit requirement in the spec to call vkGetImageMemoryRequirements() prior to calling
623 // BindAccelerationStructureMemoryNV but it's implied in that memory being bound must conform with
624 // VkAccelerationStructureMemoryRequirementsInfoNV from vkGetAccelerationStructureMemoryRequirementsNV
625 skip |= log_msg(
626 report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT, 0,
627 kVUID_BestPractices_BindAccelNV_NoMemReqQuery,
628 "vkBindAccelerationStructureMemoryNV(): "
629 "Binding memory to %s but vkGetAccelerationStructureMemoryRequirementsNV() has not been called on that structure.",
630 report_data->FormatHandle(pBindInfos[i].accelerationStructure).c_str());
631 }
632 }
633
634 return skip;
635}
636
Camden05de2d42019-08-19 10:23:56 -0600637bool BestPractices::PreCallValidateGetPhysicalDeviceQueueFamilyProperties(VkPhysicalDevice physicalDevice,
638 uint32_t* pQueueFamilyPropertyCount,
639 VkQueueFamilyProperties* pQueueFamilyProperties) {
640 const auto physical_device_state = GetPhysicalDeviceState(physicalDevice);
641 assert(physical_device_state);
642 return ValidateCommonGetPhysicalDeviceQueueFamilyProperties(report_data, physical_device_state, *pQueueFamilyPropertyCount,
643 (nullptr == pQueueFamilyProperties),
644 "vkGetPhysicalDeviceQueueFamilyProperties()");
645}
646
647bool BestPractices::PreCallValidateGetPhysicalDeviceQueueFamilyProperties2(VkPhysicalDevice physicalDevice,
648 uint32_t* pQueueFamilyPropertyCount,
649 VkQueueFamilyProperties2KHR* pQueueFamilyProperties) {
650 const auto physical_device_state = GetPhysicalDeviceState(physicalDevice);
651 assert(physical_device_state);
652 return ValidateCommonGetPhysicalDeviceQueueFamilyProperties(report_data, physical_device_state, *pQueueFamilyPropertyCount,
653 (nullptr == pQueueFamilyProperties),
654 "vkGetPhysicalDeviceQueueFamilyProperties2()");
655}
656
657bool BestPractices::PreCallValidateGetPhysicalDeviceQueueFamilyProperties2KHR(VkPhysicalDevice physicalDevice,
658 uint32_t* pQueueFamilyPropertyCount,
659 VkQueueFamilyProperties2KHR* pQueueFamilyProperties) {
660 auto physical_device_state = GetPhysicalDeviceState(physicalDevice);
661 assert(physical_device_state);
662 return ValidateCommonGetPhysicalDeviceQueueFamilyProperties(report_data, physical_device_state, *pQueueFamilyPropertyCount,
663 (nullptr == pQueueFamilyProperties),
664 "vkGetPhysicalDeviceQueueFamilyProperties2KHR()");
665}
666
667bool BestPractices::PreCallValidateGetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface,
668 uint32_t* pSurfaceFormatCount,
669 VkSurfaceFormatKHR* pSurfaceFormats) {
670 if (!pSurfaceFormats) return false;
671 const auto physical_device_state = GetPhysicalDeviceState(physicalDevice);
672 const auto& call_state = physical_device_state->vkGetPhysicalDeviceSurfaceFormatsKHRState;
673 bool skip = false;
674 if (call_state == UNCALLED) {
675 // Since we haven't recorded a preliminary value of *pSurfaceFormatCount, that likely means that the application didn't
676 // previously call this function with a NULL value of pSurfaceFormats:
677 skip |= log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT,
678 HandleToUint64(physicalDevice), kVUID_Core_DevLimit_MustQueryCount,
679 "vkGetPhysicalDeviceSurfaceFormatsKHR() called with non-NULL pSurfaceFormatCount; but no prior "
680 "positive value has been seen for pSurfaceFormats.");
681 } else {
682 auto prev_format_count = (uint32_t)physical_device_state->surface_formats.size();
683 if (prev_format_count != *pSurfaceFormatCount) {
684 skip |= log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT,
685 HandleToUint64(physicalDevice), kVUID_Core_DevLimit_CountMismatch,
686 "vkGetPhysicalDeviceSurfaceFormatsKHR() called with non-NULL pSurfaceFormatCount, and with "
687 "pSurfaceFormats set to a value (%u) that is greater than the value (%u) that was returned "
688 "when pSurfaceFormatCount was NULL.",
689 *pSurfaceFormatCount, prev_format_count);
690 }
691 }
692 return skip;
693}
Camden Stocker23cc47d2019-09-03 14:53:57 -0600694
695bool BestPractices::PreCallValidateQueueBindSparse(VkQueue queue, uint32_t bindInfoCount, const VkBindSparseInfo* pBindInfo,
696 VkFence fence) {
697 bool skip = false;
698
699 for (uint32_t bindIdx = 0; bindIdx < bindInfoCount; bindIdx++) {
700 const VkBindSparseInfo& bindInfo = pBindInfo[bindIdx];
701 // Store sparse binding image_state and after binding is complete make sure that any requiring metadata have it bound
702 std::unordered_set<IMAGE_STATE*> sparse_images;
703 // If we're binding sparse image memory make sure reqs were queried and note if metadata is required and bound
704 for (uint32_t i = 0; i < bindInfo.imageBindCount; ++i) {
705 const auto& image_bind = bindInfo.pImageBinds[i];
706 auto image_state = GetImageState(image_bind.image);
707 if (!image_state)
708 continue; // Param/Object validation should report image_bind.image handles being invalid, so just skip here.
709 sparse_images.insert(image_state);
710 if (image_state->createInfo.flags & VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT) {
711 if (!image_state->get_sparse_reqs_called || image_state->sparse_requirements.empty()) {
712 // For now just warning if sparse image binding occurs without calling to get reqs first
713 skip |= log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT,
714 HandleToUint64(image_state->image), kVUID_Core_MemTrack_InvalidState,
715 "vkQueueBindSparse(): Binding sparse memory to %s without first calling "
716 "vkGetImageSparseMemoryRequirements[2KHR]() to retrieve requirements.",
717 report_data->FormatHandle(image_state->image).c_str());
718 }
719 }
720 if (!image_state->memory_requirements_checked) {
721 // For now just warning if sparse image binding occurs without calling to get reqs first
722 skip |= log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT,
723 HandleToUint64(image_state->image), kVUID_Core_MemTrack_InvalidState,
724 "vkQueueBindSparse(): Binding sparse memory to %s without first calling "
725 "vkGetImageMemoryRequirements() to retrieve requirements.",
726 report_data->FormatHandle(image_state->image).c_str());
727 }
728 }
729 for (uint32_t i = 0; i < bindInfo.imageOpaqueBindCount; ++i) {
730 const auto& image_opaque_bind = bindInfo.pImageOpaqueBinds[i];
731 auto image_state = GetImageState(bindInfo.pImageOpaqueBinds[i].image);
732 if (!image_state)
733 continue; // Param/Object validation should report image_bind.image handles being invalid, so just skip here.
734 sparse_images.insert(image_state);
735 if (image_state->createInfo.flags & VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT) {
736 if (!image_state->get_sparse_reqs_called || image_state->sparse_requirements.empty()) {
737 // For now just warning if sparse image binding occurs without calling to get reqs first
738 skip |= log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT,
739 HandleToUint64(image_state->image), kVUID_Core_MemTrack_InvalidState,
740 "vkQueueBindSparse(): Binding opaque sparse memory to %s without first calling "
741 "vkGetImageSparseMemoryRequirements[2KHR]() to retrieve requirements.",
742 report_data->FormatHandle(image_state->image).c_str());
743 }
744 }
745 if (!image_state->memory_requirements_checked) {
746 // For now just warning if sparse image binding occurs without calling to get reqs first
747 skip |= log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT,
748 HandleToUint64(image_state->image), kVUID_Core_MemTrack_InvalidState,
749 "vkQueueBindSparse(): Binding opaque sparse memory to %s without first calling "
750 "vkGetImageMemoryRequirements() to retrieve requirements.",
751 report_data->FormatHandle(image_state->image).c_str());
752 }
753 for (uint32_t j = 0; j < image_opaque_bind.bindCount; ++j) {
754 if (image_opaque_bind.pBinds[j].flags & VK_SPARSE_MEMORY_BIND_METADATA_BIT) {
755 image_state->sparse_metadata_bound = true;
756 }
757 }
758 }
759 for (const auto& sparse_image_state : sparse_images) {
760 if (sparse_image_state->sparse_metadata_required && !sparse_image_state->sparse_metadata_bound) {
761 // Warn if sparse image binding metadata required for image with sparse binding, but metadata not bound
762 skip |= log_msg(report_data, VK_DEBUG_REPORT_WARNING_BIT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT,
763 HandleToUint64(sparse_image_state->image), kVUID_Core_MemTrack_InvalidState,
764 "vkQueueBindSparse(): Binding sparse memory to %s which requires a metadata aspect but no "
765 "binding with VK_SPARSE_MEMORY_BIND_METADATA_BIT set was made.",
766 report_data->FormatHandle(sparse_image_state->image).c_str());
767 }
768 }
769 }
770
771 return skip;
772}