Skip to content

Commit ca02a62

Browse files
T-Xrpavlik
authored andcommitted
hello_xr: add debug output for Vulkan extensions from runtime vs. app
Adding some extra debug output when "--verbose --graphics Vulkan(2)" is specified, to list which Vulkan instance and Vulkan device extensions were requested by the XR runtime and which were requested by the application. I found this quite useful to have to get the current wineopenxr implementation running without Steam. Steam uses Windows registry keys at the moment to relay Vulkan extensions needed by the XR runtime to DXVK. Without Steam I need to populate the registry keys manually at the moment. Signed-off-by: Linus Lüssing <[email protected]> Reviewed-by: Rylie Pavlik <[email protected]>
1 parent e22516b commit ca02a62

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

Diff for: changes/sdk/pr.403.gh.OpenXR-SDK-Source.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Addition: hello_xr: Log Vulkan extensions requested by runtime and by app, visible when running with `--verbose`.

Diff for: src/tests/hello_xr/graphicsplugin_vulkan.cpp

+20
Original file line numberDiff line numberDiff line change
@@ -1854,6 +1854,19 @@ struct VulkanGraphicsPluginLegacy : public VulkanGraphicsPlugin {
18541854
virtual XrStructureType GetGraphicsBindingType() const override { return XR_TYPE_GRAPHICS_BINDING_VULKAN_KHR; }
18551855
virtual XrStructureType GetSwapchainImageType() const override { return XR_TYPE_SWAPCHAIN_IMAGE_VULKAN_KHR; }
18561856

1857+
static void LogVulkanExtensions(const std::string title, const std::vector<const char*> &extensions, unsigned int start = 0) {
1858+
const std::string indentStr(1, ' ');
1859+
1860+
Log::Write(Log::Level::Verbose, Fmt("%s: (%d)", title.c_str(), extensions.size() - start));
1861+
for (auto ext : extensions) {
1862+
if (start) {
1863+
start--;
1864+
continue;
1865+
}
1866+
Log::Write(Log::Level::Verbose, Fmt("%s Name=%s", indentStr.c_str(), ext));
1867+
}
1868+
}
1869+
18571870
virtual XrResult CreateVulkanInstanceKHR(XrInstance instance, const XrVulkanInstanceCreateInfoKHR* createInfo,
18581871
VkInstance* vulkanInstance, VkResult* vulkanResult) override {
18591872
PFN_xrGetVulkanInstanceExtensionsKHR pfnGetVulkanInstanceExtensionsKHR = nullptr;
@@ -1869,11 +1882,14 @@ struct VulkanGraphicsPluginLegacy : public VulkanGraphicsPlugin {
18691882
{
18701883
// Note: This cannot outlive the extensionNames above, since it's just a collection of views into that string!
18711884
std::vector<const char*> extensions = ParseExtensionString(&extensionNames[0]);
1885+
LogVulkanExtensions("Vulkan Instance Extensions, requested by runtime", extensions);
18721886

18731887
// Merge the runtime's request with the applications requests
18741888
for (uint32_t i = 0; i < createInfo->vulkanCreateInfo->enabledExtensionCount; ++i) {
18751889
extensions.push_back(createInfo->vulkanCreateInfo->ppEnabledExtensionNames[i]);
18761890
}
1891+
LogVulkanExtensions("Vulkan Instance Extensions, requested by application", extensions,
1892+
extensions.size() - createInfo->vulkanCreateInfo->enabledExtensionCount);
18771893

18781894
VkInstanceCreateInfo instInfo{VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO};
18791895
memcpy(&instInfo, createInfo->vulkanCreateInfo, sizeof(instInfo));
@@ -1907,11 +1923,15 @@ struct VulkanGraphicsPluginLegacy : public VulkanGraphicsPlugin {
19071923
if (deviceExtensionNamesSize > 0) {
19081924
extensions = ParseExtensionString(&deviceExtensionNames[0]);
19091925
}
1926+
LogVulkanExtensions("Vulkan Device Extensions, requested by runtime", extensions);
19101927

19111928
// Merge the runtime's request with the applications requests
19121929
for (uint32_t i = 0; i < createInfo->vulkanCreateInfo->enabledExtensionCount; ++i) {
19131930
extensions.push_back(createInfo->vulkanCreateInfo->ppEnabledExtensionNames[i]);
19141931
}
1932+
LogVulkanExtensions("Vulkan Device Extensions, requested by application", extensions,
1933+
extensions.size() - createInfo->vulkanCreateInfo->enabledExtensionCount);
1934+
19151935

19161936
VkPhysicalDeviceFeatures features{};
19171937
memcpy(&features, createInfo->vulkanCreateInfo->pEnabledFeatures, sizeof(features));

0 commit comments

Comments
 (0)