1

Let's say there is one texture: 6000x6000

I only need to blur one part, let's say the center rectangle 100x100

If I use vertex shader to put the interested area to this center rectangle, by inputting the coordinates of the 4 points and their corresponding texture coordinates in the big texture, I think the fragment shader only process the pixels in the center rectangle.

In my understanding, a regular GPU cannot really handle 6000x6000 pixels concurrently; it will divide to several segments. Now with 100x100, all pixels can be processed simultaneously, so it would be faster.

Is my understanding correct?

user1914692
  • 3,033
  • 5
  • 36
  • 61

1 Answers1

1

You can do a "render to texture", so you can use your "vertex shader" to select the area you want to blur... and then your fragment shader will apply the blur only in that area.

your understanding seems to be correct: consider that the GPU will only spend efford processing the fragments INSIDE the area determined by your vertex shader, so if you set your vertex to a subset of your target [just like the screen, your target may be a texture, via framebuffers], then your GPU will process only the desired area.

Wagner Patriota
  • 5,494
  • 26
  • 49
  • Thanks. Is all of my understanding in the question correct? What you said is to say my understanding correct? – user1914692 Jan 27 '16 at 20:43
  • yes, if my understanding about your understanding is correct, yes... your understanding is correct – Wagner Patriota Jan 27 '16 at 20:58
  • then do you know how many pixels can be processed concurrently in GPU using OpenGL? Could you give me links to some sources? Thanks. – user1914692 Feb 11 '16 at 17:04
  • It may be even 1 million in parallel or even more... it doesn't depend on OpenGL itself but on your GPU. A VERY VERY quick tutorial about OpenGL that I suggest is here: http://duriansoftware.com/joe/An-intro-to-modern-OpenGL.-Table-of-Contents.html I really recommend! – Wagner Patriota Feb 12 '16 at 05:31
  • Thanks. I program a lot of fragment shaders a lot, actually. But I am not familiar with the architecture of GPU. I have been searching the source to determine the actual number of parallel units in a GPU device. Would you give me a link? I got some information about concurrent unit count using CUDA, e.g. GTX 580 has 24,576 threads. Not sure about the number on GPU when it works on OpenGL. 24,576 threads are not impressing. – user1914692 Feb 12 '16 at 23:12
  • Where did you get this information about 24,576 threads on GTX 580? This is not true. You got confused... it has 24,576 MB of RAM – Wagner Patriota Feb 12 '16 at 23:28
  • I got the number from the answer in "CUDA: How many concurrent threads in total?" http://stackoverflow.com/questions/6490572/cuda-how-many-concurrent-threads-in-total – user1914692 Feb 15 '16 at 18:03