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

Vectorize uniform inputs #1664

Merged
merged 10 commits into from
Aug 2, 2024
Merged

Conversation

heinezen
Copy link
Member

@heinezen heinezen commented Jul 30, 2024

Vectorizes parts of the renderer to increase the speed of the uniform setting and updating.

The changes so far resulted in a 40% 70% increase in FPS for me in stresstest 0.

  • Before: 520 FPS
  • After: 740 880 FPS

@heinezen heinezen added improvement Enhancement of an existing component area: renderer Concerns our graphics renderer lang: c++ Done in C++ code labels Jul 30, 2024
@heinezen heinezen force-pushed the feature/shader_update_optimize branch from 9a8eed4 to 7559958 Compare July 30, 2024 12:29
Comment on lines 357 to 360
if (not update_off.used) {
// Uniform value has not been set
continue;
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This worries me currently. If all uniforms are set, this should be fine as use would always be true and branch prediction should not be that bad. But if this is only a partial update, then this could get very slow.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've solved this by storing the used IDs in an additional vector. This adds an additional lookup but should avoid pipeline flushes.

It's hard to say what the impact of a mispredicted branch would be, so we could change this back in the future if it turns out to only have a marginal effect.

@heinezen heinezen force-pushed the feature/shader_update_optimize branch from 1cc693c to 93896f2 Compare August 1, 2024 21:29
@heinezen heinezen force-pushed the feature/shader_update_optimize branch from 93896f2 to b8a12ff Compare August 1, 2024 21:30
@heinezen heinezen marked this pull request as ready for review August 1, 2024 21:45
@heinezen heinezen requested a review from TheJJ August 1, 2024 21:45
@heinezen heinezen added this to the 0.6.0 milestone Aug 1, 2024
@TheJJ TheJJ merged commit 99e355e into SFTtech:master Aug 2, 2024
13 checks passed
@heinezen heinezen deleted the feature/shader_update_optimize branch November 25, 2024 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: renderer Concerns our graphics renderer improvement Enhancement of an existing component lang: c++ Done in C++ code
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

2 participants