[Mesa-dev] [PATCH 20/23] mesa: remove last of MAX_WIDTH, MAX_HEIGHT

Jose Fonseca jfonseca at vmware.com
Tue Feb 21 01:22:00 PST 2012


Your series is a huge step forward already.  But I wonder if we could go just a bit further and not add MAX_VIEWPORT_WIDTH/HEIGHT and MAX_RENDERBUFFER_SIZE defines.

Would it be possible to derive these limits from the maximum texture size? Either the driver reported max texture size, or just define them in terms of MAX_TEXTURE_LEVELS so that there are less places to change next time we need to bump them.

Alternatively, we could set them to zero, and later assert that the driver fill them correctly. I'm actually surprised that no driver actually sets them. Granted, viewport can be bigger than the maximum texture size, but there is no guarantee is there that old hardware drivers won't get broken next time we need to bump this to suite a new hardware.

Jose

----- Original Message -----
> From: Brian Paul <brianp at vmware.com>
> 
> Define new MAX_VIEWPORT_WIDTH/HEIGHT and MAX_RENDERBUFFER_SIZE values
> instead.
> ---
>  src/mesa/drivers/dri/i915/intel_decode.c |    1 -
>  src/mesa/main/config.h                   |   13 ++++---------
>  src/mesa/main/context.c                  |    6 +++---
>  3 files changed, 7 insertions(+), 13 deletions(-)
>  delete mode 120000 src/mesa/drivers/dri/i915/intel_decode.c
> 
> diff --git a/src/mesa/drivers/dri/i915/intel_decode.c
> b/src/mesa/drivers/dri/i915/intel_decode.c
> deleted file mode 120000
> index f671b6c..0000000
> --- a/src/mesa/drivers/dri/i915/intel_decode.c
> +++ /dev/null
> @@ -1 +0,0 @@
> -../intel/intel_decode.c
> \ No newline at end of file
> diff --git a/src/mesa/main/config.h b/src/mesa/main/config.h
> index 6286fe0..c70cc18 100644
> --- a/src/mesa/main/config.h
> +++ b/src/mesa/main/config.h
> @@ -136,15 +136,9 @@
>  #define MAX_TEXTURE_UNITS ((MAX_TEXTURE_COORD_UNITS >
>  MAX_TEXTURE_IMAGE_UNITS) ? MAX_TEXTURE_COORD_UNITS :
>  MAX_TEXTURE_IMAGE_UNITS)
>  
>  
> -/**
> - * Maximum viewport/image size.  Must accomodate all texture sizes
> too.
> - */
> -#ifndef MAX_WIDTH
> -#   define MAX_WIDTH 16384
> -#endif
> -#ifndef MAX_HEIGHT
> -#   define MAX_HEIGHT 16384
> -#endif
> +/** Maximum viewport size */
> +#define MAX_VIEWPORT_WIDTH 16384
> +#define MAX_VIEWPORT_HEIGHT 16384
>  
>  /** Maxmimum size for CVA.  May be overridden by the drivers.  */
>  #define MAX_ARRAY_LOCK_SIZE 3000
> @@ -248,6 +242,7 @@
>  /** For GL_EXT_framebuffer_object */
>  /*@{*/
>  #define MAX_COLOR_ATTACHMENTS 8
> +#define MAX_RENDERBUFFER_SIZE 16384
>  /*@}*/
>  
>  /** For GL_ATI_envmap_bump - support bump mapping on first 8 units
>  */
> diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
> index b9defdb..754d313 100644
> --- a/src/mesa/main/context.c
> +++ b/src/mesa/main/context.c
> @@ -586,8 +586,8 @@ _mesa_init_constants(struct gl_context *ctx)
>     ctx->Const.MaxLights = MAX_LIGHTS;
>     ctx->Const.MaxShininess = 128.0;
>     ctx->Const.MaxSpotExponent = 128.0;
> -   ctx->Const.MaxViewportWidth = MAX_WIDTH;
> -   ctx->Const.MaxViewportHeight = MAX_HEIGHT;
> +   ctx->Const.MaxViewportWidth = MAX_VIEWPORT_WIDTH;
> +   ctx->Const.MaxViewportHeight = MAX_VIEWPORT_HEIGHT;
>  #if FEATURE_ARB_vertex_program
>     init_program_limits(GL_VERTEX_PROGRAM_ARB,
>     &ctx->Const.VertexProgram);
>  #endif
> @@ -608,7 +608,7 @@ _mesa_init_constants(struct gl_context *ctx)
>  
>  #if FEATURE_EXT_framebuffer_object
>     ctx->Const.MaxColorAttachments = MAX_COLOR_ATTACHMENTS;
> -   ctx->Const.MaxRenderbufferSize = MAX_WIDTH;
> +   ctx->Const.MaxRenderbufferSize = MAX_RENDERBUFFER_SIZE;
>  #endif
>  
>  #if FEATURE_ARB_vertex_shader
> --
> 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