xref: /third_party/mesa3d/src/vulkan/runtime/vk_log.c (revision bf215546)
1bf215546Sopenharmony_ci/*
2bf215546Sopenharmony_ci * Copyright © 2021 Intel Corporation
3bf215546Sopenharmony_ci *
4bf215546Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a
5bf215546Sopenharmony_ci * copy of this software and associated documentation files (the "Software"),
6bf215546Sopenharmony_ci * to deal in the Software without restriction, including without limitation
7bf215546Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8bf215546Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the
9bf215546Sopenharmony_ci * Software is furnished to do so, subject to the following conditions:
10bf215546Sopenharmony_ci *
11bf215546Sopenharmony_ci * The above copyright notice and this permission notice (including the next
12bf215546Sopenharmony_ci * paragraph) shall be included in all copies or substantial portions of the
13bf215546Sopenharmony_ci * Software.
14bf215546Sopenharmony_ci *
15bf215546Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16bf215546Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17bf215546Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18bf215546Sopenharmony_ci * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19bf215546Sopenharmony_ci * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20bf215546Sopenharmony_ci * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21bf215546Sopenharmony_ci * IN THE SOFTWARE.
22bf215546Sopenharmony_ci */
23bf215546Sopenharmony_ci
24bf215546Sopenharmony_ci#include "vk_log.h"
25bf215546Sopenharmony_ci#include "vk_debug_utils.h"
26bf215546Sopenharmony_ci#include "vk_debug_report.h"
27bf215546Sopenharmony_ci
28bf215546Sopenharmony_ci#include "vk_command_buffer.h"
29bf215546Sopenharmony_ci#include "vk_enum_to_str.h"
30bf215546Sopenharmony_ci#include "vk_queue.h"
31bf215546Sopenharmony_ci#include "vk_device.h"
32bf215546Sopenharmony_ci#include "vk_physical_device.h"
33bf215546Sopenharmony_ci
34bf215546Sopenharmony_ci#include "ralloc.h"
35bf215546Sopenharmony_ci
36bf215546Sopenharmony_ci#include "log.h"
37bf215546Sopenharmony_ci
38bf215546Sopenharmony_cistatic struct vk_device *
39bf215546Sopenharmony_civk_object_to_device(struct vk_object_base *obj)
40bf215546Sopenharmony_ci{
41bf215546Sopenharmony_ci   assert(obj->device);
42bf215546Sopenharmony_ci   return obj->device;
43bf215546Sopenharmony_ci}
44bf215546Sopenharmony_ci
45bf215546Sopenharmony_cistatic struct vk_physical_device *
46bf215546Sopenharmony_civk_object_to_physical_device(struct vk_object_base *obj)
47bf215546Sopenharmony_ci{
48bf215546Sopenharmony_ci   switch (obj->type) {
49bf215546Sopenharmony_ci   case VK_OBJECT_TYPE_INSTANCE:
50bf215546Sopenharmony_ci      unreachable("Unsupported object type");
51bf215546Sopenharmony_ci   case VK_OBJECT_TYPE_PHYSICAL_DEVICE:
52bf215546Sopenharmony_ci      return container_of(obj, struct vk_physical_device, base);
53bf215546Sopenharmony_ci   case VK_OBJECT_TYPE_SURFACE_KHR:
54bf215546Sopenharmony_ci   case VK_OBJECT_TYPE_DISPLAY_KHR:
55bf215546Sopenharmony_ci   case VK_OBJECT_TYPE_DISPLAY_MODE_KHR:
56bf215546Sopenharmony_ci   case VK_OBJECT_TYPE_DEBUG_REPORT_CALLBACK_EXT:
57bf215546Sopenharmony_ci   case VK_OBJECT_TYPE_DEBUG_UTILS_MESSENGER_EXT:
58bf215546Sopenharmony_ci      unreachable("Unsupported object type");
59bf215546Sopenharmony_ci   default:
60bf215546Sopenharmony_ci      return vk_object_to_device(obj)->physical;
61bf215546Sopenharmony_ci   }
62bf215546Sopenharmony_ci}
63bf215546Sopenharmony_ci
64bf215546Sopenharmony_cistatic struct vk_instance *
65bf215546Sopenharmony_civk_object_to_instance(struct vk_object_base *obj)
66bf215546Sopenharmony_ci{
67bf215546Sopenharmony_ci   if (obj == NULL)
68bf215546Sopenharmony_ci      return NULL;
69bf215546Sopenharmony_ci
70bf215546Sopenharmony_ci   if (obj->type == VK_OBJECT_TYPE_INSTANCE) {
71bf215546Sopenharmony_ci      return container_of(obj, struct vk_instance, base);
72bf215546Sopenharmony_ci   } else {
73bf215546Sopenharmony_ci      return vk_object_to_physical_device(obj)->instance;
74bf215546Sopenharmony_ci   }
75bf215546Sopenharmony_ci}
76bf215546Sopenharmony_ci
77bf215546Sopenharmony_civoid
78bf215546Sopenharmony_ci__vk_log_impl(VkDebugUtilsMessageSeverityFlagBitsEXT severity,
79bf215546Sopenharmony_ci              VkDebugUtilsMessageTypeFlagsEXT types,
80bf215546Sopenharmony_ci              int object_count,
81bf215546Sopenharmony_ci              const void **objects_or_instance,
82bf215546Sopenharmony_ci              const char *file,
83bf215546Sopenharmony_ci              int line,
84bf215546Sopenharmony_ci              const char *format,
85bf215546Sopenharmony_ci              ...)
86bf215546Sopenharmony_ci{
87bf215546Sopenharmony_ci   struct vk_instance *instance = NULL;
88bf215546Sopenharmony_ci   struct vk_object_base **objects = NULL;
89bf215546Sopenharmony_ci   if (object_count == 0) {
90bf215546Sopenharmony_ci      instance = (struct vk_instance *) objects_or_instance;
91bf215546Sopenharmony_ci   } else {
92bf215546Sopenharmony_ci      objects = (struct vk_object_base **) objects_or_instance;
93bf215546Sopenharmony_ci      for (unsigned i = 0; i < object_count; i++) {
94bf215546Sopenharmony_ci         if (unlikely(objects[i] == NULL)) {
95bf215546Sopenharmony_ci            mesa_logw("vk_log*() called with NULL object\n");
96bf215546Sopenharmony_ci            continue;
97bf215546Sopenharmony_ci         }
98bf215546Sopenharmony_ci
99bf215546Sopenharmony_ci         if (unlikely(!objects[i]->client_visible)) {
100bf215546Sopenharmony_ci            mesa_logw("vk_log*() called with client-invisible object %p "
101bf215546Sopenharmony_ci                      "of type %s", objects[i],
102bf215546Sopenharmony_ci                      vk_ObjectType_to_str(objects[i]->type));
103bf215546Sopenharmony_ci         }
104bf215546Sopenharmony_ci
105bf215546Sopenharmony_ci         if (!instance) {
106bf215546Sopenharmony_ci            instance = vk_object_to_instance(objects[i]);
107bf215546Sopenharmony_ci            assert(instance->base.client_visible);
108bf215546Sopenharmony_ci         } else {
109bf215546Sopenharmony_ci            assert(vk_object_to_instance(objects[i]) == instance);
110bf215546Sopenharmony_ci         }
111bf215546Sopenharmony_ci         break;
112bf215546Sopenharmony_ci      }
113bf215546Sopenharmony_ci   }
114bf215546Sopenharmony_ci
115bf215546Sopenharmony_ci#ifndef DEBUG
116bf215546Sopenharmony_ci   if (unlikely(!instance) ||
117bf215546Sopenharmony_ci       (likely(list_is_empty(&instance->debug_utils.callbacks)) &&
118bf215546Sopenharmony_ci        likely(list_is_empty(&instance->debug_report.callbacks))))
119bf215546Sopenharmony_ci      return;
120bf215546Sopenharmony_ci#endif
121bf215546Sopenharmony_ci
122bf215546Sopenharmony_ci   va_list va;
123bf215546Sopenharmony_ci   char *message = NULL;
124bf215546Sopenharmony_ci
125bf215546Sopenharmony_ci   va_start(va, format);
126bf215546Sopenharmony_ci   message = ralloc_vasprintf(NULL, format, va);
127bf215546Sopenharmony_ci   va_end(va);
128bf215546Sopenharmony_ci
129bf215546Sopenharmony_ci   char *message_idname = ralloc_asprintf(NULL, "%s:%d", file, line);
130bf215546Sopenharmony_ci
131bf215546Sopenharmony_ci#if DEBUG
132bf215546Sopenharmony_ci   switch (severity) {
133bf215546Sopenharmony_ci   case VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT:
134bf215546Sopenharmony_ci      mesa_logd("%s: %s", message_idname, message);
135bf215546Sopenharmony_ci      break;
136bf215546Sopenharmony_ci   case VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT:
137bf215546Sopenharmony_ci      mesa_logi("%s: %s", message_idname, message);
138bf215546Sopenharmony_ci      break;
139bf215546Sopenharmony_ci   case VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT:
140bf215546Sopenharmony_ci      if (types & VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT)
141bf215546Sopenharmony_ci         mesa_logw("%s: PERF: %s", message_idname, message);
142bf215546Sopenharmony_ci      else
143bf215546Sopenharmony_ci         mesa_logw("%s: %s", message_idname, message);
144bf215546Sopenharmony_ci      break;
145bf215546Sopenharmony_ci   case VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT:
146bf215546Sopenharmony_ci      mesa_loge("%s: %s", message_idname, message);
147bf215546Sopenharmony_ci      break;
148bf215546Sopenharmony_ci   default:
149bf215546Sopenharmony_ci      unreachable("Invalid debug message severity");
150bf215546Sopenharmony_ci      break;
151bf215546Sopenharmony_ci   }
152bf215546Sopenharmony_ci
153bf215546Sopenharmony_ci   if (!instance) {
154bf215546Sopenharmony_ci      ralloc_free(message);
155bf215546Sopenharmony_ci      ralloc_free(message_idname);
156bf215546Sopenharmony_ci      return;
157bf215546Sopenharmony_ci   }
158bf215546Sopenharmony_ci#endif
159bf215546Sopenharmony_ci
160bf215546Sopenharmony_ci   if (!instance->base.client_visible) {
161bf215546Sopenharmony_ci      vk_debug_message_instance(instance, severity, types,
162bf215546Sopenharmony_ci                                message_idname, 0, message);
163bf215546Sopenharmony_ci      ralloc_free(message);
164bf215546Sopenharmony_ci      ralloc_free(message_idname);
165bf215546Sopenharmony_ci      return;
166bf215546Sopenharmony_ci   }
167bf215546Sopenharmony_ci
168bf215546Sopenharmony_ci   /* If VK_EXT_debug_utils messengers have been set up, form the
169bf215546Sopenharmony_ci    * message */
170bf215546Sopenharmony_ci   if (!list_is_empty(&instance->debug_utils.callbacks)) {
171bf215546Sopenharmony_ci      VkDebugUtilsMessengerCallbackDataEXT cb_data = {
172bf215546Sopenharmony_ci         .sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CALLBACK_DATA_EXT,
173bf215546Sopenharmony_ci         .pMessageIdName = message_idname,
174bf215546Sopenharmony_ci         .messageIdNumber = 0,
175bf215546Sopenharmony_ci         .pMessage = message,
176bf215546Sopenharmony_ci      };
177bf215546Sopenharmony_ci
178bf215546Sopenharmony_ci      VkDebugUtilsObjectNameInfoEXT *object_name_infos =
179bf215546Sopenharmony_ci         ralloc_array(NULL, VkDebugUtilsObjectNameInfoEXT, object_count);
180bf215546Sopenharmony_ci
181bf215546Sopenharmony_ci      ASSERTED int cmdbuf_n = 0, queue_n = 0, obj_n = 0;
182bf215546Sopenharmony_ci      for (int i = 0; i < object_count; i++) {
183bf215546Sopenharmony_ci         struct vk_object_base *base = objects[i];
184bf215546Sopenharmony_ci         if (base == NULL || !base->client_visible)
185bf215546Sopenharmony_ci            continue;
186bf215546Sopenharmony_ci
187bf215546Sopenharmony_ci         switch (base->type) {
188bf215546Sopenharmony_ci         case VK_OBJECT_TYPE_COMMAND_BUFFER: {
189bf215546Sopenharmony_ci            /* We allow at most one command buffer to be submitted at a time */
190bf215546Sopenharmony_ci            assert(++cmdbuf_n <= 1);
191bf215546Sopenharmony_ci            struct vk_command_buffer *cmd_buffer =
192bf215546Sopenharmony_ci               (struct vk_command_buffer *)base;
193bf215546Sopenharmony_ci            if (cmd_buffer->labels.size > 0) {
194bf215546Sopenharmony_ci               cb_data.cmdBufLabelCount = util_dynarray_num_elements(
195bf215546Sopenharmony_ci                  &cmd_buffer->labels, VkDebugUtilsLabelEXT);
196bf215546Sopenharmony_ci               cb_data.pCmdBufLabels = cmd_buffer->labels.data;
197bf215546Sopenharmony_ci            }
198bf215546Sopenharmony_ci            break;
199bf215546Sopenharmony_ci         }
200bf215546Sopenharmony_ci
201bf215546Sopenharmony_ci         case VK_OBJECT_TYPE_QUEUE: {
202bf215546Sopenharmony_ci            /* We allow at most one queue to be submitted at a time */
203bf215546Sopenharmony_ci            assert(++queue_n <= 1);
204bf215546Sopenharmony_ci            struct vk_queue *queue = (struct vk_queue *)base;
205bf215546Sopenharmony_ci            if (queue->labels.size > 0) {
206bf215546Sopenharmony_ci               cb_data.queueLabelCount =
207bf215546Sopenharmony_ci                  util_dynarray_num_elements(&queue->labels, VkDebugUtilsLabelEXT);
208bf215546Sopenharmony_ci               cb_data.pQueueLabels = queue->labels.data;
209bf215546Sopenharmony_ci            }
210bf215546Sopenharmony_ci            break;
211bf215546Sopenharmony_ci         }
212bf215546Sopenharmony_ci         default:
213bf215546Sopenharmony_ci            break;
214bf215546Sopenharmony_ci         }
215bf215546Sopenharmony_ci
216bf215546Sopenharmony_ci         object_name_infos[obj_n++] = (VkDebugUtilsObjectNameInfoEXT){
217bf215546Sopenharmony_ci            .sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT,
218bf215546Sopenharmony_ci            .pNext = NULL,
219bf215546Sopenharmony_ci            .objectType = base->type,
220bf215546Sopenharmony_ci            .objectHandle = (uint64_t)(uintptr_t)base,
221bf215546Sopenharmony_ci            .pObjectName = base->object_name,
222bf215546Sopenharmony_ci         };
223bf215546Sopenharmony_ci      }
224bf215546Sopenharmony_ci      cb_data.objectCount = obj_n;
225bf215546Sopenharmony_ci      cb_data.pObjects = object_name_infos;
226bf215546Sopenharmony_ci
227bf215546Sopenharmony_ci      vk_debug_message(instance, severity, types, &cb_data);
228bf215546Sopenharmony_ci
229bf215546Sopenharmony_ci      ralloc_free(object_name_infos);
230bf215546Sopenharmony_ci   }
231bf215546Sopenharmony_ci
232bf215546Sopenharmony_ci   /* If VK_EXT_debug_report callbacks also have been set up, forward
233bf215546Sopenharmony_ci    * the message there as well */
234bf215546Sopenharmony_ci   if (!list_is_empty(&instance->debug_report.callbacks)) {
235bf215546Sopenharmony_ci      VkDebugReportFlagsEXT flags = 0;
236bf215546Sopenharmony_ci
237bf215546Sopenharmony_ci      switch (severity) {
238bf215546Sopenharmony_ci      case VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT:
239bf215546Sopenharmony_ci         flags |= VK_DEBUG_REPORT_DEBUG_BIT_EXT;
240bf215546Sopenharmony_ci         break;
241bf215546Sopenharmony_ci      case VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT:
242bf215546Sopenharmony_ci         flags |= VK_DEBUG_REPORT_INFORMATION_BIT_EXT;
243bf215546Sopenharmony_ci         break;
244bf215546Sopenharmony_ci      case VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT:
245bf215546Sopenharmony_ci         if (types & VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT)
246bf215546Sopenharmony_ci            flags |= VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT;
247bf215546Sopenharmony_ci         else
248bf215546Sopenharmony_ci            flags |= VK_DEBUG_REPORT_WARNING_BIT_EXT;
249bf215546Sopenharmony_ci         break;
250bf215546Sopenharmony_ci      case VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT:
251bf215546Sopenharmony_ci         flags |= VK_DEBUG_REPORT_ERROR_BIT_EXT;
252bf215546Sopenharmony_ci         break;
253bf215546Sopenharmony_ci      default:
254bf215546Sopenharmony_ci         unreachable("Invalid debug message severity");
255bf215546Sopenharmony_ci         break;
256bf215546Sopenharmony_ci      }
257bf215546Sopenharmony_ci
258bf215546Sopenharmony_ci      /* VK_EXT_debug_report-provided callback accepts only one object
259bf215546Sopenharmony_ci       * related to the message. Since they are given to us in
260bf215546Sopenharmony_ci       * decreasing order of importance, we're forwarding the first
261bf215546Sopenharmony_ci       * one.
262bf215546Sopenharmony_ci       */
263bf215546Sopenharmony_ci      vk_debug_report(instance, flags, object_count ? objects[0] : NULL, 0,
264bf215546Sopenharmony_ci                      0, message_idname, message);
265bf215546Sopenharmony_ci   }
266bf215546Sopenharmony_ci
267bf215546Sopenharmony_ci   ralloc_free(message);
268bf215546Sopenharmony_ci   ralloc_free(message_idname);
269bf215546Sopenharmony_ci}
270bf215546Sopenharmony_ci
271bf215546Sopenharmony_cistatic struct vk_object_base *
272bf215546Sopenharmony_civk_object_for_error(struct vk_object_base *obj, VkResult error)
273bf215546Sopenharmony_ci{
274bf215546Sopenharmony_ci   if (obj == NULL)
275bf215546Sopenharmony_ci      return NULL;
276bf215546Sopenharmony_ci
277bf215546Sopenharmony_ci   switch (error) {
278bf215546Sopenharmony_ci   case VK_ERROR_OUT_OF_HOST_MEMORY:
279bf215546Sopenharmony_ci   case VK_ERROR_LAYER_NOT_PRESENT:
280bf215546Sopenharmony_ci   case VK_ERROR_EXTENSION_NOT_PRESENT:
281bf215546Sopenharmony_ci   case VK_ERROR_UNKNOWN:
282bf215546Sopenharmony_ci      return &vk_object_to_instance(obj)->base;
283bf215546Sopenharmony_ci   case VK_ERROR_FEATURE_NOT_PRESENT:
284bf215546Sopenharmony_ci      return &vk_object_to_physical_device(obj)->base;
285bf215546Sopenharmony_ci   case VK_ERROR_OUT_OF_DEVICE_MEMORY:
286bf215546Sopenharmony_ci   case VK_ERROR_MEMORY_MAP_FAILED:
287bf215546Sopenharmony_ci   case VK_ERROR_TOO_MANY_OBJECTS:
288bf215546Sopenharmony_ci      return &vk_object_to_device(obj)->base;
289bf215546Sopenharmony_ci   default:
290bf215546Sopenharmony_ci      return obj;
291bf215546Sopenharmony_ci   }
292bf215546Sopenharmony_ci}
293bf215546Sopenharmony_ci
294bf215546Sopenharmony_ciVkResult
295bf215546Sopenharmony_ci__vk_errorv(const void *_obj, VkResult error,
296bf215546Sopenharmony_ci            const char *file, int line,
297bf215546Sopenharmony_ci            const char *format, va_list va)
298bf215546Sopenharmony_ci{
299bf215546Sopenharmony_ci   struct vk_object_base *object = (struct vk_object_base *)_obj;
300bf215546Sopenharmony_ci   struct vk_instance *instance = vk_object_to_instance(object);
301bf215546Sopenharmony_ci   object = vk_object_for_error(object, error);
302bf215546Sopenharmony_ci
303bf215546Sopenharmony_ci   /* If object->client_visible isn't set then the object hasn't been fully
304bf215546Sopenharmony_ci    * constructed and we shouldn't hand it back to the client.  This typically
305bf215546Sopenharmony_ci    * happens if an error is thrown during object construction.  This is safe
306bf215546Sopenharmony_ci    * to do as long as vk_object_base_init() has already been called.
307bf215546Sopenharmony_ci    */
308bf215546Sopenharmony_ci   if (object && !object->client_visible)
309bf215546Sopenharmony_ci      object = NULL;
310bf215546Sopenharmony_ci
311bf215546Sopenharmony_ci   const char *error_str = vk_Result_to_str(error);
312bf215546Sopenharmony_ci
313bf215546Sopenharmony_ci   if (format) {
314bf215546Sopenharmony_ci      char *message = ralloc_vasprintf(NULL, format, va);
315bf215546Sopenharmony_ci
316bf215546Sopenharmony_ci      if (object) {
317bf215546Sopenharmony_ci         __vk_log(VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT,
318bf215546Sopenharmony_ci                  VK_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT,
319bf215546Sopenharmony_ci                  VK_LOG_OBJS(object), file, line,
320bf215546Sopenharmony_ci                  "%s (%s)", message, error_str);
321bf215546Sopenharmony_ci      } else {
322bf215546Sopenharmony_ci         __vk_log(VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT,
323bf215546Sopenharmony_ci                  VK_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT,
324bf215546Sopenharmony_ci                  VK_LOG_NO_OBJS(instance), file, line,
325bf215546Sopenharmony_ci                  "%s (%s)", message, error_str);
326bf215546Sopenharmony_ci      }
327bf215546Sopenharmony_ci
328bf215546Sopenharmony_ci      ralloc_free(message);
329bf215546Sopenharmony_ci   } else {
330bf215546Sopenharmony_ci      if (object) {
331bf215546Sopenharmony_ci         __vk_log(VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT,
332bf215546Sopenharmony_ci                  VK_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT,
333bf215546Sopenharmony_ci                  VK_LOG_OBJS(object), file, line,
334bf215546Sopenharmony_ci                  "%s", error_str);
335bf215546Sopenharmony_ci      } else {
336bf215546Sopenharmony_ci         __vk_log(VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT,
337bf215546Sopenharmony_ci                  VK_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT,
338bf215546Sopenharmony_ci                  VK_LOG_NO_OBJS(instance), file, line,
339bf215546Sopenharmony_ci                  "%s", error_str);
340bf215546Sopenharmony_ci      }
341bf215546Sopenharmony_ci   }
342bf215546Sopenharmony_ci
343bf215546Sopenharmony_ci   return error;
344bf215546Sopenharmony_ci}
345bf215546Sopenharmony_ci
346bf215546Sopenharmony_ciVkResult
347bf215546Sopenharmony_ci__vk_errorf(const void *_obj, VkResult error,
348bf215546Sopenharmony_ci            const char *file, int line,
349bf215546Sopenharmony_ci            const char *format, ...)
350bf215546Sopenharmony_ci{
351bf215546Sopenharmony_ci   va_list va;
352bf215546Sopenharmony_ci
353bf215546Sopenharmony_ci   va_start(va, format);
354bf215546Sopenharmony_ci   VkResult result = __vk_errorv(_obj, error, file, line, format, va);
355bf215546Sopenharmony_ci   va_end(va);
356bf215546Sopenharmony_ci
357bf215546Sopenharmony_ci   return result;
358bf215546Sopenharmony_ci}
359