layers: Add support for DebugReportMessageLUNARG
diff --git a/layers/device_limits.cpp b/layers/device_limits.cpp
index 25beade..353dafd 100644
--- a/layers/device_limits.cpp
+++ b/layers/device_limits.cpp
@@ -593,6 +593,20 @@
layer_destroy_msg_callback(my_data->report_data, msgCallback, pAllocator);
}
+VK_LAYER_EXPORT 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)
+{
+ layer_data *my_data = get_my_data_ptr(get_dispatch_key(instance), layer_data_map);
+ my_data->instance_dispatch_table->DebugReportMessageLUNARG(instance, flags, objType, object, location, msgCode, pLayerPrefix, pMsg);
+}
+
VK_LAYER_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetDeviceProcAddr(VkDevice dev, const char* funcName)
{
if (dev == NULL)
diff --git a/layers/draw_state.cpp b/layers/draw_state.cpp
index 2cafc40..44b1121 100644
--- a/layers/draw_state.cpp
+++ b/layers/draw_state.cpp
@@ -5453,6 +5453,20 @@
layer_destroy_msg_callback(my_data->report_data, msgCallback, pAllocator);
}
+VK_LAYER_EXPORT 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)
+{
+ layer_data *my_data = get_my_data_ptr(get_dispatch_key(instance), layer_data_map);
+ my_data->instance_dispatch_table->DebugReportMessageLUNARG(instance, flags, objType, object, location, msgCode, pLayerPrefix, pMsg);
+}
+
VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdDbgMarkerBegin(VkCommandBuffer commandBuffer, const char* pMarker)
{
VkBool32 skipCall = VK_FALSE;
diff --git a/layers/image.cpp b/layers/image.cpp
index 614f9d5..83496d4 100644
--- a/layers/image.cpp
+++ b/layers/image.cpp
@@ -129,6 +129,20 @@
layer_destroy_msg_callback(my_data->report_data, msgCallback, pAllocator);
}
+VK_LAYER_EXPORT 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)
+{
+ layer_data *my_data = get_my_data_ptr(get_dispatch_key(instance), layer_data_map);
+ my_data->instance_dispatch_table->DebugReportMessageLUNARG(instance, flags, objType, object, location, msgCode, pLayerPrefix, pMsg);
+}
+
VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateInstance(const VkInstanceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkInstance* pInstance)
{
layer_data *my_data = get_my_data_ptr(get_dispatch_key(*pInstance), layer_data_map);
diff --git a/layers/mem_tracker.cpp b/layers/mem_tracker.cpp
index c77f1cd..51e8679 100644
--- a/layers/mem_tracker.cpp
+++ b/layers/mem_tracker.cpp
@@ -2605,6 +2605,20 @@
layer_destroy_msg_callback(my_data->report_data, msgCallback, pAllocator);
}
+VK_LAYER_EXPORT 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)
+{
+ layer_data *my_data = get_my_data_ptr(get_dispatch_key(instance), layer_data_map);
+ my_data->instance_dispatch_table->DebugReportMessageLUNARG(instance, flags, objType, object, location, msgCode, pLayerPrefix, pMsg);
+}
+
VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateSwapchainKHR(
VkDevice device,
const VkSwapchainCreateInfoKHR *pCreateInfo,
diff --git a/layers/param_checker.cpp b/layers/param_checker.cpp
index 6f02375..372f46a 100644
--- a/layers/param_checker.cpp
+++ b/layers/param_checker.cpp
@@ -150,6 +150,20 @@
layer_destroy_msg_callback(data->report_data, msgCallback, pAllocator);
}
+VK_LAYER_EXPORT 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)
+{
+ VkLayerInstanceDispatchTable *pTable = get_dispatch_table(pc_instance_table_map, instance);
+ pTable->DebugReportMessageLUNARG(instance, flags, objType, object, location, msgCode, pLayerPrefix, pMsg);
+}
+
static const VkExtensionProperties instance_extensions[] = {
{
VK_EXT_LUNARG_DEBUG_REPORT_EXTENSION_NAME,
diff --git a/layers/swapchain.cpp b/layers/swapchain.cpp
index 609f44e..65db513 100644
--- a/layers/swapchain.cpp
+++ b/layers/swapchain.cpp
@@ -1176,6 +1176,20 @@
layer_destroy_msg_callback(my_data->report_data, msgCallback, pAllocator);
}
+VK_LAYER_EXPORT 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)
+{
+ layer_data *my_data = get_my_data_ptr(get_dispatch_key(instance), layer_data_map);
+ my_data->instance_dispatch_table->DebugReportMessageLUNARG(instance, flags, objType, object, location, msgCode, pLayerPrefix, pMsg);
+}
+
VK_LAYER_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetDeviceProcAddr(VkDevice device, const char* funcName)
{
PFN_vkVoidFunction addr;
diff --git a/layers/vk_layer_logging.h b/layers/vk_layer_logging.h
index dd89931..2237548 100644
--- a/layers/vk_layer_logging.h
+++ b/layers/vk_layer_logging.h
@@ -90,6 +90,7 @@
table->CreateDebugReportCallbackLUNARG = (PFN_vkCreateDebugReportCallbackLUNARG) gpa(inst, "vkCreateDebugReportCallbackLUNARG");
table->DestroyDebugReportCallbackLUNARG = (PFN_vkDestroyDebugReportCallbackLUNARG) gpa(inst, "vkDestroyDebugReportCallbackLUNARG");
+ table->DebugReportMessageLUNARG = (PFN_vkDebugReportMessageLUNARG) gpa(inst, "vkDebugReportMessageLUNARG");
debug_data = (debug_report_data *) malloc(sizeof(debug_report_data));
if (!debug_data) return NULL;
diff --git a/vk-layer-generate.py b/vk-layer-generate.py
index 7eaf327..23571b1 100755
--- a/vk-layer-generate.py
+++ b/vk-layer-generate.py
@@ -270,15 +270,39 @@
r_body.append('}')
return "\n".join(r_body)
+ def _gen_debug_report_msg(self):
+ r_body = []
+ r_body.append('%s' % self.lineinfo.get())
+ r_body.append('VK_LAYER_EXPORT 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)')
+ r_body.append('{')
+ # Switch to this code section for the new per-instance storage and debug callbacks
+ if self.layer_name == 'ObjectTracker' or self.layer_name == 'Threading':
+ r_body.append(' VkLayerInstanceDispatchTable *pInstanceTable = get_dispatch_table(%s_instance_table_map, instance);' % self.layer_name )
+ else:
+ r_body.append(' VkLayerInstanceDispatchTable *pInstanceTable = instance_dispatch_table(instance);')
+ r_body.append(' pInstanceTable->DebugReportMessageLUNARG(instance, flags, objType, object, location, msgCode, pLayerPrefix, pMsg);')
+ r_body.append('}')
+ return "\n".join(r_body)
+
def _gen_layer_get_global_extension_props(self, layer="Generic"):
ggep_body = []
# generated layers do not provide any global extensions
ggep_body.append('%s' % self.lineinfo.get())
ggep_body.append('')
+ if self.layer_name == 'ObjectTracker' or self.layer_name == 'Threading':
+ ggep_body.append('static const VkExtensionProperties instance_extensions[] = {')
+ ggep_body.append(' {')
+ ggep_body.append(' VK_EXT_LUNARG_DEBUG_REPORT_EXTENSION_NAME,')
+ ggep_body.append(' VK_EXT_LUNARG_DEBUG_REPORT_EXTENSION_REVISION')
+ ggep_body.append(' }')
+ ggep_body.append('};')
ggep_body.append('VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceExtensionProperties(const char *pLayerName, uint32_t *pCount, VkExtensionProperties* pProperties)')
ggep_body.append('{')
- ggep_body.append(' return util_GetExtensionProperties(0, NULL, pCount, pProperties);')
+ if self.layer_name == 'ObjectTracker' or self.layer_name == 'Threading':
+ ggep_body.append(' return util_GetExtensionProperties(1, instance_extensions, pCount, pProperties);')
+ else:
+ ggep_body.append(' return util_GetExtensionProperties(0, NULL, pCount, pProperties);')
ggep_body.append('}')
return "\n".join(ggep_body)
@@ -345,6 +369,8 @@
intercept = self._gen_layer_dbg_create_msg_callback()
elif 'DestroyDebugReportCallbackLUNARG' == proto.name:
intercept = self._gen_layer_dbg_destroy_msg_callback()
+ elif 'DebugReportMessageLUNARG' == proto.name:
+ intercept = self._gen_debug_report_msg()
elif 'CreateDevice' == proto.name:
funcs.append('/* CreateDevice HERE */')
elif 'EnumerateInstanceExtensionProperties' == proto.name:
@@ -409,6 +435,7 @@
exts.append('%s' % self.lineinfo.get())
exts.append(self._gen_create_msg_callback())
exts.append(self._gen_destroy_msg_callback())
+ exts.append(self._gen_debug_report_msg())
return "\n".join(exts)
def _generate_layer_gpa_function(self, extensions=[], instance_extensions=[]):
@@ -847,6 +874,7 @@
self._generate_dispatch_entrypoints("VK_LAYER_EXPORT"),
self._gen_create_msg_callback(),
self._gen_destroy_msg_callback(),
+ self._gen_debug_report_msg(),
self._generate_layer_gpa_function(extensions, instance_extensions)]
return "\n\n".join(body)
@@ -2119,7 +2147,8 @@
self._generate_layer_gpa_function(extensions=[],
instance_extensions=[('msg_callback_get_proc_addr', [])]),
self._gen_create_msg_callback(),
- self._gen_destroy_msg_callback()]
+ self._gen_destroy_msg_callback(),
+ self._gen_debug_report_msg()]
return "\n\n".join(body)
def main():