aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/teximage.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-11-19 10:47:23 +0100
committermarha <marha@users.sourceforge.net>2012-11-19 10:47:23 +0100
commitb3e1e62c45f525cdd332073aaa34d8452cb23374 (patch)
tree221ee6420074033279921fadc971d30d63d6847b /mesalib/src/mesa/main/teximage.c
parentb142593315b909b9e202f0f4585b96bf2e74b9db (diff)
downloadvcxsrv-b3e1e62c45f525cdd332073aaa34d8452cb23374.tar.gz
vcxsrv-b3e1e62c45f525cdd332073aaa34d8452cb23374.tar.bz2
vcxsrv-b3e1e62c45f525cdd332073aaa34d8452cb23374.zip
git update 19 nov 2012
fontconfig: c20ac78b01df3f0919352bba16b5b48b3b5d4d6d libxcb: 76a2166de9c80b35f987fdc3f3a228bafa0de94e mesa: ddb901fbf4489ffcd85d3320f23913eb1d4fbdfe pixman: 44dd746bb68625b2f6be77c3f80292b45defe9d7 xserver: 6a6c3afe71ac82a93d9fd0034dd5bbdcf0eae1ea xkeyboard-config: 709e05c069428236ca2567e784c9971eecc8ca50
Diffstat (limited to 'mesalib/src/mesa/main/teximage.c')
-rw-r--r--mesalib/src/mesa/main/teximage.c54
1 files changed, 47 insertions, 7 deletions
diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c
index 0f28009b0..7d5a574e4 100644
--- a/mesalib/src/mesa/main/teximage.c
+++ b/mesalib/src/mesa/main/teximage.c
@@ -1027,6 +1027,44 @@ _mesa_get_texture_dimensions(GLenum target)
}
+/**
+ * Return the maximum number of mipmap levels for the given target
+ * and the dimensions.
+ * The dimensions are expected not to include the border.
+ */
+GLsizei
+_mesa_get_tex_max_num_levels(GLenum target, GLsizei width, GLsizei height,
+ GLsizei depth)
+{
+ GLsizei size;
+
+ switch (target) {
+ case GL_TEXTURE_1D:
+ case GL_TEXTURE_1D_ARRAY:
+ size = width;
+ break;
+ case GL_TEXTURE_CUBE_MAP:
+ case GL_TEXTURE_CUBE_MAP_ARRAY:
+ ASSERT(width == height);
+ size = width;
+ break;
+ case GL_TEXTURE_2D:
+ case GL_TEXTURE_2D_ARRAY:
+ size = MAX2(width, height);
+ break;
+ case GL_TEXTURE_3D:
+ size = MAX3(width, height, depth);
+ break;
+ case GL_TEXTURE_RECTANGLE:
+ case GL_TEXTURE_EXTERNAL_OES:
+ return 1;
+ default:
+ assert(0);
+ return 1;
+ }
+
+ return _mesa_logbase2(size) + 1;
+}
#if 000 /* not used anymore */
@@ -1214,7 +1252,9 @@ _mesa_init_teximage_fields(struct gl_context *ctx,
target);
}
- img->MaxLog2 = MAX2(img->WidthLog2, img->HeightLog2);
+ img->MaxNumLevels =
+ _mesa_get_tex_max_num_levels(target,
+ img->Width2, img->Height2, img->Depth2);
img->TexFormat = format;
}
@@ -3532,7 +3572,7 @@ compressed_subtexture_error_check(struct gl_context *ctx, GLint dims,
void GLAPIENTRY
-_mesa_CompressedTexImage1DARB(GLenum target, GLint level,
+_mesa_CompressedTexImage1D(GLenum target, GLint level,
GLenum internalFormat, GLsizei width,
GLint border, GLsizei imageSize,
const GLvoid *data)
@@ -3544,7 +3584,7 @@ _mesa_CompressedTexImage1DARB(GLenum target, GLint level,
void GLAPIENTRY
-_mesa_CompressedTexImage2DARB(GLenum target, GLint level,
+_mesa_CompressedTexImage2D(GLenum target, GLint level,
GLenum internalFormat, GLsizei width,
GLsizei height, GLint border, GLsizei imageSize,
const GLvoid *data)
@@ -3556,7 +3596,7 @@ _mesa_CompressedTexImage2DARB(GLenum target, GLint level,
void GLAPIENTRY
-_mesa_CompressedTexImage3DARB(GLenum target, GLint level,
+_mesa_CompressedTexImage3D(GLenum target, GLint level,
GLenum internalFormat, GLsizei width,
GLsizei height, GLsizei depth, GLint border,
GLsizei imageSize, const GLvoid *data)
@@ -3611,7 +3651,7 @@ compressed_tex_sub_image(GLuint dims, GLenum target, GLint level,
void GLAPIENTRY
-_mesa_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset,
+_mesa_CompressedTexSubImage1D(GLenum target, GLint level, GLint xoffset,
GLsizei width, GLenum format,
GLsizei imageSize, const GLvoid *data)
{
@@ -3621,7 +3661,7 @@ _mesa_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset,
void GLAPIENTRY
-_mesa_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset,
+_mesa_CompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset,
GLint yoffset, GLsizei width, GLsizei height,
GLenum format, GLsizei imageSize,
const GLvoid *data)
@@ -3632,7 +3672,7 @@ _mesa_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset,
void GLAPIENTRY
-_mesa_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset,
+_mesa_CompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset,
GLint yoffset, GLint zoffset, GLsizei width,
GLsizei height, GLsizei depth, GLenum format,
GLsizei imageSize, const GLvoid *data)