Performance Issue

Hey everyone!

I have a performance issue with my program.
I am using OpenGL and GLSL volume rendering to display a texture in real-time.
(My shader also calculates the light sources)

The problem is that my software runs really really slow on the computer while my CPU is mostly idle. Meaning the GPU processing slows down my system.

The only thing that helps the performance is if i resize the window to a lower size and only then my computer starts to respond.

I want to understand why? why when i resize the window to lower size it helps? Is it because the shader doesn’t calculates all the texture box? I want to solve this problem and this is my only lead…

Thanks in advance for your help!

The approach is quite simple. First, try to change the texture size. If frame rate changes significantly then your program is texture bound. I have no idea what you are actually doing with the texture, so it is better to eliminate a possibility of texture influence.

Second, try to vary the number of GLSL commands in your fragment shader(s). If the frame rate changes then your program is fragment shader bounded (I bet on this). If the frame rate stays the same, your program is limited with the process of rasterization.

http://www.opengl.org/wiki/Performance
What are your hardware specs ?
Volume rendering is heavy of per pixel operations, so this is expected.

Thanks for the quick answers!

I’ve read in wiki value on performance “Performance - OpenGL Wiki” -
“If you are fragment processing bound, a really simple test is to reduce the size of the window you are rendering into down to the size of a postage stamp and see if your frame rate improves. If it does then you are at least partially fill rate limited - if it doesn’t then that’s not the problem. This is such a simple test that it should always be the first thing you try.”

Which is exactly what i am experiencing!!
That means that my problem is probably in the Fragment Shader.
Now my question is how can i improve the “fragment processing bound”?
For example will these things help:

  1. Amount of text? Variables, Loops, Functions etc’
  2. What is the meaning of functions which are not in use? I have some functions that most of the time i don’t use them. will it help to remove these?
  3. Loops efficiency? How can i improve them?
  4. any other ideas?

I’ve also noticed a bit of improvement in performance when removing my per-pixel phong shading. Do you have any recommendations on that?

Thanks again!

This is not true, in general. There are often other bottlenecks than CPU and GPU processing. In your case it most likely is the GPU computations that are the bottleneck (as others have said).

Regarding spec i have -
Intel® Core™ i7-2630QM processor
1.5GB GDDR5 NVIDIA® GeForce® GTX 460M card
and 8GB DDR3 1333MHz memory

You haven’t told us what it is that you’re trying to draw that’s so slow. Being fragment processing bound means that you’re drawing more stuff than the GPU can handle. We can’t help you unless we know what you’re trying to draw, what your shaders are, etc.

You are fillrate limited, and you likely have a lot of overdraw - which may be your key problem. If you can somehow reduce the overdraw, that would help. Could you do ray tracing in fragment shader instead of doing many passes?

Or reduce the rendering resolution when being interactive, which is fairly common in volume rendering.