aboutsummaryrefslogtreecommitdiff
path: root/layers/object_tracker.cpp
diff options
context:
space:
mode:
authorTobin Ehlis <tobine@google.com>2016-12-01 09:37:56 -0700
committerTobin Ehlis <tobine@google.com>2016-12-02 11:35:37 -0700
commitcb35cef6cbe50805c30fec7dceae8db911d4447f (patch)
treefad36b8df14b84119f47b93ed322b79c745e0f17 /layers/object_tracker.cpp
parent42ed85bcd0112ebc866562049f5ee71e8cd5395b (diff)
downloadusermoji-cb35cef6cbe50805c30fec7dceae8db911d4447f.tar.xz
layers:Handle NULL DebugMarker function ptrs
Fixes #1074 Object_tracker and parameter_checker intercept DebugMarker extension functions which may not be supported by underlying device and therefore could terminate with a NULL function call. Updating these layers to handle this case by making sure that their downstream function ptr is not null before calling down the chain. If the downstream function ptr is null, considering that VK_SUCCESS in the layers for functions with VkResult return code.
Diffstat (limited to 'layers/object_tracker.cpp')
-rw-r--r--layers/object_tracker.cpp28
1 files changed, 20 insertions, 8 deletions
diff --git a/layers/object_tracker.cpp b/layers/object_tracker.cpp
index c0ebb45a..6c60e44c 100644
--- a/layers/object_tracker.cpp
+++ b/layers/object_tracker.cpp
@@ -3216,6 +3216,7 @@ VKAPI_ATTR VkResult VKAPI_CALL CreateDevice(VkPhysicalDevice physicalDevice, con
layer_data *device_data = get_my_data_ptr(get_dispatch_key(*pDevice), layer_data_map);
device_data->report_data = layer_debug_report_create_device(phy_dev_data->report_data, *pDevice);
+ layer_init_device_dispatch_table(*pDevice, &device_data->dispatch_table, fpGetDeviceProcAddr);
// Add link back to physDev
device_data->physical_device = physicalDevice;
@@ -3690,7 +3691,11 @@ VKAPI_ATTR VkResult VKAPI_CALL DebugMarkerSetObjectTagEXT(VkDevice device, VkDeb
if (skip_call) {
return VK_ERROR_VALIDATION_FAILED_EXT;
}
- VkResult result = get_dispatch_table(ot_device_table_map, device)->DebugMarkerSetObjectTagEXT(device, pTagInfo);
+ layer_data *dev_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map);
+ VkResult result = VK_SUCCESS;
+ if (dev_data->dispatch_table.DebugMarkerSetObjectTagEXT) {
+ result = dev_data->dispatch_table.DebugMarkerSetObjectTagEXT(device, pTagInfo);
+ }
return result;
}
@@ -3702,7 +3707,11 @@ VKAPI_ATTR VkResult VKAPI_CALL DebugMarkerSetObjectNameEXT(VkDevice device, VkDe
if (skip_call) {
return VK_ERROR_VALIDATION_FAILED_EXT;
}
- VkResult result = get_dispatch_table(ot_device_table_map, device)->DebugMarkerSetObjectNameEXT(device, pNameInfo);
+ layer_data *dev_data = get_my_data_ptr(get_dispatch_key(device), layer_data_map);
+ VkResult result = VK_SUCCESS;
+ if (dev_data->dispatch_table.DebugMarkerSetObjectNameEXT) {
+ result = dev_data->dispatch_table.DebugMarkerSetObjectNameEXT(device, pNameInfo);
+ }
return result;
}
@@ -3712,8 +3721,9 @@ VKAPI_ATTR void VKAPI_CALL CmdDebugMarkerBeginEXT(VkCommandBuffer commandBuffer,
skip_call |=
ValidateObject(commandBuffer, commandBuffer, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, false, VALIDATION_ERROR_02014);
lock.unlock();
- if (!skip_call) {
- get_dispatch_table(ot_device_table_map, commandBuffer)->CmdDebugMarkerBeginEXT(commandBuffer, pMarkerInfo);
+ layer_data *dev_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map);
+ if (!skip_call && dev_data->dispatch_table.CmdDebugMarkerBeginEXT) {
+ dev_data->dispatch_table.CmdDebugMarkerBeginEXT(commandBuffer, pMarkerInfo);
}
}
@@ -3723,8 +3733,9 @@ VKAPI_ATTR void VKAPI_CALL CmdDebugMarkerEndEXT(VkCommandBuffer commandBuffer) {
skip_call |=
ValidateObject(commandBuffer, commandBuffer, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, false, VALIDATION_ERROR_02022);
lock.unlock();
- if (!skip_call) {
- get_dispatch_table(ot_device_table_map, commandBuffer)->CmdDebugMarkerEndEXT(commandBuffer);
+ layer_data *dev_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map);
+ if (!skip_call && dev_data->dispatch_table.CmdDebugMarkerEndEXT) {
+ dev_data->dispatch_table.CmdDebugMarkerEndEXT(commandBuffer);
}
}
@@ -3734,8 +3745,9 @@ VKAPI_ATTR void VKAPI_CALL CmdDebugMarkerInsertEXT(VkCommandBuffer commandBuffer
skip_call |=
ValidateObject(commandBuffer, commandBuffer, VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT, false, VALIDATION_ERROR_02025);
lock.unlock();
- if (!skip_call) {
- get_dispatch_table(ot_device_table_map, commandBuffer)->CmdDebugMarkerInsertEXT(commandBuffer, pMarkerInfo);
+ layer_data *dev_data = get_my_data_ptr(get_dispatch_key(commandBuffer), layer_data_map);
+ if (!skip_call && dev_data->dispatch_table.CmdDebugMarkerInsertEXT) {
+ dev_data->dispatch_table.CmdDebugMarkerInsertEXT(commandBuffer, pMarkerInfo);
}
}