Closed spencer-lunarg closed 6 days ago
So this crashes in DispatchSetDebugUtilsObjectNameEXT
because it sends down VK_OBJECT_TYPE_SHADER_EXT
to the driver, which in my case doesn't support it and crashes in the driver due to being unknown
diff --git a/layers/json/VkLayer_khronos_shader_object.json.in b/layers/json/VkLayer_khronos_shader_object.json.in
index cd3f58a..6a37477 100644
--- a/layers/json/VkLayer_khronos_shader_object.json.in
+++ b/layers/json/VkLayer_khronos_shader_object.json.in
@@ -70,6 +70,7 @@
"vkCmdSetViewportWithCountEXT",
"vkCreateShadersEXT",
"vkDestroyShaderEXT",
+ "vkSetDebugUtilsObjectNameEXT",
"vkGetShaderBinaryDataEXT"
]
}
diff --git a/layers/shader_object/generated/shader_object_entry_points_x_macros.inl b/layers/shader_object/generated/shader_object_entry_points_x_macros.inl
index 45b713a..204f5eb 100644
--- a/layers/shader_object/generated/shader_object_entry_points_x_macros.inl
+++ b/layers/shader_object/generated/shader_object_entry_points_x_macros.inl
@@ -33,6 +33,7 @@
ENTRY_POINT(DestroyDevice)\
ENTRY_POINT(CreateShadersEXT)\
ENTRY_POINT(DestroyShaderEXT)\
+ ENTRY_POINT(SetDebugUtilsObjectNameEXT)\
ENTRY_POINT(CmdBindShadersEXT)\
ENTRY_POINT(CmdBindPipeline)\
ENTRY_POINT(CreateImageView)\
diff --git a/layers/shader_object/shader_object.cpp b/layers/shader_object/shader_object.cpp
index db5dfe0..923f2e4 100644
--- a/layers/shader_object/shader_object.cpp
+++ b/layers/shader_object/shader_object.cpp
+static VKAPI_ATTR VkResult VKAPI_CALL SetDebugUtilsObjectNameEXT(VkDevice device, const VkDebugUtilsObjectNameInfoEXT *pNameInfo) {
+ DeviceData& data = *device_data_map.Get(device);
+ VkResult result = VK_ERROR_OUT_OF_DEVICE_MEMORY; // valid error return
+ // The Validation Layers (if before this extension layer) will already have tracked this, but a driver might crash with it
+ if (pNameInfo && pNameInfo->objectType != VK_OBJECT_TYPE_SHADER_EXT) {
+ result = data.vtable.SetDebugUtilsObjectNameEXT(device, pNameInfo);
+ }
+ return result;
+}
+
This "fixes" the crash, the only issue is if you go VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_shader_object:VK_LAYER_KHRONOS_validation
you won't see the name, so you just need to make sure your VVL layer is in front I guess (not sure if that is normal or not)
I tried to do the following in a VVL test
and found it breaks with the
VK_LAYER_KHRONOS_shader_object
layer because it will send down a different handle to the driver (cc @ziga-lunarg)