[Mesa-dev] [PATCH 5/5] mesa: move/fix MAX_WIDTH/HEIGHT-related assertions
Jose Fonseca
jfonseca at vmware.com
Mon Feb 20 06:53:25 PST 2012
The whole series is a great cleanup and looks correct AFAICT.
We should eventually make MAX_WIDTH/HEIGHT a swrast-only define.
Jose
----- Original Message -----
> From: Brian Paul <brianp at vmware.com>
>
> Max texture and viewport size is only limited by MAX_WIDTH/HEIGHT for
> swrast.
> ---
> src/mesa/main/context.c | 11 ++---------
> src/mesa/swrast/s_context.c | 8 ++++++++
> 2 files changed, 10 insertions(+), 9 deletions(-)
>
> diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
> index 43e7438..b9defdb 100644
> --- a/src/mesa/main/context.c
> +++ b/src/mesa/main/context.c
> @@ -712,20 +712,13 @@ check_context_limits(struct gl_context *ctx)
> 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);
> -
> /* Texture level checks */
> 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);
> -
> - assert(ctx->Const.MaxViewportWidth <= MAX_WIDTH);
> - assert(ctx->Const.MaxViewportHeight <= MAX_WIDTH);
> + assert((1 << (MAX_TEXTURE_LEVELS - 1)) <=
> ctx->Const.MaxViewportWidth);
> + assert((1 << (MAX_TEXTURE_LEVELS - 1)) <=
> ctx->Const.MaxViewportHeight);
>
> assert(ctx->Const.MaxDrawBuffers <= MAX_DRAW_BUFFERS);
>
> diff --git a/src/mesa/swrast/s_context.c
> b/src/mesa/swrast/s_context.c
> index cc304d7..2ebb649 100644
> --- a/src/mesa/swrast/s_context.c
> +++ b/src/mesa/swrast/s_context.c
> @@ -726,6 +726,14 @@ _swrast_CreateContext( struct gl_context *ctx )
> const GLuint maxThreads = 1;
> #endif
>
> + assert(ctx->Const.MaxViewportWidth <= MAX_WIDTH);
> + assert(ctx->Const.MaxViewportHeight <= MAX_WIDTH);
> +
> + /* 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);
> +
> if (SWRAST_DEBUG) {
> _mesa_debug(ctx, "_swrast_CreateContext\n");
> }
> --
> 1.7.3.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
More information about the mesa-dev
mailing list