summaryrefslogtreecommitdiff
path: root/src/mesa/main
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2000-10-16 23:43:12 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2000-10-16 23:43:12 +0000
commit1873b567b28a3e3f4d94d0eacb27ffd235ec9529 (patch)
tree95b50aad327e2451c43649041f381844dcf5c811 /src/mesa/main
parent1100b4daa30ba6604a4d01aa6d46780dd8ef256b (diff)
added _mesa_get_teximages_from_driver()
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/teximage.c52
-rw-r--r--src/mesa/main/teximage.h12
2 files changed, 60 insertions, 4 deletions
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 6617912c5f..ba11eab98f 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -1,4 +1,4 @@
-/* $Id: teximage.c,v 1.51 2000/09/28 18:30:39 brianp Exp $ */
+/* $Id: teximage.c,v 1.52 2000/10/16 23:43:12 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -2114,6 +2114,56 @@ _mesa_get_teximage_from_driver( GLcontext *ctx, GLenum target, GLint level,
}
+/*
+ * Get all the mipmap images for a texture object from the device driver.
+ * Actually, only get mipmap images if we're using a mipmap filter.
+ */
+GLboolean
+_mesa_get_teximages_from_driver(GLcontext *ctx,
+ struct gl_texture_object *texObj)
+{
+ if (ctx->Driver.GetTexImage) {
+ static const GLenum targets[] = {
+ GL_TEXTURE_1D,
+ GL_TEXTURE_2D,
+ GL_TEXTURE_3D,
+ GL_TEXTURE_CUBE_MAP_ARB,
+ GL_TEXTURE_CUBE_MAP_ARB,
+ GL_TEXTURE_CUBE_MAP_ARB
+ };
+ GLboolean needLambda = (texObj->MinFilter != texObj->MagFilter);
+ GLenum target = targets[texObj->Dimensions - 1];
+ if (needLambda) {
+ GLint level;
+ /* Get images for all mipmap levels. We might not need them
+ * all but this is easier. We're on a (slow) software path
+ * anyway.
+ */
+ for (level = 0; level <= texObj->P; level++) {
+ struct gl_texture_image *texImg = texObj->Image[level];
+ if (texImg && !texImg->Data) {
+ _mesa_get_teximage_from_driver(ctx, target, level, texObj);
+ if (!texImg->Data)
+ return GL_FALSE; /* out of memory */
+ }
+ }
+ }
+ else {
+ GLint level = texObj->BaseLevel;
+ struct gl_texture_image *texImg = texObj->Image[level];
+ if (texImg && !texImg->Data) {
+ _mesa_get_teximage_from_driver(ctx, target, level, texObj);
+ if (!texImg->Data)
+ return GL_FALSE; /* out of memory */
+ }
+ }
+ return GL_TRUE;
+ }
+ return GL_FALSE;
+}
+
+
+
void
_mesa_GetTexImage( GLenum target, GLint level, GLenum format,
GLenum type, GLvoid *pixels )
diff --git a/src/mesa/main/teximage.h b/src/mesa/main/teximage.h
index c7dbbae343..585c95f002 100644
--- a/src/mesa/main/teximage.h
+++ b/src/mesa/main/teximage.h
@@ -1,4 +1,4 @@
-/* $Id: teximage.h,v 1.13 2000/09/05 15:41:25 brianp Exp $ */
+/* $Id: teximage.h,v 1.14 2000/10/16 23:43:12 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -65,8 +65,14 @@ _mesa_select_tex_image(GLcontext *ctx, const struct gl_texture_unit *texUnit,
extern void
-_mesa_get_teximage_from_driver( GLcontext *ctx, GLenum target, GLint level,
- const struct gl_texture_object *texObj );
+_mesa_get_teximage_from_driver(GLcontext *ctx, GLenum target, GLint level,
+ const struct gl_texture_object *texObj);
+
+
+extern GLboolean
+_mesa_get_teximages_from_driver(GLcontext *ctx,
+ struct gl_texture_object *texObj);
+
/*** API entry point functions ***/