aboutsummaryrefslogtreecommitdiff
path: root/layers
diff options
context:
space:
mode:
authorCourtney Goeltzenleuchter <courtneygo@google.com>2015-11-30 12:13:14 -0700
committerJon Ashburn <jon@lunarg.com>2015-12-17 11:20:06 -0700
commit2dafae41b1f79bfb462eb37c1fdf3479879d9485 (patch)
tree5a8f281e9deb7556ee05accd6231fa6a1ef792c7 /layers
parentdd0e617a6c5865c5a0d8ef6b9f626535b5c0708d (diff)
downloadusermoji-2dafae41b1f79bfb462eb37c1fdf3479879d9485.tar.xz
debug_report: rename and update to use CreateInfo
Diffstat (limited to 'layers')
-rw-r--r--layers/device_limits.cpp45
-rw-r--r--layers/draw_state.cpp47
-rw-r--r--layers/image.cpp44
-rw-r--r--layers/mem_tracker.cpp46
-rw-r--r--layers/object_track.h8
-rw-r--r--layers/param_checker.cpp42
-rw-r--r--layers/swapchain.cpp34
-rwxr-xr-xlayers/vk_layer_config.cpp4
-rw-r--r--layers/vk_layer_config.h2
-rw-r--r--layers/vk_layer_logging.h48
-rw-r--r--layers/vk_layer_settings.txt2
11 files changed, 199 insertions, 123 deletions
diff --git a/layers/device_limits.cpp b/layers/device_limits.cpp
index c4e67c2d..d57ce6db 100644
--- a/layers/device_limits.cpp
+++ b/layers/device_limits.cpp
@@ -114,12 +114,24 @@ static void init_device_limits(layer_data *my_data, const VkAllocationCallbacks
{
option_str = getLayerOption("DeviceLimitsLogFilename");
log_output = getLayerLogOutput(option_str, "DeviceLimits");
- layer_create_msg_callback(my_data->report_data, report_flags, log_callback, (void *) log_output, &callback);
+ VkDebugReportCallbackCreateInfoLUNARG dbgCreateInfo;
+ memset(&dbgCreateInfo, 0, sizeof(dbgCreateInfo));
+ dbgCreateInfo.sType = VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_LUNARG;
+ dbgCreateInfo.flags = report_flags;
+ dbgCreateInfo.pfnCallback = log_callback;
+ dbgCreateInfo.pUserData = (void *) log_output;
+ layer_create_msg_callback(my_data->report_data, &dbgCreateInfo, pAllocator, &callback);
my_data->logging_callback.push_back(callback);
}
if (debug_action & VK_DBG_LAYER_ACTION_DEBUG_OUTPUT) {
- layer_create_msg_callback(my_data->report_data, report_flags, win32_debug_output_msg, NULL, &callback);
+ VkDebugReportCallbackCreateInfoLUNARG dbgCreateInfo;
+ memset(&dbgCreateInfo, 0, sizeof(dbgCreateInfo));
+ dbgCreateInfo.sType = VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_LUNARG;
+ dbgCreateInfo.flags = report_flags;
+ dbgCreateInfo.pfnCallback = win32_debug_output_msg;
+ dbgCreateInfo.pUserData = NULL;
+ layer_create_msg_callback(my_data->report_data, &dbgCreateInfo, pAllocator, &callback);
my_data->logging_callback.push_back(callback);
}
@@ -191,7 +203,7 @@ VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyInstance(VkInstance instance
// Clean up logging callback, if any
while (my_data->logging_callback.size() > 0) {
VkDebugReportCallbackLUNARG callback = my_data->logging_callback.back();
- layer_destroy_msg_callback(my_data->report_data, callback);
+ layer_destroy_msg_callback(my_data->report_data, callback, pAllocator);
my_data->logging_callback.pop_back();
}
@@ -550,29 +562,28 @@ VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdFillBuffer(
dev_data->device_dispatch_table->CmdFillBuffer(commandBuffer, dstBuffer, dstOffset, size, data);
}
-VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkDbgCreateMsgCallback(
- VkInstance instance,
- VkFlags msgFlags,
- const PFN_vkDbgMsgCallback pfnMsgCallback,
- void* pUserData,
- VkDebugReportCallbackLUNARG* pMsgCallback)
+VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateDebugReportCallbackLUNARG(
+ VkInstance instance,
+ VkDebugReportCallbackCreateInfoLUNARG* pCreateInfo,
+ const VkAllocationCallbacks* pAllocator,
+ VkDebugReportCallbackLUNARG* pMsgCallback)
{
layer_data *my_data = get_my_data_ptr(get_dispatch_key(instance), layer_data_map);
- VkResult res = my_data->instance_dispatch_table->DbgCreateMsgCallback(instance, msgFlags, pfnMsgCallback, pUserData, pMsgCallback);
+ VkResult res = my_data->instance_dispatch_table->CreateDebugReportCallbackLUNARG(instance, pCreateInfo, pAllocator, pMsgCallback);
if (VK_SUCCESS == res) {
- res = layer_create_msg_callback(my_data->report_data, msgFlags, pfnMsgCallback, pUserData, pMsgCallback);
+ res = layer_create_msg_callback(my_data->report_data, pCreateInfo, pAllocator, pMsgCallback);
}
return res;
}
-VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkDbgDestroyMsgCallback(
- VkInstance instance,
- VkDebugReportCallbackLUNARG msgCallback)
+VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyDebugReportCallbackLUNARG(
+ VkInstance instance,
+ VkDebugReportCallbackLUNARG msgCallback,
+ const VkAllocationCallbacks* pAllocator)
{
layer_data *my_data = get_my_data_ptr(get_dispatch_key(instance), layer_data_map);
- VkResult res = my_data->instance_dispatch_table->DbgDestroyMsgCallback(instance, msgCallback);
- layer_destroy_msg_callback(my_data->report_data, msgCallback);
- return res;
+ my_data->instance_dispatch_table->DestroyDebugReportCallbackLUNARG(instance, msgCallback, pAllocator);
+ layer_destroy_msg_callback(my_data->report_data, msgCallback, pAllocator);
}
VK_LAYER_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetDeviceProcAddr(VkDevice dev, const char* funcName)
diff --git a/layers/draw_state.cpp b/layers/draw_state.cpp
index 5ad5ee47..c2afbdc6 100644
--- a/layers/draw_state.cpp
+++ b/layers/draw_state.cpp
@@ -2569,12 +2569,24 @@ static void init_draw_state(layer_data *my_data, const VkAllocationCallbacks *pA
{
option_str = getLayerOption("DrawStateLogFilename");
log_output = getLayerLogOutput(option_str, "DrawState");
- layer_create_msg_callback(my_data->report_data, report_flags, log_callback, (void *) log_output, &callback);
+ VkDebugReportCallbackCreateInfoLUNARG dbgInfo;
+ memset(&dbgInfo, 0, sizeof(dbgInfo));
+ dbgInfo.sType = VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_LUNARG;
+ dbgInfo.pfnCallback = log_callback;
+ dbgInfo.pUserData = log_output;
+ dbgInfo.flags = report_flags;
+ layer_create_msg_callback(my_data->report_data, &dbgInfo, pAllocator, &callback);
my_data->logging_callback.push_back(callback);
}
if (debug_action & VK_DBG_LAYER_ACTION_DEBUG_OUTPUT) {
- layer_create_msg_callback(my_data->report_data, report_flags, win32_debug_output_msg, NULL, &callback);
+ VkDebugReportCallbackCreateInfoLUNARG dbgInfo;
+ memset(&dbgInfo, 0, sizeof(dbgInfo));
+ dbgInfo.sType = VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_LUNARG;
+ dbgInfo.pfnCallback = win32_debug_output_msg;
+ dbgInfo.pUserData = log_output;
+ dbgInfo.flags = report_flags;
+ layer_create_msg_callback(my_data->report_data, &dbgInfo, pAllocator, &callback);
my_data->logging_callback.push_back(callback);
}
@@ -2617,7 +2629,7 @@ VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyInstance(VkInstance instance
// Clean up logging callback, if any
while (my_data->logging_callback.size() > 0) {
VkDebugReportCallbackLUNARG callback = my_data->logging_callback.back();
- layer_destroy_msg_callback(my_data->report_data, callback);
+ layer_destroy_msg_callback(my_data->report_data, callback, pAllocator);
my_data->logging_callback.pop_back();
}
@@ -5409,29 +5421,30 @@ VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkQueuePresentKHR(VkQueue queue,
return VK_ERROR_VALIDATION_FAILED;
}
-VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkDbgCreateMsgCallback(
- VkInstance instance,
- VkFlags msgFlags,
- const PFN_vkDbgMsgCallback pfnMsgCallback,
- void* pUserData,
- VkDebugReportCallbackLUNARG* pMsgCallback)
+VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateDebugReportCallbackLUNARG(
+ VkInstance instance,
+ VkDebugReportCallbackCreateInfoLUNARG* pCreateInfo,
+ const VkAllocationCallbacks* pAllocator,
+ VkDebugReportCallbackLUNARG* pMsgCallback)
{
layer_data* my_data = get_my_data_ptr(get_dispatch_key(instance), layer_data_map);
- VkResult res = my_data->instance_dispatch_table->DbgCreateMsgCallback(instance, msgFlags, pfnMsgCallback, pUserData, pMsgCallback);
+ VkLayerInstanceDispatchTable *pTable = my_data->instance_dispatch_table;
+ VkResult res = pTable->CreateDebugReportCallbackLUNARG(instance, pCreateInfo, pAllocator, pMsgCallback);
if (VK_SUCCESS == res) {
- res = layer_create_msg_callback(my_data->report_data, msgFlags, pfnMsgCallback, pUserData, pMsgCallback);
+ res = layer_create_msg_callback(my_data->report_data, pCreateInfo, pAllocator, pMsgCallback);
}
return res;
}
-VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkDbgDestroyMsgCallback(
- VkInstance instance,
- VkDebugReportCallbackLUNARG msgCallback)
+VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyDebugReportCallbackLUNARG(
+ VkInstance instance,
+ VkDebugReportCallbackLUNARG msgCallback,
+ const VkAllocationCallbacks* pAllocator)
{
layer_data* my_data = get_my_data_ptr(get_dispatch_key(instance), layer_data_map);
- VkResult res = my_data->instance_dispatch_table->DbgDestroyMsgCallback(instance, msgCallback);
- layer_destroy_msg_callback(my_data->report_data, msgCallback);
- return res;
+ VkLayerInstanceDispatchTable *pTable = my_data->instance_dispatch_table;
+ pTable->DestroyDebugReportCallbackLUNARG(instance, msgCallback, pAllocator);
+ layer_destroy_msg_callback(my_data->report_data, msgCallback, pAllocator);
}
VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdDbgMarkerBegin(VkCommandBuffer commandBuffer, const char* pMarker)
diff --git a/layers/image.cpp b/layers/image.cpp
index e4892864..cde964af 100644
--- a/layers/image.cpp
+++ b/layers/image.cpp
@@ -84,39 +84,49 @@ static void InitImage(layer_data *data, const VkAllocationCallbacks *pAllocator)
FILE *log_output = NULL;
const char* option_str = getLayerOption("ImageLogFilename");
log_output = getLayerLogOutput(option_str, "Image");
- layer_create_msg_callback(data->report_data, report_flags, log_callback, (void *) log_output, &callback);
+ VkDebugReportCallbackCreateInfoLUNARG dbgInfo;
+ memset(&dbgInfo, 0, sizeof(dbgInfo));
+ dbgInfo.sType = VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_LUNARG;
+ dbgInfo.pfnCallback = log_callback;
+ dbgInfo.pUserData = log_output;
+ dbgInfo.flags = report_flags;
+ layer_create_msg_callback(data->report_data, &dbgInfo, pAllocator, &callback);
data->logging_callback.push_back(callback);
}
if (debug_action & VK_DBG_LAYER_ACTION_DEBUG_OUTPUT) {
- layer_create_msg_callback(data->report_data, report_flags, win32_debug_output_msg, NULL, &callback);
+ VkDebugReportCallbackCreateInfoLUNARG dbgInfo;
+ memset(&dbgInfo, 0, sizeof(dbgInfo));
+ dbgInfo.sType = VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_LUNARG;
+ dbgInfo.pfnCallback = win32_debug_output_msg;
+ dbgInfo.flags = report_flags;
+ layer_create_msg_callback(data->report_data, &dbgInfo, pAllocator, &callback);
data->logging_callback.push_back(callback);
}
}
-VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkDbgCreateMsgCallback(
- VkInstance instance,
- VkFlags msgFlags,
- const PFN_vkDbgMsgCallback pfnMsgCallback,
- void* pUserData,
- VkDebugReportCallbackLUNARG* pMsgCallback)
+VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateDebugReportCallbackLUNARG(
+ VkInstance instance,
+ VkDebugReportCallbackCreateInfoLUNARG* pCreateInfo,
+ const VkAllocationCallbacks* pAllocator,
+ VkDebugReportCallbackLUNARG* pMsgCallback)
{
layer_data *my_data = get_my_data_ptr(get_dispatch_key(instance), layer_data_map);
- VkResult res = my_data->instance_dispatch_table->DbgCreateMsgCallback(instance, msgFlags, pfnMsgCallback, pUserData, pMsgCallback);
+ VkResult res = my_data->instance_dispatch_table->CreateDebugReportCallbackLUNARG(instance, pCreateInfo, pAllocator, pMsgCallback);
if (res == VK_SUCCESS) {
- res = layer_create_msg_callback(my_data->report_data, msgFlags, pfnMsgCallback, pUserData, pMsgCallback);
+ res = layer_create_msg_callback(my_data->report_data, pCreateInfo, pAllocator, pMsgCallback);
}
return res;
}
-VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkDbgDestroyMsgCallback(
- VkInstance instance,
- VkDebugReportCallbackLUNARG msgCallback)
+VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyDebugReportCallbackLUNARG(
+ VkInstance instance,
+ VkDebugReportCallbackLUNARG msgCallback,
+ const VkAllocationCallbacks* pAllocator)
{
layer_data *my_data = get_my_data_ptr(get_dispatch_key(instance), layer_data_map);
- VkResult res = my_data->instance_dispatch_table->DbgDestroyMsgCallback(instance, msgCallback);
- layer_destroy_msg_callback(my_data->report_data, msgCallback);
- return res;
+ my_data->instance_dispatch_table->DestroyDebugReportCallbackLUNARG(instance, msgCallback, pAllocator);
+ layer_destroy_msg_callback(my_data->report_data, msgCallback, pAllocator);
}
VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateInstance(const VkInstanceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkInstance* pInstance)
@@ -145,7 +155,7 @@ VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyInstance(VkInstance instance
// Clean up logging callback, if any
while (my_data->logging_callback.size() > 0) {
VkDebugReportCallbackLUNARG callback = my_data->logging_callback.back();
- layer_destroy_msg_callback(my_data->report_data, callback);
+ layer_destroy_msg_callback(my_data->report_data, callback, pAllocator);
my_data->logging_callback.pop_back();
}
diff --git a/layers/mem_tracker.cpp b/layers/mem_tracker.cpp
index bd65bcbc..62a78ba8 100644
--- a/layers/mem_tracker.cpp
+++ b/layers/mem_tracker.cpp
@@ -1010,12 +1010,24 @@ init_mem_tracker(
{
option_str = getLayerOption("MemTrackerLogFilename");
log_output = getLayerLogOutput(option_str, "MemTracker");
- layer_create_msg_callback(my_data->report_data, report_flags, log_callback, (void *) log_output, &callback);
+ VkDebugReportCallbackCreateInfoLUNARG dbgInfo;
+ memset(&dbgInfo, 0, sizeof(dbgInfo));
+ dbgInfo.sType = VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_LUNARG;
+ dbgInfo.pfnCallback = log_callback;
+ dbgInfo.pUserData = log_output;
+ dbgInfo.flags = report_flags;
+ layer_create_msg_callback(my_data->report_data, &dbgInfo, pAllocator, &callback);
my_data->logging_callback.push_back(callback);
}
if (debug_action & VK_DBG_LAYER_ACTION_DEBUG_OUTPUT) {
- layer_create_msg_callback(my_data->report_data, report_flags, win32_debug_output_msg, NULL, &callback);
+ VkDebugReportCallbackCreateInfoLUNARG dbgInfo;
+ memset(&dbgInfo, 0, sizeof(dbgInfo));
+ dbgInfo.sType = VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_LUNARG;
+ dbgInfo.pfnCallback = win32_debug_output_msg;
+ dbgInfo.pUserData = log_output;
+ dbgInfo.flags = report_flags;
+ layer_create_msg_callback(my_data->report_data, &dbgInfo, pAllocator, &callback);
my_data->logging_callback.push_back(callback);
}
@@ -1043,7 +1055,7 @@ VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyInstance(
// Clean up logging callback, if any
while (my_data->logging_callback.size() > 0) {
VkDebugReportCallbackLUNARG callback = my_data->logging_callback.back();
- layer_destroy_msg_callback(my_data->report_data, callback);
+ layer_destroy_msg_callback(my_data->report_data, callback, pAllocator);
my_data->logging_callback.pop_back();
}
@@ -2561,32 +2573,30 @@ VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkCmdResetQueryPool(
my_data->device_dispatch_table->CmdResetQueryPool(commandBuffer, queryPool, startQuery, queryCount);
}
-VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkDbgCreateMsgCallback(
- VkInstance instance,
- VkFlags msgFlags,
- const PFN_vkDbgMsgCallback pfnMsgCallback,
- void *pUserData,
- VkDebugReportCallbackLUNARG *pMsgCallback)
+VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateDebugReportCallbackLUNARG(
+ VkInstance instance,
+ VkDebugReportCallbackCreateInfoLUNARG* pCreateInfo,
+ const VkAllocationCallbacks* pAllocator,
+ VkDebugReportCallbackLUNARG* pMsgCallback)
{
layer_data *my_data = get_my_data_ptr(get_dispatch_key(instance), layer_data_map);
VkLayerInstanceDispatchTable *pTable = my_data->instance_dispatch_table;
- VkResult res = pTable->DbgCreateMsgCallback(instance, msgFlags, pfnMsgCallback, pUserData, pMsgCallback);
+ VkResult res = pTable->CreateDebugReportCallbackLUNARG(instance, pCreateInfo, pAllocator, pMsgCallback);
if (res == VK_SUCCESS) {
- res = layer_create_msg_callback(my_data->report_data, msgFlags, pfnMsgCallback, pUserData, pMsgCallback);
+ res = layer_create_msg_callback(my_data->report_data, pCreateInfo, pAllocator, pMsgCallback);
}
return res;
}
-VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkDbgDestroyMsgCallback(
- VkInstance instance,
- VkDebugReportCallbackLUNARG msgCallback)
+VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyDebugReportCallbackLUNARG(
+ VkInstance instance,
+ VkDebugReportCallbackLUNARG msgCallback,
+ const VkAllocationCallbacks* pAllocator)
{
layer_data *my_data = get_my_data_ptr(get_dispatch_key(instance), layer_data_map);
VkLayerInstanceDispatchTable *pTable = my_data->instance_dispatch_table;
- VkResult res = pTable->DbgDestroyMsgCallback(instance, msgCallback);
- layer_destroy_msg_callback(my_data->report_data, msgCallback);
-
- return res;
+ pTable->DestroyDebugReportCallbackLUNARG(instance, msgCallback, pAllocator);
+ layer_destroy_msg_callback(my_data->report_data, msgCallback, pAllocator);
}
VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateSwapchainKHR(
diff --git a/layers/object_track.h b/layers/object_track.h
index 14101519..08f36c7a 100644
--- a/layers/object_track.h
+++ b/layers/object_track.h
@@ -425,7 +425,13 @@ initObjectTracker(
{
option_str = getLayerOption("ObjectTrackerLogFilename");
log_output = getLayerLogOutput(option_str, "ObjectTracker");
- layer_create_msg_callback(my_data->report_data, report_flags, log_callback, (void *) log_output, &(my_data->logging_callback));
+ VkDebugReportCallbackCreateInfoLUNARG dbgInfo;
+ memset(&dbgInfo, 0, sizeof(dbgInfo));
+ dbgInfo.sType = VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_LUNARG;
+ dbgInfo.pfnCallback = log_callback;
+ dbgInfo.pUserData = log_output;
+ dbgInfo.flags = report_flags;
+ layer_create_msg_callback(my_data->report_data, &dbgInfo, pAllocator, &my_data->logging_callback);
}
if (!objLockInitialized)
diff --git a/layers/param_checker.cpp b/layers/param_checker.cpp
index 42068a9d..0514bf18 100644
--- a/layers/param_checker.cpp
+++ b/layers/param_checker.cpp
@@ -96,46 +96,58 @@ static void InitParamChecker(layer_data *data, const VkAllocationCallbacks *pAll
FILE *log_output = NULL;
const char* option_str = getLayerOption("ParamCheckerLogFilename");
log_output = getLayerLogOutput(option_str, "ParamChecker");
- layer_create_msg_callback(data->report_data, report_flags, log_callback, (void *) log_output, &callback);
+ VkDebugReportCallbackCreateInfoLUNARG dbgCreateInfo;
+ memset(&dbgCreateInfo, 0, sizeof(dbgCreateInfo));
+ dbgCreateInfo.sType = VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_LUNARG;
+ dbgCreateInfo.flags = report_flags;
+ dbgCreateInfo.pfnCallback = log_callback;
+ dbgCreateInfo.pUserData = log_output;
+
+ layer_create_msg_callback(data->report_data, &dbgCreateInfo, pAllocator, &callback);
data->logging_callback.push_back(callback);
}
if (debug_action & VK_DBG_LAYER_ACTION_DEBUG_OUTPUT) {
- layer_create_msg_callback(data->report_data, report_flags, win32_debug_output_msg, NULL, &callback);
+ VkDebugReportCallbackCreateInfoLUNARG dbgCreateInfo;
+ memset(&dbgCreateInfo, 0, sizeof(dbgCreateInfo));
+ dbgCreateInfo.sType = VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_LUNARG;
+ dbgCreateInfo.flags = report_flags;
+ dbgCreateInfo.pfnCallback = win32_debug_output_msg;
+ dbgCreateInfo.pUserData = NULL;
+
+ layer_create_msg_callback(data->report_data, &dbgCreateInfo, pAllocator, &callback);
data->logging_callback.push_back(callback);
}
}
-VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkDbgCreateMsgCallback(
+VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateDebugReportCallbackLUNARG(
VkInstance instance,
- VkFlags msgFlags,
- const PFN_vkDbgMsgCallback pfnMsgCallback,
- void* pUserData,
+ VkDebugReportCallbackCreateInfoLUNARG *pCreateInfo,
+ const VkAllocationCallbacks *pAllocator,
VkDebugReportCallbackLUNARG* pMsgCallback)
{
VkLayerInstanceDispatchTable *pTable = get_dispatch_table(pc_instance_table_map, instance);
- VkResult result = pTable->DbgCreateMsgCallback(instance, msgFlags, pfnMsgCallback, pUserData, pMsgCallback);
+ VkResult result = pTable->CreateDebugReportCallbackLUNARG(instance, pCreateInfo, pAllocator, pMsgCallback);
if (result == VK_SUCCESS)
{
layer_data *data = get_my_data_ptr(get_dispatch_key(instance), layer_data_map);
- result = layer_create_msg_callback(data->report_data, msgFlags, pfnMsgCallback, pUserData, pMsgCallback);
+ result = layer_create_msg_callback(data->report_data, pCreateInfo, pAllocator, pMsgCallback);
}
return result;
}
-VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkDbgDestroyMsgCallback(
+VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyDebugReportCallbackLUNARG(
VkInstance instance,
- VkDebugReportCallbackLUNARG msgCallback)
+ VkDebugReportCallbackLUNARG msgCallback,
+ const VkAllocationCallbacks *pAllocator)
{
VkLayerInstanceDispatchTable *pTable = get_dispatch_table(pc_instance_table_map, instance);
- VkResult result = pTable->DbgDestroyMsgCallback(instance, msgCallback);
+ pTable->DestroyDebugReportCallbackLUNARG(instance, msgCallback, pAllocator);
layer_data *data = get_my_data_ptr(get_dispatch_key(instance), layer_data_map);
- layer_destroy_msg_callback(data->report_data, msgCallback);
-
- return result;
+ layer_destroy_msg_callback(data->report_data, msgCallback, pAllocator);
}
static const VkLayerProperties pc_global_layers[] = {
@@ -1760,7 +1772,7 @@ VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyInstance(
layer_data *my_data = get_my_data_ptr(key, layer_data_map);
while (my_data->logging_callback.size() > 0) {
VkDebugReportCallbackLUNARG callback = my_data->logging_callback.back();
- layer_destroy_msg_callback(my_data->report_data, callback);
+ layer_destroy_msg_callback(my_data->report_data, callback, pAllocator);
my_data->logging_callback.pop_back();
}
diff --git a/layers/swapchain.cpp b/layers/swapchain.cpp
index 4c419288..2b8ed24c 100644
--- a/layers/swapchain.cpp
+++ b/layers/swapchain.cpp
@@ -126,13 +126,26 @@ static void initSwapchain(layer_data *my_data, const VkAllocationCallbacks *pAll
// Turn on logging, since it was requested:
option_str = getLayerOption("SwapchainLogFilename");
log_output = getLayerLogOutput(option_str, "Swapchain");
- layer_create_msg_callback(my_data->report_data, report_flags,
- log_callback, (void *) log_output,
+ VkDebugReportCallbackCreateInfoLUNARG dbgInfo;
+ memset(&dbgInfo, 0, sizeof(dbgInfo));
+ dbgInfo.sType = VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_LUNARG;
+ dbgInfo.pfnCallback = log_callback;
+ dbgInfo.pUserData = log_output;
+ dbgInfo.flags = report_flags;
+ layer_create_msg_callback(my_data->report_data,
+ &dbgInfo,
+ pAllocator,
&callback);
my_data->logging_callback.push_back(callback);
}
if (debug_action & VK_DBG_LAYER_ACTION_DEBUG_OUTPUT) {
- layer_create_msg_callback(my_data->report_data, report_flags, win32_debug_output_msg, NULL, &callback);
+ VkDebugReportCallbackCreateInfoLUNARG dbgInfo;
+ memset(&dbgInfo, 0, sizeof(dbgInfo));
+ dbgInfo.sType = VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_LUNARG;
+ dbgInfo.pfnCallback = win32_debug_output_msg;
+ dbgInfo.pUserData = log_output;
+ dbgInfo.flags = report_flags;
+ layer_create_msg_callback(my_data->report_data, &dbgInfo, pAllocator, &callback);
my_data->logging_callback.push_back(callback);
}
}
@@ -210,7 +223,7 @@ VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyInstance(VkInstance instance
// Clean up logging callback, if any
while (my_data->logging_callback.size() > 0) {
VkDebugReportCallbackLUNARG callback = my_data->logging_callback.back();
- layer_destroy_msg_callback(my_data->report_data, callback);
+ layer_destroy_msg_callback(my_data->report_data, callback, pAllocator);
my_data->logging_callback.pop_back();
}
layer_debug_report_destroy_instance(my_data->report_data);
@@ -1113,22 +1126,21 @@ static inline PFN_vkVoidFunction layer_intercept_instance_proc(const char *name)
return NULL;
}
-VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkDbgCreateMsgCallback(VkInstance instance, VkFlags msgFlags, const PFN_vkDbgMsgCallback pfnMsgCallback, void* pUserData, VkDebugReportCallbackLUNARG* pMsgCallback)
+VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateDebugReportCallbackLUNARG(VkInstance instance, VkDebugReportCallbackCreateInfoLUNARG *pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDebugReportCallbackLUNARG* pMsgCallback)
{
layer_data *my_data = get_my_data_ptr(get_dispatch_key(instance), layer_data_map);
- VkResult result = my_data->instance_dispatch_table->DbgCreateMsgCallback(instance, msgFlags, pfnMsgCallback, pUserData, pMsgCallback);
+ VkResult result = my_data->instance_dispatch_table->CreateDebugReportCallbackLUNARG(instance, pCreateInfo, pAllocator, pMsgCallback);
if (VK_SUCCESS == result) {
- result = layer_create_msg_callback(my_data->report_data, msgFlags, pfnMsgCallback, pUserData, pMsgCallback);
+ result = layer_create_msg_callback(my_data->report_data, pCreateInfo, pAllocator, pMsgCallback);
}
return result;
}
-VK_LAYER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkDbgDestroyMsgCallback(VkInstance instance, VkDebugReportCallbackLUNARG msgCallback)
+VK_LAYER_EXPORT VKAPI_ATTR void VKAPI_CALL vkDestroyDebugReportCallbackLUNARG(VkInstance instance, VkDebugReportCallbackLUNARG msgCallback, const VkAllocationCallbacks *pAllocator)
{
layer_data *my_data = get_my_data_ptr(get_dispatch_key(instance), layer_data_map);
- VkResult result = my_data->instance_dispatch_table->DbgDestroyMsgCallback(instance, msgCallback);
- layer_destroy_msg_callback(my_data->report_data, msgCallback);
- return result;
+ my_data->instance_dispatch_table->DestroyDebugReportCallbackLUNARG(instance, msgCallback, pAllocator);
+ layer_destroy_msg_callback(my_data->report_data, msgCallback, pAllocator);
}
VK_LAYER_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetDeviceProcAddr(VkDevice device, const char* funcName)
diff --git a/layers/vk_layer_config.cpp b/layers/vk_layer_config.cpp
index 6d09a18e..4ca7b2cf 100755
--- a/layers/vk_layer_config.cpp
+++ b/layers/vk_layer_config.cpp
@@ -121,9 +121,9 @@ FILE* getLayerLogOutput(const char *_option, const char *layerName)
return log_output;
}
-uint32_t getLayerOptionFlags(const char *_option, uint32_t optionDefault)
+VkDebugReportFlagsLUNARG getLayerOptionFlags(const char *_option, uint32_t optionDefault)
{
- uint32_t flags = optionDefault;
+ VkDebugReportFlagsLUNARG flags = optionDefault;
const char *option = (g_configFileObj.getOption(_option));
/* parse comma-separated options */
diff --git a/layers/vk_layer_config.h b/layers/vk_layer_config.h
index c1fa1e15..167aaf67 100644
--- a/layers/vk_layer_config.h
+++ b/layers/vk_layer_config.h
@@ -32,7 +32,7 @@ extern "C" {
const char *getLayerOption(const char *_option);
FILE* getLayerLogOutput(const char *_option, const char *layerName);
-uint32_t getLayerOptionFlags(const char *_option, uint32_t optionDefault);
+VkDebugReportFlagsLUNARG getLayerOptionFlags(const char *_option, uint32_t optionDefault);
bool getLayerOptionEnum(const char *_option, uint32_t *optionDefault);
void setLayerOption(const char *_option, const char *_val);
diff --git a/layers/vk_layer_logging.h b/layers/vk_layer_logging.h
index b603da82..325b3f05 100644
--- a/layers/vk_layer_logging.h
+++ b/layers/vk_layer_logging.h
@@ -88,8 +88,8 @@ static inline debug_report_data *debug_report_create_instance(
debug_report_data *debug_data;
PFN_vkGetInstanceProcAddr gpa = table->GetInstanceProcAddr;
- table->DbgCreateMsgCallback = (PFN_vkDbgCreateMsgCallback) gpa(inst, "vkDbgCreateMsgCallback");
- table->DbgDestroyMsgCallback = (PFN_vkDbgDestroyMsgCallback) gpa(inst, "vkDbgDestroyMsgCallback");
+ table->CreateDebugReportCallbackLUNARG = (PFN_vkCreateDebugReportCallbackLUNARG) gpa(inst, "vkCreateDebugReportCallbackLUNARG");
+ table->DestroyDebugReportCallbackLUNARG = (PFN_vkDestroyDebugReportCallbackLUNARG) gpa(inst, "vkDestroyDebugReportCallbackLUNARG");
debug_data = (debug_report_data *) malloc(sizeof(debug_report_data));
if (!debug_data) return NULL;
@@ -148,31 +148,31 @@ static inline void layer_debug_report_destroy_device(VkDevice device)
}
static inline VkResult layer_create_msg_callback(
- debug_report_data *debug_data,
- VkFlags msgFlags,
- const PFN_vkDbgMsgCallback pfnMsgCallback,
- void *pUserData,
- VkDebugReportCallbackLUNARG *pMsgCallback)
+ debug_report_data *debug_data,
+ VkDebugReportCallbackCreateInfoLUNARG *pCreateInfo,
+ const VkAllocationCallbacks *pAllocator,
+ VkDebugReportCallbackLUNARG *pCallback)
{
+ /* TODO: Use app allocator */
VkLayerDbgFunctionNode *pNewDbgFuncNode = (VkLayerDbgFunctionNode*)malloc(sizeof(VkLayerDbgFunctionNode));
if (!pNewDbgFuncNode)
return VK_ERROR_OUT_OF_HOST_MEMORY;
// Handle of 0 is logging_callback so use allocated Node address as unique handle
- if (!(*pMsgCallback))
- *pMsgCallback = (VkDebugReportCallbackLUNARG) pNewDbgFuncNode;
- pNewDbgFuncNode->msgCallback = *pMsgCallback;
- pNewDbgFuncNode->pfnMsgCallback = pfnMsgCallback;
- pNewDbgFuncNode->msgFlags = msgFlags;
- pNewDbgFuncNode->pUserData = pUserData;
+ if (!(*pCallback))
+ *pCallback = (VkDebugReportCallbackLUNARG) pNewDbgFuncNode;
+ pNewDbgFuncNode->msgCallback = *pCallback;
+ pNewDbgFuncNode->pfnMsgCallback = pCreateInfo->pfnCallback;
+ pNewDbgFuncNode->msgFlags = pCreateInfo->flags;
+ pNewDbgFuncNode->pUserData = pCreateInfo->pUserData;
pNewDbgFuncNode->pNext = debug_data->g_pDbgFunctionHead;
debug_data->g_pDbgFunctionHead = pNewDbgFuncNode;
- debug_data->active_flags |= msgFlags;
+ debug_data->active_flags |= pCreateInfo->flags;
debug_report_log_msg(
debug_data, VK_DEBUG_REPORT_DEBUG_BIT,
- VK_OBJECT_TYPE_MSG_CALLBACK, (uint64_t) *pMsgCallback,
+ VK_OBJECT_TYPE_MSG_CALLBACK, (uint64_t) *pCallback,
0, DEBUG_REPORT_CALLBACK_REF,
"DebugReport",
"Added callback");
@@ -181,7 +181,8 @@ static inline VkResult layer_create_msg_callback(
static inline void layer_destroy_msg_callback(
debug_report_data *debug_data,
- VkDebugReportCallbackLUNARG msg_callback)
+ VkDebugReportCallbackLUNARG callback,
+ const VkAllocationCallbacks *pAllocator)
{
VkLayerDbgFunctionNode *pTrav = debug_data->g_pDbgFunctionHead;
VkLayerDbgFunctionNode *pPrev = pTrav;
@@ -189,7 +190,7 @@ static inline void layer_destroy_msg_callback(
debug_data->active_flags = 0;
while (pTrav) {
- if (pTrav->msgCallback == msg_callback) {
+ if (pTrav->msgCallback == callback) {
matched = true;
pPrev->pNext = pTrav->pNext;
if (debug_data->g_pDbgFunctionHead == pTrav) {
@@ -208,6 +209,7 @@ static inline void layer_destroy_msg_callback(
pPrev = pTrav;
pTrav = pTrav->pNext;
if (matched) {
+ /* TODO: Use pAllocator */
free(pPrev);
}
}
@@ -221,11 +223,11 @@ static inline PFN_vkVoidFunction debug_report_get_instance_proc_addr(
return NULL;
}
- if (!strcmp(funcName, "vkDbgCreateMsgCallback")) {
- return (PFN_vkVoidFunction) vkDbgCreateMsgCallback;
+ if (!strcmp(funcName, "vkCreateDebugReportCallbackLUNARG")) {
+ return (PFN_vkVoidFunction) vkCreateDebugReportCallbackLUNARG;
}
- if (!strcmp(funcName, "vkDbgDestroyMsgCallback")) {
- return (PFN_vkVoidFunction) vkDbgDestroyMsgCallback;
+ if (!strcmp(funcName, "vkDestroyDebugReportCallbackLUNARG")) {
+ return (PFN_vkVoidFunction) vkDestroyDebugReportCallbackLUNARG;
}
return NULL;
@@ -294,7 +296,7 @@ static inline VkBool32 log_msg(
static inline VKAPI_ATTR VkBool32 VKAPI_CALL log_callback(
VkFlags msgFlags,
- VkDebugReportObjectTypeLUNARG objType,
+ VkDebugReportObjectTypeLUNARG objType,
uint64_t srcObject,
size_t location,
int32_t msgCode,
@@ -315,7 +317,7 @@ static inline VKAPI_ATTR VkBool32 VKAPI_CALL log_callback(
static inline VKAPI_ATTR VkBool32 VKAPI_CALL win32_debug_output_msg(
VkFlags msgFlags,
- VkDebugReportObjectTypeLUNARG objType,
+ VkDebugReportObjectTypeLUNARG objType,
uint64_t srcObject,
size_t location,
int32_t msgCode,
diff --git a/layers/vk_layer_settings.txt b/layers/vk_layer_settings.txt
index 1aee14f5..5634c9b7 100644
--- a/layers/vk_layer_settings.txt
+++ b/layers/vk_layer_settings.txt
@@ -14,7 +14,7 @@
# VK_DBG_LAYER_ACTION_LOG_MSG - Log a txt message to stdout or to a log file
# specified via the <LayerName>LogFilename setting (see below)
# VK_DBG_LAYER_ACTION_CALLBACK - Call user defined callback function(s) that
-# have been registered via the vkDbgCreateMsgCallback() extension. Since
+# have been registered via the VK_EXT_LUNARG_debug_report extension. Since
# app must register callback, this is a NOOP for the settings file.
# VK_DBG_LAYER_ACTION_BREAK - Trigger a breakpoint.
#