summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/llvmpipe/lp_texture.c
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2012-07-06 19:14:37 +0100
committerJosé Fonseca <jfonseca@vmware.com>2012-08-28 15:18:43 +0100
commitbc8509b43b591796fa7c3b7a7497053eb298dc8b (patch)
treedaa86e32bec95fd54dd74101da04651bcbc3a000 /src/gallium/drivers/llvmpipe/lp_texture.c
parent6463eb013f645440d252b8b390e1c6e3c1212b7e (diff)
llvmpipe: Bump the maximum texture size (in pixels).
But cap the size in bytes, to avoid depleting the whole system memory, with humongus textures. Tested with max-texture-size piglit test. Reviewed-by: Roland Scheidegger <sroland@vmware.com> Reviewed-by: Brian Paul <brianp@vmware.com>
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_texture.c')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_texture.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_texture.c b/src/gallium/drivers/llvmpipe/lp_texture.c
index 4495e8de6cd..36041432312 100644
--- a/src/gallium/drivers/llvmpipe/lp_texture.c
+++ b/src/gallium/drivers/llvmpipe/lp_texture.c
@@ -112,6 +112,7 @@ llvmpipe_texture_layout(struct llvmpipe_screen *screen,
unsigned width = pt->width0;
unsigned height = pt->height0;
unsigned depth = pt->depth0;
+ size_t total_size = 0;
assert(LP_MAX_TEXTURE_2D_LEVELS <= LP_MAX_TEXTURE_LEVELS);
assert(LP_MAX_TEXTURE_3D_LEVELS <= LP_MAX_TEXTURE_LEVELS);
@@ -168,6 +169,11 @@ llvmpipe_texture_layout(struct llvmpipe_screen *screen,
}
}
+ total_size += lpr->num_slices_faces[level] * lpr->img_stride[level];
+ if (total_size > LP_MAX_TEXTURE_SIZE) {
+ goto fail;
+ }
+
/* Compute size of next mipmap level */
width = u_minify(width, 1);
height = u_minify(height, 1);