summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2009-02-13 07:44:02 -0700
committerBrian Paul <brianp@vmware.com>2009-02-13 07:44:15 -0700
commit6559107c7ae67ae6a94f53728cad85137aaf6312 (patch)
tree5bdf6cb8317bf50c1904076f6bb7672669a73388
parentafe24b94b3dee11ccda238ed82ed58ae46fb918b (diff)
mesa: add additional texture size/limit assertions
-rw-r--r--src/mesa/main/context.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index 19ff5e552c..9705fd8a98 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -864,6 +864,9 @@ _mesa_init_constants(GLcontext *ctx)
assert(MAX_TEXTURE_LEVELS >= MAX_3D_TEXTURE_LEVELS);
assert(MAX_TEXTURE_LEVELS >= MAX_CUBE_TEXTURE_LEVELS);
+ /* Max texture size should be <= max viewport size (render to texture) */
+ assert((1 << (MAX_TEXTURE_LEVELS - 1)) <= MAX_WIDTH);
+
/* Constants, may be overriden (usually only reduced) by device drivers */
ctx->Const.MaxTextureLevels = MAX_TEXTURE_LEVELS;
ctx->Const.Max3DTextureLevels = MAX_3D_TEXTURE_LEVELS;
@@ -960,13 +963,18 @@ check_context_limits(GLcontext *ctx)
/* number of coord units cannot be greater than number of image units */
assert(ctx->Const.MaxTextureCoordUnits <= ctx->Const.MaxTextureImageUnits);
- assert(ctx->Const.MaxViewportWidth <= MAX_WIDTH);
- assert(ctx->Const.MaxViewportHeight <= MAX_WIDTH);
+ assert(ctx->Const.MaxTextureLevels <= MAX_TEXTURE_LEVELS);
+ assert(ctx->Const.Max3DTextureLevels <= MAX_3D_TEXTURE_LEVELS);
+ assert(ctx->Const.MaxCubeTextureLevels <= MAX_CUBE_TEXTURE_LEVELS);
+ assert(ctx->Const.MaxTextureRectSize <= MAX_TEXTURE_RECT_SIZE);
/* make sure largest texture image is <= MAX_WIDTH in size */
- assert((1 << (ctx->Const.MaxTextureLevels -1 )) <= MAX_WIDTH);
- assert((1 << (ctx->Const.MaxCubeTextureLevels -1 )) <= MAX_WIDTH);
- assert((1 << (ctx->Const.Max3DTextureLevels -1 )) <= MAX_WIDTH);
+ assert((1 << (ctx->Const.MaxTextureLevels - 1)) <= MAX_WIDTH);
+ assert((1 << (ctx->Const.MaxCubeTextureLevels - 1)) <= MAX_WIDTH);
+ assert((1 << (ctx->Const.Max3DTextureLevels - 1)) <= MAX_WIDTH);
+
+ assert(ctx->Const.MaxViewportWidth <= MAX_WIDTH);
+ assert(ctx->Const.MaxViewportHeight <= MAX_WIDTH);
assert(ctx->Const.MaxDrawBuffers <= MAX_DRAW_BUFFERS);