[Mesa-dev] [PATCH 3/4] gallium: introduce PIPE_CAP_UNCLAMPED_DEPTH_VALUES.

Roland Scheidegger sroland at vmware.com
Mon Sep 15 07:37:19 PDT 2014


Am 14.09.2014 16:07, schrieb Mathias.Froehlich at gmx.net:
> From: Mathias Fröhlich <Mathias.Froehlich at gmx.net>
> 
> In preparation of NV_depth_buffer_float. Let the
> driver decide if it could support writing depth values
> beyond the [0, 1] range.
> 
> Signed-off-by: Mathias Froehlich <Mathias.Froehlich at web.de
> ---
>  src/gallium/docs/source/screen.rst               | 3 +++
>  src/gallium/drivers/freedreno/freedreno_screen.c | 1 +
>  src/gallium/drivers/i915/i915_screen.c           | 1 +
>  src/gallium/drivers/ilo/ilo_screen.c             | 1 +
>  src/gallium/drivers/llvmpipe/lp_screen.c         | 2 ++
>  src/gallium/drivers/nouveau/nv30/nv30_screen.c   | 1 +
>  src/gallium/drivers/nouveau/nv50/nv50_screen.c   | 1 +
>  src/gallium/drivers/nouveau/nvc0/nvc0_screen.c   | 1 +
>  src/gallium/drivers/r300/r300_screen.c           | 1 +
>  src/gallium/drivers/r600/r600_pipe.c             | 1 +
>  src/gallium/drivers/radeonsi/si_pipe.c           | 1 +
>  src/gallium/drivers/softpipe/sp_screen.c         | 2 ++
>  src/gallium/drivers/svga/svga_screen.c           | 1 +
>  src/gallium/drivers/vc4/vc4_screen.c             | 1 +
>  src/gallium/include/pipe/p_defines.h             | 1 +
>  15 files changed, 19 insertions(+)
> 
> diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst
> index c83be12..82f7c72 100644
> --- a/src/gallium/docs/source/screen.rst
> +++ b/src/gallium/docs/source/screen.rst
> @@ -230,6 +230,9 @@ The integer capabilities:
>    different than the underlying resource's, as permitted by
>    ARB_texture_view. For example a 2d array texture may be reinterpreted as a
>    cube (array) texture and vice-versa.
> +* ``PIPE_CAP_UNCLAMPED_DEPTH_VALUES``: If depth value clamping to [0,1] can be
> +  switched off when writing into the depth buffer. This controls whether
> +  NV_depth_buffer_float is provided.
>  
>  
>  .. _pipe_capf:
> diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c b/src/gallium/drivers/freedreno/freedreno_screen.c
> index 6db75ad..d868014 100644
> --- a/src/gallium/drivers/freedreno/freedreno_screen.c
> +++ b/src/gallium/drivers/freedreno/freedreno_screen.c
> @@ -221,6 +221,7 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>  	case PIPE_CAP_TGSI_FS_FINE_DERIVATIVE:
>  	case PIPE_CAP_CONDITIONAL_RENDER_INVERTED:
>  	case PIPE_CAP_SAMPLER_VIEW_TARGET:
> +	case PIPE_CAP_UNCLAMPED_DEPTH_VALUES:
>  		return 0;
>  
>  	/* Stream output. */
> diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c
> index 9006734..1414ffd 100644
> --- a/src/gallium/drivers/i915/i915_screen.c
> +++ b/src/gallium/drivers/i915/i915_screen.c
> @@ -223,6 +223,7 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap cap)
>     case PIPE_CAP_TEXTURE_GATHER_OFFSETS:
>     case PIPE_CAP_TGSI_VS_WINDOW_SPACE_POSITION:
>     case PIPE_CAP_CONDITIONAL_RENDER_INVERTED:
> +   case PIPE_CAP_UNCLAMPED_DEPTH_VALUES:
>        return 0;
>  
>     case PIPE_CAP_MAX_DUAL_SOURCE_RENDER_TARGETS:
> diff --git a/src/gallium/drivers/ilo/ilo_screen.c b/src/gallium/drivers/ilo/ilo_screen.c
> index 82fda2c..fc0f3eb 100644
> --- a/src/gallium/drivers/ilo/ilo_screen.c
> +++ b/src/gallium/drivers/ilo/ilo_screen.c
> @@ -439,6 +439,7 @@ ilo_get_param(struct pipe_screen *screen, enum pipe_cap param)
>     case PIPE_CAP_TGSI_FS_FINE_DERIVATIVE:
>     case PIPE_CAP_CONDITIONAL_RENDER_INVERTED:
>     case PIPE_CAP_SAMPLER_VIEW_TARGET:
> +   case PIPE_CAP_UNCLAMPED_DEPTH_VALUES:
>        return 0;
>  
>     case PIPE_CAP_VENDOR_ID:
> diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c
> index e6597e9..47a411c 100644
> --- a/src/gallium/drivers/llvmpipe/lp_screen.c
> +++ b/src/gallium/drivers/llvmpipe/lp_screen.c
> @@ -277,6 +277,8 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
>     }
>     case PIPE_CAP_UMA:
>        return 0;
> +   case PIPE_CAP_UNCLAMPED_DEPTH_VALUES:
> +      return 1;
>     }
>     /* should only get here on unhandled cases */
>     debug_printf("Unexpected PIPE_CAP %d query\n", param);
> diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.c b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
> index a1373fd..caf70be 100644
> --- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c
> +++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
> @@ -156,6 +156,7 @@ nv30_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>     case PIPE_CAP_TGSI_FS_FINE_DERIVATIVE:
>     case PIPE_CAP_CONDITIONAL_RENDER_INVERTED:
>     case PIPE_CAP_SAMPLER_VIEW_TARGET:
> +   case PIPE_CAP_UNCLAMPED_DEPTH_VALUES:
>        return 0;
>  
>     case PIPE_CAP_VENDOR_ID:
> diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.c b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
> index 3a46e72..618abf8 100644
> --- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c
> +++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
> @@ -204,6 +204,7 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>     case PIPE_CAP_COMPUTE:
>     case PIPE_CAP_DRAW_INDIRECT:
>     case PIPE_CAP_CONDITIONAL_RENDER_INVERTED:
> +   case PIPE_CAP_UNCLAMPED_DEPTH_VALUES:
>        return 0;
>  
>     case PIPE_CAP_VENDOR_ID:
> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
> index 3858981..5c5b145 100644
> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
> @@ -188,6 +188,7 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>     case PIPE_CAP_TGSI_VS_LAYER_VIEWPORT:
>     case PIPE_CAP_FAKE_SW_MSAA:
>     case PIPE_CAP_TGSI_VS_WINDOW_SPACE_POSITION:
> +   case PIPE_CAP_UNCLAMPED_DEPTH_VALUES:
>        return 0;
>  
>     case PIPE_CAP_VENDOR_ID:
> diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c
> index c35559f..03832a2 100644
> --- a/src/gallium/drivers/r300/r300_screen.c
> +++ b/src/gallium/drivers/r300/r300_screen.c
> @@ -181,6 +181,7 @@ static int r300_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
>          case PIPE_CAP_TGSI_FS_FINE_DERIVATIVE:
>          case PIPE_CAP_CONDITIONAL_RENDER_INVERTED:
>          case PIPE_CAP_SAMPLER_VIEW_TARGET:
> +        case PIPE_CAP_UNCLAMPED_DEPTH_VALUES:
>              return 0;
>  
>          /* SWTCL-only features. */
> diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c
> index c6459d8..d5ff1dd 100644
> --- a/src/gallium/drivers/r600/r600_pipe.c
> +++ b/src/gallium/drivers/r600/r600_pipe.c
> @@ -324,6 +324,7 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
>  	case PIPE_CAP_DRAW_INDIRECT:
>  	case PIPE_CAP_CONDITIONAL_RENDER_INVERTED:
>  	case PIPE_CAP_SAMPLER_VIEW_TARGET:
> +	case PIPE_CAP_UNCLAMPED_DEPTH_VALUES:
>  		return 0;
>  
>  	/* Stream output. */
> diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c
> index 4f9c876..da51f56 100644
> --- a/src/gallium/drivers/radeonsi/si_pipe.c
> +++ b/src/gallium/drivers/radeonsi/si_pipe.c
> @@ -248,6 +248,7 @@ static int si_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
>  	case PIPE_CAP_TGSI_FS_FINE_DERIVATIVE:
>  	case PIPE_CAP_CONDITIONAL_RENDER_INVERTED:
>  	case PIPE_CAP_SAMPLER_VIEW_TARGET:
> +	case PIPE_CAP_UNCLAMPED_DEPTH_VALUES:
>  		return 0;
>  
>  	case PIPE_CAP_TEXTURE_BORDER_COLOR_QUIRK:
> diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c
> index a6e7fc0..1cb8a05 100644
> --- a/src/gallium/drivers/softpipe/sp_screen.c
> +++ b/src/gallium/drivers/softpipe/sp_screen.c
> @@ -227,6 +227,8 @@ softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
>        return 0;
>     case PIPE_CAP_CONDITIONAL_RENDER_INVERTED:
>        return 1;
> +   case PIPE_CAP_UNCLAMPED_DEPTH_VALUES:
> +      return 1;
>     }
>     /* should only get here on unhandled cases */
>     debug_printf("Unexpected PIPE_CAP %d query\n", param);
> diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c
> index 004b4b4..8c68d2e 100644
> --- a/src/gallium/drivers/svga/svga_screen.c
> +++ b/src/gallium/drivers/svga/svga_screen.c
> @@ -281,6 +281,7 @@ svga_get_param(struct pipe_screen *screen, enum pipe_cap param)
>     case PIPE_CAP_TGSI_FS_FINE_DERIVATIVE:
>     case PIPE_CAP_CONDITIONAL_RENDER_INVERTED:
>     case PIPE_CAP_SAMPLER_VIEW_TARGET:
> +   case PIPE_CAP_UNCLAMPED_DEPTH_VALUES:
>        return 0;
>     case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT:
>        return 64;
> diff --git a/src/gallium/drivers/vc4/vc4_screen.c b/src/gallium/drivers/vc4/vc4_screen.c
> index 1c4d9db..266e83f 100644
> --- a/src/gallium/drivers/vc4/vc4_screen.c
> +++ b/src/gallium/drivers/vc4/vc4_screen.c
> @@ -162,6 +162,7 @@ vc4_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>          case PIPE_CAP_TGSI_FS_FINE_DERIVATIVE:
>          case PIPE_CAP_CONDITIONAL_RENDER_INVERTED:
>          case PIPE_CAP_SAMPLER_VIEW_TARGET:
> +        case PIPE_CAP_UNCLAMPED_DEPTH_VALUES:
>                  return 0;
>  
>                  /* Stream output. */
> diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
> index 93156b9..f814277 100644
> --- a/src/gallium/include/pipe/p_defines.h
> +++ b/src/gallium/include/pipe/p_defines.h
> @@ -571,6 +571,7 @@ enum pipe_cap {
>     PIPE_CAP_CONDITIONAL_RENDER_INVERTED = 108,
>     PIPE_CAP_MAX_VERTEX_ATTRIB_STRIDE = 109,
>     PIPE_CAP_SAMPLER_VIEW_TARGET = 110,
> +   PIPE_CAP_UNCLAMPED_DEPTH_VALUES = 111,
>  };
>  
>  #define PIPE_QUIRK_TEXTURE_BORDER_COLOR_SWIZZLE_NV50 (1 << 0)
> 

Reviewed-by: Roland Scheidegger <sroland at vmware.com>


More information about the mesa-dev mailing list