softpipe: added max texture/surface size sanity check
authorBrian Paul <brianp@vmware.com>
Wed, 23 Sep 2009 16:50:38 +0000 (10:50 -0600)
committerBrian Paul <brianp@vmware.com>
Wed, 23 Sep 2009 16:50:38 +0000 (10:50 -0600)
src/gallium/drivers/softpipe/sp_tile_cache.c

index a524275a71c599dd41b9b2a84e28c1c8f1bb7924..461cbb9f95350b82f57276268b2cfa6c0d5814b9 100644 (file)
@@ -116,6 +116,12 @@ sp_create_tile_cache( struct pipe_screen *screen )
 {
    struct softpipe_tile_cache *tc;
    uint pos;
+   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( softpipe_tile_cache );
    if (tc) {