From: Brian Paul Date: Fri, 2 Apr 2010 15:17:47 +0000 (-0600) Subject: llvmpipe: limit max texture size to 2Kx2K for now X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=bc50336b6ab40b6f4df7dbe19abe8b1d89938472;p=mesa.git llvmpipe: limit max texture size to 2Kx2K for now MAXWIDTH/HEIGHT were 2048 but the max texture size was 4096. This caused a crash if a 4Kx4K texture was created and rendered to. See comment about max framebuffer size in lp_scene.h. Also added assertions to catch this inconsistancy in the future. --- diff --git a/src/gallium/drivers/llvmpipe/lp_scene.c b/src/gallium/drivers/llvmpipe/lp_scene.c index 681ce674d49..0c51b52d170 100644 --- a/src/gallium/drivers/llvmpipe/lp_scene.c +++ b/src/gallium/drivers/llvmpipe/lp_scene.c @@ -483,6 +483,9 @@ void lp_scene_begin_binning( struct lp_scene *scene, scene->tiles_x = align(fb->width, TILE_SIZE) / TILE_SIZE; scene->tiles_y = align(fb->height, TILE_SIZE) / TILE_SIZE; + + assert(scene->tiles_x <= TILES_X); + assert(scene->tiles_y <= TILES_Y); } diff --git a/src/gallium/drivers/llvmpipe/lp_state_surface.c b/src/gallium/drivers/llvmpipe/lp_state_surface.c index 048ac5b968b..7d86c5750c5 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_surface.c +++ b/src/gallium/drivers/llvmpipe/lp_state_surface.c @@ -32,6 +32,7 @@ #include "util/u_inlines.h" #include "util/u_surface.h" #include "lp_context.h" +#include "lp_scene.h" #include "lp_state.h" #include "lp_setup.h" @@ -51,6 +52,9 @@ llvmpipe_set_framebuffer_state(struct pipe_context *pipe, boolean changed = !util_framebuffer_state_equal(&lp->framebuffer, fb); + assert(fb->width <= MAXWIDTH); + assert(fb->height <= MAXHEIGHT); + if (changed) { util_copy_framebuffer_state(&lp->framebuffer, fb); diff --git a/src/gallium/drivers/llvmpipe/lp_texture.h b/src/gallium/drivers/llvmpipe/lp_texture.h index 2350c26e4fc..49623949bf5 100644 --- a/src/gallium/drivers/llvmpipe/lp_texture.h +++ b/src/gallium/drivers/llvmpipe/lp_texture.h @@ -32,7 +32,7 @@ #include "pipe/p_state.h" -#define LP_MAX_TEXTURE_2D_LEVELS 13 /* 4K x 4K for now */ +#define LP_MAX_TEXTURE_2D_LEVELS 12 /* 2K x 2K for now */ #define LP_MAX_TEXTURE_3D_LEVELS 10 /* 512 x 512 x 512 for now */