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. Basic compute shader example using QShaderProgram
Forum Update on Monday, May 27th 2025

Basic compute shader example using QShaderProgram

Scheduled Pinned Locked Moved Unsolved General and Desktop
qt3dshader
3 Posts 2 Posters 1.2k 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.
  • C Offline
    C Offline
    canol
    wrote on 7 Apr 2022, 15:37 last edited by
    #1

    Hello, I have a big array of int32 numbers (100,000,000 elements). I would like to basically do some numeric calculations on this array using computer shaders so that the calculations are very fast. I see that Qt has QShaderProgram which seems to support compute shaders. But I cannot find a basic example on how to use it.

    Would it be possible for somebody to give me an example of how to create a simple compute shader program using QShaderProgram? For example, a program that would calculate the square of the input array elements?

    Or maybe I am looking at the wrong API and there is another way to take advantage of GPU using Qt?

    PS: I would like to use Qt (instead of, say, CUDA) because my program is already using Qt for GUI, so I would prefer to not add another dependency if possible.

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 7 Apr 2022, 18:33 last edited by
      #2

      Hi,

      I haven't tested it but there's this GitHub project that might be of interest.

      Hope it helps.

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

      C 1 Reply Last reply 7 Apr 2022, 21:08
      1
      • S SGaist
        7 Apr 2022, 18:33

        Hi,

        I haven't tested it but there's this GitHub project that might be of interest.

        Hope it helps.

        C Offline
        C Offline
        canol
        wrote on 7 Apr 2022, 21:08 last edited by
        #3

        @SGaist Thank you, I will check it out.

        1 Reply Last reply
        0

        3/3

        7 Apr 2022, 21:08

        • 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