Commit a743f751 authored by Ryan C. Gordon's avatar Ryan C. Gordon

Fixed strict aliasing (or inline asm?) issue.

Some versions of GCC need this fix or alpha blending is broken.

  Fixes Bugzilla #648.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%403939
parent 47ede754
...@@ -234,12 +234,12 @@ static void BlitRGBtoRGBSurfaceAlpha128MMX(SDL_BlitInfo *info) ...@@ -234,12 +234,12 @@ static void BlitRGBtoRGBSurfaceAlpha128MMX(SDL_BlitInfo *info)
Uint32 *dstp = (Uint32 *)info->d_pixels; Uint32 *dstp = (Uint32 *)info->d_pixels;
int dstskip = info->d_skip >> 2; int dstskip = info->d_skip >> 2;
Uint32 dalpha = info->dst->Amask; Uint32 dalpha = info->dst->Amask;
Uint8 load[8]; Uint64 load;
*(Uint64 *)load = 0x00fefefe00fefefeULL;/* alpha128 mask */ load = 0x00fefefe00fefefeULL;/* alpha128 mask */
movq_m2r(*load, mm4); /* alpha128 mask -> mm4 */ movq_m2r(load, mm4); /* alpha128 mask -> mm4 */
*(Uint64 *)load = 0x0001010100010101ULL;/* !alpha128 mask */ load = 0x0001010100010101ULL;/* !alpha128 mask */
movq_m2r(*load, mm3); /* !alpha128 mask -> mm3 */ movq_m2r(load, mm3); /* !alpha128 mask -> mm3 */
movd_m2r(dalpha, mm7); /* dst alpha mask */ movd_m2r(dalpha, mm7); /* dst alpha mask */
punpckldq_r2r(mm7, mm7); /* dst alpha mask | dst alpha mask -> mm7 */ punpckldq_r2r(mm7, mm7); /* dst alpha mask | dst alpha mask -> mm7 */
while(height--) { while(height--) {
...@@ -1883,13 +1883,13 @@ static void Blit565to565SurfaceAlphaMMX(SDL_BlitInfo *info) ...@@ -1883,13 +1883,13 @@ static void Blit565to565SurfaceAlphaMMX(SDL_BlitInfo *info)
Uint16 *dstp = (Uint16 *)info->d_pixels; Uint16 *dstp = (Uint16 *)info->d_pixels;
int dstskip = info->d_skip >> 1; int dstskip = info->d_skip >> 1;
Uint32 s, d; Uint32 s, d;
Uint8 load[8]; Uint64 load;
alpha &= ~(1+2+4); /* cut alpha to get the exact same behaviour */ alpha &= ~(1+2+4); /* cut alpha to get the exact same behaviour */
*(Uint64 *)load = alpha; load = alpha;
alpha >>= 3; /* downscale alpha to 5 bits */ alpha >>= 3; /* downscale alpha to 5 bits */
movq_m2r(*load, mm0); /* alpha(0000000A) -> mm0 */ movq_m2r(load, mm0); /* alpha(0000000A) -> mm0 */
punpcklwd_r2r(mm0, mm0); /* 00000A0A -> mm0 */ punpcklwd_r2r(mm0, mm0); /* 00000A0A -> mm0 */
punpcklwd_r2r(mm0, mm0); /* 0A0A0A0A -> mm0 */ punpcklwd_r2r(mm0, mm0); /* 0A0A0A0A -> mm0 */
/* position alpha to allow for mullo and mulhi on diff channels /* position alpha to allow for mullo and mulhi on diff channels
...@@ -1897,10 +1897,10 @@ static void Blit565to565SurfaceAlphaMMX(SDL_BlitInfo *info) ...@@ -1897,10 +1897,10 @@ static void Blit565to565SurfaceAlphaMMX(SDL_BlitInfo *info)
psllq_i2r(3, mm0); psllq_i2r(3, mm0);
/* Setup the 565 color channel masks */ /* Setup the 565 color channel masks */
*(Uint64 *)load = 0x07E007E007E007E0ULL; load = 0x07E007E007E007E0ULL;
movq_m2r(*load, mm4); /* MASKGREEN -> mm4 */ movq_m2r(load, mm4); /* MASKGREEN -> mm4 */
*(Uint64 *)load = 0x001F001F001F001FULL; load = 0x001F001F001F001FULL;
movq_m2r(*load, mm7); /* MASKBLUE -> mm7 */ movq_m2r(load, mm7); /* MASKBLUE -> mm7 */
while(height--) { while(height--) {
DUFFS_LOOP_QUATRO2( DUFFS_LOOP_QUATRO2(
{ {
...@@ -2022,13 +2022,13 @@ static void Blit555to555SurfaceAlphaMMX(SDL_BlitInfo *info) ...@@ -2022,13 +2022,13 @@ static void Blit555to555SurfaceAlphaMMX(SDL_BlitInfo *info)
Uint16 *dstp = (Uint16 *)info->d_pixels; Uint16 *dstp = (Uint16 *)info->d_pixels;
int dstskip = info->d_skip >> 1; int dstskip = info->d_skip >> 1;
Uint32 s, d; Uint32 s, d;
Uint8 load[8]; Uint64 load;
alpha &= ~(1+2+4); /* cut alpha to get the exact same behaviour */ alpha &= ~(1+2+4); /* cut alpha to get the exact same behaviour */
*(Uint64 *)load = alpha; load = alpha;
alpha >>= 3; /* downscale alpha to 5 bits */ alpha >>= 3; /* downscale alpha to 5 bits */
movq_m2r(*load, mm0); /* alpha(0000000A) -> mm0 */ movq_m2r(load, mm0); /* alpha(0000000A) -> mm0 */
punpcklwd_r2r(mm0, mm0); /* 00000A0A -> mm0 */ punpcklwd_r2r(mm0, mm0); /* 00000A0A -> mm0 */
punpcklwd_r2r(mm0, mm0); /* 0A0A0A0A -> mm0 */ punpcklwd_r2r(mm0, mm0); /* 0A0A0A0A -> mm0 */
/* position alpha to allow for mullo and mulhi on diff channels /* position alpha to allow for mullo and mulhi on diff channels
...@@ -2036,10 +2036,10 @@ static void Blit555to555SurfaceAlphaMMX(SDL_BlitInfo *info) ...@@ -2036,10 +2036,10 @@ static void Blit555to555SurfaceAlphaMMX(SDL_BlitInfo *info)
psllq_i2r(3, mm0); psllq_i2r(3, mm0);
/* Setup the 555 color channel masks */ /* Setup the 555 color channel masks */
*(Uint64 *)load = 0x03E003E003E003E0ULL; load = 0x03E003E003E003E0ULL;
movq_m2r(*load, mm4); /* MASKGREEN -> mm4 */ movq_m2r(load, mm4); /* MASKGREEN -> mm4 */
*(Uint64 *)load = 0x001F001F001F001FULL; load = 0x001F001F001F001FULL;
movq_m2r(*load, mm7); /* MASKBLUE -> mm7 */ movq_m2r(load, mm7); /* MASKBLUE -> mm7 */
while(height--) { while(height--) {
DUFFS_LOOP_QUATRO2( DUFFS_LOOP_QUATRO2(
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment