scp-fs2open / scp-fs2open/fs2open.github.com

HUD rendering tanks frame rate on M1 Mac

Offen
#4,855 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
bug graphics HUD mac
Vorherrschende Sprache
C++
Sterne
487
Forks
184
Ø Merge
3 T. 8 Std.
Gemergte PRs (30 T.)
45

Beschreibung

```
Initializing SDL video...
Initializing OpenGL graphics device at 1920x1080 with 32-bit color...
Requested SDL Pixel values = R: 8, G: 8, B: 8, depth: 24, stencil: 8, double-buffer: 1, FSAA: 0
Requested SDL Pixel values = R: 8, G: 8, B: 8, depth: 24, stencil: 8, double-buffer: 1, FSAA: 0
Could not create OpenGL Context: Failed creating OpenGL context at version requested
Requested SDL Pixel values = R: 8, G: 8, B: 8, depth: 24, stencil: 8, double-buffer: 1, FSAA: 0
Could not create OpenGL Context: Failed creating OpenGL context at version requested
Requested SDL Pixel values = R: 8, G: 8, B: 8, depth: 24, stencil: 8, double-buffer: 1, FSAA: 0
Could not create OpenGL Context: Failed creating OpenGL context at version requested
Requested SDL Pixel values = R: 8, G: 8, B: 8, depth: 24, stencil: 8, double-buffer: 1, FSAA: 0
Could not create OpenGL Context: Failed creating OpenGL context at version requested
Requested SDL Pixel values = R: 8, G: 8, B: 8, depth: 24, stencil: 8, double-buffer: 1, FSAA: 0
Actual SDL Video values = R: 8, G: 8, B: 8, depth: 32, stencil: 8, double-buffer: 1, FSAA: 0
OpenGL Vendor : Apple
OpenGL Renderer : Apple M1 Ultra
OpenGL Version : 4.1 Metal - 83

WARNING: Failed to find uniform 'clipEnabled'.
Max texture units: 2 (16)
Max client texture states: 2 (1)
Max elements vertices: 1048575
Max elements indices: 150000
Max texture size: 16384x16384
Max render buffer size: 16384x16384
Can use compressed textures: YES
Texture compression available: YES
Post-processing enabled: YES
Using trilinear texture filter.
OpenGL Shader Version: 4.10
Max uniform block size: 65536
Max uniform buffer bindings: 80
Uniform buffer byte offset alignment: 256
... OpenGL init is complete!
Initializing path renderer...
Checking graphics capabilities:
Persistent buffer mapping: Disabled
Checking mod required rendering features...
All required features are supported.
GRAPHICS: Initializing default colors...
```

I'm trying to get this running natively on a M1 Ultra Mac running Mac OS Ventura. I did get it working after hacking around the prebuilt libraries not being arm64, but I noticed that the frame rate is unexpectedly jerky even with all settings and resolution turned all the way down. By enabling the "-profile-frame-time" option it becomes clear that this is because more than 16 ms is spent on the HUD alone (and apparently around 6 on NanoVG):

with_hud

By disabling the HUD the frame rate massively improves (probably full-speed without the profiling):

without_hud

I further experimented with hacking out NanoVG, which had some benefit (without apparently affecting the HUD display?), but the major impact appears to come from rendering the HUD itself, which doesn't look like it should be expensive at all.
It seems most likely to me that it's somehow using OpenGL in a way that Apple's OpenGL -> Metal wrapper doesn't like. I'm not sure what that could be, however. Does anyone have any suggestions on how to get to the bottom of this?

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

Es werden keine Quelldateien oder Tests genannt. Reproduziere das Problem auf einem M1 Mac mit -profile-frame-time und vergleiche die Frame-Zeiten bei aktiviertem oder deaktiviertem HUD und NanoVG, um den Rendering-Engpass zu lokalisieren. Erledigt ist die Aufgabe, wenn die HUD-bedingte Verlangsamung identifiziert und behoben wurde, die HUD-Ausgabe erhalten bleibt und verbesserte Frame-Zeiten bestätigt wurden.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
cpp, macos
Bereich
computer-graphics, performance
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
25/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.