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

Fix decreased performance of software rendering #22820

Merged
merged 2 commits into from
Jan 30, 2018

Conversation

BevapDin
Copy link
Contributor

Fixes #22739.

The software renderer stores textures as run-length encoded chunks of pixels.
This makes accessing a pixel (or a range of pixels) in the middle of the texture slow, as the chunks in front of it must be decoded first.

To avoid this, the new code creates a single texture for each tile (setting the maximal texture size to the tile size means the following code will separate each tile into its own texture). Those textures will be drawn complete (from the beginning to the end), which makes drawing fast again.

This was the behaviour of the code before #22579 (it would create single texture for each tile). I compared the performance of this version with the version directly before #22579, it's about the same, noticeable faster than the current master.

Note: the performance slightly depends on the used tileset. I tested it with ChestHole.

The software renderer stores textures as run-length encoded chunks of pixels.
This makes accessing a pixel (or a range of pixels) in the middle of the texture slow, as the chunks in front of it must be decoded first.

To avoid this, the new code creates a single texture for each tile (setting the maximal texture size to the tile size means the following code will separate each tile into its own texture).
Those textures will be drawn complete (from the beginning to the end), which makes drawing fast again.
If that is not fulfilled (e.g. very small maximal texture size and very large tiles), the game won't be able to allocate even a single tile texture.
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