struct gl_renderbuffer *rb);
/**
- * Note: no context argument. This function doesn't initially look
- * like it belongs here, except that the driver is the only entity
- * that knows for sure how the texture memory is allocated - via
- * the above callbacks. There is then an argument that the driver
- * knows what memcpy paths might be fast. Typically this is invoked with
- *
- * to -- a pointer into texture memory allocated by NewTextureImage() above.
- * from -- a pointer into client memory or a mesa temporary.
- * sz -- nr bytes to copy.
- */
- void* (*TextureMemCpy)( void *to, const void *from, size_t sz );
-
- /**
* Called by glAreTextureResident().
*/
GLboolean (*IsTextureResident)( struct gl_context *ctx,
GLubyte *dstImage = dstSlices[dstZoffset + img]
+ dstYoffset * dstRowStride
+ dstXoffset * texelBytes;
- ctx->Driver.TextureMemCpy(dstImage, srcImage,
- bytesPerRow * srcHeight);
+ memcpy(dstImage, srcImage, bytesPerRow * srcHeight);
srcImage += srcImageStride;
}
}
+ dstYoffset * dstRowStride
+ dstXoffset * texelBytes;
for (row = 0; row < srcHeight; row++) {
- ctx->Driver.TextureMemCpy(dstRow, srcRow, bytesPerRow);
+ memcpy(dstRow, srcRow, bytesPerRow);
dstRow += dstRowStride;
srcRow += srcRowStride;
}
/**
- * From linux kernel i386 header files, copes with odd sizes better
- * than COPY_DWORDS would:
- * XXX Put this in src/mesa/main/imports.h ???
- */
-#if defined(PIPE_CC_GCC) && defined(PIPE_ARCH_X86)
-static INLINE void *
-__memcpy(void *to, const void *from, size_t n)
-{
- int d0, d1, d2;
- __asm__ __volatile__("rep ; movsl\n\t"
- "testb $2,%b4\n\t"
- "je 1f\n\t"
- "movsw\n"
- "1:\ttestb $1,%b4\n\t"
- "je 2f\n\t"
- "movsb\n" "2:":"=&c"(d0), "=&D"(d1), "=&S"(d2)
- :"0"(n / 4), "q"(n), "1"((long) to), "2"((long) from)
- :"memory");
- return (to);
-}
-#else
-#define __memcpy(a,b,c) memcpy(a,b,c)
-#endif
-
-
-/**
- * The system memcpy (at least on ubuntu 5.10) has problems copying
- * to agp (writecombined) memory from a source which isn't 64-byte
- * aligned - there is a 4x performance falloff.
- *
- * The x86 __memcpy is immune to this but is slightly slower
- * (10%-ish) than the system memcpy.
- *
- * The sse_memcpy seems to have a slight cliff at 64/32 bytes, but
- * isn't much faster than x86_memcpy for agp copies.
- *
- * TODO: switch dynamically.
- */
-static void *
-do_memcpy(void *dest, const void *src, size_t n)
-{
- if ((((unsigned long) src) & 63) || (((unsigned long) dest) & 63)) {
- return __memcpy(dest, src, n);
- }
- else
- return memcpy(dest, src, n);
-}
-
-
-/**
* Return default texture resource binding bitmask for the given format.
*/
static GLuint
functions->MapTextureImage = st_MapTextureImage;
functions->UnmapTextureImage = st_UnmapTextureImage;
- functions->TextureMemCpy = do_memcpy;
-
/* XXX Temporary until we can query pipe's texture sizes */
functions->TestProxyTexImage = _mesa_test_proxy_teximage;