Is this a bug? SDL_CreateRenderer -1 much faster than anything else

While testing the speed of SDL_RenderDrawLinesF on different renderers I noticed a big difference when passing -1 (to SDL_CreateRenderer to let it choose the best renderer) compared to specifying an other renderer. Usually -1 chooses rendering index 0, but even specifying 0 directly causes SDL_RenderDrawLinesF to run slower. So what gives? What’s special about -1? Why should it be any different to manually choosing the renderer it will choose.

Renderer 0 on my PC is direct3d, 1 is direct3d11 which is much slower for line drawing.

What gives?

1 Like

Hi
Please read the first answer SDL_HINT_RENDER_BATCHING question

2 Likes

So batching is only used by default if you specify -1 to SDL_CreateRenderer?

“… SDL will disable batching if a specific render backend is requested (since this might indicate that the app is planning to use the underlying graphics API directly).”

Ah! Now I understand, thank-you! Took me a while. I don’t know if I’m getting slow in my old age, or some clarity needs to be added to SDL_CreateRenderer. :man_shrugging:

You can place SDL_SetHint(SDL_HINT_RENDER_BATCHING, “1”) before creating of the render instance and batching will be working with any supported backend.