Code Monkey home page Code Monkey logo

Comments (5)

vettoreldaniele avatar vettoreldaniele commented on July 4, 2024 1

Issue arise when we loop on the swapchain:

  • in the other samples, we ask vk to wait for this semaphore (through the ppWaitSemaphores of the submit info)
  • in this sample, we don't wait for this one.

This should fix the issue. Sadly I fail for another reason which is [WARNING] vkAcquireNextImageKHR returned: VK_SUBOPTIMAL_KHR (same on all samples). I believe it's because I'm on wayland+sway, and the window gets resized slightly when being created, to the swapchain needs to be recreated.

@RenfengLiu is that patch fixing your issue?

diff --git a/projects/23_async_compute/main.cpp b/projects/23_async_compute/main.cpp
index f3bf21a..f9e938f 100644
--- a/projects/23_async_compute/main.cpp
+++ b/projects/23_async_compute/main.cpp
@@ -925,16 +925,18 @@ void ProjApp::BlitAndPresent(PerFrame& frame, uint32_t swapchainImageIndex)
     }
     PPX_CHECKED_CALL(cmd->End());

-    const grfx::Semaphore* ppWaitSemaphores[4] = {
+    const grfx::Semaphore* ppWaitSemaphores[] = {
         frame.composeData[0].completeSemaphore,
         frame.composeData[1].completeSemaphore,
         frame.composeData[2].completeSemaphore,
-        frame.composeData[3].completeSemaphore};
+        frame.composeData[3].completeSemaphore,
+        frame.imageAcquiredSemaphore
+    };

     grfx::SubmitInfo submitInfo     = {};
     submitInfo.commandBufferCount   = 1;
     submitInfo.ppCommandBuffers     = &cmd;
-    submitInfo.waitSemaphoreCount   = 4;
+    submitInfo.waitSemaphoreCount   = sizeof(ppWaitSemaphores) / sizeof(ppWaitSemaphores[0]);
     submitInfo.ppWaitSemaphores     = ppWaitSemaphores;
     submitInfo.signalSemaphoreCount = 1;
     submitInfo.ppSignalSemaphores   = &frame.renderCompleteSemaphore;

Thanks for the patch, this should work. I overlooked this when writing the sample since the pattern is different from other samples. Can you submit this as a PR?

from bigwheels.

vettoreldaniele avatar vettoreldaniele commented on July 4, 2024

I can't reproduce on my machine. Do you see this error consistently? What GPU do you have? I wonder if it's something related to the sample making assumption on graphics/compute queue availability or something of the sort.

from bigwheels.

RenfengLiu avatar RenfengLiu commented on July 4, 2024

I'm on a windows machine with vulkan 1.3.236. It's caused by https://github.com/google/bigwheels/blob/main/projects/23_async_compute/main.cpp#L757, the frame.imageAcquiredSemaphore is signaled every time, but no one is waiting for it.

from bigwheels.

Keenuts avatar Keenuts commented on July 4, 2024

Can reproduce this on my machine:

CPU info for AMD Ryzen 9 3900X 12-Core Processor
Using Vulkan 1.1
Found GPU [0]: AMD Radeon RX 5700 XT (RADV NAVI10)
   graphics queue count : 1
   compute  queue count : 4
   transfer queue count : 4
Creating application graphics device using AMD Radeon RX 5700 XT (RADV NAVI10)
   requested graphics queue count : 1
   requested compute  queue count : 1
   requested transfer queue count : 0
[WARNING] Transfer queue will be shared with graphics or compute queue.
*** VULKAN VALIDATION ERROR MESSAGE ***
Severity : ERROR
Type     : [VALIDATION]
Objects  : [0]: <UNNAMED OBJECT>
Message  : Validation Error: [ VUID-vkAcquireNextImageKHR-semaphore-01286 ] Object 0: handle = 0x72303f0000000052, type = VK_OBJECT_TYPE_SEMAPHORE; | MessageID = 0xe9e4b2a9 | vkAcquireNextImageKHR: Semaphore must not be currently signaled. The Vulkan spec states: If semaphore is not VK_NULL_HANDLE it must be unsignaled (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-vkAcquireNextImageKHR-semaphore-01286)

vk_23_async_compute: /home/nathan/projects/mainline/bigwheels/src/ppx/grfx/vk/vk_instance.cpp:115: VkBool32 ppx::grfx::vk::DebugUtilsMessengerCallback(VkDebugUtilsMessageSeverityFlagBitsEXT, VkDebugUtilsMessageTypeFlagsEXT, const VkDebugUtilsMessengerCallbackDataEXT*, void*): Assertion `false' failed

from bigwheels.

Keenuts avatar Keenuts commented on July 4, 2024

Issue arise when we loop on the swapchain:

  • in the other samples, we ask vk to wait for this semaphore (through the ppWaitSemaphores of the submit info)
  • in this sample, we don't wait for this one.

This should fix the issue. Sadly I fail for another reason which is [WARNING] vkAcquireNextImageKHR returned: VK_SUBOPTIMAL_KHR (same on all samples).
I believe it's because I'm on wayland+sway, and the window gets resized slightly when being created, to the swapchain needs to be recreated.

@RenfengLiu is that patch fixing your issue?

diff --git a/projects/23_async_compute/main.cpp b/projects/23_async_compute/main.cpp
index f3bf21a..f9e938f 100644
--- a/projects/23_async_compute/main.cpp
+++ b/projects/23_async_compute/main.cpp
@@ -925,16 +925,18 @@ void ProjApp::BlitAndPresent(PerFrame& frame, uint32_t swapchainImageIndex)
     }
     PPX_CHECKED_CALL(cmd->End());

-    const grfx::Semaphore* ppWaitSemaphores[4] = {
+    const grfx::Semaphore* ppWaitSemaphores[] = {
         frame.composeData[0].completeSemaphore,
         frame.composeData[1].completeSemaphore,
         frame.composeData[2].completeSemaphore,
-        frame.composeData[3].completeSemaphore};
+        frame.composeData[3].completeSemaphore,
+        frame.imageAcquiredSemaphore
+    };

     grfx::SubmitInfo submitInfo     = {};
     submitInfo.commandBufferCount   = 1;
     submitInfo.ppCommandBuffers     = &cmd;
-    submitInfo.waitSemaphoreCount   = 4;
+    submitInfo.waitSemaphoreCount   = sizeof(ppWaitSemaphores) / sizeof(ppWaitSemaphores[0]);
     submitInfo.ppWaitSemaphores     = ppWaitSemaphores;
     submitInfo.signalSemaphoreCount = 1;
     submitInfo.ppSignalSemaphores   = &frame.renderCompleteSemaphore;

from bigwheels.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.