Skip to content
Snippets Groups Projects

Improve HUD rendering when drawing stretched patches

Merged Hanicef requested to merge Hanicef/SRB2Classic:fix-hud-render-performance into next

In HWR_DrawStretchyFixedPatch, there was a bit of code that did some excessive integer to float conversions by accident. This happened because C compilers don't optimize integers to floats at compile time (funnily enough) and as such, takes two integer values, divides them, converts them to float, divides, then back to integer, add or subtracts and then back to float again. As you can imagine, this is a pretty slow process, and it had a noticeable performance dip on OpenGL when drawing patches.

Also, just for funsies, I made a timelapse of the fix here:

1408-timelapse.webm

This timelapse is when I got into completely blind, so I did no preparation on this (and I switched terminal to cool-retro-term just so you folks could look at something nice, something that didn't really work out at the start considering the illegible text near the beginning). It's my normal workflow when dealing with performance issues and the software you saw were kakoune (text editor) and perf (profiler). And if anyone asks: the music playing is keisari micro by laamaa.

Fixes #1408 (closed)

Merge request reports

Pipeline #7004 passed

Pipeline passed for d467f842 on Hanicef:fix-hud-render-performance

Merged by LactozillaLactozilla 2 months ago (Feb 16, 2025 1:11pm UTC)

Loading

Pipeline #7188 passed

Pipeline passed for e6f4362b on next

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
Please register or sign in to reply
Loading