PDA

View Full Version : Display algorithm in Fragment Shader



yuqingcai@gmail.com
04-14-2014, 02:24 AM
I am new in OpenGL, recently, I am using OpenGL ES to process real time video frame(frame size if about 800 * 600, target GPU is PowerVR SGX543/266 MHz). In this project, we anlyse data of pixel cluster and display the pixel with an algorithm (for example, make a Gaussian Blur algorithm). In my design, the algorithm is implemented in the Fragment Shader(Time Complexity is O(n*n)), it works, but the frame rate is too low, The normal frame rate is about 60 fpt, when enable the algorithm, frame rate become to 2 fpt.
My question is: "algorithm implemented in the Fragment Shader", is this pattern correct? It seems absolute to fall down the frame rate.

aqnuep
04-14-2014, 03:28 AM
Yes, you should use fragment shader, especially because your target GPU doesn't support compute shaders (which could be an alternative).

Your problem is that you use n*n fetches in your fragment shader. But this is not the most efficient way.

You should use a 2-pass separable Gaussian filter then you can reduce the number of fetches to 2*n. Also there are other techniques to reduce the fetch count.

For more information check this article (http://rastergrid.com/blog/2010/09/efficient-gaussian-blur-with-linear-sampling/).

yuqingcai@gmail.com
04-14-2014, 09:13 AM
aqueous, thanks your reply, it's very helpful for me.:)