diff options
author | Ilia Mirkin <[email protected]> | 2014-08-10 11:52:55 -0400 |
---|---|---|
committer | Ilia Mirkin <[email protected]> | 2014-08-13 10:09:01 -0400 |
commit | d72d67832bd7a5f2aa0c402333a7de6804ad35ef (patch) | |
tree | 32a80b59fcabb2998644cc38b5a1b2368f4dd177 /src/mesa/drivers/dri/nouveau/nouveau_texture.c | |
parent | ddcbea91f11a96b154b7e31c1b60816583056234 (diff) |
nouveau: only try to get new storage if there are any levels
This would try to allocate 0-sized bo's when the max level was below the
base level.
Signed-off-by: Ilia Mirkin <[email protected]>
Reviewed-by: Francisco Jerez <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/nouveau/nouveau_texture.c')
-rw-r--r-- | src/mesa/drivers/dri/nouveau/nouveau_texture.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_texture.c b/src/mesa/drivers/dri/nouveau/nouveau_texture.c index e7d5c0238b6..4626cc30229 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_texture.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_texture.c @@ -345,16 +345,19 @@ relayout_texture(struct gl_context *ctx, struct gl_texture_object *t) height = minify(height, 1); } - /* Get new storage. */ - size = align(offset, 64); - - ret = nouveau_bo_new(context_dev(ctx), NOUVEAU_BO_MAP | - NOUVEAU_BO_GART | NOUVEAU_BO_VRAM, - 0, size, NULL, &ss[last].bo); - assert(!ret); - - for (i = t->BaseLevel; i < last; i++) - nouveau_bo_ref(ss[last].bo, &ss[i].bo); + if (t->BaseLevel <= last) { + /* Get new storage. */ + size = align(offset, 64); + assert(size); + + ret = nouveau_bo_new(context_dev(ctx), NOUVEAU_BO_MAP | + NOUVEAU_BO_GART | NOUVEAU_BO_VRAM, + 0, size, NULL, &ss[last].bo); + assert(!ret); + + for (i = t->BaseLevel; i < last; i++) + nouveau_bo_ref(ss[last].bo, &ss[i].bo); + } } } |