OSDN Git Service

mesa: Add condition in glGetTexImage for zero size textures
authorAnuj Phogat <anuj.phogat@gmail.com>
Tue, 17 Jan 2012 00:15:30 +0000 (16:15 -0800)
committerIan Romanick <ian.d.romanick@intel.com>
Thu, 19 Jan 2012 19:13:07 +0000 (11:13 -0800)
commit8ac4470041ff63e01b4d4200ca298bd7244232f8
tree62672ada15ca6b1f70e69a5c4dc1fcb328e3b8ad
parent6382f98b9a37616a0802cb8ef450ce16e5ef1921
mesa: Add condition in glGetTexImage for zero size textures

TestMipMaps() function in src/OGLconform/textureNPOT.c calls glTexImage2D()
with width = 0. Texture with zero size skips miptree allocation due to a
condition in function _mesa_store_teximage3d(). While calling glGetTexImage()
it results in assertion failure in intel_map_texture_image() due to null mt
pointer.

This patch fixes the issue by detecting the zero size texture early in
glGetTexImage and glGetCompressedTexImage functions. In such a case function
simply returns doing nothing.
Verified that below mentioned bug is fixed by this patch.

https://bugs.freedesktop.org/show_bug.cgi?id=42334

NOTE: This is a candidate for stable branches

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
(cherry picked from commit f1a9a9bcd19dcbb8a0a4bd7299400cb418970f99)
src/mesa/main/texgetimage.c
src/mesa/main/teximage.h