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

Common: avoid if in indexed bmp unpack #2186

Merged
merged 1 commit into from
Oct 18, 2023

Conversation

ericoporto
Copy link
Member

this is done to squeeze that for to be a little faster when loading something from the spritefile. The change is almost negligible but in the VS Profiler what happens is the fraction of UnpackIndexedBitmap is reduced compared to BitmapToVideoMem (in gfxdriverbase).

@ivan-mogilko
Copy link
Contributor

ivan-mogilko commented Oct 17, 2023

Actually, copying to a local pal[256] may not even be necessary, because the palette passed into this function is already a local array of 256:

uint32_t palette[256];

Perhaps you could remake UnpackIndexedBitmap to accept const std::array<uint32_t, 256> &palette to enforce that.

@ericoporto
Copy link
Member Author

That is a good point, I hadn’t looked up to who was calling it, will adjust to this.

@ericoporto
Copy link
Member Author

ericoporto commented Oct 17, 2023

Done! After this last change, it lowered relevance from UnpackIndexedBitmap of contributing from 10% to 1.5% to same scene using the VS Profiler! This is huge! (before it only changed from 10% to 8%!)

this is done to squeeze that for a little faster
@ivan-mogilko ivan-mogilko merged commit c904b95 into adventuregamestudio:master Oct 18, 2023
20 checks passed
@ericoporto ericoporto deleted the perf-spritefile branch October 18, 2023 11:39
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