debug_report: Add DebugReportMessage function
diff --git a/include/vulkan/vk_layer.h b/include/vulkan/vk_layer.h
index 5ac2f7e..401ca866 100644
--- a/include/vulkan/vk_layer.h
+++ b/include/vulkan/vk_layer.h
@@ -176,6 +176,7 @@
PFN_vkGetPhysicalDeviceSurfacePresentModesKHR GetPhysicalDeviceSurfacePresentModesKHR;
PFN_vkCreateDebugReportCallbackLUNARG CreateDebugReportCallbackLUNARG;
PFN_vkDestroyDebugReportCallbackLUNARG DestroyDebugReportCallbackLUNARG;
+ PFN_vkDebugReportMessageLUNARG DebugReportMessageLUNARG;
#ifdef VK_USE_PLATFORM_MIR_KHR
PFN_vkCreateMirSurfaceKHR CreateMirSurfaceKHR;
PFN_vkGetPhysicalDeviceMirPresentationSupportKHR GetPhysicalDeviceMirPresentationSupportKHR;
diff --git a/include/vulkan/vk_lunarg_debug_report.h b/include/vulkan/vk_lunarg_debug_report.h
index 316476e..c8d47cd 100644
--- a/include/vulkan/vk_lunarg_debug_report.h
+++ b/include/vulkan/vk_lunarg_debug_report.h
@@ -138,6 +138,7 @@
typedef VkResult (VKAPI_PTR *PFN_vkCreateDebugReportCallbackLUNARG)(VkInstance instance, VkDebugReportCallbackCreateInfoLUNARG *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDebugReportCallbackLUNARG* pCallback);
typedef void (VKAPI_PTR *PFN_vkDestroyDebugReportCallbackLUNARG)(VkInstance instance, VkDebugReportCallbackLUNARG callback, const VkAllocationCallbacks *pAllocator);
+typedef void (VKAPI_PTR *PFN_vkDebugReportMessageLUNARG)(VkInstance instance, VkDebugReportFlagsLUNARG msgFlags, VkDebugReportObjectTypeLUNARG objType, uint64_t srcObject, size_t location, int32_t msgCode, const char *pLayerPrefix, const char *pMsg);
#ifdef VK_PROTOTYPES
@@ -152,6 +153,16 @@
VkInstance instance,
VkDebugReportCallbackLUNARG callback,
const VkAllocationCallbacks* pAllocator);
+
+VKAPI_ATTR void VKAPI_CALL vkDebugReportMessageLUNARG(
+ VkInstance instance,
+ VkDebugReportFlagsLUNARG flags,
+ VkDebugReportObjectTypeLUNARG objType,
+ uint64_t object,
+ size_t location,
+ int32_t msgCode,
+ const char* pLayerPrefix,
+ const char* pMsg);
#endif // VK_PROTOTYPES
#ifdef __cplusplus
diff --git a/layers/vk_layer_logging.h b/layers/vk_layer_logging.h
index 325b3f0..dd89931 100644
--- a/layers/vk_layer_logging.h
+++ b/layers/vk_layer_logging.h
@@ -230,6 +230,10 @@
return (PFN_vkVoidFunction) vkDestroyDebugReportCallbackLUNARG;
}
+ if (!strcmp(funcName, "vkDebugReportMessageLUNARG")) {
+ return (PFN_vkVoidFunction) vkDebugReportMessageLUNARG;
+ }
+
return NULL;
}
diff --git a/loader/debug_report.c b/loader/debug_report.c
index 5ef00eb..35c3bd7 100644
--- a/loader/debug_report.c
+++ b/loader/debug_report.c
@@ -92,6 +92,39 @@
return result;
}
+// Utility function to handle reporting
+static inline VkBool32 debug_report_log_msg(
+ VkInstance instance,
+ VkFlags msgFlags,
+ VkDebugReportObjectTypeLUNARG objectType,
+ uint64_t srcObject,
+ size_t location,
+ int32_t msgCode,
+ const char* pLayerPrefix,
+ const char* pMsg)
+{
+ struct loader_instance *inst = loader_get_instance(instance);
+ VkBool32 bail = false;
+ VkLayerDbgFunctionNode *pTrav = inst->DbgFunctionHead;
+ while (pTrav) {
+ if (pTrav->msgFlags & msgFlags) {
+ if (pTrav->pfnMsgCallback(msgFlags,
+ objectType, srcObject,
+ location,
+ msgCode,
+ pLayerPrefix,
+ pMsg,
+ (void *) pTrav->pUserData)) {
+ bail = true;
+ }
+ }
+ pTrav = pTrav->pNext;
+ }
+
+ return bail;
+}
+
+
static VKAPI_ATTR void VKAPI_CALL debug_report_DestroyDebugReportCallback(
VkInstance instance,
VkDebugReportCallbackLUNARG callback,
@@ -119,6 +152,21 @@
loader_platform_thread_unlock_mutex(&loader_lock);
}
+static VKAPI_ATTR void VKAPI_CALL debug_report_DebugReportMessage(
+ VkInstance instance,
+ VkDebugReportFlagsLUNARG flags,
+ VkDebugReportObjectTypeLUNARG objType,
+ uint64_t object,
+ size_t location,
+ int32_t msgCode,
+ const char* pLayerPrefix,
+ const char* pMsg)
+{
+ struct loader_instance *inst = loader_get_instance(instance);
+
+ inst->disp->DebugReportMessageLUNARG(instance, flags, objType, object, location, msgCode, pLayerPrefix, pMsg);
+
+}
/*
* This is the instance chain terminator function
@@ -216,6 +264,37 @@
}
}
+
+/*
+ * This is the instance chain terminator function
+ * for DebugReportMessage
+ */
+VKAPI_ATTR void VKAPI_CALL loader_DebugReportMessage(
+ VkInstance instance,
+ VkDebugReportFlagsLUNARG flags,
+ VkDebugReportObjectTypeLUNARG objType,
+ uint64_t object,
+ size_t location,
+ int32_t msgCode,
+ const char* pLayerPrefix,
+ const char* pMsg)
+{
+ const struct loader_icd *icd;
+ struct loader_instance *inst = loader_get_instance(instance);
+
+ for (icd = inst->icds; icd; icd = icd->next) {
+ if (icd->DebugReportMessageLUNARG != NULL) {
+ icd->DebugReportMessageLUNARG(icd->instance, flags, objType, object, location, msgCode, pLayerPrefix, pMsg);
+ }
+ }
+
+ /*
+ * Now that all ICDs have seen the message, call the necessary callbacks.
+ * Ignoring "bail" return value as there is nothing to bail from at this point.
+ */
+ debug_report_log_msg(instance, flags, objType, object, location, msgCode, pLayerPrefix, pMsg);
+}
+
bool debug_report_instance_gpa(
struct loader_instance *ptr_instance,
const char* name,
@@ -233,5 +312,9 @@
*addr = ptr_instance->debug_report_enabled ? (void *) debug_report_DestroyDebugReportCallback : NULL;
return true;
}
+ if (!strcmp("vkDebugReportMessageLUNARG", name)) {
+ *addr = ptr_instance->debug_report_enabled ? (void *) debug_report_DebugReportMessage : NULL;
+ return true;
+ }
return false;
}
diff --git a/loader/debug_report.h b/loader/debug_report.h
index 481cbd4..1780831 100644
--- a/loader/debug_report.h
+++ b/loader/debug_report.h
@@ -112,3 +112,13 @@
VkInstance instance,
VkDebugReportCallbackLUNARG callback,
const VkAllocationCallbacks *pAllocator);
+
+VKAPI_ATTR void VKAPI_CALL loader_DebugReportMessage(
+ VkInstance instance,
+ VkDebugReportFlagsLUNARG flags,
+ VkDebugReportObjectTypeLUNARG objType,
+ uint64_t object,
+ size_t location,
+ int32_t msgCode,
+ const char* pLayerPrefix,
+ const char* pMsg);
diff --git a/loader/loader.c b/loader/loader.c
index 6e37f06..5ad128e 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -116,6 +116,7 @@
.GetPhysicalDeviceSurfacePresentModesKHR = loader_GetPhysicalDeviceSurfacePresentModesKHR,
.CreateDebugReportCallbackLUNARG = loader_CreateDebugReportCallback,
.DestroyDebugReportCallbackLUNARG = loader_DestroyDebugReportCallback,
+ .DebugReportMessageLUNARG = loader_DebugReportMessage,
#ifdef VK_USE_PLATFORM_MIR_KHR
.CreateMirSurfaceKHR = loader_CreateMirSurfaceKHR,
.GetPhysicalDeviceMirPresentationSupportKHR = loader_GetPhysicalDeviceMirPresentationSupportKHR,
diff --git a/loader/loader.h b/loader/loader.h
index 0c0c94a..9a940bb 100644
--- a/loader/loader.h
+++ b/loader/loader.h
@@ -190,6 +190,7 @@
PFN_vkGetPhysicalDeviceSparseImageFormatProperties GetPhysicalDeviceSparseImageFormatProperties;
PFN_vkCreateDebugReportCallbackLUNARG CreateDebugReportCallbackLUNARG;
PFN_vkDestroyDebugReportCallbackLUNARG DestroyDebugReportCallbackLUNARG;
+ PFN_vkDebugReportMessageLUNARG DebugReportMessageLUNARG;
PFN_vkGetPhysicalDeviceSurfaceSupportKHR GetPhysicalDeviceSurfaceSupportKHR;
PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR GetPhysicalDeviceSurfaceCapabilitiesKHR;
PFN_vkGetPhysicalDeviceSurfaceFormatsKHR GetPhysicalDeviceSurfaceFormatsKHR;
diff --git a/loader/table_ops.h b/loader/table_ops.h
index 7cbb51c..5035496 100644
--- a/loader/table_ops.h
+++ b/loader/table_ops.h
@@ -471,6 +471,7 @@
table->DestroySurfaceKHR = (PFN_vkDestroySurfaceKHR) gpa(inst, "vkDestroySurfaceKHR");
table->CreateDebugReportCallbackLUNARG = (PFN_vkCreateDebugReportCallbackLUNARG) gpa(inst, "vkCreateDebugReportCallbackLUNARG");
table->DestroyDebugReportCallbackLUNARG = (PFN_vkDestroyDebugReportCallbackLUNARG) gpa(inst, "vkDestroyDebugReportCallbackLUNARG");
+ table->DebugReportMessageLUNARG = (PFN_vkDebugReportMessageLUNARG) gpa(inst, "vkDebugReportMessageLUNARG");
table->GetPhysicalDeviceSurfaceSupportKHR = (PFN_vkGetPhysicalDeviceSurfaceSupportKHR) gpa(inst, "vkGetPhysicalDeviceSurfaceSupportKHR");
table->GetPhysicalDeviceSurfaceCapabilitiesKHR = (PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR) gpa(inst, "vkGetPhysicalDeviceSurfaceCapabilitiesKHR");
table->GetPhysicalDeviceSurfaceFormatsKHR = (PFN_vkGetPhysicalDeviceSurfaceFormatsKHR) gpa(inst, "vkGetPhysicalDeviceSurfaceFormatsKHR");
@@ -575,6 +576,8 @@
return (void *) table->CreateDebugReportCallbackLUNARG;
if (!strcmp(name, "DestroyDebugReportCallbackLUNARG"))
return (void *) table->DestroyDebugReportCallbackLUNARG;
+ if (!strcmp(name, "DebugReportMessageLUNARG"))
+ return (void *) table->DebugReportMessageLUNARG;
return NULL;
}
diff --git a/tests/vkrenderframework.cpp b/tests/vkrenderframework.cpp
index 9333819..91abd4d 100644
--- a/tests/vkrenderframework.cpp
+++ b/tests/vkrenderframework.cpp
@@ -131,6 +131,8 @@
m_DestroyDebugReportCallback = (PFN_vkDestroyDebugReportCallbackLUNARG) vkGetInstanceProcAddr(this->inst, "vkDestroyDebugReportCallbackLUNARG");
ASSERT_NE(m_DestroyDebugReportCallback, (PFN_vkDestroyDebugReportCallbackLUNARG) NULL) << "Did not get function pointer for DestroyDebugReportCallback";
+ m_DebugReportMessage = (PFN_vkDebugReportMessageLUNARG) vkGetInstanceProcAddr(this->inst, "vkDebugReportMessageLUNARG");
+ ASSERT_NE(m_DebugReportMessage, (PFN_vkDebugReportMessageLUNARG) NULL) << "Did not get function pointer for DebugReportMessage";
}
}
diff --git a/tests/vkrenderframework.h b/tests/vkrenderframework.h
index f5b3bf7..641c971 100644
--- a/tests/vkrenderframework.h
+++ b/tests/vkrenderframework.h
@@ -142,6 +142,7 @@
VkDepthStencilObj *m_depthStencil;
PFN_vkCreateDebugReportCallbackLUNARG m_CreateDebugReportCallback;
PFN_vkDestroyDebugReportCallbackLUNARG m_DestroyDebugReportCallback;
+ PFN_vkDebugReportMessageLUNARG m_DebugReportMessage;
VkDebugReportCallbackLUNARG m_globalMsgCallback;
VkDebugReportCallbackLUNARG m_devMsgCallback;
diff --git a/vulkan.py b/vulkan.py
index b41e506..b725054 100755
--- a/vulkan.py
+++ b/vulkan.py
@@ -1134,6 +1134,16 @@
[Param("VkInstance", "instance"),
Param("VkDebugReportCallbackLUNARG", "callback"),
Param("const VkAllocationCallbacks*", "pAllocator")]),
+
+ Proto("void", "DebugReportMessageLUNARG",
+ [Param("VkInstance", "instance"),
+ Param("VkDebugReportFlagsLUNARG", "flags"),
+ Param("VkDebugReportObjectTypeLUNARG", "objType"),
+ Param("uint64_t", "object"),
+ Param("size_t", "location"),
+ Param("int32_t", "msgCode"),
+ Param("const char *", "pLayerPrefix"),
+ Param("const char *", "pMsg")]),
],
)
lunarg_debug_marker = Extension(