Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.97a is out! (02/02/24); New blog post: Simulator Enhancements (03/13/24)

Author Topic: Diagnosis of AMD OpenGL lag  (Read 1420 times)

Schwartz

  • Admiral
  • *****
  • Posts: 1452
    • View Profile
Diagnosis of AMD OpenGL lag
« on: April 29, 2020, 12:20:32 AM »

I've recently been using a combination of mods that made the AMD issue painfully obvious, and for a pretty specific case. Maybe this helps to troubleshoot it or to find settings and tweaks to make the game playable for us AMD folks.

When a lot of fighters are in combat and the Dassault-Mikoyan Normandy carrier ship system is enabled, FPS suddenly tanks into the single digits like so. Observe twice the FPS once the glows disappear. This happens whether fighters are on-screen or off-screen. I'm thinking it has something to do with drawing glow on many items. Not the complexity of it but simply adding up the numbers. The card can handle expensive stuff like GraphicsLib shader ripples just fine - I generally play with GraphicsLib loaded but shaders off. This is not a mod issue. These mods just showcase it.

Is there a way to disable special effects, or even any kind of lighting, on fighters and missiles in vanilla? If not, that would be a useful setting to have to fix AMD gripes in lieu of a better driver that likely will never come.
« Last Edit: April 29, 2020, 12:33:11 AM by Schwartz »
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23988
    • View Profile
Re: Diagnosis of AMD OpenGL lag
« Reply #1 on: April 29, 2020, 09:36:20 AM »

Thank you for the added info!

Unfortunately, what's going on in that screenshot is just "a bunch more rendering"; how much more is hard to say since it depends on the configuration of that specific ship system. It's not lighting or anything special - the "glow" is just rendering the same fighters again on top of the base fighters, with some transparency, a different blend mode, and offsets. None of that is qualitatively different than what goes on normally.

(If it's truly not affected by the fighters going significantly off-screen, this is probably not rendering-related at all, since ships are not rendered once they're off-screen, with a certain safety margin. In that case, I'd guess the ship system script is doing something extremely performance-intensive that's not rendering-related.)
Logged

Schwartz

  • Admiral
  • *****
  • Posts: 1452
    • View Profile
Re: Diagnosis of AMD OpenGL lag
« Reply #2 on: April 29, 2020, 10:42:18 AM »

Hmm.. true, it could be two different things. I know AMD hates to have lots of items on screen even if they're tiny and trivially easy to render. Exigency missile spam always tore into my FPS too.

I'll test this some more tomorrow. But generally speaking, I think it's not wrong that doubling fighter entities for a visual effect is going to incur a much bigger penalty on AMD. I would gladly trade completely boring fighter visuals for more FPS. And even missiles without trails.
Logged

Thaago

  • Global Moderator
  • Admiral
  • *****
  • Posts: 7174
  • Harpoon Affectionado
    • View Profile
Re: Diagnosis of AMD OpenGL lag
« Reply #3 on: April 29, 2020, 11:15:41 AM »

I believe the ship system visuals are based on the Entropy Amplifier system (Harmful Mechanic and I were discussing this slowdown a while back), if thats helpful.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23988
    • View Profile
Re: Diagnosis of AMD OpenGL lag
« Reply #4 on: April 29, 2020, 11:19:28 AM »

Thank you - yeah, that makes sense. I was assuming it was based on Targeting Feed, but those are basically the same.

That doesn't explain why it has the same impact when the fighters are off-screen, though, I'd expect zero impact in that case if this is a graphics-related slowdown. Hmm.
Logged

Schwartz

  • Admiral
  • *****
  • Posts: 1452
    • View Profile
Re: Diagnosis of AMD OpenGL lag
« Reply #5 on: April 29, 2020, 06:26:04 PM »

There is graphics-related slowdown for sure. I know zooming in when a lot is going on gives me way higher FPS. But in this particular case, it didn't help much. Maybe that is related to AI / pathing / targeting, because I also noticed that close to the end of combat, when the available enemy targets are reduced from 2 to the last ship, suddenly FPS goes up a lot. Almost as if AI can't decide to target #1 or #2 and churns cycles on that until that decision doesn't have to be made anymore. But that's surely not related to AMD but just CPU.

