We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 36

Summary: Problems with Altivec alpha-blitting code
Product: SDL Reporter: Richard Drummond <evilrich>
Component: videoAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: 1.2.9   
Hardware: PowerPC   
OS: Mac OS X (All)   
Attachments: Fix for altivec alpha-blitting

Description Richard Drummond 2006-01-07 07:47:08 UTC
There are a couple of issues with the selection of Altivec alpha-blitting routines in CalculateAlphaBlit() in src/video/SDL_Blit_A.c.

1) There's no check for the presence of Altivec when checking if the Blit32to565PixelAlphaAltivec() routine can be selected.

2) Altivec cannot be used in video memory, and there's no check if the destination surface is a hardware surface. (Alpha-blitting to a hardware surface with GPU support is a bad idea, but somebody's bound to do it anyway.)

Patch to fix these attached.
Comment 1 Richard Drummond 2006-01-07 07:48:23 UTC
Created attachment 18 [details]
Fix for altivec alpha-blitting
Comment 2 Ryan C. Gordon 2006-01-07 09:46:46 UTC
Are you sure Altivec can't be used in video memory? I would think it would just look like regular address space to the CPU, but I've never tried.

--ryan.

Comment 3 Richard Drummond 2006-01-07 10:05:01 UTC
> Are you sure Altivec can't be used in video memory?

Fairly sure. I get a alignment exception here on AmigaOS when trying to do a load to an Altivec register from video memory (even when the address to load from is 16-byte-aligned). I've been told that Altivec only works in cacheable memory (video memory is cache inhibited).

Comment 4 Ryan C. Gordon 2006-01-08 16:19:08 UTC
Sounds reasonable. Patch applied.

Thanks!

--ryan.
Comment 5 Ryan C. Gordon 2006-01-27 11:23:10 UTC
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.