Mesa (intel-2008-q4): mesa: Fix the size per pixel for packed pixel format data type.
Haihao Xiang
haihao at kemper.freedesktop.org
Thu Jan 8 08:52:17 UTC 2009
Module: Mesa
Branch: intel-2008-q4
Commit: 0640a81b6cd281ea2fa3196dd59c057910779f20
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=0640a81b6cd281ea2fa3196dd59c057910779f20
Author: Xiang, Haihao <haihao.xiang at intel.com>
Date: Tue Jan 6 15:37:45 2009 +0800
mesa: Fix the size per pixel for packed pixel format data type.
(cherry picked from commit f1f022dbb103947b0edf5ae984fcff00f6a8e539)
---
src/mesa/main/image.c | 2 +-
src/mesa/main/image.h | 3 +++
src/mesa/main/mipmap.c | 6 +++++-
3 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c
index c205b4b..4d86c54 100644
--- a/src/mesa/main/image.c
+++ b/src/mesa/main/image.c
@@ -61,7 +61,7 @@
/**
* \return GL_TRUE if type is packed pixel type, GL_FALSE otherwise.
*/
-static GLboolean
+GLboolean
_mesa_type_is_packed(GLenum type)
{
switch (type) {
diff --git a/src/mesa/main/image.h b/src/mesa/main/image.h
index 38e1374..0e0bbd9 100644
--- a/src/mesa/main/image.h
+++ b/src/mesa/main/image.h
@@ -36,6 +36,9 @@ _mesa_swap2( GLushort *p, GLuint n );
extern void
_mesa_swap4( GLuint *p, GLuint n );
+extern GLboolean
+_mesa_type_is_packed(GLenum type);
+
extern GLint
_mesa_sizeof_type( GLenum type );
diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c
index 78d14b2..8569ee5 100644
--- a/src/mesa/main/mipmap.c
+++ b/src/mesa/main/mipmap.c
@@ -41,7 +41,11 @@ bytes_per_pixel(GLenum datatype, GLuint comps)
{
GLint b = _mesa_sizeof_packed_type(datatype);
assert(b >= 0);
- return b * comps;
+
+ if (_mesa_type_is_packed(datatype))
+ return b;
+ else
+ return b * comps;
}
More information about the mesa-commit
mailing list