Commit graph

4209 commits

Author SHA1 Message Date
Sam Lantinga
4c83734b3f Fixed debug format 2011-02-17 18:53:46 -08:00
Sam Lantinga
6ade085169 Removed the obsolete NoSTDIO configurations 2011-02-17 12:16:01 -08:00
Sam Lantinga
3746025d7f Allow the application to explicitly request a software renderer. 2011-02-17 12:03:48 -08:00
Sam Lantinga
baf813b8c1 Our minimum Windows version is Windows 2000, so it's okay to directly call InitializeCriticalSectionAndSpinCount().. 2011-02-17 09:26:15 -08:00
Sam Lantinga
58d7fc4732 Fixed bug 1128
Patrick Baggett      2011-02-16 22:58:33 PST

This enhancement is for both x86/x64 Windows.

The SDL implementation of mutexes uses the Win32 API interprocess
synchronization primitive called a "Mutex". This implementation is subpar
because it has a much higher overhead than an intraprocess mutex. The exact
technical details are below, but my tests have shown that for reasonably high
contention (10 threads on 4 physical cores), it has 13x higher overhead than
the Win32 CriticalSection API.

If this enhancement is accepted, I will write a patch to implement SDL mutexes
using the critical section API, which should dramatically reduce overhead and
improve scalability.


-- Tech details --
Normally, Win32 Mutexes are used across process boundaries to synchronize
separate processes. In order to lock or unlock them, a user->kernel space
transition is necessary, even in the uncontented case on a single CPU machine.
Win32 CriticalSection objects can only be used within the same process virtual
address space and thus to lock one, does not require a user->kernel space
transition for the uncontended case, and additionally may spin a short while
before going into kernel wait. This small spin allows a thread to obtain the
lock if the mutex is released shortly after the thread starts spinning, in
effect bypassing the overhead of user->kernel space transition which has higher
overhead than the spinning itself.
2011-02-17 09:13:12 -08:00
Sam Lantinga
ea8037a625 Implemented OpenGL ES RenderClear() 2011-02-17 02:23:48 -08:00
Sam Lantinga
7fda55f8d4 Fixed warnings about unused variables and so forth. 2011-02-17 02:18:41 -08:00
Sam Lantinga
30d36c1c80 Fixed SDL_RenderClear() if the render driver doesn't implement it. 2011-02-17 02:17:38 -08:00
Sam Lantinga
b411d9fc24 Fixed crash when drawing non-textured primitives 2011-02-17 02:16:30 -08:00
Sam Lantinga
765c7da302 Updated deployment target to iPhone/iPad 3.2, and added dependencies on SDL for the demos. 2011-02-16 20:19:02 -08:00
Sam Lantinga
1cbbefce43 Fixed bug 1122 (spinlock fails to compile with -march=armv4t) 2011-02-16 17:17:21 -08:00
Sam Lantinga
d4a7019d95 There are bindings to Go at https://github.com/banthar/Go-SDL 2011-02-16 15:56:37 -08:00
Sam Lantinga
d4acca7166 Renamed SDL_keysym.h to SDL_keycode.h to avoid confusion.
--HG--
rename : include/SDL_keysym.h => include/SDL_keycode.h
2011-02-16 15:46:12 -08:00
Sam Lantinga
d2b922f555 Fixed bug #1090 (SDL_BlitCopyOverlap() assumes memcpy() operates in order)
Even if we're blitting between two different surfaces their pixels might still overlap, because of SDL_CreateRGBSurfaceFrom(), so always use SDL_BlitCopy() and check for overlap in that function.

When handling overlapping surfaces, don't assume that memcpy() iterates forward, instead use memmove() correctly, and provide a fallback implementation of SDL_memmove() that handles the different cases.

Fixed a bug with SDL_memset() not completely filling lengths that aren't a multiple of 4.
Optimized SDL_memcpy() a bit using the same technique as SDL_memset().
2011-02-16 15:25:10 -08:00
Sam Lantinga
dc23c42ea9 The library target directly depends on SDL_revision.h 2011-02-16 14:38:49 -08:00
Sam Lantinga
44d550e466 Updated to remove stdio redirect option 2011-02-16 14:35:38 -08:00
Sam Lantinga
7755315b2d Fixed SDL_revision.h dependencies 2011-02-16 13:02:37 -08:00
Sam Lantinga
9f536cb6f7 Source is not executable... 2011-02-16 12:52:09 -08:00
Sam Lantinga
f4dd9b9456 Allow you to override SDL's main override 2011-02-16 12:27:29 -08:00
Sam Lantinga
0a5c049c24 The scripts to generate header files are no longer necessary. 2011-02-16 12:15:04 -08:00
Sam Lantinga
911522c1fe Updated HG ignore file for Visual C++ files 2011-02-16 05:00:33 -08:00
Sam Lantinga
c2204a539c Fixed bug #1121 (More than one device through SDL_JOYSTICK_DEVICE)
Chusslove Illich      2011-02-13 04:30:28 PST

Currently SDL_JOYSTICK_DEVICE environment variable can be used to add
exactly one topmost device. I think it would be nice if one could also set
several devices (e.g. a stick and a throttle) in this way, as a colon-
separated list. The attached patch implements this
2011-02-16 04:51:13 -08:00
Sam Lantinga
e6accab8ba Fixed bug #1085 (Jump to NULL function pointer on ALSA_OpenDevice)
Bruno      2010-12-16 02:41:51 PST

Fix segfault in ALSA_OpenDevice()

When alsa is linked to libsdl instead of being loaded on demand at runtime the
alsa macro snd_pcm_hw_params_alloca(ptr); misbehaves.

That macro calls snd_pcm_hw_params_sizeof() in order to determine the amount of
memory to allocate but due to mis-placed define that function is replaced with
ALSA_snd_pcm_hw_params_sizeof by preprocessor (and in case of link to alsa that
function pointer is initialized to itself).

Attached patch fixes the issue.
2011-02-16 04:08:28 -08:00
Sam Lantinga
86ccb87283 Fixed bug #1064 (configure still has --enable-stdio-redirect option) 2011-02-16 03:59:39 -08:00
Sam Lantinga
e17d29cd0e Setup the screensaver in the OpenGL case as well. 2011-02-16 02:57:00 -08:00
Sam Lantinga
2266448814 Fixed bug #963 (Crash with OpenGL & window resizing)
The crash was already fixed, but the window doesn't need to be recreated if you're just changing the size of the OpenGL window.
2011-02-16 02:55:46 -08:00
Sam Lantinga
1eebb75596 Building SDL_revision.h is a dependency of installing the headers. :) 2011-02-16 02:55:32 -08:00
Sam Lantinga
e0bf2dc643 Made it possible to build SDL from a fresh checkout without any additional steps.
The trick is that if you're using configure and you don't want to have SDL_config.h and SDL_revision.h to show up as modified, you need to configure and build from a separate directory.

You also need to include SDL_revision.h directly if you want to use the SDL_REVISION constant, as a side effect of these changes.

