Basic compute shader example using QShaderProgram
-
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.
-