llvmpipe: added max texture/surface size sanity check
authorBrian Paul <brianp@vmware.com>
Wed, 23 Sep 2009 17:04:57 +0000 (11:04 -0600)
committerBrian Paul <brianp@vmware.com>
Wed, 23 Sep 2009 17:05:00 +0000 (11:05 -0600)
Carried over from softpipe driver.

src/gallium/drivers/llvmpipe/lp_tile_cache.c

index 2e576e6039d45f841b6aa9012c0dcba0a50b4057..73460106f3812ecd22ebe1f1db7c5d673016ec83 100644 (file)
@@ -48,6 +48,12 @@ struct llvmpipe_tile_cache *
 lp_create_tile_cache( struct pipe_screen *screen )
 {
    struct llvmpipe_tile_cache *tc;
+   int maxLevels, maxTexSize;
+
+   /* sanity checking: max sure MAX_WIDTH/HEIGHT >= largest texture image */
+   maxLevels = screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_2D_LEVELS);
+   maxTexSize = 1 << (maxLevels - 1);
+   assert(MAX_WIDTH >= maxTexSize);
 
    tc = CALLOC_STRUCT( llvmpipe_tile_cache );
    if(!tc)