Commit 41318a58 authored by Jason Ekstrand's avatar Jason Ekstrand Committed by Marge Bot
Browse files

vulkan: Use vk_object_base::type for debug_report


Reviewed-by: Lionel Landwerlin's avatarLionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Bas Nieuwenhuizen's avatarBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <!8676>
parent c41eaf0a
......@@ -287,11 +287,8 @@ static void radv_spirv_nir_debug(void *private_data,
snprintf(buffer, sizeof(buffer), "SPIR-V offset %lu: %s",
(unsigned long)spirv_offset, message);
vk_debug_report(&instance->vk.debug_report,
vk_flags[level],
VK_DEBUG_REPORT_OBJECT_TYPE_SHADER_MODULE_EXT,
(uint64_t)(uintptr_t)debug_data->module,
0, 0, "radv", buffer);
vk_debug_report(&instance->vk.debug_report, vk_flags[level],
&debug_data->module->base, 0, 0, "radv", buffer);
}
static void radv_compiler_debug(void *private_data,
......@@ -311,9 +308,7 @@ static void radv_compiler_debug(void *private_data,
*/
vk_debug_report(&instance->vk.debug_report,
vk_flags[level] | VK_DEBUG_REPORT_DEBUG_BIT_EXT,
VK_DEBUG_REPORT_OBJECT_TYPE_SHADER_MODULE_EXT,
(uint64_t)(uintptr_t)debug_data->module,
0, 0, "radv", message);
&debug_data->module->base, 0, 0, "radv", message);
}
static void
......
......@@ -114,9 +114,8 @@ __vk_errorv(struct radv_instance *instance, const void *object,
if (instance) {
vk_debug_report(&instance->vk.debug_report,
VK_DEBUG_REPORT_ERROR_BIT_EXT, type,
(uint64_t)(uintptr_t) object, line, 0, "radv",
report);
VK_DEBUG_REPORT_ERROR_BIT_EXT,
object, line, 0, "radv", report);
}
fprintf(stderr, "%s\n", report);
......
......@@ -93,8 +93,7 @@ compiler_debug_log(void *data, const char *fmt, ...)
vk_debug_report(&instance->vk.debug_report,
VK_DEBUG_REPORT_DEBUG_BIT_EXT,
VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT,
0, 0, 0, "anv", str);
NULL, 0, 0, "anv", str);
}
static void
......
......@@ -113,10 +113,8 @@ static void anv_spirv_nir_debug(void *private_data,
snprintf(buffer, sizeof(buffer), "SPIR-V offset %lu: %s", (unsigned long) spirv_offset, message);
vk_debug_report(&instance->vk.debug_report,
vk_flags[level],
VK_DEBUG_REPORT_OBJECT_TYPE_SHADER_MODULE_EXT,
(uint64_t) (uintptr_t) debug_data->module,
vk_debug_report(&instance->vk.debug_report, vk_flags[level],
&debug_data->module->base,
0, 0, "anv", buffer);
}
......@@ -1407,9 +1405,7 @@ anv_pipeline_compile_graphics(struct anv_graphics_pipeline *pipeline,
vk_debug_report(&pipeline->base.device->physical->instance->vk.debug_report,
VK_DEBUG_REPORT_WARNING_BIT_EXT |
VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT,
VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_CACHE_EXT,
(uint64_t)(uintptr_t)cache,
0, 0, "anv",
&cache->base, 0, 0, "anv",
"Found a partial pipeline in the cache. This is "
"most likely caused by an incomplete pipeline cache "
"import or export");
......
......@@ -64,11 +64,9 @@ __anv_perf_warn(struct anv_device *device,
snprintf(report, sizeof(report), "%s: %s", file, buffer);
VkObjectType object_type = object ? object->type : VK_OBJECT_TYPE_UNKNOWN;
vk_debug_report(&device->physical->instance->vk.debug_report,
VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT,
object_type, (uint64_t)(uintptr_t)object,
line, 0, "anv", report);
object, line, 0, "anv", report);
mesa_logw("%s:%d: PERF: %s", file, line, buffer);
}
......@@ -93,11 +91,9 @@ __vk_errorv(struct anv_instance *instance,
}
if (instance) {
VkObjectType object_type = object ? object->type : VK_OBJECT_TYPE_UNKNOWN;
vk_debug_report(&instance->vk.debug_report,
VK_DEBUG_REPORT_ERROR_BIT_EXT,
object_type, (uint64_t)(uintptr_t)object,
line, 0, "anv", report);
object, line, 0, "anv", report);
}
mesa_loge("%s", report);
......
......@@ -1233,9 +1233,7 @@ emit_cb_state(struct anv_graphics_pipeline *pipeline,
is_dual_src_blend_factor(a->dstAlphaBlendFactor))) {
vk_debug_report(&device->physical->instance->vk.debug_report,
VK_DEBUG_REPORT_WARNING_BIT_EXT,
VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT,
(uint64_t)(uintptr_t)device,
0, 0, "anv",
&device->vk.base, 0, 0, "anv",
"Enabled dual-src blend factors without writing both targets "
"in the shader. Disabling blending to avoid GPU hangs.");
entry.ColorBufferBlendEnable = false;
......
......@@ -96,15 +96,15 @@ vk_destroy_debug_report_callback(struct vk_debug_report_instance *instance,
vk_object_base_finish(&callback->base);
}
void
vk_debug_report(struct vk_debug_report_instance *instance,
VkDebugReportFlagsEXT flags,
VkDebugReportObjectTypeEXT object_type,
uint64_t handle,
size_t location,
int32_t messageCode,
const char* pLayerPrefix,
const char *pMessage)
static void
debug_report(struct vk_debug_report_instance *instance,
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->callbacks))
......@@ -129,6 +129,21 @@ vk_debug_report(struct vk_debug_report_instance *instance,
mtx_unlock(&instance->callbacks_mutex);
}
void
vk_debug_report(struct vk_debug_report_instance *instance,
VkDebugReportFlagsEXT flags,
const struct vk_object_base *object,
size_t location,
int32_t messageCode,
const char* pLayerPrefix,
const char *pMessage)
{
VkDebugReportObjectTypeEXT object_type =
object ? object->type : VK_OBJECT_TYPE_UNKNOWN;
debug_report(instance, flags, object_type, (uint64_t)(uintptr_t)object,
location, messageCode, pLayerPrefix, pMessage);
}
VkResult
vk_common_CreateDebugReportCallbackEXT(VkInstance _instance,
const VkDebugReportCallbackCreateInfoEXT *pCreateInfo,
......@@ -163,6 +178,6 @@ vk_common_DebugReportMessageEXT(VkInstance _instance,
const char* pMessage)
{
VK_FROM_HANDLE(vk_instance, instance, _instance);
vk_debug_report(&instance->debug_report, flags, objectType,
object, location, messageCode, pLayerPrefix, pMessage);
debug_report(&instance->debug_report, flags, objectType,
object, location, messageCode, pLayerPrefix, pMessage);
}
......@@ -69,8 +69,7 @@ vk_destroy_debug_report_callback(struct vk_debug_report_instance *instance,
void
vk_debug_report(struct vk_debug_report_instance *instance,
VkDebugReportFlagsEXT flags,
VkDebugReportObjectTypeEXT object_type,
uint64_t handle,
const struct vk_object_base *object,
size_t location,
int32_t messageCode,
const char* pLayerPrefix,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment