Here's another task that springs to mind, now that SDL 1.3 is getting
render targets.

Right now, in the SDL 1.3 backend, all textures are created as
streaming textures, which means that SDL keeps a copy of the texture
data in main memory. Whenever we need to blit something from one
surface to another, we use and update that data and after unlocking
the surface, the version in video memory is updated. Altogether, this
is just a workaround and slows down rendering quite a bit. But with
support for render targets in SDL 1.3, it should be possible to blit
directly from one texture to another, meaning we can get rid of
streaming textures and the costly software blitting.

Here's the commit that adds render targets to SDL:

    http://hg.libsdl.org/SDL/rev/b6212690f78d

And here's the code that needs changing:

    
https://github.com/ksterker/adonthell/blob/master/src/gfx/sdl13/surface_sdl.cc

In there you'll find a lot of those checks:

    if (!target || target == display)
    {
        // draw on screen
    }
    else
    {
        // draw on surface
    }

I assume that all the else branches could be rewritten to use render
targets instead.

Textures would no longer have to be created with
SDL_TEXTUREACCESS_STREAMING but should use SDL_TEXTUREACCESS_TARGET
instead.

Haven't looked in depth at all the required changes and ramifications,
but if somebody wants to give that a go, please do so!

Kai

_______________________________________________
Adonthell-devel mailing list
Adonthell-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/adonthell-devel

Reply via email to