Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use F3DEX3 memset to clear Z buffer for RDP time savings #130

Merged
merged 7 commits into from
Jun 6, 2024

Conversation

sauraen
Copy link
Collaborator

@sauraen sauraen commented Jun 2, 2024

If F3DEX3 is enabled and the global variable gUseMemsetForZBuffer is set (is by default), F3DEX3's new SPMemset command is used to clear the Z buffer instead of a fill rectangle on the RDP. This saves about 400 us of RDP time, and adds about 400 us of RSP time, per frame. Theoretically the RSP is supposed to be faster at filling memory than the RDP, but I wasn't able to measure one being more than the other because the game's render time fluctuates anyway. Even at the same time, this is still a benefit as the game is usually RDP bound.

The Z buffer is cleared later in the frame, after drawing the sky (before anything which uses the Z buffer), because we need to get the framebuffer clear or sky draw commands started on the RDP before spending RSP time clearing the Z buffer.

Also cleans up a little repeated code in z_select.

@sauraen sauraen changed the base branch from main to develop/2.1.0 June 2, 2024 01:06
@sauraen sauraen marked this pull request as ready for review June 2, 2024 22:11
@sauraen sauraen changed the title [WIP] Use F3DEX3 memset to clear Z buffer for RDP time savings Use F3DEX3 memset to clear Z buffer for RDP time savings Jun 2, 2024
@sauraen sauraen merged commit 3251456 into develop/2.1.0 Jun 6, 2024
4 checks passed
@sauraen sauraen deleted the F3DEX3Memset branch June 6, 2024 03:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants