r300: fix valgrind warnings
[mesa.git] / src / mesa / drivers / dri / common / spantmp2.h
1 /*
2 * Copyright 2000-2001 VA Linux Systems, Inc.
3 * (C) Copyright IBM Corporation 2004
4 * All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * on the rights to use, copy, modify, merge, publish, distribute, sub
10 * license, and/or sell copies of the Software, and to permit persons to whom
11 * the Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice (including the next
14 * paragraph) shall be included in all copies or substantial portions of the
15 * Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
20 * VA LINUX SYSTEM, IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
21 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
22 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
23 * USE OR OTHER DEALINGS IN THE SOFTWARE.
24 */
25
26 /**
27 * \file spantmp2.h
28 *
29 * Template file of span read / write functions.
30 *
31 * \author Keith Whitwell <keithw@tungstengraphics.com>
32 * \author Gareth Hughes <gareth@nvidia.com>
33 * \author Ian Romanick <idr@us.ibm.com>
34 */
35
36 #include "main/colormac.h"
37 #include "spantmp_common.h"
38
39 #ifndef DBG
40 #define DBG 0
41 #endif
42
43 #ifndef HW_READ_CLIPLOOP
44 #define HW_READ_CLIPLOOP() HW_CLIPLOOP()
45 #endif
46
47 #ifndef HW_WRITE_CLIPLOOP
48 #define HW_WRITE_CLIPLOOP() HW_CLIPLOOP()
49 #endif
50
51 #if (SPANTMP_PIXEL_FMT == GL_RGB) && (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_SHORT_5_6_5)
52
53 /**
54 ** GL_RGB, GL_UNSIGNED_SHORT_5_6_5
55 **/
56
57 #ifndef GET_VALUE
58 #ifndef GET_PTR
59 #define GET_PTR(_x, _y) (buf + (_x) * 2 + (_y) * pitch)
60 #endif
61
62 #define GET_VALUE(_x, _y) *(volatile GLushort *)(GET_PTR(_x, _y))
63 #define PUT_VALUE(_x, _y, _v) *(volatile GLushort *)(GET_PTR(_x, _y)) = (_v)
64 #endif /* GET_VALUE */
65
66 #define INIT_MONO_PIXEL(p, color) \
67 p = PACK_COLOR_565( color[0], color[1], color[2] )
68
69 #define WRITE_RGBA( _x, _y, r, g, b, a ) \
70 PUT_VALUE(_x, _y, ((((int)r & 0xf8) << 8) | \
71 (((int)g & 0xfc) << 3) | \
72 (((int)b & 0xf8) >> 3))) \
73
74 #define WRITE_PIXEL( _x, _y, p ) PUT_VALUE(_x, _y, p)
75
76 #define READ_RGBA( rgba, _x, _y ) \
77 do { \
78 GLushort p = GET_VALUE(_x, _y); \
79 rgba[0] = ((p >> 8) & 0xf8) * 255 / 0xf8; \
80 rgba[1] = ((p >> 3) & 0xfc) * 255 / 0xfc; \
81 rgba[2] = ((p << 3) & 0xf8) * 255 / 0xf8; \
82 rgba[3] = 0xff; \
83 } while (0)
84
85 #elif (SPANTMP_PIXEL_FMT == GL_BGRA) && (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_SHORT_4_4_4_4_REV)
86
87 /**
88 ** GL_BGRA, GL_UNSIGNED_SHORT_4_4_4_4_REV
89 **/
90
91 #ifndef GET_VALUE
92 #ifndef GET_PTR
93 #define GET_PTR(_x, _y) (buf + (_x) * 2 + (_y) * pitch)
94 #endif
95
96 #define GET_VALUE(_x, _y) *(volatile GLushort *)(GET_PTR(_x, _y))
97 #define PUT_VALUE(_x, _y, _v) *(volatile GLushort *)(GET_PTR(_x, _y)) = (_v)
98 #endif /* GET_VALUE */
99
100 #define INIT_MONO_PIXEL(p, color) \
101 p = PACK_COLOR_4444(color[3], color[0], color[1], color[2])
102
103 #define WRITE_RGBA( _x, _y, r, g, b, a ) \
104 PUT_VALUE(_x, _y, PACK_COLOR_4444(a, r, g, b)) \
105
106 #define WRITE_PIXEL( _x, _y, p ) PUT_VALUE(_x, _y, p)
107
108 #define READ_RGBA( rgba, _x, _y ) \
109 do { \
110 GLushort p = GET_VALUE(_x, _y); \
111 rgba[0] = ((p >> 8) & 0xf) * 0x11; \
112 rgba[1] = ((p >> 4) & 0xf) * 0x11; \
113 rgba[2] = ((p >> 0) & 0xf) * 0x11; \
114 rgba[3] = ((p >> 12) & 0xf) * 0x11; \
115 } while (0)
116
117
118 #elif (SPANTMP_PIXEL_FMT == GL_BGRA) && (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_SHORT_1_5_5_5_REV)
119
120 /**
121 ** GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5_REV
122 **/
123
124 #ifndef GET_VALUE
125 #ifndef GET_PTR
126 #define GET_PTR(_x, _y) (buf + (_x) * 2 + (_y) * pitch)
127 #endif
128
129 #define GET_VALUE(_x, _y) *(volatile GLushort *)(GET_PTR(_x, _y))
130 #define PUT_VALUE(_x, _y, _v) *(volatile GLushort *)(GET_PTR(_x, _y)) = (_v)
131 #endif /* GET_VALUE */
132
133 #define INIT_MONO_PIXEL(p, color) \
134 p = PACK_COLOR_1555(color[3], color[0], color[1], color[2])
135
136 #define WRITE_RGBA( _x, _y, r, g, b, a ) \
137 PUT_VALUE(_x, _y, PACK_COLOR_1555(a, r, g, b)) \
138
139 #define WRITE_PIXEL( _x, _y, p ) PUT_VALUE(_x, _y, p)
140
141 #define READ_RGBA( rgba, _x, _y ) \
142 do { \
143 GLushort p = GET_VALUE(_x, _y); \
144 rgba[0] = ((p >> 7) & 0xf8) * 255 / 0xf8; \
145 rgba[1] = ((p >> 2) & 0xf8) * 255 / 0xf8; \
146 rgba[2] = ((p << 3) & 0xf8) * 255 / 0xf8; \
147 rgba[3] = ((p >> 15) & 0x1) * 0xff; \
148 } while (0)
149
150 #elif (SPANTMP_PIXEL_FMT == GL_BGRA) && (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV)
151
152 /**
153 ** GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV
154 **/
155
156 #ifndef GET_VALUE
157 #ifndef GET_PTR
158 #define GET_PTR(_x, _y) ( buf + (_x) * 4 + (_y) * pitch)
159 #endif
160
161 #define GET_VALUE(_x, _y) *(volatile GLuint *)(GET_PTR(_x, _y))
162 #define PUT_VALUE(_x, _y, _v) *(volatile GLuint *)(GET_PTR(_x, _y)) = (_v)
163 #endif /* GET_VALUE */
164
165 # define INIT_MONO_PIXEL(p, color) \
166 p = PACK_COLOR_8888(color[3], color[0], color[1], color[2])
167
168 # define WRITE_RGBA(_x, _y, r, g, b, a) \
169 PUT_VALUE(_x, _y, ((r << 16) | \
170 (g << 8) | \
171 (b << 0) | \
172 (a << 24)))
173
174 #define WRITE_PIXEL(_x, _y, p) PUT_VALUE(_x, _y, p)
175
176 # if defined( USE_X86_ASM )
177 # define READ_RGBA(rgba, _x, _y) \
178 do { \
179 GLuint p = GET_VALUE(_x, _y); \
180 __asm__ __volatile__( "bswap %0; rorl $8, %0" \
181 : "=r" (p) : "0" (p) ); \
182 ((GLuint *)rgba)[0] = p; \
183 } while (0)
184 # elif defined( MESA_BIG_ENDIAN )
185 /* On PowerPC with GCC 3.4.2 the shift madness below becomes a single
186 * rotlwi instruction. It also produces good code on SPARC.
187 */
188 # define READ_RGBA( rgba, _x, _y ) \
189 do { \
190 GLuint p = GET_VALUE(_x, _y); \
191 GLuint t = p; \
192 *((uint32_t *) rgba) = (t >> 24) | (p << 8); \
193 } while (0)
194 # else
195 # define READ_RGBA( rgba, _x, _y ) \
196 do { \
197 GLuint p = GET_VALUE(_x, _y); \
198 rgba[0] = (p >> 16) & 0xff; \
199 rgba[1] = (p >> 8) & 0xff; \
200 rgba[2] = (p >> 0) & 0xff; \
201 rgba[3] = (p >> 24) & 0xff; \
202 } while (0)
203 # endif
204
205 #else
206 #error SPANTMP_PIXEL_FMT must be set to a valid value!
207 #endif
208
209
210
211 /**
212 ** Assembly routines.
213 **/
214
215 #if defined( USE_MMX_ASM ) || defined( USE_SSE_ASM )
216 #include "x86/read_rgba_span_x86.h"
217 #include "x86/common_x86_asm.h"
218 #endif
219
220 static void TAG(WriteRGBASpan)( GLcontext *ctx,
221 struct gl_renderbuffer *rb,
222 GLuint n, GLint x, GLint y,
223 const void *values, const GLubyte mask[] )
224 {
225 HW_WRITE_LOCK()
226 {
227 const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values;
228 GLint x1;
229 GLint n1;
230 LOCAL_VARS;
231
232 y = Y_FLIP(y);
233
234 HW_WRITE_CLIPLOOP()
235 {
236 GLint i = 0;
237 CLIPSPAN(x,y,n,x1,n1,i);
238
239 if (DBG) fprintf(stderr, "WriteRGBASpan %d..%d (x1 %d)\n",
240 (int)i, (int)n1, (int)x1);
241
242 if (mask)
243 {
244 for (;n1>0;i++,x1++,n1--)
245 if (mask[i])
246 WRITE_RGBA( x1, y,
247 rgba[i][0], rgba[i][1],
248 rgba[i][2], rgba[i][3] );
249 }
250 else
251 {
252 for (;n1>0;i++,x1++,n1--)
253 WRITE_RGBA( x1, y,
254 rgba[i][0], rgba[i][1],
255 rgba[i][2], rgba[i][3] );
256 }
257 }
258 HW_ENDCLIPLOOP();
259 }
260 HW_WRITE_UNLOCK();
261 }
262
263 static void TAG(WriteRGBSpan)( GLcontext *ctx,
264 struct gl_renderbuffer *rb,
265 GLuint n, GLint x, GLint y,
266 const void *values, const GLubyte mask[] )
267 {
268 HW_WRITE_LOCK()
269 {
270 const GLubyte (*rgb)[3] = (const GLubyte (*)[3]) values;
271 GLint x1;
272 GLint n1;
273 LOCAL_VARS;
274
275 y = Y_FLIP(y);
276
277 HW_WRITE_CLIPLOOP()
278 {
279 GLint i = 0;
280 CLIPSPAN(x,y,n,x1,n1,i);
281
282 if (DBG) fprintf(stderr, "WriteRGBSpan %d..%d (x1 %d)\n",
283 (int)i, (int)n1, (int)x1);
284
285 if (mask)
286 {
287 for (;n1>0;i++,x1++,n1--)
288 if (mask[i])
289 WRITE_RGBA( x1, y, rgb[i][0], rgb[i][1], rgb[i][2], 255 );
290 }
291 else
292 {
293 for (;n1>0;i++,x1++,n1--)
294 WRITE_RGBA( x1, y, rgb[i][0], rgb[i][1], rgb[i][2], 255 );
295 }
296 }
297 HW_ENDCLIPLOOP();
298 }
299 HW_WRITE_UNLOCK();
300 }
301
302 static void TAG(WriteRGBAPixels)( GLcontext *ctx,
303 struct gl_renderbuffer *rb,
304 GLuint n, const GLint x[], const GLint y[],
305 const void *values, const GLubyte mask[] )
306 {
307 HW_WRITE_LOCK()
308 {
309 const GLubyte (*rgba)[4] = (const GLubyte (*)[4]) values;
310 GLint i;
311 LOCAL_VARS;
312
313 if (DBG) fprintf(stderr, "WriteRGBAPixels\n");
314
315 HW_WRITE_CLIPLOOP()
316 {
317 if (mask)
318 {
319 for (i=0;i<n;i++)
320 {
321 if (mask[i]) {
322 const int fy = Y_FLIP(y[i]);
323 if (CLIPPIXEL(x[i],fy))
324 WRITE_RGBA( x[i], fy,
325 rgba[i][0], rgba[i][1],
326 rgba[i][2], rgba[i][3] );
327 }
328 }
329 }
330 else
331 {
332 for (i=0;i<n;i++)
333 {
334 const int fy = Y_FLIP(y[i]);
335 if (CLIPPIXEL(x[i],fy))
336 WRITE_RGBA( x[i], fy,
337 rgba[i][0], rgba[i][1],
338 rgba[i][2], rgba[i][3] );
339 }
340 }
341 }
342 HW_ENDCLIPLOOP();
343 }
344 HW_WRITE_UNLOCK();
345 }
346
347
348 static void TAG(WriteMonoRGBASpan)( GLcontext *ctx,
349 struct gl_renderbuffer *rb,
350 GLuint n, GLint x, GLint y,
351 const void *value, const GLubyte mask[] )
352 {
353 HW_WRITE_LOCK()
354 {
355 const GLubyte *color = (const GLubyte *) value;
356 GLint x1;
357 GLint n1;
358 LOCAL_VARS;
359 INIT_MONO_PIXEL(p, color);
360
361 y = Y_FLIP( y );
362
363 if (DBG) fprintf(stderr, "WriteMonoRGBASpan\n");
364
365 HW_WRITE_CLIPLOOP()
366 {
367 GLint i = 0;
368 CLIPSPAN(x,y,n,x1,n1,i);
369 if (mask)
370 {
371 for (;n1>0;i++,x1++,n1--)
372 if (mask[i])
373 WRITE_PIXEL( x1, y, p );
374 }
375 else
376 {
377 for (;n1>0;i++,x1++,n1--)
378 WRITE_PIXEL( x1, y, p );
379 }
380 }
381 HW_ENDCLIPLOOP();
382 }
383 HW_WRITE_UNLOCK();
384 }
385
386
387 static void TAG(WriteMonoRGBAPixels)( GLcontext *ctx,
388 struct gl_renderbuffer *rb,
389 GLuint n,
390 const GLint x[], const GLint y[],
391 const void *value,
392 const GLubyte mask[] )
393 {
394 HW_WRITE_LOCK()
395 {
396 const GLubyte *color = (const GLubyte *) value;
397 GLint i;
398 LOCAL_VARS;
399 INIT_MONO_PIXEL(p, color);
400
401 if (DBG) fprintf(stderr, "WriteMonoRGBAPixels\n");
402
403 HW_WRITE_CLIPLOOP()
404 {
405 if (mask)
406 {
407 for (i=0;i<n;i++)
408 if (mask[i]) {
409 int fy = Y_FLIP(y[i]);
410 if (CLIPPIXEL( x[i], fy ))
411 WRITE_PIXEL( x[i], fy, p );
412 }
413 }
414 else
415 {
416 for (i=0;i<n;i++) {
417 int fy = Y_FLIP(y[i]);
418 if (CLIPPIXEL( x[i], fy ))
419 WRITE_PIXEL( x[i], fy, p );
420 }
421 }
422 }
423 HW_ENDCLIPLOOP();
424 }
425 HW_WRITE_UNLOCK();
426 }
427
428
429 static void TAG(ReadRGBASpan)( GLcontext *ctx,
430 struct gl_renderbuffer *rb,
431 GLuint n, GLint x, GLint y, void *values)
432 {
433 HW_READ_LOCK()
434 {
435 GLubyte (*rgba)[4] = (GLubyte (*)[4]) values;
436 GLint x1,n1;
437 LOCAL_VARS;
438
439 y = Y_FLIP(y);
440
441 if (DBG) fprintf(stderr, "ReadRGBASpan\n");
442
443 HW_READ_CLIPLOOP()
444 {
445 GLint i = 0;
446 CLIPSPAN(x,y,n,x1,n1,i);
447 for (;n1>0;i++,x1++,n1--)
448 READ_RGBA( rgba[i], x1, y );
449 }
450 HW_ENDCLIPLOOP();
451 }
452 HW_READ_UNLOCK();
453 }
454
455
456 #if defined(GET_PTR) && \
457 defined(USE_MMX_ASM) && \
458 (((SPANTMP_PIXEL_FMT == GL_BGRA) && \
459 (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV)) || \
460 ((SPANTMP_PIXEL_FMT == GL_RGB) && \
461 (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_SHORT_5_6_5)))
462 static void TAG2(ReadRGBASpan,_MMX)( GLcontext *ctx,
463 struct gl_renderbuffer *rb,
464 GLuint n, GLint x, GLint y, void *values)
465 {
466 #ifndef USE_INNER_EMMS
467 /* The EMMS instruction is directly in-lined here because using GCC's
468 * built-in _mm_empty function was found to utterly destroy performance.
469 */
470 __asm__ __volatile__( "emms" );
471 #endif
472
473 HW_READ_LOCK()
474 {
475 GLubyte (*rgba)[4] = (GLubyte (*)[4]) values;
476 GLint x1,n1;
477 LOCAL_VARS;
478
479 y = Y_FLIP(y);
480
481 if (DBG) fprintf(stderr, "ReadRGBASpan\n");
482
483 HW_READ_CLIPLOOP()
484 {
485 GLint i = 0;
486 CLIPSPAN(x,y,n,x1,n1,i);
487
488 {
489 const void * src = GET_PTR( x1, y );
490 #if (SPANTMP_PIXEL_FMT == GL_RGB) && \
491 (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_SHORT_5_6_5)
492 _generic_read_RGBA_span_RGB565_MMX( src, rgba[i], n1 );
493 #else
494 _generic_read_RGBA_span_BGRA8888_REV_MMX( src, rgba[i], n1 );
495 #endif
496 }
497 }
498 HW_ENDCLIPLOOP();
499 }
500 HW_READ_UNLOCK();
501 #ifndef USE_INNER_EMMS
502 __asm__ __volatile__( "emms" );
503 #endif
504 }
505 #endif
506
507
508 #if defined(GET_PTR) && \
509 defined(USE_SSE_ASM) && \
510 (SPANTMP_PIXEL_FMT == GL_BGRA) && \
511 (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV)
512 static void TAG2(ReadRGBASpan,_SSE2)( GLcontext *ctx,
513 struct gl_renderbuffer *rb,
514 GLuint n, GLint x, GLint y,
515 void *values)
516 {
517 HW_READ_LOCK()
518 {
519 GLubyte (*rgba)[4] = (GLubyte (*)[4]) values;
520 GLint x1,n1;
521 LOCAL_VARS;
522
523 y = Y_FLIP(y);
524
525 if (DBG) fprintf(stderr, "ReadRGBASpan\n");
526
527 HW_READ_CLIPLOOP()
528 {
529 GLint i = 0;
530 CLIPSPAN(x,y,n,x1,n1,i);
531
532 {
533 const void * src = GET_PTR( x1, y );
534 _generic_read_RGBA_span_BGRA8888_REV_SSE2( src, rgba[i], n1 );
535 }
536 }
537 HW_ENDCLIPLOOP();
538 }
539 HW_READ_UNLOCK();
540 }
541 #endif
542
543 #if defined(GET_PTR) && \
544 defined(USE_SSE_ASM) && \
545 (SPANTMP_PIXEL_FMT == GL_BGRA) && \
546 (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV)
547 static void TAG2(ReadRGBASpan,_SSE)( GLcontext *ctx,
548 struct gl_renderbuffer *rb,
549 GLuint n, GLint x, GLint y,
550 void *values)
551 {
552 #ifndef USE_INNER_EMMS
553 /* The EMMS instruction is directly in-lined here because using GCC's
554 * built-in _mm_empty function was found to utterly destroy performance.
555 */
556 __asm__ __volatile__( "emms" );
557 #endif
558
559 HW_READ_LOCK()
560 {
561 GLubyte (*rgba)[4] = (GLubyte (*)[4]) values;
562 GLint x1,n1;
563 LOCAL_VARS;
564
565 y = Y_FLIP(y);
566
567 if (DBG) fprintf(stderr, "ReadRGBASpan\n");
568
569 HW_READ_CLIPLOOP()
570 {
571 GLint i = 0;
572 CLIPSPAN(x,y,n,x1,n1,i);
573
574 {
575 const void * src = GET_PTR( x1, y );
576 _generic_read_RGBA_span_BGRA8888_REV_SSE( src, rgba[i], n1 );
577 }
578 }
579 HW_ENDCLIPLOOP();
580 }
581 HW_READ_UNLOCK();
582 #ifndef USE_INNER_EMMS
583 __asm__ __volatile__( "emms" );
584 #endif
585 }
586 #endif
587
588
589 static void TAG(ReadRGBAPixels)( GLcontext *ctx,
590 struct gl_renderbuffer *rb,
591 GLuint n, const GLint x[], const GLint y[],
592 void *values )
593 {
594 HW_READ_LOCK()
595 {
596 GLubyte (*rgba)[4] = (GLubyte (*)[4]) values;
597 GLubyte *mask = NULL; /* remove someday */
598 GLint i;
599 LOCAL_VARS;
600
601 if (DBG) fprintf(stderr, "ReadRGBAPixels\n");
602
603 HW_READ_CLIPLOOP()
604 {
605 if (mask)
606 {
607 for (i=0;i<n;i++)
608 if (mask[i]) {
609 int fy = Y_FLIP( y[i] );
610 if (CLIPPIXEL( x[i], fy ))
611 READ_RGBA( rgba[i], x[i], fy );
612 }
613 }
614 else
615 {
616 for (i=0;i<n;i++) {
617 int fy = Y_FLIP( y[i] );
618 if (CLIPPIXEL( x[i], fy ))
619 READ_RGBA( rgba[i], x[i], fy );
620 }
621 }
622 }
623 HW_ENDCLIPLOOP();
624 }
625 HW_READ_UNLOCK();
626 }
627
628 static void TAG(InitPointers)(struct gl_renderbuffer *rb)
629 {
630 rb->PutRow = TAG(WriteRGBASpan);
631 rb->PutRowRGB = TAG(WriteRGBSpan);
632 rb->PutMonoRow = TAG(WriteMonoRGBASpan);
633 rb->PutValues = TAG(WriteRGBAPixels);
634 rb->PutMonoValues = TAG(WriteMonoRGBAPixels);
635 rb->GetValues = TAG(ReadRGBAPixels);
636
637 #if defined(GET_PTR)
638 #if defined(USE_SSE_ASM) && \
639 (SPANTMP_PIXEL_FMT == GL_BGRA) && \
640 (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV)
641 if ( cpu_has_xmm2 ) {
642 if (DBG) fprintf( stderr, "Using %s version of GetRow\n", "SSE2" );
643 rb->GetRow = TAG2(ReadRGBASpan, _SSE2);
644 }
645 else
646 #endif
647 #if defined(USE_SSE_ASM) && \
648 (SPANTMP_PIXEL_FMT == GL_BGRA) && \
649 (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV)
650 if ( cpu_has_xmm ) {
651 if (DBG) fprintf( stderr, "Using %s version of GetRow\n", "SSE" );
652 rb->GetRow = TAG2(ReadRGBASpan, _SSE);
653 }
654 else
655 #endif
656 #if defined(USE_MMX_ASM) && \
657 (((SPANTMP_PIXEL_FMT == GL_BGRA) && \
658 (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV)) || \
659 ((SPANTMP_PIXEL_FMT == GL_RGB) && \
660 (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_SHORT_5_6_5)))
661 if ( cpu_has_mmx ) {
662 if (DBG) fprintf( stderr, "Using %s version of GetRow\n", "MMX" );
663 rb->GetRow = TAG2(ReadRGBASpan, _MMX);
664 }
665 else
666 #endif
667 #endif /* GET_PTR */
668 {
669 if (DBG) fprintf( stderr, "Using %s version of GetRow\n", "C" );
670 rb->GetRow = TAG(ReadRGBASpan);
671 }
672
673 }
674
675
676 #undef INIT_MONO_PIXEL
677 #undef WRITE_PIXEL
678 #undef WRITE_RGBA
679 #undef READ_RGBA
680 #undef TAG
681 #undef TAG2
682 #undef GET_VALUE
683 #undef PUT_VALUE
684 #undef GET_PTR
685 #undef SPANTMP_PIXEL_FMT
686 #undef SPANTMP_PIXEL_TYPE