aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/swrast
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa/swrast')
-rw-r--r--mesalib/src/mesa/swrast/s_texture.c21
-rw-r--r--mesalib/src/mesa/swrast/swrast.h4
2 files changed, 23 insertions, 2 deletions
diff --git a/mesalib/src/mesa/swrast/s_texture.c b/mesalib/src/mesa/swrast/s_texture.c
index 72d309300..9718367a8 100644
--- a/mesalib/src/mesa/swrast/s_texture.c
+++ b/mesalib/src/mesa/swrast/s_texture.c
@@ -96,6 +96,25 @@ _swrast_alloc_texture_image_buffer(struct gl_context *ctx,
swImg->ImageOffsets[i] = i * width * height;
}
+ _swrast_init_texture_image(texImage, width, height, depth);
+
+ return GL_TRUE;
+}
+
+
+/**
+ * Code that overrides ctx->Driver.AllocTextureImageBuffer may use this to
+ * initialize the fields of swrast_texture_image without allocating the image
+ * buffer or initializing ImageOffsets or RowStride.
+ *
+ * Returns GL_TRUE on success, GL_FALSE on memory allocation failure.
+ */
+void
+_swrast_init_texture_image(struct gl_texture_image *texImage, GLsizei width,
+ GLsizei height, GLsizei depth)
+{
+ struct swrast_texture_image *swImg = swrast_texture_image(texImage);
+
if ((width == 1 || _mesa_is_pow_two(texImage->Width2)) &&
(height == 1 || _mesa_is_pow_two(texImage->Height2)) &&
(depth == 1 || _mesa_is_pow_two(texImage->Depth2)))
@@ -115,8 +134,6 @@ _swrast_alloc_texture_image_buffer(struct gl_context *ctx,
swImg->HeightScale = (GLfloat) texImage->Height;
swImg->DepthScale = (GLfloat) texImage->Depth;
}
-
- return GL_TRUE;
}
diff --git a/mesalib/src/mesa/swrast/swrast.h b/mesalib/src/mesa/swrast/swrast.h
index 468d22f0b..ad19eeecc 100644
--- a/mesalib/src/mesa/swrast/swrast.h
+++ b/mesalib/src/mesa/swrast/swrast.h
@@ -192,6 +192,10 @@ _swrast_alloc_texture_image_buffer(struct gl_context *ctx,
GLsizei height, GLsizei depth);
extern void
+_swrast_init_texture_image(struct gl_texture_image *texImage, GLsizei width,
+ GLsizei height, GLsizei depth);
+
+extern void
_swrast_free_texture_image_buffer(struct gl_context *ctx,
struct gl_texture_image *texImage);