[SDL] slowdown of alpha blits when colorkey is enabled
Clemens Kirchgatterer
clemens at thf.ath.cx
Wed Apr 14 22:33:28 PDT 2004
Stephane Marchesin <stephane.marchesin at wanadoo.fr> wrote:
> Clemens Kirchgatterer wrote:
> > Stephane Marchesin <stephane.marchesin at wanadoo.fr> wrote:
> > in the latter case, there would be room for improvment within sdl.
> There's always room for improvement :)
>
> I just looked and there are no optimized functions for colorkeyed
> blitting. Plus, the branch is hard for the cpu to predict, and a
> misprediction costs at least 15 cpu cycles on any modern cpu, compare
> this to the number of cycles needed to blit a pixel (far fewer than 5,
> depending on the pixel format) and you have a good explanation for the
> slower speed. i686 and upper CPUs have an instruction (cmov) for
> conditional move that avoids branches, but the blitting code doesn't
> lend itself well to this optimization, so gcc won't be able to do it.
>
> The function you're interested in is called BlitNtoNSurfaceAlphaKey
> and is in SDL12/src/video/SDL_blit_A.c, you might want to see what you
> can do to speed it up.
thank you very much. though, i fear my 6510 assembly knowledge will not
be to helpful. :-/
anyway, i will have a look ...
> - that can be a problem if you use, for example, two different pixel
> format with the same bpp
how could i end up with this? only when i create surfaces with
different maskX values. correct?
> - backends might do other transformations than just changing pixel
> format on the surface, so I think displayformating is just the way to
> go to be on the safe side.
so you do a DisplayFormat after each CreateSurface ?
thank you very much for your suggestions...
clemens
More information about the SDL
mailing list