Mesa (master): llvmpipe: limit max texture size to 2Kx2K for now
Brian Paul
brianp at kemper.freedesktop.org
Fri Apr 2 15:22:51 UTC 2010
Module: Mesa
Branch: master
Commit: bc50336b6ab40b6f4df7dbe19abe8b1d89938472
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=bc50336b6ab40b6f4df7dbe19abe8b1d89938472
Author: Brian Paul <brianp at vmware.com>
Date: Fri Apr 2 09:17:47 2010 -0600
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.
---
src/gallium/drivers/llvmpipe/lp_scene.c | 3 +++
src/gallium/drivers/llvmpipe/lp_state_surface.c | 4 ++++
src/gallium/drivers/llvmpipe/lp_texture.h | 2 +-
3 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/src/gallium/drivers/llvmpipe/lp_scene.c b/src/gallium/drivers/llvmpipe/lp_scene.c
index 681ce67..0c51b52 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 048ac5b..7d86c57 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 2350c26..4962394 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 */
More information about the mesa-commit
mailing list