📄 spantmp2.h
字号:
WRITE_PIXEL( x1, y, p ); } else { for (;n1>0;i++,x1++,n1--) WRITE_PIXEL( x1, y, p ); } } HW_ENDCLIPLOOP(); } HW_WRITE_UNLOCK();}static void TAG(WriteMonoRGBAPixels)( GLcontext *ctx, struct gl_renderbuffer *rb, GLuint n, const GLint x[], const GLint y[], const void *value, const GLubyte mask[] ) { HW_WRITE_LOCK() { const GLubyte *color = (const GLubyte *) value; GLint i; LOCAL_VARS; INIT_MONO_PIXEL(p, color); if (DBG) fprintf(stderr, "WriteMonoRGBAPixels\n"); HW_WRITE_CLIPLOOP() { if (mask) { for (i=0;i<n;i++) if (mask[i]) { int fy = Y_FLIP(y[i]); if (CLIPPIXEL( x[i], fy )) WRITE_PIXEL( x[i], fy, p ); } } else { for (i=0;i<n;i++) { int fy = Y_FLIP(y[i]); if (CLIPPIXEL( x[i], fy )) WRITE_PIXEL( x[i], fy, p ); } } } HW_ENDCLIPLOOP(); } HW_WRITE_UNLOCK();}static void TAG(ReadRGBASpan)( GLcontext *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, void *values){ HW_READ_LOCK() { GLubyte (*rgba)[4] = (GLubyte (*)[4]) values; GLint x1,n1; LOCAL_VARS; y = Y_FLIP(y); if (DBG) fprintf(stderr, "ReadRGBASpan\n"); HW_READ_CLIPLOOP() { GLint i = 0; CLIPSPAN(x,y,n,x1,n1,i); for (;n1>0;i++,x1++,n1--) READ_RGBA( rgba[i], x1, y ); } HW_ENDCLIPLOOP(); } HW_READ_UNLOCK();}#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)( GLcontext *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, void *values){#ifndef USE_INNER_EMMS /* The EMMS instruction is directly in-lined here because using GCC's * built-in _mm_empty function was found to utterly destroy performance. */ __asm__ __volatile__( "emms" );#endif HW_READ_LOCK() { GLubyte (*rgba)[4] = (GLubyte (*)[4]) values; GLint x1,n1; LOCAL_VARS; y = Y_FLIP(y); if (DBG) fprintf(stderr, "ReadRGBASpan\n"); HW_READ_CLIPLOOP() { GLint i = 0; CLIPSPAN(x,y,n,x1,n1,i); { const void * src = GET_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_READ_UNLOCK();#ifndef USE_INNER_EMMS __asm__ __volatile__( "emms" );#endif}#endif#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)( GLcontext *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, void *values){ HW_READ_LOCK() { GLubyte (*rgba)[4] = (GLubyte (*)[4]) values; GLint x1,n1; LOCAL_VARS; y = Y_FLIP(y); if (DBG) fprintf(stderr, "ReadRGBASpan\n"); HW_READ_CLIPLOOP() { GLint i = 0; CLIPSPAN(x,y,n,x1,n1,i); { const void * src = GET_PTR( x1, y ); _generic_read_RGBA_span_BGRA8888_REV_SSE2( src, rgba[i], n1 ); } } HW_ENDCLIPLOOP(); } HW_READ_UNLOCK();}#endif#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)( GLcontext *ctx, struct gl_renderbuffer *rb, GLuint n, GLint x, GLint y, void *values){#ifndef USE_INNER_EMMS /* The EMMS instruction is directly in-lined here because using GCC's * built-in _mm_empty function was found to utterly destroy performance. */ __asm__ __volatile__( "emms" );#endif HW_READ_LOCK() { GLubyte (*rgba)[4] = (GLubyte (*)[4]) values; GLint x1,n1; LOCAL_VARS; y = Y_FLIP(y); if (DBG) fprintf(stderr, "ReadRGBASpan\n"); HW_READ_CLIPLOOP() { GLint i = 0; CLIPSPAN(x,y,n,x1,n1,i); { const void * src = GET_PTR( x1, y ); _generic_read_RGBA_span_BGRA8888_REV_SSE( src, rgba[i], n1 ); } } HW_ENDCLIPLOOP(); } HW_READ_UNLOCK();#ifndef USE_INNER_EMMS __asm__ __volatile__( "emms" );#endif}#endifstatic void TAG(ReadRGBAPixels)( GLcontext *ctx, struct gl_renderbuffer *rb, GLuint n, const GLint x[], const GLint y[], void *values ){ HW_READ_LOCK() { GLubyte (*rgba)[4] = (GLubyte (*)[4]) values; GLubyte *mask = NULL; /* remove someday */ GLint i; LOCAL_VARS; if (DBG) fprintf(stderr, "ReadRGBAPixels\n"); HW_READ_CLIPLOOP() { if (mask) { for (i=0;i<n;i++) if (mask[i]) { int fy = Y_FLIP( y[i] ); if (CLIPPIXEL( x[i], fy )) READ_RGBA( rgba[i], x[i], fy ); } } else { for (i=0;i<n;i++) { int fy = Y_FLIP( y[i] ); if (CLIPPIXEL( x[i], fy )) READ_RGBA( rgba[i], x[i], fy ); } } } HW_ENDCLIPLOOP(); } HW_READ_UNLOCK();}static void TAG(InitPointers)(struct gl_renderbuffer *rb){ rb->PutRow = TAG(WriteRGBASpan); rb->PutRowRGB = TAG(WriteRGBSpan); rb->PutMonoRow = TAG(WriteMonoRGBASpan); rb->PutValues = TAG(WriteRGBAPixels); rb->PutMonoValues = TAG(WriteMonoRGBAPixels); rb->GetValues = TAG(ReadRGBAPixels);#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 GetRow\n", "SSE2" ); rb->GetRow = TAG2(ReadRGBASpan, _SSE2); } else#endif#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 GetRow\n", "SSE" ); rb->GetRow = TAG2(ReadRGBASpan, _SSE); } else#endif#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 GetRow\n", "MMX" ); rb->GetRow = TAG2(ReadRGBASpan, _MMX); } else#endif { if (DBG) fprintf( stderr, "Using %s version of GetRow\n", "C" ); rb->GetRow = TAG(ReadRGBASpan); }}#undef INIT_MONO_PIXEL#undef WRITE_PIXEL#undef WRITE_RGBA#undef READ_RGBA#undef TAG#undef TAG2#undef GET_PTR#undef SPANTMP_PIXEL_FMT#undef SPANTMP_PIXEL_TYPE
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -