0
\$\begingroup\$

I have been developing a massive RTS during the past 18 months, which is comming together nicely!

Now i have an issue i can't really wrap my head around.

If i render 100 models from a distance where the camera can see them all, everthing works perfectly. If i then render them when there camera is up close, my GPU goes to 100% and of course everything starts to lag. I don't really get the difference, the math is the same.

Works on Nvidia m1000m and burns on AMD RX5700. OpenGl version 4.1.

CPU, memory and GPU memory stays the same so i don't suspect any leaks.

I have tried debugging with glGetError() and CodeXL, no luck.

Am i missing something simple in OpenGL?

\$\endgroup\$
  • 4
    \$\begingroup\$ This sounds like you're hitting fill rate limits. Up close, each model touches more pixels, invoking the rasterizer, fragment shader, and blending pipeline proportionately more often, consuming more computation bandwidth and more memory bandwidth to write the results into the frame buffer. Any hidden surfaces that you end up drawing, then drawing over, go from the cost of a few pixels when they're small to substantial fractions of the frame when drawn large/up close. At some point, you start to saturate the available cores or available memory transfer, and things start to get backed up. \$\endgroup\$ – DMGregory Sep 16 '19 at 13:04
  • \$\begingroup\$ A quick test for being fillrate limited is to reduce the size of your viewport - if performance improves, then it's a good indicator that you are indeed fillrate limited. Incidentally - "the math is the same" - it may indeed be, but as you've discovered, you can't just measure the front-end of the pipeline and assume it holds good in all cases. \$\endgroup\$ – Maximus Minimus Sep 16 '19 at 16:34
  • \$\begingroup\$ Thank you for responding. At a later point i will be using defered shading for diffuse, normals and lighting, which will be a great improvement for the fragment shader. If i were to hit fill rate limits, wouldn't i also have issues on my Nvidia machine? Especially considering we are talking m1000m vs RX5700. I just tried changing my viewport from 3440x1440 to 1920x1080 and just for fun 300x200. The same issue occurs. Any other ideas? \$\endgroup\$ – JensF Sep 16 '19 at 20:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.