[SDL] Alpha blending bug - fixed?
Frank Mehnert
fm3 at os.inf.tu-dresden.de
Tue Nov 21 14:59:01 PST 2006
Hi,
the original code takes the _address_ of the sf->Ashift variable and passes
this address to the assembler, because the 'm' constraint is used! Therefore
the movd instruction will not only load the content of sf->Ashift into
the mm5 register but also the following bits of the SDL_Pixelformat
structure (the lower three bytes of Rmask). The original propose of using the
local ashift variable (which is 32 bits wide) as input for the assembler
statement was correct.
To force gcc to load sf->Amask into a register you could also use
- : /* nothing */ : "m" (sf->Amask), "m" (sf->Ashift) );
+ : /* nothing */ : "r" (sf->Amask), "r" ((Uint32) sf->Ashift) );
Note the "r" constraint.
Kind regards,
Frank
On Tuesday 21 November 2006 22:51, Gabriel Gambetta wrote:
> Thanks for listening :)
>
> The patch you sent doesn't even compile -
>
> ./src/video/SDL_blit_A.c: In function 'BlitRGBtoRGBPixelAlphaMMX3DNOW':
> ./src/video/SDL_blit_A.c:1571: error: memory input 1 is not directly
> addressable
>
> In any case I guess GCC should be smart enough to make this work as
> expected, whether it's an alignment issue or a data size issue. GCC bug
> maybe?
>
> --Gabriel
>
> El mar, 21-11-2006 a las 16:30 -0500, Ryan C. Gordon escribió:
> > > The only thing I could find out was that ashift is 32-bit aligned but
> > > sf->Ashift isn't:
> >
> > I don't think it's an alignment issue, since GCC should be smart enough
> > to get it into a register even if unaligned...however, sf->AShift is 8
> > bits, and ashift is 32, which is probably why you get different
> > results...it probably landed in (say) %al instead of %eax, leaving junk
> > in the rest of the register's bits.
> >
> > Try the attached patch and see if it works, too.
>
> _______________________________________________
> SDL mailing list
> SDL at libsdl.org
> http://www.libsdl.org/mailman/listinfo/sdl
--
## Dept. of Computer Science, Dresden University of Technology, Germany ##
## http://os.inf.tu-dresden.de/~fm3 ##
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20061121/7457d71b/attachment.pgp
More information about the SDL
mailing list