[Mesa-dev] [PATCH 05/11] gallium: add PIPE_SHADER_CAP_MAX_BUFFERS

Brian Paul brianp at vmware.com
Mon Sep 28 07:25:18 PDT 2015


On 09/27/2015 12:33 AM, Ilia Mirkin wrote:
> Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
> ---
>   src/gallium/auxiliary/gallivm/lp_bld_limits.h    | 1 +
>   src/gallium/auxiliary/tgsi/tgsi_exec.h           | 1 +
>   src/gallium/docs/source/screen.rst               | 4 ++++
>   src/gallium/drivers/freedreno/freedreno_screen.c | 2 ++
>   src/gallium/drivers/nouveau/nv30/nv30_screen.c   | 2 ++
>   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           | 2 ++
>   src/gallium/drivers/r600/r600_pipe.c             | 1 +
>   src/gallium/drivers/radeonsi/si_pipe.c           | 2 ++
>   src/gallium/drivers/svga/svga_screen.c           | 3 +++
>   src/gallium/drivers/vc4/vc4_screen.c             | 2 ++
>   src/gallium/include/pipe/p_defines.h             | 3 ++-
>   13 files changed, 24 insertions(+), 1 deletion(-)
>
> diff --git a/src/gallium/auxiliary/gallivm/lp_bld_limits.h b/src/gallium/auxiliary/gallivm/lp_bld_limits.h
> index 571c615..1f49157 100644
> --- a/src/gallium/auxiliary/gallivm/lp_bld_limits.h
> +++ b/src/gallium/auxiliary/gallivm/lp_bld_limits.h
> @@ -136,6 +136,7 @@ gallivm_get_shader_param(enum pipe_shader_cap param)
>      case PIPE_SHADER_CAP_TGSI_DROUND_SUPPORTED:
>      case PIPE_SHADER_CAP_TGSI_DFRACEXP_DLDEXP_SUPPORTED:
>      case PIPE_SHADER_CAP_TGSI_FMA_SUPPORTED:
> +   case PIPE_SHADER_CAP_MAX_BUFFERS:
>         return 0;
>      }
>      /* if we get here, we missed a shader cap above (and should have seen
> diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.h b/src/gallium/auxiliary/tgsi/tgsi_exec.h
> index a371aa9..be77979 100644
> --- a/src/gallium/auxiliary/tgsi/tgsi_exec.h
> +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.h
> @@ -473,6 +473,7 @@ tgsi_exec_get_shader_param(enum pipe_shader_cap param)
>         return 1;
>      case PIPE_SHADER_CAP_TGSI_DROUND_SUPPORTED:
>      case PIPE_SHADER_CAP_TGSI_FMA_SUPPORTED:
> +   case PIPE_SHADER_CAP_MAX_BUFFERS:
>         return 0;
>      }
>      /* if we get here, we missed a shader cap above (and should have seen
> diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst
> index e780047..e2550f5 100644
> --- a/src/gallium/docs/source/screen.rst
> +++ b/src/gallium/docs/source/screen.rst
> @@ -356,6 +356,10 @@ to be 0.
>     are supported.
>   * ``PIPE_SHADER_CAP_TGSI_ANY_INOUT_DECL_RANGE``: Whether the driver doesn't
>     ignore tgsi_declaration_range::Last for shader inputs and outputs.
> +* ``PIPE_SHADER_CAP_MAX_BUFFERS``: Maximum number of memory buffers
> +  (also used to implement atomic counters). Having this be non-0 also
> +  implies support for the ``LOAD``, ``STORE``, and ``ATOM*`` TGSI
> +  opcodes.
>
>
>   .. _pipe_compute_cap:
> diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c b/src/gallium/drivers/freedreno/freedreno_screen.c
> index c9228c5..34f33c2 100644
> --- a/src/gallium/drivers/freedreno/freedreno_screen.c
> +++ b/src/gallium/drivers/freedreno/freedreno_screen.c
> @@ -404,6 +404,8 @@ fd_screen_get_shader_param(struct pipe_screen *pscreen, unsigned shader,
>   		return 16;
>   	case PIPE_SHADER_CAP_PREFERRED_IR:
>   		return PIPE_SHADER_IR_TGSI;
> +	case PIPE_SHADER_CAP_MAX_BUFFERS:
> +		return 0;
>   	}
>   	debug_printf("unknown shader param %d\n", param);
>   	return 0;
> diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.c b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
> index 806d4e6..461795d 100644
> --- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c
> +++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
> @@ -261,6 +261,7 @@ nv30_screen_get_shader_param(struct pipe_screen *pscreen, unsigned shader,
>         case PIPE_SHADER_CAP_TGSI_DFRACEXP_DLDEXP_SUPPORTED:
>         case PIPE_SHADER_CAP_TGSI_FMA_SUPPORTED:
>         case PIPE_SHADER_CAP_TGSI_ANY_INOUT_DECL_RANGE:
> +      case PIPE_SHADER_CAP_MAX_BUFFERS:
>            return 0;
>         default:
>            debug_printf("unknown vertex shader param %d\n", param);
> @@ -302,6 +303,7 @@ nv30_screen_get_shader_param(struct pipe_screen *pscreen, unsigned shader,
>         case PIPE_SHADER_CAP_TGSI_DFRACEXP_DLDEXP_SUPPORTED:
>         case PIPE_SHADER_CAP_TGSI_FMA_SUPPORTED:
>         case PIPE_SHADER_CAP_TGSI_ANY_INOUT_DECL_RANGE:
> +      case PIPE_SHADER_CAP_MAX_BUFFERS:
>            return 0;
>         default:
>            debug_printf("unknown fragment shader param %d\n", param);
> diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.c b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
> index c3bbc83..f74daac 100644
> --- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c
> +++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
> @@ -297,6 +297,7 @@ nv50_screen_get_shader_param(struct pipe_screen *pscreen, unsigned shader,
>      case PIPE_SHADER_CAP_TGSI_DFRACEXP_DLDEXP_SUPPORTED:
>      case PIPE_SHADER_CAP_TGSI_FMA_SUPPORTED:
>      case PIPE_SHADER_CAP_TGSI_ANY_INOUT_DECL_RANGE:
> +   case PIPE_SHADER_CAP_MAX_BUFFERS:
>         return 0;
>      default:
>         NOUVEAU_ERR("unknown PIPE_SHADER_CAP %d\n", param);
> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
> index 1909b91..12388b8 100644
> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
> @@ -306,6 +306,7 @@ nvc0_screen_get_shader_param(struct pipe_screen *pscreen, unsigned shader,
>      case PIPE_SHADER_CAP_TGSI_DFRACEXP_DLDEXP_SUPPORTED:
>      case PIPE_SHADER_CAP_TGSI_FMA_SUPPORTED:
>      case PIPE_SHADER_CAP_TGSI_ANY_INOUT_DECL_RANGE:
> +   case PIPE_SHADER_CAP_MAX_BUFFERS:
>         return 0;
>      case PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS:
>         return 16; /* would be 32 in linked (OpenGL-style) mode */
> diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c
> index e669ba2..426cb2f 100644
> --- a/src/gallium/drivers/r300/r300_screen.c
> +++ b/src/gallium/drivers/r300/r300_screen.c
> @@ -300,6 +300,7 @@ static int r300_get_shader_param(struct pipe_screen *pscreen, unsigned shader, e
>           case PIPE_SHADER_CAP_TGSI_DROUND_SUPPORTED:
>           case PIPE_SHADER_CAP_TGSI_DFRACEXP_DLDEXP_SUPPORTED:
>           case PIPE_SHADER_CAP_TGSI_FMA_SUPPORTED:
> +        case PIPE_SHADER_CAP_MAX_BUFFERS:
>               return 0;
>           case PIPE_SHADER_CAP_PREFERRED_IR:
>               return PIPE_SHADER_IR_TGSI;
> @@ -356,6 +357,7 @@ static int r300_get_shader_param(struct pipe_screen *pscreen, unsigned shader, e
>           case PIPE_SHADER_CAP_TGSI_DROUND_SUPPORTED:
>           case PIPE_SHADER_CAP_TGSI_DFRACEXP_DLDEXP_SUPPORTED:
>           case PIPE_SHADER_CAP_TGSI_FMA_SUPPORTED:
> +        case PIPE_SHADER_CAP_MAX_BUFFERS:
>               return 0;
>           case PIPE_SHADER_CAP_PREFERRED_IR:
>               return PIPE_SHADER_IR_TGSI;
> diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c
> index 36d7e68..71e58b0 100644
> --- a/src/gallium/drivers/r600/r600_pipe.c
> +++ b/src/gallium/drivers/r600/r600_pipe.c
> @@ -508,6 +508,7 @@ static int r600_get_shader_param(struct pipe_screen* pscreen, unsigned shader, e
>   	case PIPE_SHADER_CAP_TGSI_DROUND_SUPPORTED:
>   	case PIPE_SHADER_CAP_TGSI_DFRACEXP_DLDEXP_SUPPORTED:
>   	case PIPE_SHADER_CAP_TGSI_FMA_SUPPORTED:
> +	case PIPE_SHADER_CAP_MAX_BUFFERS:
>   		return 0;
>   	}
>   	return 0;
> diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c
> index 9edee50..5529a31 100644
> --- a/src/gallium/drivers/radeonsi/si_pipe.c
> +++ b/src/gallium/drivers/radeonsi/si_pipe.c
> @@ -498,6 +498,8 @@ static int si_get_shader_param(struct pipe_screen* pscreen, unsigned shader, enu
>   	case PIPE_SHADER_CAP_TGSI_FMA_SUPPORTED:
>   	case PIPE_SHADER_CAP_TGSI_ANY_INOUT_DECL_RANGE:
>   		return 1;
> +	case PIPE_SHADER_CAP_MAX_BUFFERS:
> +		return 0;
>   	}
>   	return 0;
>   }
> diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c
> index 44b6f4a..7dea794 100644
> --- a/src/gallium/drivers/svga/svga_screen.c
> +++ b/src/gallium/drivers/svga/svga_screen.c
> @@ -453,6 +453,7 @@ vgpu9_get_shader_param(struct pipe_screen *screen, unsigned shader,
>         case PIPE_SHADER_CAP_TGSI_DFRACEXP_DLDEXP_SUPPORTED:
>         case PIPE_SHADER_CAP_TGSI_FMA_SUPPORTED:
>         case PIPE_SHADER_CAP_TGSI_ANY_INOUT_DECL_RANGE:
> +      case PIPE_SHADER_CAP_MAX_BUFFERS:
>            return 0;
>         }
>         /* If we get here, we failed to handle a cap above */
> @@ -509,6 +510,7 @@ vgpu9_get_shader_param(struct pipe_screen *screen, unsigned shader,
>         case PIPE_SHADER_CAP_TGSI_DFRACEXP_DLDEXP_SUPPORTED:
>         case PIPE_SHADER_CAP_TGSI_FMA_SUPPORTED:
>         case PIPE_SHADER_CAP_TGSI_ANY_INOUT_DECL_RANGE:
> +      case PIPE_SHADER_CAP_MAX_BUFFERS:
>            return 0;
>         }
>         /* If we get here, we failed to handle a cap above */
> @@ -598,6 +600,7 @@ vgpu10_get_shader_param(struct pipe_screen *screen, unsigned shader,
>      case PIPE_SHADER_CAP_TGSI_DFRACEXP_DLDEXP_SUPPORTED:
>      case PIPE_SHADER_CAP_TGSI_FMA_SUPPORTED:
>      case PIPE_SHADER_CAP_TGSI_ANY_INOUT_DECL_RANGE:
> +   case PIPE_SHADER_CAP_MAX_BUFFERS:
>         return 0;
>      default:
>         debug_printf("Unexpected vgpu10 shader query %u\n", param);
> diff --git a/src/gallium/drivers/vc4/vc4_screen.c b/src/gallium/drivers/vc4/vc4_screen.c
> index c4b52e1..e29fd3e 100644
> --- a/src/gallium/drivers/vc4/vc4_screen.c
> +++ b/src/gallium/drivers/vc4/vc4_screen.c
> @@ -335,6 +335,8 @@ vc4_screen_get_shader_param(struct pipe_screen *pscreen, unsigned shader,
>                   return VC4_MAX_TEXTURE_SAMPLERS;
>           case PIPE_SHADER_CAP_PREFERRED_IR:
>                   return PIPE_SHADER_IR_TGSI;
> +        case PIPE_SHADER_CAP_MAX_BUFFERS:
> +                return 0;
>           default:
>                   fprintf(stderr, "unknown shader param %d\n", param);
>                   return 0;
> diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
> index 47fa82a..bea865f 100644
> --- a/src/gallium/include/pipe/p_defines.h
> +++ b/src/gallium/include/pipe/p_defines.h
> @@ -695,7 +695,8 @@ enum pipe_shader_cap
>      PIPE_SHADER_CAP_TGSI_DROUND_SUPPORTED, /* all rounding modes */
>      PIPE_SHADER_CAP_TGSI_DFRACEXP_DLDEXP_SUPPORTED,
>      PIPE_SHADER_CAP_TGSI_FMA_SUPPORTED,
> -   PIPE_SHADER_CAP_TGSI_ANY_INOUT_DECL_RANGE
> +   PIPE_SHADER_CAP_TGSI_ANY_INOUT_DECL_RANGE,
> +   PIPE_SHADER_CAP_MAX_BUFFERS,

Wouldn't something like PIPE_SHADER_CAP_MAX_ATOMIC_BUFFERS be more 
descriptive?  MAX_BUFFERS seems pretty generic.

-Brian

>   };
>
>   /**
>



More information about the mesa-dev mailing list