comparison src/video/SDL_blit_A.c @ 2101:c4e0afbcf1f6

Merge r3005:3006 from branches/SDL-1.2: Alpha blending MMX/3DNow register bug.
author Ryan C. Gordon <icculus@icculus.org>
date Wed, 04 Apr 2007 09:36:25 +0000
parents fffea8d6bf92
children 2c835d58faad
comparison
equal deleted inserted replaced
2100:62debeaac5e9 2101:c4e0afbcf1f6
385 movq_r2r(mm7, mm0); /* 00FFFFFF -> mm0 */ 385 movq_r2r(mm7, mm0); /* 00FFFFFF -> mm0 */
386 packsswb_r2r(mm6, mm0); /* 00000FFF -> mm0 (channel mask) */ 386 packsswb_r2r(mm6, mm0); /* 00000FFF -> mm0 (channel mask) */
387 packsswb_r2r(mm6, mm3); /* 0000FFFF -> mm3 */ 387 packsswb_r2r(mm6, mm3); /* 0000FFFF -> mm3 */
388 pxor_r2r(mm0, mm3); /* 0000F000 -> mm3 (~channel mask) */ 388 pxor_r2r(mm0, mm3); /* 0000F000 -> mm3 (~channel mask) */
389 /* get alpha channel shift */ 389 /* get alpha channel shift */
390 movd_m2r(sf->Ashift, mm5); /* Ashift -> mm5 */ 390 __asm__ __volatile__ (
391 "movd %0, %%mm5"
392 : : "rm" ((Uint32) sf->Ashift) ); /* Ashift -> mm5 */
391 393
392 while (height--) { 394 while (height--) {
393 /* *INDENT-OFF* */ 395 /* *INDENT-OFF* */
394 DUFFS_LOOP4({ 396 DUFFS_LOOP4({
395 Uint32 alpha = *srcp & amask; 397 Uint32 alpha = *srcp & amask;
1630 int srcskip = info->s_skip >> 2; 1632 int srcskip = info->s_skip >> 2;
1631 Uint32 *dstp = (Uint32 *) info->d_pixels; 1633 Uint32 *dstp = (Uint32 *) info->d_pixels;
1632 int dstskip = info->d_skip >> 2; 1634 int dstskip = info->d_skip >> 2;
1633 SDL_PixelFormat *sf = info->src; 1635 SDL_PixelFormat *sf = info->src;
1634 Uint32 amask = sf->Amask; 1636 Uint32 amask = sf->Amask;
1635 Uint32 ashift = sf->Ashift;
1636 1637
1637 __asm__( 1638 __asm__(
1638 /* make mm6 all zeros. */ 1639 /* make mm6 all zeros. */
1639 "pxor %%mm6, %%mm6\n" 1640 "pxor %%mm6, %%mm6\n"
1640 /* Make a mask to preserve the alpha. */ 1641 /* Make a mask to preserve the alpha. */
1648 "packsswb %%mm6, %%mm4\n\t" /* 00000FFF -> mm4 (channel mask) */ 1649 "packsswb %%mm6, %%mm4\n\t" /* 00000FFF -> mm4 (channel mask) */
1649 "packsswb %%mm6, %%mm3\n\t" /* 0000FFFF -> mm3 */ 1650 "packsswb %%mm6, %%mm3\n\t" /* 0000FFFF -> mm3 */
1650 "pxor %%mm4, %%mm3\n\t" /* 0000F000 -> mm3 (~channel mask) */ 1651 "pxor %%mm4, %%mm3\n\t" /* 0000F000 -> mm3 (~channel mask) */
1651 /* get alpha channel shift */ 1652 /* get alpha channel shift */
1652 "movd %1, %%mm5\n\t" /* Ashift -> mm5 */ 1653 "movd %1, %%mm5\n\t" /* Ashift -> mm5 */
1653 : /* nothing */ : "m"(amask), "m"(ashift)); 1654 : /* nothing */ : "rm"(amask), "rm"((Uint32) sf->Ashift));
1654 1655
1655 while (height--) { 1656 while (height--) {
1656 1657
1657 /* *INDENT-OFF* */ 1658 /* *INDENT-OFF* */
1658 DUFFS_LOOP4({ 1659 DUFFS_LOOP4({