Mercurial > sdl-ios-xcode
annotate src/hermes/mmx_main.asm @ 1120:8e1fde455471
Patch by me to fix crash described below.
--ryan.
To: sdl@libsdl.org
From: Rainer Deyke <rainerd@eldwood.com>
Date: Tue, 16 Aug 2005 01:08:18 -0600
Subject: [SDL] Bug report: SDL_CreateRGBSurface with SDL_HWSURFACE crashes
If SDL is in full-screen mode with a hardware video surface on OS X,
SDL_CreateRGBSurface with SDL_HWSURFACE crashes. The crash occurs on
line 109 of SDL_Surface.c. This was tested on OS X 10.3.9 with both SDL
1.2.8 and the latest CVS. Here is a small C++ program that demonstrates
the problem:
#include "SDL.h"
#include <stdio.h>
namespace {
void wait_for_key()
{
SDL_Event e;
printf("%d\n", SDL_GetAppState());
while (SDL_WaitEvent(&e)) {
if (e.type == SDL_KEYDOWN || e.type == SDL_QUIT) return;
}
}
}
int main(int, char *[])
{
SDL_Init(SDL_INIT_VIDEO);
SDL_Surface *screen
= SDL_SetVideoMode(640, 480, 32, SDL_FULLSCREEN | SDL_HWSURFACE);
SDL_Surface *s = SDL_CreateRGBSurface(SDL_HWSURFACE, 640, 480, 32,
screen->format->Rmask, screen->format->Gmask,
screen->format->Bmask, screen->format->Amask);
wait_for_key();
if (s) SDL_FreeSurface(s);
SDL_Quit();
printf("Success!\n");
return 0;
}
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Thu, 18 Aug 2005 06:46:32 +0000 |
parents | 74212992fb08 |
children | da33b7e6d181 |
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 | |
16 SECTION .text | |
17 | |
18 ;; _ConvertMMX: | |
19 ;; [ESP+8] ConverterInfo* | |
20 ;; -------------------------------------------------------------------------- | |
21 ;; ConverterInfo (ebp+..) | |
22 ;; 0: void *s_pixels | |
23 ;; 4: int s_width | |
24 ;; 8: int s_height | |
25 ;; 12: int s_add | |
26 ;; 16: void *d_pixels | |
27 ;; 20: int d_width | |
28 ;; 24: int d_height | |
29 ;; 28: int d_add | |
30 ;; 32: void (*converter_function)() | |
31 ;; 36: int32 *lookup | |
32 | |
33 _ConvertMMX: | |
34 push ebp | |
35 mov ebp,esp | |
36 | |
37 ; Save the registers used by the blitters, necessary for optimized code | |
38 pusha | |
39 | |
40 mov eax,[ebp+8] | |
41 | |
42 cmp dword [eax+4],BYTE 0 | |
43 je endconvert | |
44 | |
45 mov ebp,eax | |
46 | |
47 mov esi,[ebp+0] | |
48 mov edi,[ebp+16] | |
49 | |
50 y_loop: | |
51 mov ecx,[ebp+4] | |
52 | |
53 jmp [ebp+32] | |
54 | |
55 _mmxreturn: | |
56 add esi,[ebp+12] | |
57 add edi,[ebp+28] | |
58 | |
59 dec dword [ebp+8] | |
60 jnz y_loop | |
61 | |
62 | |
63 ; Restore the registers used by the blitters, necessary for optimized code | |
64 popa | |
65 | |
66 pop ebp | |
67 | |
68 endconvert: | |
69 emms | |
70 | |
71 ret | |
72 | |
73 | |
74 |