mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-03-25 06:50:46 +01:00
vulkan: do not pass vk_instance for debug report messages
RADV wants to abstract the compiler from any instance/device/pdev objects. The previous NULL check for instance seems to be useless. Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40379>
This commit is contained in:
parent
a8e49be9d9
commit
d6fe5ee8a6
6 changed files with 40 additions and 30 deletions
|
|
@ -347,7 +347,7 @@ radv_spirv_nir_debug(void *private_data, enum nir_spirv_debug_level level, size_
|
|||
|
||||
snprintf(buffer, sizeof(buffer), "SPIR-V offset %lu: %s", (unsigned long)spirv_offset, message);
|
||||
|
||||
vk_debug_report(&instance->vk, vk_flags[level], debug_data->object, 0, 0, "radv", buffer);
|
||||
vk_debug_report(&instance->vk.debug_report, vk_flags[level], debug_data->object, 0, 0, "radv", buffer);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -364,7 +364,8 @@ radv_compiler_debug(void *private_data, enum aco_compiler_debug_level level, con
|
|||
/* VK_DEBUG_REPORT_DEBUG_BIT_EXT specifies diagnostic information
|
||||
* from the implementation and layers.
|
||||
*/
|
||||
vk_debug_report(&instance->vk, vk_flags[level] | VK_DEBUG_REPORT_DEBUG_BIT_EXT, NULL, 0, 0, "radv", message);
|
||||
vk_debug_report(&instance->vk.debug_report, vk_flags[level] | VK_DEBUG_REPORT_DEBUG_BIT_EXT, NULL, 0, 0, "radv",
|
||||
message);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -2297,7 +2297,9 @@ emit_binding_table(struct anv_cmd_buffer *cmd_buffer,
|
|||
"descriptor does not have NonReadable "
|
||||
"set and the image does not have a "
|
||||
"corresponding SPIR-V format enum.");
|
||||
vk_debug_report(&cmd_buffer->device->physical->instance->vk,
|
||||
struct vk_instance *instance =
|
||||
&cmd_buffer->device->physical->instance->vk;
|
||||
vk_debug_report(&instance->debug_report,
|
||||
VK_DEBUG_REPORT_ERROR_BIT_EXT,
|
||||
&desc->image_view->vk.base,
|
||||
__LINE__, 0, "anv",
|
||||
|
|
|
|||
|
|
@ -94,20 +94,20 @@ vk_common_DestroyDebugReportCallbackEXT(VkInstance _instance,
|
|||
}
|
||||
|
||||
static void
|
||||
debug_report(struct vk_instance *instance,
|
||||
VkDebugReportFlagsEXT flags,
|
||||
VkDebugReportObjectTypeEXT object_type,
|
||||
uint64_t handle,
|
||||
size_t location,
|
||||
int32_t messageCode,
|
||||
const char* pLayerPrefix,
|
||||
const char *pMessage)
|
||||
debug_report_message(struct vk_debug_report *debug_report,
|
||||
VkDebugReportFlagsEXT flags,
|
||||
VkDebugReportObjectTypeEXT object_type,
|
||||
uint64_t handle,
|
||||
size_t location,
|
||||
int32_t messageCode,
|
||||
const char* pLayerPrefix,
|
||||
const char *pMessage)
|
||||
{
|
||||
/* Allow NULL for convinience, return if no callbacks registered. */
|
||||
if (!instance || list_is_empty(&instance->debug_report.callbacks))
|
||||
/* Return if no callbacks registered. */
|
||||
if (list_is_empty(&debug_report->callbacks))
|
||||
return;
|
||||
|
||||
mtx_lock(&instance->debug_report.callbacks_mutex);
|
||||
mtx_lock(&debug_report->callbacks_mutex);
|
||||
|
||||
/* Section 33.2 of the Vulkan 1.0.59 spec says:
|
||||
*
|
||||
|
|
@ -117,13 +117,13 @@ debug_report(struct vk_instance *instance,
|
|||
* is active."
|
||||
*/
|
||||
list_for_each_entry(struct vk_debug_report_callback, cb,
|
||||
&instance->debug_report.callbacks, link) {
|
||||
&debug_report->callbacks, link) {
|
||||
if (cb->flags & flags)
|
||||
cb->callback(flags, object_type, handle, location, messageCode,
|
||||
pLayerPrefix, pMessage, cb->data);
|
||||
}
|
||||
|
||||
mtx_unlock(&instance->debug_report.callbacks_mutex);
|
||||
mtx_unlock(&debug_report->callbacks_mutex);
|
||||
}
|
||||
|
||||
VKAPI_ATTR void VKAPI_CALL
|
||||
|
|
@ -137,12 +137,12 @@ vk_common_DebugReportMessageEXT(VkInstance _instance,
|
|||
const char* pMessage)
|
||||
{
|
||||
VK_FROM_HANDLE(vk_instance, instance, _instance);
|
||||
debug_report(instance, flags, objectType,
|
||||
object, location, messageCode, pLayerPrefix, pMessage);
|
||||
debug_report_message(&instance->debug_report, flags, objectType,
|
||||
object, location, messageCode, pLayerPrefix, pMessage);
|
||||
}
|
||||
|
||||
void
|
||||
vk_debug_report(struct vk_instance *instance,
|
||||
vk_debug_report(struct vk_debug_report *debug_report,
|
||||
VkDebugReportFlagsEXT flags,
|
||||
const struct vk_object_base *object,
|
||||
size_t location,
|
||||
|
|
@ -152,7 +152,8 @@ vk_debug_report(struct vk_instance *instance,
|
|||
{
|
||||
VkObjectType object_type =
|
||||
object ? object->type : VK_OBJECT_TYPE_UNKNOWN;
|
||||
debug_report(instance, flags, (VkDebugReportObjectTypeEXT)object_type,
|
||||
(uint64_t)(uintptr_t)object, location, messageCode,
|
||||
pLayerPrefix, pMessage);
|
||||
|
||||
debug_report_message(debug_report, flags, (VkDebugReportObjectTypeEXT)object_type,
|
||||
(uint64_t)(uintptr_t)object, location, messageCode,
|
||||
pLayerPrefix, pMessage);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,14 +26,22 @@
|
|||
#ifndef VK_DEBUG_REPORT_H
|
||||
#define VK_DEBUG_REPORT_H
|
||||
|
||||
#include "vk_instance.h"
|
||||
#include "vk_object.h"
|
||||
|
||||
#include "util/simple_mtx.h"
|
||||
#include "util/list.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct vk_debug_report {
|
||||
mtx_t callbacks_mutex;
|
||||
struct list_head callbacks;
|
||||
};
|
||||
|
||||
void
|
||||
vk_debug_report(struct vk_instance *instance,
|
||||
vk_debug_report(struct vk_debug_report *debug_report,
|
||||
VkDebugReportFlagsEXT flags,
|
||||
const struct vk_object_base *object,
|
||||
size_t location,
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
#ifndef VK_INSTANCE_H
|
||||
#define VK_INSTANCE_H
|
||||
|
||||
#include "vk_debug_report.h"
|
||||
#include "vk_dispatch_table.h"
|
||||
#include "vk_extensions.h"
|
||||
#include "vk_object.h"
|
||||
|
|
@ -110,10 +111,7 @@ struct vk_instance {
|
|||
struct vk_instance_dispatch_table dispatch_table;
|
||||
|
||||
/* VK_EXT_debug_report debug callbacks */
|
||||
struct {
|
||||
mtx_t callbacks_mutex;
|
||||
struct list_head callbacks;
|
||||
} debug_report;
|
||||
struct vk_debug_report debug_report;
|
||||
|
||||
/* VK_EXT_debug_utils */
|
||||
struct {
|
||||
|
|
|
|||
|
|
@ -259,8 +259,8 @@ __vk_log_impl(VkDebugUtilsMessageSeverityFlagBitsEXT severity,
|
|||
* decreasing order of importance, we're forwarding the first
|
||||
* one.
|
||||
*/
|
||||
vk_debug_report(instance, flags, object_count ? objects[0] : NULL, 0,
|
||||
0, message_idname, message);
|
||||
vk_debug_report(&instance->debug_report, flags, object_count ? objects[0] : NULL,
|
||||
0, 0, message_idname, message);
|
||||
}
|
||||
|
||||
ralloc_free(message);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue