Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Added notes on the next steps for SDL 1.3
Browse files Browse the repository at this point in the history
Moved fill and copy routines to their own files.
  • Loading branch information
slouken committed Aug 16, 2007
1 parent 1ca5a39 commit 1946a4e
Show file tree
Hide file tree
Showing 6 changed files with 405 additions and 364 deletions.
10 changes: 10 additions & 0 deletions NOTES
Expand Up @@ -157,6 +157,16 @@ Change textures to static/streaming. Static textures are not lockable,
streaming textures are lockable and may have system memory pixels available.
SDL_compat will use a streaming video texture, and will never be HWSURFACE,
but may be PREALLOC, if system memory pixels are available.
*** DONE Thu Aug 16 14:18:42 PDT 2007

The software renderer will be abstracted so the surface management can be
used by any renderer that provides functions to copy surfaces to the window.

Blitters...
----
Copy blit and fill rect are optimized with MMX and SSE now.

Here are the pieces we still need:
- Merging SDL texture capabilities into the SDL surface system
- Generic fallback blitter architecture
- Custom fast path blitters
2 changes: 1 addition & 1 deletion src/video/SDL_blit.c
Expand Up @@ -24,7 +24,7 @@
#include "SDL_video.h"
#include "SDL_sysvideo.h"
#include "SDL_blit.h"
#include "SDL_blit_copy.h"
#include "SDL_copy.h"
#include "SDL_RLEaccel_c.h"
#include "SDL_pixels_c.h"

Expand Down
56 changes: 29 additions & 27 deletions src/video/SDL_blit_copy.c → src/video/SDL_copy.c
Expand Up @@ -23,10 +23,38 @@

#include "SDL_video.h"
#include "SDL_blit.h"
#include "SDL_blit_copy.h"
#include "SDL_copy.h"


#ifdef __SSE__
/* This assumes 16-byte aligned src and dst */
static __inline__ void
SDL_memcpySSE(Uint8 * dst, const Uint8 * src, int len)
{
int i;

__m128 values[4];
for (i = len / 64; i--;) {
_mm_prefetch(src, _MM_HINT_NTA);
values[0] = *(__m128 *) (src + 0);
values[1] = *(__m128 *) (src + 16);
values[2] = *(__m128 *) (src + 32);
values[3] = *(__m128 *) (src + 48);
_mm_stream_ps((float *) (dst + 0), values[0]);
_mm_stream_ps((float *) (dst + 16), values[1]);
_mm_stream_ps((float *) (dst + 32), values[2]);
_mm_stream_ps((float *) (dst + 48), values[3]);
src += 64;
dst += 64;
}

if (len & 63)
SDL_memcpy(dst, src, len & 63);
}
#endif /* __SSE__ */

#ifdef __MMX__
/* This assumes 8-byte aligned src and dst */
static __inline__ void
SDL_memcpyMMX(Uint8 * dst, const Uint8 * src, int len)
{
Expand Down Expand Up @@ -60,32 +88,6 @@ SDL_memcpyMMX(Uint8 * dst, const Uint8 * src, int len)
}
#endif /* __MMX__ */

#ifdef __SSE__
static __inline__ void
SDL_memcpySSE(Uint8 * dst, const Uint8 * src, int len)
{
int i;

__m128 values[4];
for (i = len / 64; i--;) {
_mm_prefetch(src, _MM_HINT_NTA);
values[0] = *(__m128 *) (src + 0);
values[1] = *(__m128 *) (src + 16);
values[2] = *(__m128 *) (src + 32);
values[3] = *(__m128 *) (src + 48);
_mm_stream_ps((float *) (dst + 0), values[0]);
_mm_stream_ps((float *) (dst + 16), values[1]);
_mm_stream_ps((float *) (dst + 32), values[2]);
_mm_stream_ps((float *) (dst + 48), values[3]);
src += 64;
dst += 64;
}

if (len & 63)
SDL_memcpy(dst, src, len & 63);
}
#endif /* __SSE__ */

void
SDL_BlitCopy(SDL_BlitInfo * info)
{
Expand Down
File renamed without changes.

0 comments on commit 1946a4e

Please sign in to comment.