summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/teximage.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2005-07-05 14:13:42 +0000
committerBrian Paul <[email protected]>2005-07-05 14:13:42 +0000
commit4cf6718725c7cf3bfb728118a8b14f8cf206c701 (patch)
treee6c1517b9be0d5db682fceb90f1f396423f5ac6a /src/mesa/main/teximage.c
parent78be0b5dadb3fb80e2283dbfa7f2ede146d80b41 (diff)
The old MESA_PBUFFER_ALLOC() function allocated memory on 512-byte boundaries.
Restore that behavior with new _mesa_alloc_texmemory() function. Should fix via_sse_memcpy() problem in found with flightgear.
Diffstat (limited to 'src/mesa/main/teximage.c')
-rw-r--r--src/mesa/main/teximage.c29
1 files changed, 27 insertions, 2 deletions
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 62153dca418..b5d2d266b00 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -51,6 +51,29 @@
#include "mtypes.h"
+/**
+ * We allocate texture memory on 512-byte boundaries so we can use MMX/SSE
+ * elsewhere.
+ */
+void *
+_mesa_alloc_texmemory(GLsizei bytes)
+{
+ return _mesa_align_malloc(bytes, 512);
+}
+
+
+/**
+ * Free texture memory allocated with _mesa_alloc_texmemory()
+ */
+void
+_mesa_free_texmemory(void *m)
+{
+ _mesa_align_free(m);
+}
+
+
+
+
#if 0
static void PrintTexture(GLcontext *ctx, const struct gl_texture_image *img)
{
@@ -572,17 +595,19 @@ _mesa_new_texture_image( GLcontext *ctx )
/**
* Free texture image data.
+ * This function is a fallback called via ctx->Driver.FreeTexImageData().
*
* \param teximage texture image.
*
* Free the texture image data if it's not marked as client data.
*/
void
-_mesa_free_texture_image_data( GLcontext *ctx, struct gl_texture_image *texImage )
+_mesa_free_texture_image_data(GLcontext *ctx,
+ struct gl_texture_image *texImage)
{
if (texImage->Data && !texImage->IsClientData) {
/* free the old texture data */
- _mesa_free(texImage->Data);
+ _mesa_free_texmemory(texImage->Data);
}
texImage->Data = NULL;