Mercurial > sdl-ios-xcode
annotate src/hermes/mmx_main.asm @ 1544:ab1e4c41ab71
Fixed bug #33
Mike Frysinger wrote:
> with libsdl-1.2.9, some games (like bomberclone) started
> segfaulting in Gentoo
[...snip...]
> the last change in the last hunk:
[...snip...]
> if i change the statement to read:
> (table[which].blit_features & GetBlitFeatures()) == GetBlitFeatures()
> bomberclone no longer segfaults on my box
Alex Volkov wrote:
> The test "(table[which].blit_features & GetBlitFeatures()) ==
> table[which].blit_features)" is correct, and the previous
> "(table[which].cpu_mmx == SDL_HasMMX())" was actually broken.
I think there is potentially a slightly different cause of the above problem.
During the introduction of the Altivec code, the blit_table struct field
'alpha' got changed from a straightforward enum to a bitmask, which makes
perfect sense by itself. However, now the table driven blitter selection code
in SDL_CalculateBlitN() can choose the wrong blitters when searching for a
NO_ALPHA blitter because of the following code:
int a_need = 0;
...
(a_need & table[which].alpha) == a_need &&
When searching through the normal_blit_2[] table, a SET_ALPHA blitter (like
Blit_RGB565_ARGB8888) can now be selected instead of a NO_ALPHA one, causing
alpha channel bits to appear in a non-alpha destination surface. I suppose this
could theoretically be an indirect cause of the segfault mentioned above.
I *think* this can be fixed by changing to
int a_need = NO_ALPHA;
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Wed, 15 Mar 2006 15:47:49 +0000 |
parents | 2d6dc7de1145 |
children | 393092a3ebf6 |
rev | line source |
---|---|
0 | 1 ; |
2 ; mmx format converter main loops for HERMES | |
3 ; Some routines Copyright (c) 1998 Christian Nentwich (c.nentwich@cs.ucl.ac.uk) | |
4 ; This source code is licensed under the GNU LGPL | |
5 ; | |
6 ; Please refer to the file COPYING.LIB contained in the distribution for | |
7 ; licensing conditions | |
8 ; | |
9 | |
10 BITS 32 | |
11 | |
12 GLOBAL _ConvertMMX | |
13 GLOBAL _mmxreturn | |
14 | |
15 SECTION .text | |
16 | |
17 ;; _ConvertMMX: | |
18 ;; [ESP+8] ConverterInfo* | |
19 ;; -------------------------------------------------------------------------- | |
20 ;; ConverterInfo (ebp+..) | |
21 ;; 0: void *s_pixels | |
22 ;; 4: int s_width | |
23 ;; 8: int s_height | |
24 ;; 12: int s_add | |
25 ;; 16: void *d_pixels | |
26 ;; 20: int d_width | |
27 ;; 24: int d_height | |
28 ;; 28: int d_add | |
29 ;; 32: void (*converter_function)() | |
30 ;; 36: int32 *lookup | |
31 | |
32 _ConvertMMX: | |
33 push ebp | |
34 mov ebp,esp | |
35 | |
36 ; Save the registers used by the blitters, necessary for optimized code | |
37 pusha | |
38 | |
39 mov eax,[ebp+8] | |
40 | |
41 cmp dword [eax+4],BYTE 0 | |
42 je endconvert | |
43 | |
44 mov ebp,eax | |
45 | |
46 mov esi,[ebp+0] | |
47 mov edi,[ebp+16] | |
48 | |
49 y_loop: | |
50 mov ecx,[ebp+4] | |
51 | |
52 jmp [ebp+32] | |
53 | |
54 _mmxreturn: | |
55 add esi,[ebp+12] | |
56 add edi,[ebp+28] | |
57 | |
58 dec dword [ebp+8] | |
59 jnz y_loop | |
60 | |
61 | |
62 ; Restore the registers used by the blitters, necessary for optimized code | |
63 popa | |
64 | |
65 pop ebp | |
66 | |
67 endconvert: | |
68 emms | |
69 | |
70 ret | |
71 | |
1199
2d6dc7de1145
From: Mike Frysinger <vapier@gentoo.org>
Ryan C. Gordon <icculus@icculus.org>
parents:
1166
diff
changeset
|
72 %ifidn __OUTPUT_FORMAT__,elf |
2d6dc7de1145
From: Mike Frysinger <vapier@gentoo.org>
Ryan C. Gordon <icculus@icculus.org>
parents:
1166
diff
changeset
|
73 section .note.GNU-stack noalloc noexec nowrite progbits |
2d6dc7de1145
From: Mike Frysinger <vapier@gentoo.org>
Ryan C. Gordon <icculus@icculus.org>
parents:
1166
diff
changeset
|
74 %endif |