aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYuanhan Liu <[email protected]>2011-09-26 09:23:06 +0800
committerYuanhan Liu <[email protected]>2011-09-26 09:23:06 +0800
commit455a19b1b3d7ca0a40c65d89e45209dbd8ac7b35 (patch)
tree9be49332607212afc10b9f8eebea03f6d3b622e1
parent65b8eea0644fdb7e9150d0e98c06d7f8ba6d5302 (diff)
intel: fix potential segfault error at intel_(un)map_texture_image
intel_image->mt might be NULL, say with border width set. It then would trigger a segfault at intel_map/unmap_texture_image function. This would fix the oglc misctest(basic.textureBorderIgnore) fail. Signed-off-by: Yuanhan Liu <[email protected]>
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_tex.c b/src/mesa/drivers/dri/intel/intel_tex.c
index 8d3cbd69420..f8c3f7741dd 100644
--- a/src/mesa/drivers/dri/intel/intel_tex.c
+++ b/src/mesa/drivers/dri/intel/intel_tex.c
@@ -113,7 +113,7 @@ intel_map_texture_image(struct gl_context *ctx,
* row of blocks. intel_miptree_get_image_offset() already does
* the divide.
*/
- _mesa_get_format_block_size(mt->format, &bw, &bh);
+ _mesa_get_format_block_size(tex_image->TexFormat, &bw, &bh);
assert(y % bh == 0);
y /= bh;
@@ -150,7 +150,8 @@ intel_unmap_texture_image(struct gl_context *ctx,
struct intel_context *intel = intel_context(ctx);
struct intel_texture_image *intel_image = intel_texture_image(tex_image);
- intel_region_unmap(intel, intel_image->mt->region);
+ if (intel_image->mt)
+ intel_region_unmap(intel, intel_image->mt->region);
if (intel_image->stencil_rb) {
/*