| Summary: | Optimized C 32bit RGB<->RGBA alpha masking blitters | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Ryan C. Gordon <icculus> |
| Component: | video | Assignee: | Ryan C. Gordon <icculus> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | codepro |
| Version: | HG 1.2 | ||
| Hardware: | All | ||
| OS: | All | ||
| Attachments: | optimized blitters patch | ||
|
Description
Ryan C. Gordon
2006-01-03 11:50:14 UTC
Created attachment 9 [details]
optimized blitters patch
I can't see how this patch's blitter ever gets called. If there's no alpha and the RGB masks match, SDL_CalculateBlit() will choose SDL_BlitCopy() at a higher level without calling SDL_CalculateBlitN(), where this patch's blitter would be chosen. If there is alpha, we'll end up in SDL_CalculateAlphaBlit(). Am I missing something here? --ryan. The SDL_CalculateBlit() will never choose SDL_BlitCopy() because map->identity will never be set for such blits -- one surface has Amask and the other does not. In the case of a RGBA->RGB blit, the blitter would be called when the source (RGBA) surface does not have SDL_SRCALPHA flag set. In this case, the blit_index would be 0 (assuming SDL_SRCOLORKEY is not there either), and SDL_CalculateAlphaBlit() would not get called. Oh, I see. I had SRCALPHA set on the source surface, which prevented me from hitting this blitter. I've updated SDL12/test/testblitspeed.c so I can exercise this codepath...this blitter is a little more than 3x faster than what it would otherwise use, which is pretty darned nice. :) I tweaked the patch so that it'll try to find a blitter in the normal_blit table first, though...this will let it fall into the Altivec blitters on PowerPC, which will probably beat this code, and future-proofs against an SSE (whatever) version being added later. It'll use this if we ended up with BlitNtoN as the blitter in the normal_blit table. It's in CVS now, thanks! --ryan. Setting Sam as "QA Contact" on all bugs (even resolved ones) so he'll definitely be in the loop to any further discussion here about SDL. --ryan. |