: "=r" (p) : "r" (p) ); \
((GLuint *)rgba)[0] = p; \
} while (0)
+# elif defined( MESA_BIG_ENDIAN )
+ /* On PowerPC with GCC 3.4.2 the shift madness below becomes a single
+ * rotlwi instruction. It also produces good code on SPARC.
+ */
+# define READ_RGBA( rgba, _x, _y ) \
+ do { \
+ GLuint p = *(volatile GLuint *) GET_SRC_PTR(_x, _y); \
+ GLuint t = p; \
+ *((uint32_t *) rgba) = (t >> 24) | (p << 8); \
+ } while (0)
# else
# define READ_RGBA( rgba, _x, _y ) \
do { \
}
-#if defined(USE_MMX_ASM)
+#if defined(USE_MMX_ASM) && \
+ (((SPANTMP_PIXEL_FMT == GL_BGRA) && \
+ (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV)) || \
+ ((SPANTMP_PIXEL_FMT == GL_RGB) && \
+ (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_SHORT_5_6_5)))
static void TAG2(ReadRGBASpan,_MMX)( const GLcontext *ctx,
GLuint n, GLint x, GLint y,
GLubyte rgba[][4])
__asm__ __volatile__( "emms" );
#endif
- HW_LOCK()
+ HW_READ_LOCK()
{
GLint x1,n1;
LOCAL_VARS;
{
const char * src = GET_SRC_PTR( x1, y );
+#if (SPANTMP_PIXEL_FMT == GL_RGB) && \
+ (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_SHORT_5_6_5)
+ _generic_read_RGBA_span_RGB565_MMX( src, rgba[i], n1 );
+#else
_generic_read_RGBA_span_BGRA8888_REV_MMX( src, rgba[i], n1 );
+#endif
}
}
HW_ENDCLIPLOOP();
}
- HW_UNLOCK();
+ HW_READ_UNLOCK();
#ifndef USE_INNER_EMMS
__asm__ __volatile__( "emms" );
#endif
#endif
-#if defined(USE_SSE_ASM)
+#if defined(USE_SSE_ASM) && \
+ (SPANTMP_PIXEL_FMT == GL_BGRA) && \
+ (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV)
static void TAG2(ReadRGBASpan,_SSE2)( const GLcontext *ctx,
GLuint n, GLint x, GLint y,
GLubyte rgba[][4])
{
- HW_LOCK()
+ HW_READ_LOCK()
{
GLint x1,n1;
LOCAL_VARS;
}
HW_ENDCLIPLOOP();
}
- HW_UNLOCK();
+ HW_READ_UNLOCK();
}
#endif
-#if defined(USE_SSE_ASM)
+#if defined(USE_SSE_ASM) && \
+ (SPANTMP_PIXEL_FMT == GL_BGRA) && \
+ (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV)
static void TAG2(ReadRGBASpan,_SSE)( const GLcontext *ctx,
GLuint n, GLint x, GLint y,
GLubyte rgba[][4])
__asm__ __volatile__( "emms" );
#endif
- HW_LOCK()
+ HW_READ_LOCK()
{
GLint x1,n1;
LOCAL_VARS;
}
HW_ENDCLIPLOOP();
}
- HW_UNLOCK();
+ HW_READ_UNLOCK();
#ifndef USE_INNER_EMMS
__asm__ __volatile__( "emms" );
#endif
swdd->WriteMonoRGBAPixels = TAG(WriteMonoRGBAPixels);
swdd->ReadRGBAPixels = TAG(ReadRGBAPixels);
-#if defined(USE_SSE_ASM)
+#if defined(USE_SSE_ASM) && \
+ (SPANTMP_PIXEL_FMT == GL_BGRA) && \
+ (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV)
if ( cpu_has_xmm2 ) {
if (DBG) fprintf( stderr, "Using %s version of ReadRGBASpan\n", "SSE2" );
swdd->ReadRGBASpan = TAG2(ReadRGBASpan, _SSE2);
}
else
#endif
-#if defined(USE_SSE_ASM)
+#if defined(USE_SSE_ASM) && \
+ (SPANTMP_PIXEL_FMT == GL_BGRA) && \
+ (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV)
if ( cpu_has_xmm ) {
if (DBG) fprintf( stderr, "Using %s version of ReadRGBASpan\n", "SSE" );
swdd->ReadRGBASpan = TAG2(ReadRGBASpan, _SSE);
}
else
#endif
-#if defined(USE_MMX_ASM)
+#if defined(USE_MMX_ASM) && \
+ (((SPANTMP_PIXEL_FMT == GL_BGRA) && \
+ (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV)) || \
+ ((SPANTMP_PIXEL_FMT == GL_RGB) && \
+ (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_SHORT_5_6_5)))
if ( cpu_has_mmx ) {
if (DBG) fprintf( stderr, "Using %s version of ReadRGBASpan\n", "MMX" );
swdd->ReadRGBASpan = TAG2(ReadRGBASpan, _MMX);