Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Game Development
  4. running multiple QVulkanWindows and QVulkanWindowRenderers in a QSplitter in parallel
QtWS25 Last Chance

running multiple QVulkanWindows and QVulkanWindowRenderers in a QSplitter in parallel

Scheduled Pinned Locked Moved Unsolved Game Development
3 Posts 2 Posters 384 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    blaberj
    wrote on 28 May 2024, 19:39 last edited by
    #1

    Basically, I have a multi camera stream (for instance, say 3 cameras that generate a stream of 3 synchronized images, sort of like a stereo camera) that I want to display in a QSplitter. I have it setup such that there are three QVulkanWindows which have an overwritten QVulkanWindowRenderer. The intent is to display the image stream for now and at some point render things on the images as well.

    My issue is I noticed the overrided startNextFrame() method (which essentially just copies the image buffer to a vulkan image and creates/populates the command buffer) runs serially for each QVulkanWindowRenderer. So if I put a std::this_thread::sleep_for(std::chrono::milliseconds(1000)); in startNextFrame() it will basically cause a three second delay in rendering a frame in each window, but they can pretty much be done in parallel without a lot of issue.

    So my questions are:

    1. Is this the right approach to do this sort of thing?
    2. Is there an easy way to make startNextFrame() for each QVulkanWindow run in parallel? Or should I focus on just trying to minimize the time spent in startNextFrame()?
    J 1 Reply Last reply 29 May 2024, 05:28
    0
    • B blaberj
      28 May 2024, 19:39

      Basically, I have a multi camera stream (for instance, say 3 cameras that generate a stream of 3 synchronized images, sort of like a stereo camera) that I want to display in a QSplitter. I have it setup such that there are three QVulkanWindows which have an overwritten QVulkanWindowRenderer. The intent is to display the image stream for now and at some point render things on the images as well.

      My issue is I noticed the overrided startNextFrame() method (which essentially just copies the image buffer to a vulkan image and creates/populates the command buffer) runs serially for each QVulkanWindowRenderer. So if I put a std::this_thread::sleep_for(std::chrono::milliseconds(1000)); in startNextFrame() it will basically cause a three second delay in rendering a frame in each window, but they can pretty much be done in parallel without a lot of issue.

      So my questions are:

      1. Is this the right approach to do this sort of thing?
      2. Is there an easy way to make startNextFrame() for each QVulkanWindow run in parallel? Or should I focus on just trying to minimize the time spent in startNextFrame()?
      J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 29 May 2024, 05:28 last edited by
      #2

      @blaberj said in running multiple QVulkanWindows and QVulkanWindowRenderers in a QSplitter in parallel:

      std::this_thread::sleep_for(std::chrono::milliseconds(1000))

      Why do you need this?
      If you want to do something after curtain time interval use QTimer.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      B 1 Reply Last reply 29 May 2024, 11:41
      0
      • J jsulm
        29 May 2024, 05:28

        @blaberj said in running multiple QVulkanWindows and QVulkanWindowRenderers in a QSplitter in parallel:

        std::this_thread::sleep_for(std::chrono::milliseconds(1000))

        Why do you need this?
        If you want to do something after curtain time interval use QTimer.

        B Offline
        B Offline
        blaberj
        wrote on 29 May 2024, 11:41 last edited by blaberj
        #3

        @jsulm the sleep call was just to simulate work. Was just messing around to see what would happen. My primary concern is if theres an operation in there that takes some time it will end up taking 3x longer since there are 3 vulkan windows and the update is done in serial rather than parallel.

        But before I go off trying to prematurely optimize was wondering if the approach I'm taking is even the right way to go about things.

        It does seem to work for the toy example I'm using (just loading an image from disk to display) but that image load operation takes 10ms, and since its done 3 times it ends up taking 30ms per update which will actually start impacting framerates and kind of
        concerns me. In reality the app will use a camera stream which will be faster with a set framerate so might not be as big of an issue though.

        Another thing too is most examples I've seen have just used a single QVulkanWindow, but for my case it seems like using multiple would make things much easier since each window has its own independently managed swap chain and I'd be able to use a QSplitter to make one window larger than the other.

        1 Reply Last reply
        0

        3/3

        29 May 2024, 11:41

        • Login

        • Login or register to search.
        3 out of 3
        • First post
          3/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved