[Mesa-dev] [PATCH] gallium: add support for GLES texture float extensions (v2)

Edward O'Callaghan edward.ocallaghan at koparo.com
Wed Aug 12 23:28:49 PDT 2015


Reviewed-by: Edward O'Callaghan <eocallaghan at alterapraxis.com>

-- 
  Edward O'Callaghan
  edward.ocallaghan at koparo.com

On Wed, Aug 12, 2015, at 08:45 PM, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>
> 
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=74329
> 
> v2: add a CAP for half floats
>     drivers should not expose the CAPs if they don't support the formats
> ---
>  src/gallium/docs/source/screen.rst               | 6 ++++++
>  src/gallium/drivers/freedreno/freedreno_screen.c | 2 ++
>  src/gallium/drivers/i915/i915_screen.c           | 2 ++
>  src/gallium/drivers/ilo/ilo_screen.c             | 2 ++
>  src/gallium/drivers/llvmpipe/lp_screen.c         | 2 ++
>  src/gallium/drivers/nouveau/nv30/nv30_screen.c   | 2 ++
>  src/gallium/drivers/nouveau/nv50/nv50_screen.c   | 2 ++
>  src/gallium/drivers/nouveau/nvc0/nvc0_screen.c   | 2 ++
>  src/gallium/drivers/r300/r300_screen.c           | 2 ++
>  src/gallium/drivers/r600/r600_pipe.c             | 2 ++
>  src/gallium/drivers/radeonsi/si_pipe.c           | 2 ++
>  src/gallium/drivers/softpipe/sp_screen.c         | 2 ++
>  src/gallium/drivers/svga/svga_screen.c           | 2 ++
>  src/gallium/drivers/vc4/vc4_screen.c             | 2 ++
>  src/gallium/include/pipe/p_defines.h             | 2 ++
>  src/mesa/state_tracker/st_extensions.c           | 8 ++++++++
>  16 files changed, 42 insertions(+)
> 
> diff --git a/src/gallium/docs/source/screen.rst
> b/src/gallium/docs/source/screen.rst
> index dbdccc7..c0b5eb3 100644
> --- a/src/gallium/docs/source/screen.rst
> +++ b/src/gallium/docs/source/screen.rst
> @@ -258,6 +258,12 @@ The integer capabilities:
>    How many per-patch outputs and inputs are supported between
>    tessellation
>    control and tessellation evaluation shaders, not counting in TESSINNER
>    and
>    TESSOUTER. The minimum allowed value for OpenGL is 30.
> +* ``PIPE_CAP_TEXTURE_FLOAT_LINEAR``: Whether the linear minification and
> +  magnification filters are supported with single-precision
> floating-point
> +  textures.
> +* ``PIPE_CAP_TEXTURE_HALF_FLOAT_LINEAR``: Whether the linear
> minification and
> +  magnification filters are supported with half-precision floating-point
> +  textures.
>  
>  
>  .. _pipe_capf:
> diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c
> b/src/gallium/drivers/freedreno/freedreno_screen.c
> index 417d7c6..b267fd0 100644
> --- a/src/gallium/drivers/freedreno/freedreno_screen.c
> +++ b/src/gallium/drivers/freedreno/freedreno_screen.c
> @@ -222,6 +222,8 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum
> pipe_cap param)
>  	case PIPE_CAP_RESOURCE_FROM_USER_MEMORY:
>  	case PIPE_CAP_DEVICE_RESET_STATUS_QUERY:
>  	case PIPE_CAP_MAX_SHADER_PATCH_VARYINGS:
> +       case PIPE_CAP_TEXTURE_FLOAT_LINEAR:
> +       case PIPE_CAP_TEXTURE_HALF_FLOAT_LINEAR:
>  		return 0;
>  
>  	case PIPE_CAP_MAX_VIEWPORTS:
> diff --git a/src/gallium/drivers/i915/i915_screen.c
> b/src/gallium/drivers/i915/i915_screen.c
> index 6083687..7608ca5 100644
> --- a/src/gallium/drivers/i915/i915_screen.c
> +++ b/src/gallium/drivers/i915/i915_screen.c
> @@ -244,6 +244,8 @@ i915_get_param(struct pipe_screen *screen, enum
> pipe_cap cap)
>     case PIPE_CAP_RESOURCE_FROM_USER_MEMORY:
>     case PIPE_CAP_DEVICE_RESET_STATUS_QUERY:
>     case PIPE_CAP_MAX_SHADER_PATCH_VARYINGS:
> +   case PIPE_CAP_TEXTURE_FLOAT_LINEAR:
> +   case PIPE_CAP_TEXTURE_HALF_FLOAT_LINEAR:
>        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 338643e..9f150bb 100644
> --- a/src/gallium/drivers/ilo/ilo_screen.c
> +++ b/src/gallium/drivers/ilo/ilo_screen.c
> @@ -451,6 +451,8 @@ ilo_get_param(struct pipe_screen *screen, enum
> pipe_cap param)
>     case PIPE_CAP_TEXTURE_GATHER_SM5:
>        return 0;
>     case PIPE_CAP_BUFFER_MAP_PERSISTENT_COHERENT:
> +   case PIPE_CAP_TEXTURE_FLOAT_LINEAR:
> +   case PIPE_CAP_TEXTURE_HALF_FLOAT_LINEAR:
>        return true;
>     case PIPE_CAP_FAKE_SW_MSAA:
>     case PIPE_CAP_TEXTURE_QUERY_LOD:
> diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c
> b/src/gallium/drivers/llvmpipe/lp_screen.c
> index 1c6c82e..539bb44 100644
> --- a/src/gallium/drivers/llvmpipe/lp_screen.c
> +++ b/src/gallium/drivers/llvmpipe/lp_screen.c
> @@ -288,6 +288,8 @@ llvmpipe_get_param(struct pipe_screen *screen, enum
> pipe_cap param)
>     case PIPE_CAP_VERTEXID_NOBASE:
>        return 0;
>     case PIPE_CAP_POLYGON_OFFSET_CLAMP:
> +   case PIPE_CAP_TEXTURE_FLOAT_LINEAR:
> +   case PIPE_CAP_TEXTURE_HALF_FLOAT_LINEAR:
>        return 1;
>     case PIPE_CAP_MULTISAMPLE_Z_RESOLVE:
>     case PIPE_CAP_RESOURCE_FROM_USER_MEMORY:
> diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.c
> b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
> index 97cf058..73bcd5b 100644
> --- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c
> +++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
> @@ -164,6 +164,8 @@ nv30_screen_get_param(struct pipe_screen *pscreen,
> enum pipe_cap param)
>     case PIPE_CAP_RESOURCE_FROM_USER_MEMORY:
>     case PIPE_CAP_DEVICE_RESET_STATUS_QUERY:
>     case PIPE_CAP_MAX_SHADER_PATCH_VARYINGS:
> +   case PIPE_CAP_TEXTURE_FLOAT_LINEAR:
> +   case PIPE_CAP_TEXTURE_HALF_FLOAT_LINEAR:
>        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 d869544..1e19877 100644
> --- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c
> +++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
> @@ -176,6 +176,8 @@ nv50_screen_get_param(struct pipe_screen *pscreen,
> enum pipe_cap param)
>     case PIPE_CAP_CLIP_HALFZ:
>     case PIPE_CAP_POLYGON_OFFSET_CLAMP:
>     case PIPE_CAP_QUERY_PIPELINE_STATISTICS:
> +   case PIPE_CAP_TEXTURE_FLOAT_LINEAR:
> +   case PIPE_CAP_TEXTURE_HALF_FLOAT_LINEAR:
>        return 1;
>     case PIPE_CAP_SEAMLESS_CUBE_MAP:
>        return 1; /* class_3d >= NVA0_3D_CLASS; */
> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
> b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
> index 5c382b8..0c25ec4 100644
> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
> @@ -175,6 +175,8 @@ nvc0_screen_get_param(struct pipe_screen *pscreen,
> enum pipe_cap param)
>     case PIPE_CAP_CLIP_HALFZ:
>     case PIPE_CAP_POLYGON_OFFSET_CLAMP:
>     case PIPE_CAP_MULTISAMPLE_Z_RESOLVE:
> +   case PIPE_CAP_TEXTURE_FLOAT_LINEAR:
> +   case PIPE_CAP_TEXTURE_HALF_FLOAT_LINEAR:
>        return 1;
>     case PIPE_CAP_SEAMLESS_CUBE_MAP_PER_TEXTURE:
>        return (class_3d >= NVE4_3D_CLASS) ? 1 : 0;
> diff --git a/src/gallium/drivers/r300/r300_screen.c
> b/src/gallium/drivers/r300/r300_screen.c
> index f1df79c..74aae37 100644
> --- a/src/gallium/drivers/r300/r300_screen.c
> +++ b/src/gallium/drivers/r300/r300_screen.c
> @@ -192,6 +192,8 @@ static int r300_get_param(struct pipe_screen*
> pscreen, enum pipe_cap param)
>          case PIPE_CAP_RESOURCE_FROM_USER_MEMORY:
>          case PIPE_CAP_DEVICE_RESET_STATUS_QUERY:
>          case PIPE_CAP_MAX_SHADER_PATCH_VARYINGS:
> +        case PIPE_CAP_TEXTURE_FLOAT_LINEAR:
> +        case PIPE_CAP_TEXTURE_HALF_FLOAT_LINEAR:
>              return 0;
>  
>          /* SWTCL-only features. */
> diff --git a/src/gallium/drivers/r600/r600_pipe.c
> b/src/gallium/drivers/r600/r600_pipe.c
> index c4f5c74..a0fe1d3 100644
> --- a/src/gallium/drivers/r600/r600_pipe.c
> +++ b/src/gallium/drivers/r600/r600_pipe.c
> @@ -270,6 +270,8 @@ static int r600_get_param(struct pipe_screen*
> pscreen, enum pipe_cap param)
>  	case PIPE_CAP_CLIP_HALFZ:
>  	case PIPE_CAP_POLYGON_OFFSET_CLAMP:
>  	case PIPE_CAP_CONDITIONAL_RENDER_INVERTED:
> +       case PIPE_CAP_TEXTURE_FLOAT_LINEAR:
> +       case PIPE_CAP_TEXTURE_HALF_FLOAT_LINEAR:
>  		return 1;
>  
>  	case PIPE_CAP_DEVICE_RESET_STATUS_QUERY:
> diff --git a/src/gallium/drivers/radeonsi/si_pipe.c
> b/src/gallium/drivers/radeonsi/si_pipe.c
> index 9e40241..83b304b 100644
> --- a/src/gallium/drivers/radeonsi/si_pipe.c
> +++ b/src/gallium/drivers/radeonsi/si_pipe.c
> @@ -276,6 +276,8 @@ static int si_get_param(struct pipe_screen* pscreen,
> enum pipe_cap param)
>  	case PIPE_CAP_TGSI_TEXCOORD:
>  	case PIPE_CAP_TGSI_FS_FINE_DERIVATIVE:
>  	case PIPE_CAP_CONDITIONAL_RENDER_INVERTED:
> +       case PIPE_CAP_TEXTURE_FLOAT_LINEAR:
> +       case PIPE_CAP_TEXTURE_HALF_FLOAT_LINEAR:
>  		return 1;
>  
>  	case PIPE_CAP_RESOURCE_FROM_USER_MEMORY:
> diff --git a/src/gallium/drivers/softpipe/sp_screen.c
> b/src/gallium/drivers/softpipe/sp_screen.c
> index ed8e545..49a21d9 100644
> --- a/src/gallium/drivers/softpipe/sp_screen.c
> +++ b/src/gallium/drivers/softpipe/sp_screen.c
> @@ -234,6 +234,8 @@ softpipe_get_param(struct pipe_screen *screen, enum
> pipe_cap param)
>     case PIPE_CAP_CONDITIONAL_RENDER_INVERTED:
>        return 1;
>     case PIPE_CAP_CLIP_HALFZ:
> +   case PIPE_CAP_TEXTURE_FLOAT_LINEAR:
> +   case PIPE_CAP_TEXTURE_HALF_FLOAT_LINEAR:
>        return 1;
>     case PIPE_CAP_VERTEXID_NOBASE:
>        return 0;
> diff --git a/src/gallium/drivers/svga/svga_screen.c
> b/src/gallium/drivers/svga/svga_screen.c
> index ac5abe8..7b70272 100644
> --- a/src/gallium/drivers/svga/svga_screen.c
> +++ b/src/gallium/drivers/svga/svga_screen.c
> @@ -310,6 +310,8 @@ svga_get_param(struct pipe_screen *screen, enum
> pipe_cap param)
>     case PIPE_CAP_RESOURCE_FROM_USER_MEMORY:
>     case PIPE_CAP_DEVICE_RESET_STATUS_QUERY:
>     case PIPE_CAP_MAX_SHADER_PATCH_VARYINGS:
> +   case PIPE_CAP_TEXTURE_FLOAT_LINEAR:
> +   case PIPE_CAP_TEXTURE_HALF_FLOAT_LINEAR:
>        return 0;
>     }
>  
> diff --git a/src/gallium/drivers/vc4/vc4_screen.c
> b/src/gallium/drivers/vc4/vc4_screen.c
> index a20818d..72f0826 100644
> --- a/src/gallium/drivers/vc4/vc4_screen.c
> +++ b/src/gallium/drivers/vc4/vc4_screen.c
> @@ -177,6 +177,8 @@ vc4_screen_get_param(struct pipe_screen *pscreen,
> enum pipe_cap param)
>          case PIPE_CAP_RESOURCE_FROM_USER_MEMORY:
>          case PIPE_CAP_DEVICE_RESET_STATUS_QUERY:
>  	case PIPE_CAP_MAX_SHADER_PATCH_VARYINGS:
> +       case PIPE_CAP_TEXTURE_FLOAT_LINEAR:
> +       case PIPE_CAP_TEXTURE_HALF_FLOAT_LINEAR:
>                  return 0;
>  
>                  /* Stream output. */
> diff --git a/src/gallium/include/pipe/p_defines.h
> b/src/gallium/include/pipe/p_defines.h
> index 8532826..83a3e2b 100644
> --- a/src/gallium/include/pipe/p_defines.h
> +++ b/src/gallium/include/pipe/p_defines.h
> @@ -607,6 +607,8 @@ enum pipe_cap
>     PIPE_CAP_RESOURCE_FROM_USER_MEMORY,
>     PIPE_CAP_DEVICE_RESET_STATUS_QUERY,
>     PIPE_CAP_MAX_SHADER_PATCH_VARYINGS,
> +   PIPE_CAP_TEXTURE_FLOAT_LINEAR,
> +   PIPE_CAP_TEXTURE_HALF_FLOAT_LINEAR,
>  };
>  
>  #define PIPE_QUIRK_TEXTURE_BORDER_COLOR_SWIZZLE_NV50 (1 << 0)
> diff --git a/src/mesa/state_tracker/st_extensions.c
> b/src/mesa/state_tracker/st_extensions.c
> index 13d636f..ee14019 100644
> --- a/src/mesa/state_tracker/st_extensions.c
> +++ b/src/mesa/state_tracker/st_extensions.c
> @@ -474,6 +474,8 @@ void st_init_extensions(struct pipe_screen *screen,
>         * support the GL_POINT_SPRITE_R_MODE_NV option. */
>  
>        { o(OES_standard_derivatives),         PIPE_CAP_SM3               
>                      },
> +      { o(OES_texture_float_linear),        
> PIPE_CAP_TEXTURE_FLOAT_LINEAR             },
> +      { o(OES_texture_half_float_linear),   
> PIPE_CAP_TEXTURE_HALF_FLOAT_LINEAR        },
>        { o(ARB_texture_cube_map_array),       PIPE_CAP_CUBE_MAP_ARRAY    
>                      },
>        { o(ARB_texture_multisample),         
>        PIPE_CAP_TEXTURE_MULTISAMPLE              },
>        { o(ARB_texture_query_lod),            PIPE_CAP_TEXTURE_QUERY_LOD 
>                      },
> @@ -492,6 +494,12 @@ void st_init_extensions(struct pipe_screen *screen,
>          { PIPE_FORMAT_R32G32B32A32_FLOAT,
>            PIPE_FORMAT_R16G16B16A16_FLOAT } },
>  
> +      { { o(OES_texture_float) },
> +        { PIPE_FORMAT_R32G32B32A32_FLOAT } },
> +
> +      { { o(OES_texture_half_float) },
> +        { PIPE_FORMAT_R16G16B16A16_FLOAT } },
> +
>        { { o(ARB_texture_rgb10_a2ui) },
>          { PIPE_FORMAT_R10G10B10A2_UINT,
>            PIPE_FORMAT_B10G10R10A2_UINT },
> -- 
> 2.1.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