SDL2 WinRT performance issues

Meldryt wrote:

We develop a simple 2D game for ios and windows phone. Both versions are quiet similar
The game runs fluenty on an old IPhone with 50-60 fps but on windows phone it runs only at 20-25fps.

Maybe it has something to do with the multitouch handling or draw calls.
We use some SDL draw functions for simple primitives like SDL_RenderFillRect, filled circles (filledPolygonRGBA from gfxprimitives) or draw text functions like TTF_RenderText_Solid.
I have already tried to gain more performance by reducing draw calls for single primitives, but it didnt help.

I’d be surprised if it had to do with multitouch code, and suspect the D3D11 renderer could use some additional optimization.

Might you be able to provide some sample code that illustrates the issue?

– David L.

I supposed you’re using SDL2_gfx. I’ve skimmed through the code, and found that this library draw each pixel in the circle individually (by calling SDL_RenderDrawPoint()). I cannot be so sure as I haven’t really benchmark it, but I think doing so can really hurt performance. You might want to try benchmark it.

If it’s really the case then I think you might want to reconsider using filled circles. Or may be you can do the caching by drawing circle in to a texture and reusing the texture instead of redrawing circle every frame.

My statement above is not based on any kinds of test or benchmark. It might be incorrect.

SDL2_gfx uses DrawPoint (circle, aaCircle) or DrawLine (filled circle)
which may incur a severe performance penalty depending on the renderer.
The library was not designed to be very performant, but rather to
provide backwards compatibility for SDL_gfx and some uses which don’t
require a lot of primitives to be rendered.

You can run TestGfx to get a benchmark … here are my numbers from my
PC with i7 CPU and a low end NVidia card.

Win32\Release>TestGfx.exe
INFO: SDL2_gfx 1.0.2: testgfx
INFO: Platform: Windows
INFO: Renderer 0: direct3d (Accelerated)
INFO: Test 0 Pixel: 2730666.6 /sec
INFO: Test 1 Hline: 2048000.0 /sec
INFO: Test 2 Vline: 2048000.0 /sec
INFO: Test 3 Rectangle: 4096000.0 /sec
INFO: Test 4 RoundedRectangle: 126030.7 /sec
INFO: Test 5 Box: 4096000.0 /sec
INFO: Test 6 Line: 1638400.0 /sec
INFO: Test 7 Circle: 43574.4 /sec
INFO: Test 8 AACircle: 19366.4 /sec
INFO: Test 9 FilledCircle: 59362.3 /sec
INFO: Test 10 Ellipse: 40554.4 /sec
INFO: Test 11 AAEllipse: 18492.0 /sec
INFO: Test 12 FilledEllipse: 60681.4 /sec
INFO: Test 13 Bezier: 5142.8 /sec
INFO: Test 14 Polygon: 2730500.0 /sec
INFO: Test 15 AAPolygon: 5696.8 /sec
INFO: Test 16 FilledPolygon: 19320.7 /sec
INFO: Test 17 Trigon: 3276800.0 /sec
INFO: Test 18 Arc: 92564.9 /sec
INFO: Test 19 Pie: 682666.6 /sec
INFO: Test 20 FilledPie: 60457.5 /sec
INFO: Test 21 ThickLine: 27029.7 /sec

–AndreasOn 11/28/2014 1:53 PM, mr_tawan wrote:

I supposed you’re using SDL2_gfx. I’ve skimmed through the code, and
found that this library draw each pixel in the circle individually (by
calling SDL_RenderDrawPoint()). I cannot be so sure as I haven’t
really benchmark it, but I think doing so can really hurt performance.
You might want to try benchmark it.

If it’s really the case then I think you might want to reconsider
using filled circles. Or may be you can do the caching by drawing
circle in to a texture and reusing the texture instead of redrawing
circle every frame.

My statement above is not based on any kinds of test or benchmark. It
might be incorrect.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org