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 5434 - opengles: Reduce drawcalls and improve the performance of SDL_RenderCopy and SDL_RenderCopyEx
Summary: opengles: Reduce drawcalls and improve the performance of SDL_RenderCopy and...
Status: ASSIGNED
Alias: None
Product: SDL
Classification: Unclassified
Component: render (show other bugs)
Version: 2.0.15
Hardware: x86_64 iOS (All)
: P2 major
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-01-02 12:25 UTC by sowfelicity
Modified: 2021-01-12 04:32 UTC (History)
1 user (show)

See Also:


Attachments
Reduce drawcalls of SDL_RenderCopy and SDL_RenderCopyEx. (11.51 KB, patch)
2021-01-02 12:25 UTC, sowfelicity
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description sowfelicity 2021-01-02 12:25:02 UTC
Created attachment 4627 [details]
Reduce drawcalls of SDL_RenderCopy and SDL_RenderCopyEx.

This patch roughly merges multiple glDrawArrays calls into a single glDrawArrays call to improve performance of SDL_RenderCopy and SDL_RenderCopyEx for rendering a large number of small sprites sharing the same texture.

8192 "icon.bmps" were created with random color and angular velocity on iphone 6.
The original SDL2 render these sprites at about 24 Frames Per Second while the patched SDL2 do the same thing at more than 39 Frames Per Second. The patch makes it possible to render more small particles fast with SDL2.
Comment 1 Sam Lantinga 2021-01-02 18:17:21 UTC
Ryan, is this something that's generally useful for all the renderers?
Comment 2 Ryan C. Gordon 2021-01-12 04:32:35 UTC
(In reply to Sam Lantinga from comment #1)
> Ryan, is this something that's generally useful for all the renderers?

Yes, many of them can benefit from this at a higher level. A good practical use case is particle systems that will draw maybe hundreds of the same sprite with different vertex colors and rotations.

Some of the renderers have the vertex color put in a uniform, which would need to be replaced to work with this approach, and could probably do the merging on the fly at a higher level, but yeah, something like sowfelicity's patch is worth aiming for.

--ryan.