We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3027 - software renderer should be smarter about using RLE encoding
Summary: software renderer should be smarter about using RLE encoding
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: render (show other bugs)
Version: 2.0.3
Hardware: x86_64 Windows 7
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-06-19 19:22 UTC by Adam M.
Modified: 2015-06-20 05:14 UTC (History)
0 users

See Also:


Attachments
ignore this (71 bytes, text/plain)
2015-06-19 19:55 UTC, Adam M.
Details
the real proposed patch (v1) (2.36 KB, patch)
2015-06-19 19:59 UTC, Adam M.
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Adam M. 2015-06-19 19:22:51 UTC
The software renderer enables RLE encoding for textures created with SDL_TEXTUREACCESS_STATIC. RLE encoding is somewhat expensive, and it doesn't support all of the texture features. When a texture feature unsupported by RLE is used, the texture gets RLE-decoded. Then it may get RLE-encoded again, and RLE-decoded again, and encoded again and decoded again, perhaps many times per frame.

An example is color mod. I draw a texture to the screen about 4000 times per frame (it contains all of the tiles drawn on screen), and each time set a different color mod. Often the color mod is white. Often it is not. Each time it transitions to/from white, the texture gets be RLE encoded/decoded. This is very undesirable.

Possible fixes:
1. Don't use RLE encoding in the software renderer.
2. Make the software renderer remember incompatible features have been used and permanently disable RLE for that texture. This way you get RLE for plain textures but don't have to worry about frequent encoding and decoding.
3. Make the RLE blitter support color mod, etc.

#2 seems like the best balance of work vs. payoff.
Comment 1 Adam M. 2015-06-19 19:55:40 UTC
Created attachment 2189 [details]
ignore this

I've attached a proposed fix for this.
Comment 2 Adam M. 2015-06-19 19:59:32 UTC
Created attachment 2190 [details]
the real proposed patch (v1)

Whoops, I attached an empty patch. Here's the real one.
Comment 3 Sam Lantinga 2015-06-20 05:14:14 UTC
This looks good, thanks!
https://hg.libsdl.org/SDL/rev/2f5a57f86e24