From 98dc68c7bdeb880e2c485175a4b62714db7acfbf Mon Sep 17 00:00:00 2001 From: Luc Ma Date: Thu, 22 Aug 2024 09:28:08 +0800 Subject: [PATCH 1/3] Fix pipelinestatistics example MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix compilation error: no matching function for call to ‘vk::Device::getQueryPoolResults(vk::QueryPool&, int, int, std::vector&, long unsigned int, vk::QueryResultFlagBits) const’ Building and testing vulkan environment: ``` GPU0: apiVersion = 1.3.255 driverVersion = 0.0.1 vendorID = 0x10005 deviceID = 0x0000 deviceType = PHYSICAL_DEVICE_TYPE_CPU deviceName = llvmpipe (LLVM 15.0.7, 256 bits) driverID = DRIVER_ID_MESA_LLVMPIPE driverName = llvmpipe driverInfo = Mesa 23.2.1-1ubuntu3.1~22.04.2 (LLVM 15.0.7) conformanceVersion = 1.3.1.1 deviceUUID = 6d657361-3233-2e32-2e31-2d3175627500 driverUUID = 6c6c766d-7069-7065-5555-494400000000 ``` Signed-off-by: Luc Ma --- examples/pipelinestatistics/pipelinestatistics.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/pipelinestatistics/pipelinestatistics.cpp b/examples/pipelinestatistics/pipelinestatistics.cpp index e3e82a418..0a0ee21c3 100644 --- a/examples/pipelinestatistics/pipelinestatistics.cpp +++ b/examples/pipelinestatistics/pipelinestatistics.cpp @@ -124,7 +124,7 @@ class VulkanExample : public vkx::ExampleBase { // Retrieves the results of the pipeline statistics query submitted to the command buffer void getQueryResults() { uint32_t count = static_cast(pipelineStats.size()); - device.getQueryPoolResults(queryPool, 0, 1, pipelineStats, sizeof(uint64_t), vk::QueryResultFlagBits::e64); + device.getQueryPoolResults(queryPool, 0, 1, count * sizeof(uint64_t), pipelineStats.data(), sizeof(uint64_t), vk::QueryResultFlagBits::e64); } void updateCommandBufferPreDraw(const vk::CommandBuffer& drawCmdBuffer) override { From 190f08155d779610dce153d37984f2afb93b3120 Mon Sep 17 00:00:00 2001 From: Luc Ma Date: Thu, 22 Aug 2024 09:57:44 +0800 Subject: [PATCH 2/3] Fix terraintessellation example MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix compilation error: no matching function for call to ‘vk::Device::getQueryPoolResults(vk::QueryPool&, int, int, std::array&, long unsigned int, vk::QueryResultFlagBits) const’ 152 | device.getQueryPoolResults(queryPool, 0, 1, pipelineStats, sizeof(uint64_t), vk::QueryResultFlagBits::e64); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Luc Ma --- examples/terraintessellation/terraintessellation.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/examples/terraintessellation/terraintessellation.cpp b/examples/terraintessellation/terraintessellation.cpp index fc486f7a9..eb10e922a 100644 --- a/examples/terraintessellation/terraintessellation.cpp +++ b/examples/terraintessellation/terraintessellation.cpp @@ -149,7 +149,8 @@ class VulkanExample : public vkx::ExampleBase { // Retrieves the results of the pipeline statistics query submitted to the command buffer void getQueryResults() { // We use vkGetQueryResults to copy the results into a host visible buffer - device.getQueryPoolResults(queryPool, 0, 1, pipelineStats, sizeof(uint64_t), vk::QueryResultFlagBits::e64); + uint32_t count = static_cast(pipelineStats.size()); + device.getQueryPoolResults(queryPool, 0, 1, count * sizeof(uint64_t), pipelineStats.data(), sizeof(uint64_t), vk::QueryResultFlagBits::e64); } void loadAssets() override { From bdd0f6977e55dba654ff7e6d1310d6b9cb76bd5f Mon Sep 17 00:00:00 2001 From: Luc Ma Date: Thu, 22 Aug 2024 10:18:07 +0800 Subject: [PATCH 3/3] Use vk::ResultValue<> to adapt the latest vulkan-sdk Since 8ba8294c86d0 ("Update for Vulkan-Docs 1.3.212") in the repo [Vulkan-Headers](https://github.com/KhronosGroup/Vulkan-Headers/commit/8ba8294c86d0e99fcb457bedbd573dd678ccc9b3#diff-a83f956c7aeb2b6dee7ffa2f249c0d98a2cfad6e157fe8438e372a5267afaeffL5986-R6086), vk::createResultValue is renamed as vk::createResultValueType. And in the recent versions (after 1.3.282), vk::createResultValueType has been encapsulated under namespace ::detail, so presumably users have to construct a vk::ResultValue<> on their own. Signed-off-by: Luc Ma --- base/glfw/glfw.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base/glfw/glfw.cpp b/base/glfw/glfw.cpp index a195da3e3..4b1099cbd 100644 --- a/base/glfw/glfw.cpp +++ b/base/glfw/glfw.cpp @@ -29,7 +29,7 @@ vk::SurfaceKHR Window::createWindowSurface(GLFWwindow* window, const vk::Instanc VkSurfaceKHR rawSurface; vk::Result result = static_cast(glfwCreateWindowSurface((VkInstance)instance, window, reinterpret_cast(pAllocator), &rawSurface)); - return vk::createResultValue(result, rawSurface, "vk::CommandBuffer::begin"); + return {vk::ResultValue(result, rawSurface).value}; } #endif