| Summary: | [PATCH] increase performance SDL_CreateTextureFromSurface for s/w render | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Dmitry Gapkalov <gapkalov> |
| Component: | render | Assignee: | Ryan C. Gordon <icculus> |
| Status: | ASSIGNED --- | QA Contact: | Sam Lantinga <slouken> |
| Severity: | enhancement | ||
| Priority: | P2 | CC: | icculus, muesli4 |
| Version: | 2.0.9 | Keywords: | target-2.0.16 |
| Hardware: | All | ||
| OS: | All | ||
| Attachments: | patch | ||
(Sorry if you get several emails like this, we're marking a bunch of bugs.) We're hoping to ship SDL 2.0.11 on a much shorter timeframe than we have historically done releases, so I'm starting to tag bugs we hope to have closed in this release cycle. Note that this tag means we just intend to scrutinize this bug for the 2.0.11 release: we may fix it, reject it, or even push it back to a later release for now, but this helps give us both a goal and a wishlist for the next release. If this bug has been quiet for a few months and you have new information (such as, "this is definitely still broken" or "this got fixed at some point"), please feel free to retest and/or add more notes to the bug. --ryan. It would probably make more sense to provide this a function for the software back-end that falls back to something like: SDL_Texture texture = SDL_CreateTexture(renderer, surface); SDL_FreeSurface(surface); return texture; On the software back-end it moves the pixel data and the other stuff to the texture and overwrites and frees the surface. Basically, the important stuff gets moved without expensive copies. I wouldn't share any of that without explicitly stating it. Otherwise, that might lead to annoying behavior and unexpected side effects. We're changing how we do SDL release versions; now releases will be even numbers (2.0.10, 2.0.12, etc), and as soon as we tag a release, we'll move the internal version number to an odd number (2.0.12 ships, we tag the latest in revision control as 2.0.13 immediately, which will become 2.0.14 on release, etc). As such, I'm moving the bugs tagged with target-2.0.11 to target 2.0.12. Sorry if you get a lot of email from this change! Thanks, --ryan. We're changing how we do SDL release versions; now releases will be even numbers (2.0.10, 2.0.12, etc), and as soon as we tag a release, we'll move the internal version number to an odd number (2.0.12 ships, we tag the latest in revision control as 2.0.13 immediately, which will become 2.0.14 on release, etc). As such, I'm moving the bugs tagged with target-2.0.11 to target 2.0.12. Sorry if you get a lot of email from this change! Thanks, --ryan. I agree with Moritz, we should probably add a function named something like SDL_ConvertSurfaceToTexture() where it explicitly destroys the surface, possibly stealing its internal data for the new texture without copying it. As such, I'm removing the target-2.0.12 keyword from this bug, so we can explore this in the (near?) future. --ryan. Agreed. |
Created attachment 3659 [details] patch remove excess allocations and memory copying while SDL_CreateTextureFromSurface for s/w render in situation while texture and surface format is equal. case: 1) load gfx file to surface 2) create texture from surface 3) free surface 4) use texture for blit to screen basic idea in sharing pixel data between surface and texture in situation while format of surface and texture are equal.