--- a/ccdemos/common_sdl.h Mon Apr 28 11:44:11 2008 +0200
+++ b/ccdemos/common_sdl.h Tue Apr 29 13:56:29 2008 +0200
@@ -28,9 +28,10 @@
return;
Uint32 *bufp = (Uint32 *)screen->pixels;
- unsigned char c[3];
for (Float *fd = render_buffer; fd != render_buffer + w*h*3; fd += 3)
{
+#ifdef NO_SSE
+ unsigned char c[3];
for (int i = 0; i < 3; i++)
{
if (fd[i] > 1.0)
@@ -39,6 +40,11 @@
c[i] = (unsigned char)(fd[i] * 255.0);
}
*bufp = SDL_MapRGB(screen->format, c[0], c[1], c[2]);
+#else
+ __m64 m = _mm_cvtps_pi8(_mm_mul_ps(_mm_set_ps1(255.0),
+ _mm_min_ps(mOne, _mm_set_ps(0, fd[2],fd[1],fd[0]))));
+ *bufp = SDL_MapRGB(screen->format, ((char*)&m)[0], ((char*)&m)[1], ((char*)&m)[2]);
+#endif
bufp++;
}