SDL2 WinRT performance issues |
Re: SDL2 WinRT performance issues |
DLudwig
|
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. |
|||||||||||||
|
Meldryt
|
edit:
found the problem. it must be something inside filledPolygonRGBA function from gfxprimitives |
|||||||||||
|
Meldryt
|
ups. i meant filledCircleRGBA.
i call this function around six times per frame, and it dropped from 60 fps to 20-25 fps. well, drawing filled circles with sdl seem to be a problem for me, so i draw preinitialized textures instead. now it runs at constant 60 fps. |
|||||||||||||
|
mr_tawan
|
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 WinRT performance issues |
Andreas Schiffler
Guest
|
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 --Andreas On 11/28/2014 1:53 PM, mr_tawan wrote:
|
|||||||||||||||
|
Meldryt
|
Yeah there s lot of code for one little circle -,- Using textures is definitely the better option for me as long as i dont have to change primitive dimensions dynamically.
|
|||||||||||
|