--HG--
rename : include/SDL_config.h.default => include/SDL_config.h
2011-02-16 02:37:09 -08:00
Sam Lantinga
20ae4187a4 Needed to allocate memory for the shadow surface if we needed to create one. 2011-02-16 01:40:44 -08:00
Sam Lantinga
3c7c3d8d8b Okay, _now_ SDL_WM_ToggleFullScreen() works on all platforms. :) 2011-02-16 01:26:39 -08:00
Sam Lantinga
1738e5f49d Hot damn, SDL_WM_ToggleFullScreen() works on all platforms now. :) 2011-02-16 00:45:10 -08:00
Sam Lantinga
d119c3824f Fixed resetting the Direc3D renderer on mode change 2011-02-16 00:11:48 -08:00
Sam Lantinga
6c726ca475 Fixed a host of issues with Windows fullscreen modes. Toggling fullscreen OpenGL works now in my test environment. 2011-02-15 23:07:14 -08:00
Sam Lantinga
d865e46b13 Allow centering on a different display 2011-02-15 22:51:29 -08:00
Sam Lantinga
3e5d117b19 Fixed gcc -pedantic warning 2011-02-15 21:57:31 -08:00
Sam Lantinga
99260d91a1 Implemented X11 fullscreen toggling with modern window managers 2011-02-15 17:23:02 -08:00
Sam Lantinga
8abd1a0541 Patch to fix includes from Frank Zago 2011-02-15 16:41:04 -08:00
Sam Lantinga
c1b336b8ee Don't accidentally pick a YV12 format as the closest format. 2011-02-15 15:50:21 -08:00
Sam Lantinga
a6be4e7267 Don't reset the viewport unless you have to. 2011-02-15 14:17:42 -08:00
Sam Lantinga
2a4134c20a Whoops, need to actually clip to the viewport in the software renderer. 2011-02-15 14:10:50 -08:00
Sam Lantinga
c804b92b9e Changed the concept of a render clip rect to a render viewport.
The render viewport is automatically re-centered when the window changes size, so applications that don't care will not have to handle recalculating their rendering coordinates.

Fixed API for drawing and filling multiple rectangles - the parameter should be an array of rects, not an array of pointers to rects.

Fixed API for updating window rects for consistency with other APIs - the order is pointer to array followed by count in array.
2011-02-15 13:59:59 -08:00
Ken Rogoway
32d70d6f2b Software scaling support. Not very fast, but it seems to work. 2011-02-14 11:50:18 -06:00
Sam Lantinga
20b4d9f762 Patch from Ken Rogoway:
Migrate all of the recent changes into the SDL VS2005 project file.
Fix missing return value in SDL_pixels.c
Fix compile error in testscale.c, variable was incorrectly named.
Added VS2005 project file for testscale
2011-02-14 00:45:16 -08:00
Sam Lantinga
72cdb910fb Center the old SDL 1.2 screen in the window if we can't get the size we wanted. 2011-02-13 23:09:18 -08:00
Sam Lantinga
98f0920828 Fixed crash while resizing a window on Mac OS X. 2011-02-13 22:53:12 -08:00
Sam Lantinga
da8fc93d71 The format_version isn't used anymore. 2011-02-13 22:30:06 -08:00
Sam Lantinga
19ffc209ef Fixed renderer variable scope. 2011-02-13 14:05:33 -08:00
Sam Lantinga
1c7ff9df09 Removed renderer definition, removed extra -I statements since no other platform has them (files should be explicit in their include paths). 2011-02-13 14:02:37 -08:00
Sam Lantinga
f9a5f416fb Frank Zago to SDL
On 02/12/2011 01:44 PM, Sam Lantinga wrote:
> BTW, you probably want to nuke the NDS renderer and just implement these three
> functions instead:
>     int (*CreateWindowFramebuffer) (_THIS, SDL_Window * window, Uint32 *
> format, void ** pixels, int *pitch);
>     int (*UpdateWindowFramebuffer) (_THIS, SDL_Window * window, int numrects,
> SDL_Rect * rects);
>     void (*DestroyWindowFramebuffer) (_THIS, SDL_Window * window);

Patch attached. The renderer for the DS is not used anymore, but I left the
file in place if someone wants to finish it.

I've also added a README.ds and fixed the spinlocks.
2011-02-13 14:01:02 -08:00
Sam Lantinga
5095592ce5 A few fixes:
Fixed creating render texture framebuffer.
Removed the need for palette watch, added surface format caching.
Added an SDL_DONTFREE flag so you can't free the window and 1.2 shadow surfaces.
2011-02-13 13:46:10 -08:00