doesn anyone know if there's a way to optimize the SDL 1.2 blittling routines?
Using 32 bit mode is slow even in 640x480 if there are a certain number of blitting operations. Could be possible to substitute at least the blitting part using the compositing? This probably would imply the conversion of an SDL surface to an amiga surface. What do you think about?
Looks like normal bitmaps. Compositing should be able to handle most of these formats I presume. At this time there is probably some incompatibility between the surfaces most SDL programs use and Amiga, so a software conversion has to be run before the bitmap is blitted.
I don't know where this conversion happens. Maybe there is a manual copy/conversion from SDL to an Amiga bitmap somewhere that is actually unnecessary, but added for maximum platform independence. It would probably be possible to use a blitting function here for most cases, or maybe even skip this step completely, just put it on a composition bitmap and off it goes. Don't know the abstraction inside SDL, but it's probably quite high so lots of conversions and layers needed to go through.
Software developer for Amiga OS3 and OS4. Develops for OnyxSoft and the Amiga using E and C and occasionally C++
/* Create surface hardware record if not already present */
if (!surface->hwdata)
surface->hwdata = SaveAllocPooled(_this->hidden, sizeof(struct private_hwdata));
if (surface->hwdata) {
struct BitMap *friend_bitmap;
This one doesn´t use SDL at all... it´s more after "CompositePOC" (Aminet). The concept used there is not very SDL-ish, and I think that compositing could be used in SDL in very few points (blitting incl. alpha channel, for example. But not with RLE surfaces etc.)
This one doesn´t use SDL at all... it´s more after "CompositePOC" (Aminet). The concept used there is not very SDL-ish, and I think that compositing could be used in SDL in very few points (blitting incl. alpha channel, for example. But not with RLE surfaces etc.)
Even if it is only needed with alpha blitting (& maybe blitting with 2D transforms), implementing it could make a big difference. If a game uses alpha blitting to render almost everything, then accelerating that function becomes critical. From memory, lack of HW accelerated alpha blitting was a key performance killer for several SDL games.
As an aside, the Quake III engine renders pretty much everything using glDrawElementsTriangles() with arrays of triangles whose vertices are in tri-strip order (and uses compiled vertex arrays where possible). That makes this one particular draw function and mode performance critical for that engine. Indeed, I've read that ATI implemented driver optimizations specifically for Quake III based on the above.
I don´t know the implementation details of the SDL alpha blit function, but I would think that it blits rectangles.
AbbayeDesMortes uses the vertex mode of CompositeTags() (as I do in my several test programs *hint* ), that´s why I think that it isn´t very SDL-ish...
I don´t know the implementation details of the SDL alpha blit function, but I would think that it blits rectangles.
If SDL doesn't support 2D rotation & other transformations, then that should make implementing HW acceleration easier.
Quote:
AbbayeDesMortes uses the vertex mode of CompositeTags() (as I do in my several test programs *hint* ), that´s why I think that it isn´t very SDL-ish...
Not sure what you mean here. The one question that matters is if CompositeTags() can do what SDL's alpha blitting is supposed to do. So long as SDL doesn't use a premultiplied alpha, then I'd expect that the answer is: yes, it can.
I agree "Abbaye des morts" currently dont use SDL at all SDL calls in original sources have been replaced with AmigaOS equivalent for the Amiga port So there is now a function for drawing rectangular "sprite" that works the same ways as SDL but use CompositeTags >uses the vertex mode of CompositeTags() Yes but that is not a problem as it used to draw a rectangular "sprite" but let you the freedom to rotate/resize it if needed (like CompositePoc)
Here's a function where to look at, as well as the other functions present in the SDL_os4utils.c
/*
* Find a suitable AmigaOS screenmode to use for an SDL
* screen of the specified width, height, bits-per-pixel
* and SDL flags.
*
* Actually we ignore the flags for now, but it may come
* in handy later.
*/
uint32
os4video_FindMode(uint32 width, uint32 height, uint32 bpp, uint32 flags)
{
/* Get a list of p96 formats for this bpp */
const RGBFTYPE *p96Format = os4video_GetP96FormatsForBpp(bpp);
/* Try each p96 format in the list */
while (*p96Format != RGBFB_NONE)
{
/* And see if there is a mode of sufficient size for the p96 format */
foundMode = findModeWithPixelFormat (width, height, *p96Format, &foundWidth, &foundHeight);
if (foundMode != INVALID_ID)
{
dprintf("Found mode %08lx with height:%d width:%d\n", foundMode, foundWidth, foundHeight);
return foundMode;
}
/* Otherwise try the next format */
p96Format++;
}
I am working with experimental SDL 1.2 library which uses compositing for alpha blits. It currently works in fullscreen only (with SDL_HWSURFACE). Colorkey emulation is planned via alpha channel.
Hans: SDL1 transparent blitting operations are per-pixel alpha, per-surface alpha and color key, and there is no scaling/rotation. SDL2 seems to be a different beast.
One more thing: if both source surface and display surface are SDL_HWSURFACE (== BMF_DISPLAYABLE), SDL (opaque) blitting is HW accelerated. IIRC this is currently only possible in fullscreen.
I was trying to do the same (not with the alpha part, btw). Actually i was about to substitute all the old IP96 using the IGraphics part of the new SDK.
It's a sort of of multiple sprite blitting and the usage of a particle system. Yes, alpha is used. Source and destination surfaces are SDL surface, 32 bit.