Massive frame rate drop when zooming in eg on earth and it's child orbits.
se5a opened this issue · 2 comments
This seems to have cropped up with updates to SDL2 and related libraries.
from my merge looking it appears to be struggling with sdl2.drawline on the orbits. this was not a problem previously.
It slows down when you zoom in on nothing as well.
Fixed this thanks to Martins over in Handmade Discord.
seems there were some changes between SDL2-2.0.8 and 2-2.0.20
Added this: SDL.SDL_SetHint("SDL_RENDER_LINE_METHOD", "2");
to where I'm creating the SDL window and it's solved it.
https://github.com/libsdl-org/SDL/blob/1fc7f681187f80ccd6b9625214b47db665cd9aaf/include/SDL_hints.h#L1304-L1315
Martins also noted that how I'm doing the drawlines is not ideal and suggests:
"prepare one large geometry buffer that you draw as rarely as you can
basically this code: https://github.com/libsdl-org/SDL/blob/release-2.0.20/src/render/SDL_render.c#L3031-L3149 "
definitely something to look at in the future.
basically what was happening is when zoomed out, many of the renderdrawlines were getting culled because they were < 1 pix long, but when zooming in it wasn't culling anything and drawing all the lines, even though they were off-screen.
pushing the fix for this soon, I'm also in the middle of fixing #315