Reputation: 4668
Does a renderer created with SDL_CreateSoftwareRenderer()
behave any differently than one created with SDL_CreateRenderer()
using the SDL_RENDERER_SOFTWARE
flag?
Upvotes: 3
Views: 2782
Reputation: 18409
There are differences on how these two operate, or even their intended use. SDL_CreateSoftwareRenderer
creates software renderer drawing to given surface. There is no requirement for this surface to be window surface, you can draw to backbuffer, convert it to texture and feed the result to d3d or opengl renderer.
SDL_CreateRenderer
creates renderer for a given window, meaning it is supposed to draw to that window - with some checks, like opengl or vulkan requires window to be created with specific flags. It goes through list of available rendering backends and tries to find the one that matches your flags
the best. Eventually if it decides to use software renderer (either nothing else is supported or software is explicitly requested, although there is more than one way to do so - see the last paragraph) it calls more-or-less SDL_CreateSoftwareRenderer(SDL_GetWindowSurface(window))
(not exactly so, but if you'll trace the code it is the same).
flags
in SDL_CreateRenderer
are not absolute; if a hint says to use direct3d or opengl, your SDL_RENDERER_SOFTWARE
will be ignored. SDL_CreateSoftwareRenderer
is always software.
Upvotes: 5
Reputation: 2051
Nope! They should behave the same.
SDL2 has quite a list of convenience functions which are equivalent to simply calling another function with a specific set of arguments. For instance, looking at the API listing by name, you'll find that the SDL_LogMessage ()
function is matched with a variety of other functions that implicitly specify the priority
field, like SDL_LogVerbose ()
or SDL_LogError ()
.
To some extent, in addition to providing ease-of-use, these combined convenience functions help provide brevity to code while still maintaining clarity. As such, I would advise and advocate for their use when possible!
Upvotes: 1