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

HUD rendering tanks frame rate on M1 Mac

Aperta
#4,855 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub
bug graphics HUD mac
Lingua principale
C++
Stelle
487
Fork
184
Merge medio
3g 8h
PR unite (30g)
45

Descrizione

```
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?

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Non sono indicati file sorgente né test. Riproduci il problema su un Mac M1 con -profile-frame-time, quindi confronta i tempi dei frame con HUD e NanoVG abilitati o disabilitati per individuare il collo di bottiglia del rendering. Il lavoro è completato quando il rallentamento correlato all'HUD è stato identificato e risolto, l'output dell'HUD è preservato e il miglioramento dei tempi dei frame è confermato.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
cpp, macos
Ambito
computer-graphics, performance
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.