[Mesa-dev] [PATCH] gallium: separate out floating-point CAPs into its own enum

Jakob Bornecrantz jakob at vmware.com
Sun Nov 20 17:16:17 PST 2011


Looks good, for the u_caps.c code you might as well just change
the macro to include the FLOAT_ prefix instead changing where
they are used. Fix that and you have my

Reviewed-by: Jakob Bornecrantz <jakob at vmware.com>

Cheers, Jakob.

----- Original Message -----
> The motivation behind this is to add some self-documentation in the
> code about how each CAP can be used.
> 
> The idea is:
> - enum pipe_cap is only valid in get_param
> - enum pipe_cap_float is only valid in get_paramf
> 
> Which CAPs are floating-point have been determined based on how
> everybody
> except svga implemented the functions. svga have been modified to
> match all
> the other drivers.
> 
> Besides that, the floating-point CAPs are now prefixed with
> PIPE_CAP_FLOAT_.
> ---
>  src/gallium/auxiliary/util/u_caps.c        |   10 ++++----
>  src/gallium/docs/source/screen.rst         |   28
>  +++++++++++++--------
>  src/gallium/drivers/cell/ppu/cell_screen.c |   14 +++++-----
>  src/gallium/drivers/galahad/glhd_screen.c  |    2 +-
>  src/gallium/drivers/i915/i915_screen.c     |   14 +++++-----
>  src/gallium/drivers/i965/brw_screen.c      |   14 +++++-----
>  src/gallium/drivers/identity/id_screen.c   |    2 +-
>  src/gallium/drivers/llvmpipe/lp_screen.c   |   22 ++++++++--------
>  src/gallium/drivers/noop/noop_pipe.c       |    3 +-
>  src/gallium/drivers/nv50/nv50_screen.c     |   14 +++++-----
>  src/gallium/drivers/nvc0/nvc0_screen.c     |   14 +++++-----
>  src/gallium/drivers/nvfx/nvfx_screen.c     |   14 +++++-----
>  src/gallium/drivers/r300/r300_screen.c     |   23 +++++++++--------
>  src/gallium/drivers/r300/r300_state.c      |    2 +-
>  src/gallium/drivers/r600/r600_pipe.c       |   15 ++++++-----
>  src/gallium/drivers/rbug/rbug_screen.c     |    2 +-
>  src/gallium/drivers/softpipe/sp_screen.c   |   14 +++++-----
>  src/gallium/drivers/svga/svga_screen.c     |   37
>  ++++++++++++++++------------
>  src/gallium/drivers/trace/tr_screen.c      |    2 +-
>  src/gallium/include/pipe/p_defines.h       |   30
>  ++++++++++++++--------
>  src/gallium/include/pipe/p_screen.h        |    2 +-
>  src/mesa/state_tracker/st_extensions.c     |   17 ++++++++----
>  22 files changed, 161 insertions(+), 134 deletions(-)
> 
> diff --git a/src/gallium/auxiliary/util/u_caps.c
> b/src/gallium/auxiliary/util/u_caps.c
> index 75677b2..064fe3d 100644
> --- a/src/gallium/auxiliary/util/u_caps.c
> +++ b/src/gallium/auxiliary/util/u_caps.c
> @@ -122,7 +122,7 @@ static unsigned caps_dx_9_1[] = {
>     UTIL_CHECK_INT(MAX_TEXTURE_2D_LEVELS, 12),    /* 2048 */
>     UTIL_CHECK_INT(MAX_TEXTURE_3D_LEVELS, 9),     /* 256 */
>     UTIL_CHECK_INT(MAX_TEXTURE_CUBE_LEVELS, 10),  /* 512 */
> -   UTIL_CHECK_FLOAT(MAX_TEXTURE_ANISOTROPY, 2),
> +   UTIL_CHECK_FLOAT(FLOAT_MAX_TEXTURE_ANISOTROPY, 2),
>     UTIL_CHECK_TERMINATE
>  };
>  
> @@ -134,7 +134,7 @@ static unsigned caps_dx_9_2[] = {
>     UTIL_CHECK_INT(MAX_TEXTURE_2D_LEVELS, 12),    /* 2048 */
>     UTIL_CHECK_INT(MAX_TEXTURE_3D_LEVELS, 9),     /* 256 */
>     UTIL_CHECK_INT(MAX_TEXTURE_CUBE_LEVELS, 10),  /* 512 */
> -   UTIL_CHECK_FLOAT(MAX_TEXTURE_ANISOTROPY, 16),
> +   UTIL_CHECK_FLOAT(FLOAT_MAX_TEXTURE_ANISOTROPY, 16),
>     UTIL_CHECK_TERMINATE
>  };
>  
> @@ -147,7 +147,7 @@ static unsigned caps_dx_9_3[] = {
>     UTIL_CHECK_INT(MAX_TEXTURE_2D_LEVELS, 13),    /* 4096 */
>     UTIL_CHECK_INT(MAX_TEXTURE_3D_LEVELS, 9),     /* 256 */
>     UTIL_CHECK_INT(MAX_TEXTURE_CUBE_LEVELS, 10),  /* 512 */
> -   UTIL_CHECK_FLOAT(MAX_TEXTURE_ANISOTROPY, 16),
> +   UTIL_CHECK_FLOAT(FLOAT_MAX_TEXTURE_ANISOTROPY, 16),
>     UTIL_CHECK_TERMINATE
>  };
>  
> @@ -160,7 +160,7 @@ static unsigned caps_dx_10[] = {
>     UTIL_CHECK_INT(MAX_TEXTURE_2D_LEVELS, 14),    /* 8192 */
>     UTIL_CHECK_INT(MAX_TEXTURE_3D_LEVELS, 12),    /* 2048 */
>     UTIL_CHECK_INT(MAX_TEXTURE_CUBE_LEVELS, 14),  /* 8192 */
> -   UTIL_CHECK_FLOAT(MAX_TEXTURE_ANISOTROPY, 16),
> +   UTIL_CHECK_FLOAT(FLOAT_MAX_TEXTURE_ANISOTROPY, 16),
>     UTIL_CHECK_UNIMPLEMENTED, /* XXX Unimplemented features in
>     Gallium */
>     UTIL_CHECK_TERMINATE
>  };
> @@ -174,7 +174,7 @@ static unsigned caps_dx_11[] = {
>     UTIL_CHECK_INT(MAX_TEXTURE_2D_LEVELS, 14),    /* 16384 */
>     UTIL_CHECK_INT(MAX_TEXTURE_3D_LEVELS, 12),    /* 2048 */
>     UTIL_CHECK_INT(MAX_TEXTURE_CUBE_LEVELS, 14),  /* 16384 */
> -   UTIL_CHECK_FLOAT(MAX_TEXTURE_ANISOTROPY, 16),
> +   UTIL_CHECK_FLOAT(FLOAT_MAX_TEXTURE_ANISOTROPY, 16),
>     UTIL_CHECK_FORMAT(B8G8R8A8_UNORM),
>     UTIL_CHECK_UNIMPLEMENTED, /* XXX Unimplemented features in
>     Gallium */
>     UTIL_CHECK_TERMINATE
> diff --git a/src/gallium/docs/source/screen.rst
> b/src/gallium/docs/source/screen.rst
> index 1272171..d5a2bbe 100644
> --- a/src/gallium/docs/source/screen.rst
> +++ b/src/gallium/docs/source/screen.rst
> @@ -74,20 +74,26 @@ The integer capabilities:
>  * ``PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER``: Whether the TGSI
>    property FS_COORD_PIXEL_CENTER with value INTEGER is supported.
>  
> -The floating-point capabilities:
>  
> -* ``PIPE_CAP_MAX_LINE_WIDTH``: The maximum width of a regular line.
> -* ``PIPE_CAP_MAX_LINE_WIDTH_AA``: The maximum width of a smoothed
> line.
> -* ``PIPE_CAP_MAX_POINT_WIDTH``: The maximum width and height of a
> point.
> -* ``PIPE_CAP_MAX_POINT_WIDTH_AA``: The maximum width and height of a
> smoothed point.
> -* ``PIPE_CAP_MAX_TEXTURE_ANISOTROPY``: The maximum level of
> anisotropy that can be
> +.. _pipe_cap_float:
> +
> +PIPE_CAP_FLOAT_*
> +^^^^^^^^^^^^^^^^
> +
> +The floating-point capabilities are:
> +
> +* ``PIPE_CAP_FLOAT_MAX_LINE_WIDTH``: The maximum width of a regular
> line.
> +* ``PIPE_CAP_FLOAT_MAX_LINE_WIDTH_AA``: The maximum width of a
> smoothed line.
> +* ``PIPE_CAP_FLOAT_MAX_POINT_WIDTH``: The maximum width and height
> of a point.
> +* ``PIPE_CAP_FLOAT_MAX_POINT_WIDTH_AA``: The maximum width and
> height of a smoothed point.
> +* ``PIPE_CAP_FLOAT_MAX_TEXTURE_ANISOTROPY``: The maximum level of
> anisotropy that can be
>    applied to anisotropically filtered textures.
> -* ``PIPE_CAP_MAX_TEXTURE_LOD_BIAS``: The maximum :term:`LOD` bias
> that may be applied
> +* ``PIPE_CAP_FLOAT_MAX_TEXTURE_LOD_BIAS``: The maximum :term:`LOD`
> bias that may be applied
>    to filtered textures.
> -* ``PIPE_CAP_GUARD_BAND_LEFT``,
> -  ``PIPE_CAP_GUARD_BAND_TOP``,
> -  ``PIPE_CAP_GUARD_BAND_RIGHT``,
> -  ``PIPE_CAP_GUARD_BAND_BOTTOM``: TODO
> +* ``PIPE_CAP_FLOAT_GUARD_BAND_LEFT``,
> +  ``PIPE_CAP_FLOAT_GUARD_BAND_TOP``,
> +  ``PIPE_CAP_FLOAT_GUARD_BAND_RIGHT``,
> +  ``PIPE_CAP_FLOAT_GUARD_BAND_BOTTOM``: TODO
>  
>  
>  .. _pipe_shader_cap:
> diff --git a/src/gallium/drivers/cell/ppu/cell_screen.c
> b/src/gallium/drivers/cell/ppu/cell_screen.c
> index 86acbc7..af5d72f 100644
> --- a/src/gallium/drivers/cell/ppu/cell_screen.c
> +++ b/src/gallium/drivers/cell/ppu/cell_screen.c
> @@ -120,23 +120,23 @@ cell_get_shader_param(struct pipe_screen
> *screen, unsigned shader, enum pipe_sha
>  }
>  
>  static float
> -cell_get_paramf(struct pipe_screen *screen, enum pipe_cap param)
> +cell_get_paramf(struct pipe_screen *screen, enum pipe_cap_float
> param)
>  {
>     switch (param) {
> -   case PIPE_CAP_MAX_LINE_WIDTH:
> +   case PIPE_CAP_FLOAT_MAX_LINE_WIDTH:
>        /* fall-through */
> -   case PIPE_CAP_MAX_LINE_WIDTH_AA:
> +   case PIPE_CAP_FLOAT_MAX_LINE_WIDTH_AA:
>        return 255.0; /* arbitrary */
>  
> -   case PIPE_CAP_MAX_POINT_WIDTH:
> +   case PIPE_CAP_FLOAT_MAX_POINT_WIDTH:
>        /* fall-through */
> -   case PIPE_CAP_MAX_POINT_WIDTH_AA:
> +   case PIPE_CAP_FLOAT_MAX_POINT_WIDTH_AA:
>        return 255.0; /* arbitrary */
>  
> -   case PIPE_CAP_MAX_TEXTURE_ANISOTROPY:
> +   case PIPE_CAP_FLOAT_MAX_TEXTURE_ANISOTROPY:
>        return 0.0;
>  
> -   case PIPE_CAP_MAX_TEXTURE_LOD_BIAS:
> +   case PIPE_CAP_FLOAT_MAX_TEXTURE_LOD_BIAS:
>        return 16.0; /* arbitrary */
>  
>     default:
> diff --git a/src/gallium/drivers/galahad/glhd_screen.c
> b/src/gallium/drivers/galahad/glhd_screen.c
> index b4edebe..bb0db74 100644
> --- a/src/gallium/drivers/galahad/glhd_screen.c
> +++ b/src/gallium/drivers/galahad/glhd_screen.c
> @@ -92,7 +92,7 @@ galahad_screen_get_shader_param(struct pipe_screen
> *_screen,
>  
>  static float
>  galahad_screen_get_paramf(struct pipe_screen *_screen,
> -                           enum pipe_cap param)
> +                           enum pipe_cap_float param)
>  {
>     struct galahad_screen *glhd_screen = galahad_screen(_screen);
>     struct pipe_screen *screen = glhd_screen->screen;
> diff --git a/src/gallium/drivers/i915/i915_screen.c
> b/src/gallium/drivers/i915/i915_screen.c
> index 75545f4..a6d3cf1 100644
> --- a/src/gallium/drivers/i915/i915_screen.c
> +++ b/src/gallium/drivers/i915/i915_screen.c
> @@ -241,23 +241,23 @@ i915_get_param(struct pipe_screen *screen, enum
> pipe_cap cap)
>  }
>  
>  static float
> -i915_get_paramf(struct pipe_screen *screen, enum pipe_cap cap)
> +i915_get_paramf(struct pipe_screen *screen, enum pipe_cap_float cap)
>  {
>     switch(cap) {
> -   case PIPE_CAP_MAX_LINE_WIDTH:
> +   case PIPE_CAP_FLOAT_MAX_LINE_WIDTH:
>        /* fall-through */
> -   case PIPE_CAP_MAX_LINE_WIDTH_AA:
> +   case PIPE_CAP_FLOAT_MAX_LINE_WIDTH_AA:
>        return 7.5;
>  
> -   case PIPE_CAP_MAX_POINT_WIDTH:
> +   case PIPE_CAP_FLOAT_MAX_POINT_WIDTH:
>        /* fall-through */
> -   case PIPE_CAP_MAX_POINT_WIDTH_AA:
> +   case PIPE_CAP_FLOAT_MAX_POINT_WIDTH_AA:
>        return 255.0;
>  
> -   case PIPE_CAP_MAX_TEXTURE_ANISOTROPY:
> +   case PIPE_CAP_FLOAT_MAX_TEXTURE_ANISOTROPY:
>        return 4.0;
>  
> -   case PIPE_CAP_MAX_TEXTURE_LOD_BIAS:
> +   case PIPE_CAP_FLOAT_MAX_TEXTURE_LOD_BIAS:
>        return 16.0;
>  
>     default:
> diff --git a/src/gallium/drivers/i965/brw_screen.c
> b/src/gallium/drivers/i965/brw_screen.c
> index deafd4b..3f1b34b 100644
> --- a/src/gallium/drivers/i965/brw_screen.c
> +++ b/src/gallium/drivers/i965/brw_screen.c
> @@ -250,23 +250,23 @@ brw_get_shader_param(struct pipe_screen
> *screen, unsigned shader, enum pipe_shad
>  }
>  
>  static float
> -brw_get_paramf(struct pipe_screen *screen, enum pipe_cap param)
> +brw_get_paramf(struct pipe_screen *screen, enum pipe_cap_float
> param)
>  {
>     switch (param) {
> -   case PIPE_CAP_MAX_LINE_WIDTH:
> +   case PIPE_CAP_FLOAT_MAX_LINE_WIDTH:
>        /* fall-through */
> -   case PIPE_CAP_MAX_LINE_WIDTH_AA:
> +   case PIPE_CAP_FLOAT_MAX_LINE_WIDTH_AA:
>        return 7.5;
>  
> -   case PIPE_CAP_MAX_POINT_WIDTH:
> +   case PIPE_CAP_FLOAT_MAX_POINT_WIDTH:
>        /* fall-through */
> -   case PIPE_CAP_MAX_POINT_WIDTH_AA:
> +   case PIPE_CAP_FLOAT_MAX_POINT_WIDTH_AA:
>        return 255.0;
>  
> -   case PIPE_CAP_MAX_TEXTURE_ANISOTROPY:
> +   case PIPE_CAP_FLOAT_MAX_TEXTURE_ANISOTROPY:
>        return 4.0;
>  
> -   case PIPE_CAP_MAX_TEXTURE_LOD_BIAS:
> +   case PIPE_CAP_FLOAT_MAX_TEXTURE_LOD_BIAS:
>        return 16.0;
>  
>     default:
> diff --git a/src/gallium/drivers/identity/id_screen.c
> b/src/gallium/drivers/identity/id_screen.c
> index 9bf7fd4..f042398 100644
> --- a/src/gallium/drivers/identity/id_screen.c
> +++ b/src/gallium/drivers/identity/id_screen.c
> @@ -89,7 +89,7 @@ identity_screen_get_shader_param(struct pipe_screen
> *_screen,
>  
>  static float
>  identity_screen_get_paramf(struct pipe_screen *_screen,
> -                           enum pipe_cap param)
> +                           enum pipe_cap_float param)
>  {
>     struct identity_screen *id_screen = identity_screen(_screen);
>     struct pipe_screen *screen = id_screen->screen;
> diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c
> b/src/gallium/drivers/llvmpipe/lp_screen.c
> index fac13e7..c7053b1 100644
> --- a/src/gallium/drivers/llvmpipe/lp_screen.c
> +++ b/src/gallium/drivers/llvmpipe/lp_screen.c
> @@ -192,25 +192,25 @@ llvmpipe_get_shader_param(struct pipe_screen
> *screen, unsigned shader, enum pipe
>  }
>  
>  static float
> -llvmpipe_get_paramf(struct pipe_screen *screen, enum pipe_cap param)
> +llvmpipe_get_paramf(struct pipe_screen *screen, enum pipe_cap_float
> param)
>  {
>     switch (param) {
> -   case PIPE_CAP_MAX_LINE_WIDTH:
> +   case PIPE_CAP_FLOAT_MAX_LINE_WIDTH:
>        /* fall-through */
> -   case PIPE_CAP_MAX_LINE_WIDTH_AA:
> +   case PIPE_CAP_FLOAT_MAX_LINE_WIDTH_AA:
>        return 255.0; /* arbitrary */
> -   case PIPE_CAP_MAX_POINT_WIDTH:
> +   case PIPE_CAP_FLOAT_MAX_POINT_WIDTH:
>        /* fall-through */
> -   case PIPE_CAP_MAX_POINT_WIDTH_AA:
> +   case PIPE_CAP_FLOAT_MAX_POINT_WIDTH_AA:
>        return 255.0; /* arbitrary */
> -   case PIPE_CAP_MAX_TEXTURE_ANISOTROPY:
> +   case PIPE_CAP_FLOAT_MAX_TEXTURE_ANISOTROPY:
>        return 16.0; /* not actually signficant at this time */
> -   case PIPE_CAP_MAX_TEXTURE_LOD_BIAS:
> +   case PIPE_CAP_FLOAT_MAX_TEXTURE_LOD_BIAS:
>        return 16.0; /* arbitrary */
> -   case PIPE_CAP_GUARD_BAND_LEFT:
> -   case PIPE_CAP_GUARD_BAND_TOP:
> -   case PIPE_CAP_GUARD_BAND_RIGHT:
> -   case PIPE_CAP_GUARD_BAND_BOTTOM:
> +   case PIPE_CAP_FLOAT_GUARD_BAND_LEFT:
> +   case PIPE_CAP_FLOAT_GUARD_BAND_TOP:
> +   case PIPE_CAP_FLOAT_GUARD_BAND_RIGHT:
> +   case PIPE_CAP_FLOAT_GUARD_BAND_BOTTOM:
>        return 0.0;
>     default:
>        assert(0);
> diff --git a/src/gallium/drivers/noop/noop_pipe.c
> b/src/gallium/drivers/noop/noop_pipe.c
> index baa4255..eb87cd9 100644
> --- a/src/gallium/drivers/noop/noop_pipe.c
> +++ b/src/gallium/drivers/noop/noop_pipe.c
> @@ -329,7 +329,8 @@ static int noop_get_param(struct pipe_screen*
> pscreen, enum pipe_cap param)
>  	return screen->get_param(screen, param);
>  }
>  
> -static float noop_get_paramf(struct pipe_screen* pscreen, enum
> pipe_cap param)
> +static float noop_get_paramf(struct pipe_screen* pscreen,
> +			     enum pipe_cap_float param)
>  {
>  	struct pipe_screen *screen = ((struct
>  	noop_pipe_screen*)pscreen)->oscreen;
>  
> diff --git a/src/gallium/drivers/nv50/nv50_screen.c
> b/src/gallium/drivers/nv50/nv50_screen.c
> index 1270c83..cfe3077 100644
> --- a/src/gallium/drivers/nv50/nv50_screen.c
> +++ b/src/gallium/drivers/nv50/nv50_screen.c
> @@ -201,18 +201,18 @@ nv50_screen_get_shader_param(struct pipe_screen
> *pscreen, unsigned shader,
>  }
>  
>  static float
> -nv50_screen_get_paramf(struct pipe_screen *pscreen, enum pipe_cap
> param)
> +nv50_screen_get_paramf(struct pipe_screen *pscreen, enum
> pipe_cap_float param)
>  {
>     switch (param) {
> -   case PIPE_CAP_MAX_LINE_WIDTH:
> -   case PIPE_CAP_MAX_LINE_WIDTH_AA:
> +   case PIPE_CAP_FLOAT_MAX_LINE_WIDTH:
> +   case PIPE_CAP_FLOAT_MAX_LINE_WIDTH_AA:
>        return 10.0f;
> -   case PIPE_CAP_MAX_POINT_WIDTH:
> -   case PIPE_CAP_MAX_POINT_WIDTH_AA:
> +   case PIPE_CAP_FLOAT_MAX_POINT_WIDTH:
> +   case PIPE_CAP_FLOAT_MAX_POINT_WIDTH_AA:
>        return 64.0f;
> -   case PIPE_CAP_MAX_TEXTURE_ANISOTROPY:
> +   case PIPE_CAP_FLOAT_MAX_TEXTURE_ANISOTROPY:
>        return 16.0f;
> -   case PIPE_CAP_MAX_TEXTURE_LOD_BIAS:
> +   case PIPE_CAP_FLOAT_MAX_TEXTURE_LOD_BIAS:
>        return 4.0f;
>     default:
>        NOUVEAU_ERR("unknown PIPE_CAP %d\n", param);
> diff --git a/src/gallium/drivers/nvc0/nvc0_screen.c
> b/src/gallium/drivers/nvc0/nvc0_screen.c
> index 0da7be4..056f8e7 100644
> --- a/src/gallium/drivers/nvc0/nvc0_screen.c
> +++ b/src/gallium/drivers/nvc0/nvc0_screen.c
> @@ -193,18 +193,18 @@ nvc0_screen_get_shader_param(struct pipe_screen
> *pscreen, unsigned shader,
>  }
>  
>  static float
> -nvc0_screen_get_paramf(struct pipe_screen *pscreen, enum pipe_cap
> param)
> +nvc0_screen_get_paramf(struct pipe_screen *pscreen, enum
> pipe_cap_float param)
>  {
>     switch (param) {
> -   case PIPE_CAP_MAX_LINE_WIDTH:
> -   case PIPE_CAP_MAX_LINE_WIDTH_AA:
> +   case PIPE_CAP_FLOAT_MAX_LINE_WIDTH:
> +   case PIPE_CAP_FLOAT_MAX_LINE_WIDTH_AA:
>        return 10.0f;
> -   case PIPE_CAP_MAX_POINT_WIDTH:
> -   case PIPE_CAP_MAX_POINT_WIDTH_AA:
> +   case PIPE_CAP_FLOAT_MAX_POINT_WIDTH:
> +   case PIPE_CAP_FLOAT_MAX_POINT_WIDTH_AA:
>        return 64.0f;
> -   case PIPE_CAP_MAX_TEXTURE_ANISOTROPY:
> +   case PIPE_CAP_FLOAT_MAX_TEXTURE_ANISOTROPY:
>        return 16.0f;
> -   case PIPE_CAP_MAX_TEXTURE_LOD_BIAS:
> +   case PIPE_CAP_FLOAT_MAX_TEXTURE_LOD_BIAS:
>        return 4.0f;
>     default:
>        NOUVEAU_ERR("unknown PIPE_CAP %d\n", param);
> diff --git a/src/gallium/drivers/nvfx/nvfx_screen.c
> b/src/gallium/drivers/nvfx/nvfx_screen.c
> index 6086d43..6d6f0bc 100644
> --- a/src/gallium/drivers/nvfx/nvfx_screen.c
> +++ b/src/gallium/drivers/nvfx/nvfx_screen.c
> @@ -190,20 +190,20 @@ nvfx_screen_get_shader_param(struct pipe_screen
> *pscreen, unsigned shader, enum
>  }
>  
>  static float
> -nvfx_screen_get_paramf(struct pipe_screen *pscreen, enum pipe_cap
> param)
> +nvfx_screen_get_paramf(struct pipe_screen *pscreen, enum
> pipe_cap_float param)
>  {
>  	struct nvfx_screen *screen = nvfx_screen(pscreen);
>  
>  	switch (param) {
> -	case PIPE_CAP_MAX_LINE_WIDTH:
> -	case PIPE_CAP_MAX_LINE_WIDTH_AA:
> +	case PIPE_CAP_FLOAT_MAX_LINE_WIDTH:
> +	case PIPE_CAP_FLOAT_MAX_LINE_WIDTH_AA:
>  		return 10.0;
> -	case PIPE_CAP_MAX_POINT_WIDTH:
> -	case PIPE_CAP_MAX_POINT_WIDTH_AA:
> +	case PIPE_CAP_FLOAT_MAX_POINT_WIDTH:
> +	case PIPE_CAP_FLOAT_MAX_POINT_WIDTH_AA:
>  		return 64.0;
> -	case PIPE_CAP_MAX_TEXTURE_ANISOTROPY:
> +	case PIPE_CAP_FLOAT_MAX_TEXTURE_ANISOTROPY:
>  		return screen->use_nv4x ? 16.0 : 8.0;
> -	case PIPE_CAP_MAX_TEXTURE_LOD_BIAS:
> +	case PIPE_CAP_FLOAT_MAX_TEXTURE_LOD_BIAS:
>  		return 15.0;
>  	default:
>  		NOUVEAU_ERR("Unknown PIPE_CAP %d\n", param);
> diff --git a/src/gallium/drivers/r300/r300_screen.c
> b/src/gallium/drivers/r300/r300_screen.c
> index ab1cec5..af4cb67 100644
> --- a/src/gallium/drivers/r300/r300_screen.c
> +++ b/src/gallium/drivers/r300/r300_screen.c
> @@ -274,15 +274,16 @@ static int r300_get_shader_param(struct
> pipe_screen *pscreen, unsigned shader, e
>      return 0;
>  }
>  
> -static float r300_get_paramf(struct pipe_screen* pscreen, enum
> pipe_cap param)
> +static float r300_get_paramf(struct pipe_screen* pscreen,
> +                             enum pipe_cap_float param)
>  {
>      struct r300_screen* r300screen = r300_screen(pscreen);
>  
>      switch (param) {
> -        case PIPE_CAP_MAX_LINE_WIDTH:
> -        case PIPE_CAP_MAX_LINE_WIDTH_AA:
> -        case PIPE_CAP_MAX_POINT_WIDTH:
> -        case PIPE_CAP_MAX_POINT_WIDTH_AA:
> +        case PIPE_CAP_FLOAT_MAX_LINE_WIDTH:
> +        case PIPE_CAP_FLOAT_MAX_LINE_WIDTH_AA:
> +        case PIPE_CAP_FLOAT_MAX_POINT_WIDTH:
> +        case PIPE_CAP_FLOAT_MAX_POINT_WIDTH_AA:
>              /* The maximum dimensions of the colorbuffer are our
>              practical
>               * rendering limits. 2048 pixels should be enough for
>               anybody. */
>              if (r300screen->caps.is_r500) {
> @@ -292,14 +293,14 @@ static float r300_get_paramf(struct
> pipe_screen* pscreen, enum pipe_cap param)
>              } else {
>                  return 2560.0f;
>              }
> -        case PIPE_CAP_MAX_TEXTURE_ANISOTROPY:
> +        case PIPE_CAP_FLOAT_MAX_TEXTURE_ANISOTROPY:
>              return 16.0f;
> -        case PIPE_CAP_MAX_TEXTURE_LOD_BIAS:
> +        case PIPE_CAP_FLOAT_MAX_TEXTURE_LOD_BIAS:
>              return 16.0f;
> -        case PIPE_CAP_GUARD_BAND_LEFT:
> -        case PIPE_CAP_GUARD_BAND_TOP:
> -        case PIPE_CAP_GUARD_BAND_RIGHT:
> -        case PIPE_CAP_GUARD_BAND_BOTTOM:
> +        case PIPE_CAP_FLOAT_GUARD_BAND_LEFT:
> +        case PIPE_CAP_FLOAT_GUARD_BAND_TOP:
> +        case PIPE_CAP_FLOAT_GUARD_BAND_RIGHT:
> +        case PIPE_CAP_FLOAT_GUARD_BAND_BOTTOM:
>              /* XXX I don't know what these should be but the least
>              we can do is
>               * silence the potential error message */
>              return 0.0f;
> diff --git a/src/gallium/drivers/r300/r300_state.c
> b/src/gallium/drivers/r300/r300_state.c
> index 11282a4..e19a9b3 100644
> --- a/src/gallium/drivers/r300/r300_state.c
> +++ b/src/gallium/drivers/r300/r300_state.c
> @@ -1074,7 +1074,7 @@ static void* r300_create_rs_state(struct
> pipe_context* pipe,
>          /* Per-vertex point size.
>           * Clamp to [0, max FB size] */
>          psiz = pipe->screen->get_paramf(pipe->screen,
> -                                        PIPE_CAP_MAX_POINT_WIDTH);
> +
>                                        PIPE_CAP_FLOAT_MAX_POINT_WIDTH);
>          point_minmax =
>              pack_float_16_6x(psiz) <<
>              R300_GA_POINT_MINMAX_MAX_SHIFT;
>      } else {
> diff --git a/src/gallium/drivers/r600/r600_pipe.c
> b/src/gallium/drivers/r600/r600_pipe.c
> index 243de14..c7a6030 100644
> --- a/src/gallium/drivers/r600/r600_pipe.c
> +++ b/src/gallium/drivers/r600/r600_pipe.c
> @@ -433,23 +433,24 @@ static int r600_get_param(struct pipe_screen*
> pscreen, enum pipe_cap param)
>  	}
>  }
>  
> -static float r600_get_paramf(struct pipe_screen* pscreen, enum
> pipe_cap param)
> +static float r600_get_paramf(struct pipe_screen* pscreen,
> +			     enum pipe_cap_float param)
>  {
>  	struct r600_screen *rscreen = (struct r600_screen *)pscreen;
>  	enum radeon_family family = rscreen->family;
>  
>  	switch (param) {
> -	case PIPE_CAP_MAX_LINE_WIDTH:
> -	case PIPE_CAP_MAX_LINE_WIDTH_AA:
> -	case PIPE_CAP_MAX_POINT_WIDTH:
> -	case PIPE_CAP_MAX_POINT_WIDTH_AA:
> +	case PIPE_CAP_FLOAT_MAX_LINE_WIDTH:
> +	case PIPE_CAP_FLOAT_MAX_LINE_WIDTH_AA:
> +	case PIPE_CAP_FLOAT_MAX_POINT_WIDTH:
> +	case PIPE_CAP_FLOAT_MAX_POINT_WIDTH_AA:
>  		if (family >= CHIP_CEDAR)
>  			return 16384.0f;
>  		else
>  			return 8192.0f;
> -	case PIPE_CAP_MAX_TEXTURE_ANISOTROPY:
> +	case PIPE_CAP_FLOAT_MAX_TEXTURE_ANISOTROPY:
>  		return 16.0f;
> -	case PIPE_CAP_MAX_TEXTURE_LOD_BIAS:
> +	case PIPE_CAP_FLOAT_MAX_TEXTURE_LOD_BIAS:
>  		return 16.0f;
>  	default:
>  		R600_ERR("r600: unsupported paramf %d\n", param);
> diff --git a/src/gallium/drivers/rbug/rbug_screen.c
> b/src/gallium/drivers/rbug/rbug_screen.c
> index 7c8dfdc..76487ce 100644
> --- a/src/gallium/drivers/rbug/rbug_screen.c
> +++ b/src/gallium/drivers/rbug/rbug_screen.c
> @@ -92,7 +92,7 @@ rbug_screen_get_shader_param(struct pipe_screen
> *_screen,
>  
>  static float
>  rbug_screen_get_paramf(struct pipe_screen *_screen,
> -                       enum pipe_cap param)
> +                       enum pipe_cap_float param)
>  {
>     struct rbug_screen *rb_screen = rbug_screen(_screen);
>     struct pipe_screen *screen = rb_screen->screen;
> diff --git a/src/gallium/drivers/softpipe/sp_screen.c
> b/src/gallium/drivers/softpipe/sp_screen.c
> index 4851049..191f821 100644
> --- a/src/gallium/drivers/softpipe/sp_screen.c
> +++ b/src/gallium/drivers/softpipe/sp_screen.c
> @@ -157,20 +157,20 @@ softpipe_get_shader_param(struct pipe_screen
> *screen, unsigned shader, enum pipe
>  }
>  
>  static float
> -softpipe_get_paramf(struct pipe_screen *screen, enum pipe_cap param)
> +softpipe_get_paramf(struct pipe_screen *screen, enum pipe_cap_float
> param)
>  {
>     switch (param) {
> -   case PIPE_CAP_MAX_LINE_WIDTH:
> +   case PIPE_CAP_FLOAT_MAX_LINE_WIDTH:
>        /* fall-through */
> -   case PIPE_CAP_MAX_LINE_WIDTH_AA:
> +   case PIPE_CAP_FLOAT_MAX_LINE_WIDTH_AA:
>        return 255.0; /* arbitrary */
> -   case PIPE_CAP_MAX_POINT_WIDTH:
> +   case PIPE_CAP_FLOAT_MAX_POINT_WIDTH:
>        /* fall-through */
> -   case PIPE_CAP_MAX_POINT_WIDTH_AA:
> +   case PIPE_CAP_FLOAT_MAX_POINT_WIDTH_AA:
>        return 255.0; /* arbitrary */
> -   case PIPE_CAP_MAX_TEXTURE_ANISOTROPY:
> +   case PIPE_CAP_FLOAT_MAX_TEXTURE_ANISOTROPY:
>        return 16.0;
> -   case PIPE_CAP_MAX_TEXTURE_LOD_BIAS:
> +   case PIPE_CAP_FLOAT_MAX_TEXTURE_LOD_BIAS:
>        return 16.0; /* arbitrary */
>     default:
>        return 0;
> diff --git a/src/gallium/drivers/svga/svga_screen.c
> b/src/gallium/drivers/svga/svga_screen.c
> index 7c4aa31..710e7d9 100644
> --- a/src/gallium/drivers/svga/svga_screen.c
> +++ b/src/gallium/drivers/svga/svga_screen.c
> @@ -94,34 +94,48 @@ svga_get_name( struct pipe_screen *pscreen )
>  
>  
>  static float
> -svga_get_paramf(struct pipe_screen *screen, enum pipe_cap param)
> +svga_get_paramf(struct pipe_screen *screen, enum pipe_cap_float
> param)
>  {
>     struct svga_screen *svgascreen = svga_screen(screen);
>     struct svga_winsys_screen *sws = svgascreen->sws;
>     SVGA3dDevCapResult result;
>  
>     switch (param) {
> -   case PIPE_CAP_MAX_LINE_WIDTH:
> +   case PIPE_CAP_FLOAT_MAX_LINE_WIDTH:
>        /* fall-through */
> -   case PIPE_CAP_MAX_LINE_WIDTH_AA:
> +   case PIPE_CAP_FLOAT_MAX_LINE_WIDTH_AA:
>        return 7.0;
>  
> -   case PIPE_CAP_MAX_POINT_WIDTH:
> +   case PIPE_CAP_FLOAT_MAX_POINT_WIDTH:
>        /* fall-through */
> -   case PIPE_CAP_MAX_POINT_WIDTH_AA:
> +   case PIPE_CAP_FLOAT_MAX_POINT_WIDTH_AA:
>        /* Keep this to a reasonable size to avoid failures in
>         * conform/pntaa.c:
>         */
>        return SVGA_MAX_POINTSIZE;
>  
> -   case PIPE_CAP_MAX_TEXTURE_ANISOTROPY:
> +   case PIPE_CAP_FLOAT_MAX_TEXTURE_ANISOTROPY:
>        if(!sws->get_cap(sws, SVGA3D_DEVCAP_MAX_TEXTURE_ANISOTROPY,
>        &result))
>           return 4.0;
>        return result.u;
>  
> -   case PIPE_CAP_MAX_TEXTURE_LOD_BIAS:
> +   case PIPE_CAP_FLOAT_MAX_TEXTURE_LOD_BIAS:
>        return 16.0;
>  
> +   default:
> +      return 0;
> +   }
> +}
> +
> +
> +static int
> +svga_get_param(struct pipe_screen *screen, enum pipe_cap param)
> +{
> +   struct svga_screen *svgascreen = svga_screen(screen);
> +   struct svga_winsys_screen *sws = svgascreen->sws;
> +   SVGA3dDevCapResult result;
> +
> +   switch (param) {
>     case PIPE_CAP_MAX_COMBINED_SAMPLERS:
>        return 16;
>     case PIPE_CAP_NPOT_TEXTURES:
> @@ -196,15 +210,6 @@ svga_get_paramf(struct pipe_screen *screen, enum
> pipe_cap param)
>     }
>  }
>  
> -
> -/* This is a fairly pointless interface
> - */
> -static int
> -svga_get_param(struct pipe_screen *screen, enum pipe_cap param)
> -{
> -   return (int) svga_get_paramf( screen, param );
> -}
> -
>  static int svga_get_shader_param(struct pipe_screen *screen,
>  unsigned shader, enum pipe_shader_cap param)
>  {
>     struct svga_screen *svgascreen = svga_screen(screen);
> diff --git a/src/gallium/drivers/trace/tr_screen.c
> b/src/gallium/drivers/trace/tr_screen.c
> index a7d3366..2498096 100644
> --- a/src/gallium/drivers/trace/tr_screen.c
> +++ b/src/gallium/drivers/trace/tr_screen.c
> @@ -132,7 +132,7 @@ trace_screen_get_shader_param(struct pipe_screen
> *_screen, unsigned shader,
>  
>  static float
>  trace_screen_get_paramf(struct pipe_screen *_screen,
> -                        enum pipe_cap param)
> +                        enum pipe_cap_float param)
>  {
>     struct trace_screen *tr_scr = trace_screen(_screen);
>     struct pipe_screen *screen = tr_scr->screen;
> diff --git a/src/gallium/include/pipe/p_defines.h
> b/src/gallium/include/pipe/p_defines.h
> index 5196591..1650850 100644
> --- a/src/gallium/include/pipe/p_defines.h
> +++ b/src/gallium/include/pipe/p_defines.h
> @@ -419,7 +419,7 @@ enum pipe_transfer_usage {
>  
>  /**
>   * Implementation capabilities/limits which are queried through
> - * pipe_screen::get_param() and pipe_screen::get_paramf().
> + * pipe_screen::get_param()
>   */
>  enum pipe_cap {
>     PIPE_CAP_NPOT_TEXTURES = 1,
> @@ -436,16 +436,6 @@ enum pipe_cap {
>     PIPE_CAP_MAX_TEXTURE_2D_LEVELS = 12,
>     PIPE_CAP_MAX_TEXTURE_3D_LEVELS = 13,
>     PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS = 14,
> -   PIPE_CAP_MAX_LINE_WIDTH = 15,
> -   PIPE_CAP_MAX_LINE_WIDTH_AA = 16,
> -   PIPE_CAP_MAX_POINT_WIDTH = 17,
> -   PIPE_CAP_MAX_POINT_WIDTH_AA = 18,
> -   PIPE_CAP_MAX_TEXTURE_ANISOTROPY = 19,
> -   PIPE_CAP_MAX_TEXTURE_LOD_BIAS = 20,
> -   PIPE_CAP_GUARD_BAND_LEFT = 21,  /*< float */
> -   PIPE_CAP_GUARD_BAND_TOP = 22,  /*< float */
> -   PIPE_CAP_GUARD_BAND_RIGHT = 23,  /*< float */
> -   PIPE_CAP_GUARD_BAND_BOTTOM = 24,  /*< float */
>     PIPE_CAP_TEXTURE_MIRROR_CLAMP = 25,
>     PIPE_CAP_BLEND_EQUATION_SEPARATE = 28,
>     PIPE_CAP_SM3 = 29,  /*< Shader Model, supported */
> @@ -479,6 +469,24 @@ enum pipe_cap {
>     PIPE_CAP_TEXTURE_BARRIER = 53
>  };
>  
> +/**
> + * Implementation limits which are queried through
> + * pipe_screen::get_paramf()
> + */
> +enum pipe_cap_float
> +{
> +   PIPE_CAP_FLOAT_MAX_LINE_WIDTH = 15,
> +   PIPE_CAP_FLOAT_MAX_LINE_WIDTH_AA = 16,
> +   PIPE_CAP_FLOAT_MAX_POINT_WIDTH = 17,
> +   PIPE_CAP_FLOAT_MAX_POINT_WIDTH_AA = 18,
> +   PIPE_CAP_FLOAT_MAX_TEXTURE_ANISOTROPY = 19,
> +   PIPE_CAP_FLOAT_MAX_TEXTURE_LOD_BIAS = 20,
> +   PIPE_CAP_FLOAT_GUARD_BAND_LEFT = 21,  /*< float */
> +   PIPE_CAP_FLOAT_GUARD_BAND_TOP = 22,  /*< float */
> +   PIPE_CAP_FLOAT_GUARD_BAND_RIGHT = 23,  /*< float */
> +   PIPE_CAP_FLOAT_GUARD_BAND_BOTTOM = 24,  /*< float */
> +};
> +
>  /* Shader caps not specific to any single stage */
>  enum pipe_shader_cap
>  {
> diff --git a/src/gallium/include/pipe/p_screen.h
> b/src/gallium/include/pipe/p_screen.h
> index 6821edd..661d505 100644
> --- a/src/gallium/include/pipe/p_screen.h
> +++ b/src/gallium/include/pipe/p_screen.h
> @@ -85,7 +85,7 @@ struct pipe_screen {
>      * Query a float-valued capability/parameter/limit
>      * \param param  one of PIPE_CAP_x
>      */
> -   float (*get_paramf)( struct pipe_screen *, enum pipe_cap param );
> +   float (*get_paramf)( struct pipe_screen *, enum pipe_cap_float
> param );
>  
>     /**
>      * Query a per-shader-stage integer-valued
>      capability/parameter/limit
> diff --git a/src/mesa/state_tracker/st_extensions.c
> b/src/mesa/state_tracker/st_extensions.c
> index 3563e1d..940e60d 100644
> --- a/src/mesa/state_tracker/st_extensions.c
> +++ b/src/mesa/state_tracker/st_extensions.c
> @@ -113,14 +113,18 @@ void st_init_limits(struct st_context *st)
>                1, MAX_DRAW_BUFFERS);
>  
>     c->MaxLineWidth
> -      = _maxf(1.0f, screen->get_paramf(screen,
> PIPE_CAP_MAX_LINE_WIDTH));
> +      = _maxf(1.0f, screen->get_paramf(screen,
> +
>                                       PIPE_CAP_FLOAT_MAX_LINE_WIDTH));
>     c->MaxLineWidthAA
> -      = _maxf(1.0f, screen->get_paramf(screen,
> PIPE_CAP_MAX_LINE_WIDTH_AA));
> +      = _maxf(1.0f, screen->get_paramf(screen,
> +
>                                       PIPE_CAP_FLOAT_MAX_LINE_WIDTH_AA));
>  
>     c->MaxPointSize
> -      = _maxf(1.0f, screen->get_paramf(screen,
> PIPE_CAP_MAX_POINT_WIDTH));
> +      = _maxf(1.0f, screen->get_paramf(screen,
> +
>                                       PIPE_CAP_FLOAT_MAX_POINT_WIDTH));
>     c->MaxPointSizeAA
> -      = _maxf(1.0f, screen->get_paramf(screen,
> PIPE_CAP_MAX_POINT_WIDTH_AA));
> +      = _maxf(1.0f, screen->get_paramf(screen,
> +
>                                       PIPE_CAP_FLOAT_MAX_POINT_WIDTH_AA));
>     /* called after _mesa_create_context/_mesa_init_point, fix
>     default user
>      * settable max point size up
>      */
> @@ -132,10 +136,11 @@ void st_init_limits(struct st_context *st)
>     c->MinPointSizeAA = 0.0f;
>  
>     c->MaxTextureMaxAnisotropy
> -      = _maxf(2.0f, screen->get_paramf(screen,
> PIPE_CAP_MAX_TEXTURE_ANISOTROPY));
> +      = _maxf(2.0f, screen->get_paramf(screen,
> +
>                                 PIPE_CAP_FLOAT_MAX_TEXTURE_ANISOTROPY));
>  
>     c->MaxTextureLodBias
> -      = screen->get_paramf(screen, PIPE_CAP_MAX_TEXTURE_LOD_BIAS);
> +      = screen->get_paramf(screen,
> PIPE_CAP_FLOAT_MAX_TEXTURE_LOD_BIAS);
>  
>     c->MaxDrawBuffers
>        = CLAMP(screen->get_param(screen,
>        PIPE_CAP_MAX_RENDER_TARGETS),
> --
> 1.7.5.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