* compute next (level+1) image size
* \return GL_FALSE if no smaller size can be generated (eg. src is 1x1x1 size)
*/
-static GLboolean
-next_mipmap_level_size(GLenum target, GLint border,
+GLboolean
+_mesa_next_mipmap_level_size(GLenum target, GLint border,
GLint srcWidth, GLint srcHeight, GLint srcDepth,
GLint *dstWidth, GLint *dstHeight, GLint *dstDepth)
{
srcDepth = srcImage->Depth;
border = srcImage->Border;
- nextLevel = next_mipmap_level_size(target, border,
+ nextLevel = _mesa_next_mipmap_level_size(target, border,
srcWidth, srcHeight, srcDepth,
&dstWidth, &dstHeight, &dstDepth);
if (!nextLevel)
srcDepth = srcImage->Depth;
border = srcImage->Border;
- nextLevel = next_mipmap_level_size(target, border,
+ nextLevel = _mesa_next_mipmap_level_size(target, border,
srcWidth, srcHeight, srcDepth,
&dstWidth, &dstHeight, &dstDepth);
if (!nextLevel)
_mesa_generate_mipmap(struct gl_context *ctx, GLenum target,
struct gl_texture_object *texObj);
+extern GLboolean
+_mesa_next_mipmap_level_size(GLenum target, GLint border,
+ GLint srcWidth, GLint srcHeight, GLint srcDepth,
+ GLint *dstWidth, GLint *dstHeight, GLint *dstDepth);
#endif /* MIPMAP_H */
#include "macros.h"
#include "teximage.h"
#include "texobj.h"
+#include "mipmap.h"
#include "texstorage.h"
#include "mtypes.h"
}
-/**
- * Compute the size of the next mipmap level.
- */
-static void
-next_mipmap_level_size(GLenum target,
- GLint *width, GLint *height, GLint *depth)
-{
- if (*width > 1) {
- *width /= 2;
- }
-
- if ((*height > 1) && (target != GL_TEXTURE_1D_ARRAY)) {
- *height /= 2;
- }
-
- if ((*depth > 1) && (target != GL_TEXTURE_2D_ARRAY)) {
- *depth /= 2;
- }
-}
-
-
/** Helper to get a particular texture image in a texture object */
static struct gl_texture_image *
get_tex_image(struct gl_context *ctx,
0, internalFormat, texFormat);
}
- next_mipmap_level_size(target, &levelWidth, &levelHeight, &levelDepth);
+ _mesa_next_mipmap_level_size(target, 0, levelWidth, levelHeight, levelDepth,
+ &levelWidth, &levelHeight, &levelDepth);
}
return GL_TRUE;
}