summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/llvmpipe/lp_texture.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2010-06-29 15:40:15 -0600
committerBrian Paul <[email protected]>2010-06-29 15:40:19 -0600
commit3d6101245b2726721a26931e0491c61286ca29c6 (patch)
treed6b53f8b69309e27a6803181d86e59bab103d030 /src/gallium/drivers/llvmpipe/lp_texture.c
parent249c6735dd5679be9f6ab8951982253919152985 (diff)
llvmpipe: don't crash/assert on out of memory
Check for null pointers and return early, etc.
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_texture.c')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_texture.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_texture.c b/src/gallium/drivers/llvmpipe/lp_texture.c
index 0d526ead89d..a156bb6517b 100644
--- a/src/gallium/drivers/llvmpipe/lp_texture.c
+++ b/src/gallium/drivers/llvmpipe/lp_texture.c
@@ -389,7 +389,6 @@ llvmpipe_resource_map(struct pipe_resource *resource,
map = llvmpipe_get_texture_image(lpr, face + zslice, level,
tex_usage, layout);
- assert(map);
return map;
}
else {
@@ -1035,7 +1034,7 @@ llvmpipe_get_texture_image(struct llvmpipe_resource *lpr,
layout_logic(cur_layout, layout, usage, &new_layout, &convert);
- if (convert) {
+ if (convert && other_data && target_data) {
if (layout == LP_TEX_LAYOUT_TILED) {
lp_linear_to_tiled(other_data, target_data,
x * TILE_SIZE, y * TILE_SIZE,
@@ -1067,8 +1066,6 @@ llvmpipe_get_texture_image(struct llvmpipe_resource *lpr,
width_t, height_t, layout);
}
- assert(target_data);
-
return target_data;
}
@@ -1187,13 +1184,16 @@ llvmpipe_get_texture_tile(struct llvmpipe_resource *lpr,
cur_layout = llvmpipe_get_texture_tile_layout(lpr, face_slice, level, tx, ty);
layout_logic(cur_layout, LP_TEX_LAYOUT_TILED, usage, &new_layout, &convert);
- if (convert) {
+ if (convert && linear_image && tiled_image) {
lp_linear_to_tiled(linear_image, tiled_image,
x, y, TILE_SIZE, TILE_SIZE, lpr->base.format,
lpr->row_stride[level],
lpr->tiles_per_row[level]);
}
+ if (!tiled_image)
+ return NULL;
+
if (new_layout != cur_layout)
llvmpipe_set_texture_tile_layout(lpr, face_slice, level, tx, ty, new_layout);