Skip to content
Snippets Groups Projects

NPO2 span function optimization

Merged Hannu Hanhi requested to merge Hannu_Hanhi/SRB2:sw-npo2-span-opt into next

This patch makes non-power-of-two span drawing functions about 3-7 times faster. This is achieved by replacing the modulo operations in the loop with additions and subtractions.

Timedemos of a affected map show around 10% improvement in FPS. (Recording a replay of just standing in a room with NPO2 floors and ceilings would probably show more dramatic results)

Slope drawing is not changed. I'm still working on that and will make a separate merge request when it's ready.

Here's the screenshots the best case scenario improvements I found. The changes in performance were tested on my AMD Ryzen PC and an old Intel gaming laptop.

Before

srb20294

After

srb20295

31 ms --> 4.4 ms!

Edited by Hannu Hanhi

Merge request reports

Checking pipeline status.

Approval is optional

Merged by James R.James R. 4 years ago (Oct 23, 2020 8:36pm UTC)

Merge details

  • Changes merged into with 135d0f91.
  • Did not delete the source branch.

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