Likely I'm describing two separate issues of slowdown here. I'll replace the Normandys with Herons and see what that does to FPS.
Logged

Alex

  • Administrator
  • Admiral
  • *****
  • Posts: 23988
    • View Profile
Re: Diagnosis of AMD OpenGL lag
« Reply #6 on: April 29, 2020, 06:31:52 PM »

It's definitely not the AI, at least not the vanilla portion of it. And it's definitely not CPU unless there's something in a mod you're using that causes that. It's tough to diagnose these sorts of things because a very slight difference in load could make something stop or start bottlenecking. I suspect that's what you're seeing there, rendering "just a bit more" overloads some component of the rendering pipeline and the frame rate goes down the tubes...
Logged

Schwartz

  • Admiral
  • *****
  • Posts: 1452
    • View Profile
Re: Diagnosis of AMD OpenGL lag
« Reply #7 on: May 01, 2020, 07:19:03 AM »

After replacing the ship system with Heron's Targeting Feed, I'm no longer getting the slowdown. Whatever istl_strikecommand does, it kills FPS. This could still be related to the AMD issue.. I assume other people don't get such an awful result.
Logged

Thaago

  • Global Moderator
  • Admiral
  • *****
  • Posts: 7174
  • Harpoon Affectionado
    • View Profile
Re: Diagnosis of AMD OpenGL lag
« Reply #8 on: May 01, 2020, 09:35:01 AM »

Thats very interesting, because the code is nearly identical between the two systems. The main graphical difference is that the istl_StrikeCommandStats changes engines settings:

Code: java
if (jitterLevel > 0) {
                fighter.getEngineController().fadeToOtherColor(this, new Color(145,175,255,255), new Color(45,75,255,25), jitterLevel, 1f);
fighter.getEngineController().extendFlame(this, 0.6f, 0.15f, 0.6f);
                                       
fighter.setJitterUnder(KEY_JITTER, JITTER_COLOR, jitterLevel, 3, 0f, jitterRangeBonus);
fighter.setJitter(KEY_JITTER, JITTER_UNDER_COLOR, jitterLevel, 1, 0f, 0 + jitterRangeBonus * 1f);
Global.getSoundPlayer().playLoop("system_targeting_feed_loop", ship, 1f, 1f, fighter.getLocation(), fighter.getVelocity());
}

vs the targeting feed:
Code: java
if (jitterLevel > 0) {
//fighter.setWeaponGlow(effectLevel, new Color(255,50,0,125), EnumSet.allOf(WeaponType.class));
fighter.setWeaponGlow(effectLevel, Misc.setAlpha(JITTER_UNDER_COLOR, 255), EnumSet.allOf(WeaponType.class));

fighter.setJitterUnder(KEY_JITTER, JITTER_COLOR, jitterLevel, 5, 0f, jitterRangeBonus);
fighter.setJitter(KEY_JITTER, JITTER_UNDER_COLOR, jitterLevel, 2, 0f, 0 + jitterRangeBonus * 1f);
Global.getSoundPlayer().playLoop("system_targeting_feed_loop", ship, 1f, 1f, fighter.getLocation(), fighter.getVelocity());
}

Engine effects have always been intensive, but it seems odd that changing existing ones would be so impactful.

I've attached the full system script for reference.

[attachment deleted by admin]
Logged

Schwartz

  • Admiral
  • *****
  • Posts: 1452
    • View Profile
Re: Diagnosis of AMD OpenGL lag
« Reply #9 on: May 01, 2020, 10:55:53 PM »

It looks like I spoke too soon. The reason why I get more FPS is that the Normandys haven't been using their Targeting Feeds. You're right though, visually they're even nearly the same, except the glow is a different color.

They're both very expensive for my card. We're talking an empty simulator with 1 Normandy and 3 Spark squads. System off = 60 FPS, 30% idle. System on = 56 FPS, 0% idle.
« Last Edit: May 01, 2020, 11:13:27 PM by Schwartz »
Logged