aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/swrast/s_texture.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-09-19 13:23:24 +0200
committermarha <marha@users.sourceforge.net>2011-09-19 13:23:24 +0200
commitb2c925e360e2c366526de15b44603f855f94139c (patch)
tree2a963073645913b7c6d43fa04dc0aa13bda57b80 /mesalib/src/mesa/swrast/s_texture.c
parent18ae1470a8dbcfe369ddf0d7e17e0ea665251ccd (diff)
downloadvcxsrv-b2c925e360e2c366526de15b44603f855f94139c.tar.gz
vcxsrv-b2c925e360e2c366526de15b44603f855f94139c.tar.bz2
vcxsrv-b2c925e360e2c366526de15b44603f855f94139c.zip
xtrans libX11 libXext libXdmcp libXau libXft libXinerama libXmu libfontenc
mesa git update 19 sept 2011
Diffstat (limited to 'mesalib/src/mesa/swrast/s_texture.c')
-rw-r--r--mesalib/src/mesa/swrast/s_texture.c65
1 files changed, 65 insertions, 0 deletions
diff --git a/mesalib/src/mesa/swrast/s_texture.c b/mesalib/src/mesa/swrast/s_texture.c
index 6cc72c582..7e3fc2806 100644
--- a/mesalib/src/mesa/swrast/s_texture.c
+++ b/mesalib/src/mesa/swrast/s_texture.c
@@ -28,9 +28,74 @@
#include "main/context.h"
#include "main/fbobject.h"
+#include "main/teximage.h"
#include "swrast/swrast.h"
#include "swrast/s_context.h"
+
+/**
+ * Allocate a new swrast_texture_image (a subclass of gl_texture_image).
+ * Called via ctx->Driver.NewTextureImage().
+ */
+struct gl_texture_image *
+_swrast_new_texture_image( struct gl_context *ctx )
+{
+ (void) ctx;
+ return (struct gl_texture_image *) CALLOC_STRUCT(swrast_texture_image);
+}
+
+
+/**
+ * Free a swrast_texture_image (a subclass of gl_texture_image).
+ * Called via ctx->Driver.DeleteTextureImage().
+ */
+void
+_swrast_delete_texture_image(struct gl_context *ctx,
+ struct gl_texture_image *texImage)
+{
+ /* Nothing special for the subclass yet */
+ _mesa_delete_texture_image(ctx, texImage);
+}
+
+
+/**
+ * Called via ctx->Driver.AllocTextureImageBuffer()
+ */
+GLboolean
+_swrast_alloc_texture_image_buffer(struct gl_context *ctx,
+ struct gl_texture_image *texImage,
+ gl_format format, GLsizei width,
+ GLsizei height, GLsizei depth)
+{
+ GLuint bytes = _mesa_format_image_size(format, width, height, depth);
+
+ /* This _should_ be true (revisit if these ever fail) */
+ assert(texImage->Width == width);
+ assert(texImage->Height == height);
+ assert(texImage->Depth == depth);
+
+ assert(!texImage->Data);
+ texImage->Data = _mesa_align_malloc(bytes, 512);
+
+ return texImage->Data != NULL;
+}
+
+
+/**
+ * Called via ctx->Driver.FreeTextureImageBuffer()
+ */
+void
+_swrast_free_texture_image_buffer(struct gl_context *ctx,
+ struct gl_texture_image *texImage)
+{
+ if (texImage->Data && !texImage->IsClientData) {
+ _mesa_align_free(texImage->Data);
+ }
+
+ texImage->Data = NULL;
+}
+
+
/**
* Error checking for debugging only.
*/