Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qopenglbuffer - 64 bit addressing?
Forum Updated to NodeBB v4.3 + New Features

Qopenglbuffer - 64 bit addressing?

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 4 Posters 564 Views 2 Watching
  • 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.
  • N Offline
    N Offline
    NightShadeI
    wrote on 15 Aug 2023, 20:49 last edited by NightShadeI
    #1

    Hi guys recently I stumbled on some bug where is was trying to reserve more than 2^31 bytes of buffer space with QOpenGlBuffer, but the API limits to using an int , which means we are restricted to what we can reserve. This is only around 2GB of space, I imagine modern GPUs can handle much more than this

    Is there some way around this? Im trying to render a large grid , and with this restriction and my design, I can approximately only reach 3500 by 3500 which isn't very big.

    I understand there are workarounds (breaking into chunks for example), but I'm more interested in if there is any way around this restriction or why it is imposed

    Thanks!

    N 1 Reply Last reply 19 Aug 2023, 02:38
    0
    • N NightShadeI
      15 Aug 2023, 20:49

      Hi guys recently I stumbled on some bug where is was trying to reserve more than 2^31 bytes of buffer space with QOpenGlBuffer, but the API limits to using an int , which means we are restricted to what we can reserve. This is only around 2GB of space, I imagine modern GPUs can handle much more than this

      Is there some way around this? Im trying to render a large grid , and with this restriction and my design, I can approximately only reach 3500 by 3500 which isn't very big.

      I understand there are workarounds (breaking into chunks for example), but I'm more interested in if there is any way around this restriction or why it is imposed

      Thanks!

      N Offline
      N Offline
      NightShadeI
      wrote on 19 Aug 2023, 02:38 last edited by
      #2

      @NightShadeI

      Any thoughts on this one? Would I have to use native GL buffers instead of the convenience wrappers? Can support be added?

      C S 2 Replies Last reply 19 Aug 2023, 06:52
      0
      • N NightShadeI
        19 Aug 2023, 02:38

        @NightShadeI

        Any thoughts on this one? Would I have to use native GL buffers instead of the convenience wrappers? Can support be added?

        C Online
        C Online
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on 19 Aug 2023, 06:52 last edited by
        #3

        @NightShadeI said in Qopenglbuffer - 64 bit addressing?:

        Can support be added?

        As this would be an api change - no not until Qt7.

        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
        Visit the Qt Academy at https://academy.qt.io/catalog

        1 Reply Last reply
        0
        • C Offline
          C Offline
          Chris Kawa
          Lifetime Qt Champion
          wrote on 19 Aug 2023, 06:55 last edited by Chris Kawa
          #4

          Although OpenGL API uses GLsizeiptr for the size, which is a 64 bit value, the actual allowed maximum buffer size you can access in a shader is limited to the value of GL_MAX_SHADER_STORAGE_BLOCK_SIZE. As you can see here this value is usually 2^31 or less on pretty much all modern consumer hardware. So although Qt limits what the spec allows, extending it wouldn't let you access more anyway.

          If you need bigger buffers there are probably vendor specific extensions for that.

          Out of curiosity - why do you need such a large buffer? A 4K display has 8 294 400 pixels, which at 32bit pixel format needs around 30MB of storage. You physically can't show more than that on screen at any given time, so I can't imagine why you would need over 2GB for any data. Also accessing it from a shader would be terribly inefficient due to it being so sparse and thus missing cache all the time.

          I think a better course for you would be to rethink your architecture and structure your shader inputs differently.

          1 Reply Last reply
          2
          • N NightShadeI
            19 Aug 2023, 02:38

            @NightShadeI

            Any thoughts on this one? Would I have to use native GL buffers instead of the convenience wrappers? Can support be added?

            S Offline
            S Offline
            SGaist
            Lifetime Qt Champion
            wrote on 19 Aug 2023, 09:18 last edited by
            #5

            Hi,

            I don't know the design decisions but this is coherent with the rest of the Qt API. Also, at the time of the writing of these classes, GPU memory was not that big and in the absolute they are still not compared to CPU memory. Also if you want such powerful cards, your budget is going to be pretty high.

            These considerations aside, can you explain why you need such a big block of memory ? It seems a bit extreme.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            N 1 Reply Last reply 19 Aug 2023, 23:42
            1
            • S SGaist
              19 Aug 2023, 09:18

              Hi,

              I don't know the design decisions but this is coherent with the rest of the Qt API. Also, at the time of the writing of these classes, GPU memory was not that big and in the absolute they are still not compared to CPU memory. Also if you want such powerful cards, your budget is going to be pretty high.

              These considerations aside, can you explain why you need such a big block of memory ? It seems a bit extreme.

              N Offline
              N Offline
              NightShadeI
              wrote on 19 Aug 2023, 23:42 last edited by NightShadeI
              #6

              @SGaist @Chris-Kawa You're both probably right, the answer I guess was "convenience"

              Im trying to make some game clone of a 2D grid game, and the original old game supported up to 200x200 ish tiles , there has always been requests for higher dimensionality so I wanted to see just how far I could push it. Was able to get to around 3200x3200 and still get some insane FPS

              I was thinking also that as my VertexData size increases during further development that 3500x3500 limit will also decrease, but I think like Chris mentioned, maybe the solution is just to have a better approach (i.e. more buffers depending whats on the screen?)

              The interesting thing about the original game is it allowed very close zoom in / zoom out , so I could probably also have different buffers dependant on the zoom kind of like mip-mapping, but honestly was just toying to see how high I could go before I ran into real issues!

              edit: Another solution to probably push that higher might be indexed buffer rendering? I'm just doing a very basic 6 points per tile right now

              I suppose we can mark as solved :) would be nice to try higher given my GPU definitely supports more than 2GB , but i'm satisfied with the answers here (and so many of them!)

              S 1 Reply Last reply 20 Aug 2023, 12:33
              0
              • N NightShadeI
                19 Aug 2023, 23:42

                @SGaist @Chris-Kawa You're both probably right, the answer I guess was "convenience"

                Im trying to make some game clone of a 2D grid game, and the original old game supported up to 200x200 ish tiles , there has always been requests for higher dimensionality so I wanted to see just how far I could push it. Was able to get to around 3200x3200 and still get some insane FPS

                I was thinking also that as my VertexData size increases during further development that 3500x3500 limit will also decrease, but I think like Chris mentioned, maybe the solution is just to have a better approach (i.e. more buffers depending whats on the screen?)

                The interesting thing about the original game is it allowed very close zoom in / zoom out , so I could probably also have different buffers dependant on the zoom kind of like mip-mapping, but honestly was just toying to see how high I could go before I ran into real issues!

                edit: Another solution to probably push that higher might be indexed buffer rendering? I'm just doing a very basic 6 points per tile right now

                I suppose we can mark as solved :) would be nice to try higher given my GPU definitely supports more than 2GB , but i'm satisfied with the answers here (and so many of them!)

                S Offline
                S Offline
                SGaist
                Lifetime Qt Champion
                wrote on 20 Aug 2023, 12:33 last edited by
                #7

                AFAIK, most if not all games adapt the level of details based on the zoom factor because there's no sense in calculating all the details of the grass at the limit of the forest located 2km away from you. But it start making sense when you are close to it.

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                1
                • N NightShadeI has marked this topic as solved on 10 Sept 2023, 06:15

                1/7

                15 Aug 2023, 20:49

                • Login

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