Generate unique layer name for vulkan layer

* When self-capturing the loader now requires a unique name even if the enable
  var is different.
This commit is contained in:
baldurk
2026-02-13 15:27:47 +00:00
parent e8e20a7444
commit 8d27883043
4 changed files with 16 additions and 3 deletions
+2 -1
View File
@@ -115,7 +115,8 @@ elseif(UNIX)
add_definitions(-DVK_USE_PLATFORM_WIN32_KHR)
set(VULKAN_LAYER_MODULE_PATH "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/${LIB_SUBFOLDER_TRAIL_SLASH}lib${RDOC_BASE_NAME}.so")
set(VULKAN_ENABLE_VAR "ENABLE_VULKAN_${RDOC_BASE_NAME_UPPER}_CAPTURE")
set(VULKAN_ENABLE_VAR "ENABLE_VULKAN_${RDOC_BASE_NAME_UPPER}_Capture")
set(VULKAN_LAYER_NAME "VK_LAYER_${RDOC_BASE_NAME_UPPER}_CAPTURE")
set(json_in ${CMAKE_CURRENT_SOURCE_DIR}/renderdoc.json)
set(json_out ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${RDOC_BASE_NAME}_capture${VULKAN_JSON_SUFFIX}.json)
+1 -1
View File
@@ -1,7 +1,7 @@
{
"file_format_version" : "1.1.2",
"layer" : {
"name": "VK_LAYER_RENDERDOC_Capture",
"name": "@VULKAN_LAYER_NAME@",
"type": "GLOBAL",
"library_path": "@VULKAN_LAYER_MODULE_PATH@",
"api_version": "1.4.324",
+11
View File
@@ -280,6 +280,17 @@ static rdcstr GenerateJSON(const rdcstr &sopath)
idx = json.find(enableVarString);
}
const char layerNameString[] = "@VULKAN_LAYER_NAME@";
idx = json.find(layerNameString);
while(idx >= 0)
{
json = json.substr(0, idx) + "VK_LAYER_" + strupper(VulkanLayerJSONBasename) + "_Capture" +
json.substr(idx + sizeof(layerNameString) - 1);
idx = json.find(layerNameString);
}
return json;
}
+2 -1
View File
@@ -853,8 +853,9 @@ namespace DXCEnumerateAndCheck {
<Message Text="Processing layer JSON file for RenderDoc $(MajorVersion).$(MinorVersion)" Importance="High" />
<!-- Read the template json, replace the major/minor versions -->
<PropertyGroup>
<VulkanLayerName>VK_LAYER_$(ProjectName.ToUpper())_Capture</VulkanLayerName>
<VulkanEnableVar>ENABLE_VULKAN_$(ProjectName)_CAPTURE</VulkanEnableVar>
<JSONContents>$([System.IO.File]::ReadAllText('$(SolutionDir)renderdoc/driver/vulkan/renderdoc.json').Replace('@RENDERDOC_VERSION_MAJOR@', '$(MajorVersion)').Replace('@RENDERDOC_VERSION_MINOR@', '$(MinorVersion)').Replace('@VULKAN_LAYER_MODULE_PATH@', '.\\$(ProjectName).dll').Replace('@VULKAN_ENABLE_VAR@', $(VulkanEnableVar.ToUpper())))</JSONContents>
<JSONContents>$([System.IO.File]::ReadAllText('$(SolutionDir)renderdoc/driver/vulkan/renderdoc.json').Replace('@RENDERDOC_VERSION_MAJOR@', '$(MajorVersion)').Replace('@RENDERDOC_VERSION_MINOR@', '$(MinorVersion)').Replace('@VULKAN_LAYER_MODULE_PATH@', '.\\$(ProjectName).dll').Replace('@VULKAN_LAYER_NAME@', $(VulkanLayerName)).Replace('@VULKAN_ENABLE_VAR@', $(VulkanEnableVar.ToUpper())))</JSONContents>
</PropertyGroup>
<!-- Write it out to the output directory -->
<WriteLinesToFile File="$(OutDir)$(ProjectName).json" Lines="$(JSONContents)" Overwrite="true" />