diff --git a/changes/sdk/pr.538.gh.OpenXR-SDK-Source.md b/changes/sdk/pr.538.gh.OpenXR-SDK-Source.md new file mode 100644 index 000000000..01720f606 --- /dev/null +++ b/changes/sdk/pr.538.gh.OpenXR-SDK-Source.md @@ -0,0 +1 @@ +> hello_xr: Fix Vulkan resource destruction bugs of ShaderProgram and Pipeline. diff --git a/src/tests/hello_xr/graphicsplugin_vulkan.cpp b/src/tests/hello_xr/graphicsplugin_vulkan.cpp index 58a450045..7601f814b 100644 --- a/src/tests/hello_xr/graphicsplugin_vulkan.cpp +++ b/src/tests/hello_xr/graphicsplugin_vulkan.cpp @@ -352,7 +352,7 @@ struct ShaderProgram { if (m_vkDevice != nullptr) { for (auto& si : shaderInfo) { if (si.module != VK_NULL_HANDLE) { - vkDestroyShaderModule(m_vkDevice, shaderInfo[0].module, nullptr); + vkDestroyShaderModule(m_vkDevice, si.module, nullptr); } si.module = VK_NULL_HANDLE; } @@ -881,6 +881,8 @@ struct Pipeline { m_vkDevice = nullptr; } + ~Pipeline() { Release(); } + private: VkDevice m_vkDevice{VK_NULL_HANDLE}; };