[Mesa-dev] [PATCH 2/4] gallium: add cap to show that fs can accept layer/viewport inputs

Roland Scheidegger sroland at vmware.com
Tue Jul 1 05:38:23 PDT 2014


Sure though it seems a bit unfortunate if all the code is already
there... Please also enable it for llvmpipe.

Roland

Am 30.06.2014 17:22, schrieb Ilia Mirkin:
> Looks like it'll be a while before someone can look at my r600 patch
> which makes layer/viewport available in the fragment shader. Roland,
> would you be OK with a version of this patch which adds a new CAP for
> viewport/layer support in FS? (To be enabled only on nv50/nvc0 for
> now.) The cap can later be removed.
> 
> On Sun, Jun 22, 2014 at 11:10 AM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
>> Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
>> ---
>>  src/gallium/docs/source/screen.rst               | 2 ++
>>  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         | 1 +
>>  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         | 1 +
>>  src/gallium/drivers/svga/svga_screen.c           | 1 +
>>  src/gallium/include/pipe/p_defines.h             | 3 ++-
>>  src/mesa/state_tracker/st_extensions.c           | 1 +
>>  15 files changed, 17 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst
>> index 1a80b04..ebebfe8 100644
>> --- a/src/gallium/docs/source/screen.rst
>> +++ b/src/gallium/docs/source/screen.rst
>> @@ -205,6 +205,8 @@ The integer capabilities:
>>  * ``PIPE_CAP_TGSI_VS_WINDOW_SPACE_POSITION``: Whether
>>    TGSI_PROPERTY_VS_WINDOW_SPACE_POSITION is supported, which disables clipping
>>    and viewport transformation.
>> +* ``PIPE_CAP_TGSI_FS_LAYER_VIEWPORT``: Whether the fragment shader can accept
>> +  ``TGSI_SEMANTIC_LAYER`` and ``TGSI_SEMANTIC_VIEWPORT_INDEX`` inputs.
>>
>>
>>  .. _pipe_capf:
>> diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c b/src/gallium/drivers/freedreno/freedreno_screen.c
>> index e7a185d..fa201ce 100644
>> --- a/src/gallium/drivers/freedreno/freedreno_screen.c
>> +++ b/src/gallium/drivers/freedreno/freedreno_screen.c
>> @@ -215,6 +215,7 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>>         case PIPE_CAP_SAMPLE_SHADING:
>>         case PIPE_CAP_TEXTURE_GATHER_OFFSETS:
>>         case PIPE_CAP_TGSI_VS_WINDOW_SPACE_POSITION:
>> +       case PIPE_CAP_TGSI_FS_LAYER_VIEWPORT:
>>                 return 0;
>>
>>         /* Stream output. */
>> diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c
>> index 79d8659..b776c49 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_SAMPLE_SHADING:
>>     case PIPE_CAP_TEXTURE_GATHER_OFFSETS:
>>     case PIPE_CAP_TGSI_VS_WINDOW_SPACE_POSITION:
>> +   case PIPE_CAP_TGSI_FS_LAYER_VIEWPORT:
>>        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 b08ae20..4b1fe35 100644
>> --- a/src/gallium/drivers/ilo/ilo_screen.c
>> +++ b/src/gallium/drivers/ilo/ilo_screen.c
>> @@ -442,6 +442,7 @@ ilo_get_param(struct pipe_screen *screen, enum pipe_cap param)
>>     case PIPE_CAP_SAMPLE_SHADING:
>>     case PIPE_CAP_TEXTURE_GATHER_OFFSETS:
>>     case PIPE_CAP_TGSI_VS_WINDOW_SPACE_POSITION:
>> +   case PIPE_CAP_TGSI_FS_LAYER_VIEWPORT:
>>        return 0;
>>
>>     default:
>> diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c
>> index a6b712a..3ccbcd3 100644
>> --- a/src/gallium/drivers/llvmpipe/lp_screen.c
>> +++ b/src/gallium/drivers/llvmpipe/lp_screen.c
>> @@ -244,6 +244,7 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
>>     case PIPE_CAP_SAMPLE_SHADING:
>>     case PIPE_CAP_TEXTURE_GATHER_OFFSETS:
>>     case PIPE_CAP_TGSI_VS_WINDOW_SPACE_POSITION:
>> +   case PIPE_CAP_TGSI_FS_LAYER_VIEWPORT:
>>        return 0;
>>     case PIPE_CAP_FAKE_SW_MSAA:
>>         return 1;
>> diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.c b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
>> index 5c3d783..db4755b 100644
>> --- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c
>> +++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
>> @@ -146,6 +146,7 @@ nv30_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>>     case PIPE_CAP_TGSI_VS_WINDOW_SPACE_POSITION:
>>     case PIPE_CAP_USER_VERTEX_BUFFERS:
>>     case PIPE_CAP_COMPUTE:
>> +   case PIPE_CAP_TGSI_FS_LAYER_VIEWPORT:
>>        return 0;
>>     }
>>
>> diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.c b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
>> index c09a8c6..68becec 100644
>> --- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c
>> +++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
>> @@ -197,6 +197,7 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>>     case PIPE_CAP_TEXTURE_GATHER_OFFSETS:
>>     case PIPE_CAP_TGSI_VS_WINDOW_SPACE_POSITION:
>>     case PIPE_CAP_COMPUTE:
>> +   case PIPE_CAP_TGSI_FS_LAYER_VIEWPORT:
>>        return 0;
>>     }
>>
>> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
>> index 52a067e..2c8f1ca 100644
>> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
>> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
>> @@ -181,6 +181,7 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>>     case PIPE_CAP_TGSI_VS_LAYER:
>>     case PIPE_CAP_FAKE_SW_MSAA:
>>     case PIPE_CAP_TGSI_VS_WINDOW_SPACE_POSITION:
>> +   case PIPE_CAP_TGSI_FS_LAYER_VIEWPORT:
>>        return 0;
>>     }
>>
>> diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c
>> index d4bb6ab..abb9046 100644
>> --- a/src/gallium/drivers/r300/r300_screen.c
>> +++ b/src/gallium/drivers/r300/r300_screen.c
>> @@ -176,6 +176,7 @@ static int r300_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
>>          case PIPE_CAP_SAMPLE_SHADING:
>>          case PIPE_CAP_TEXTURE_GATHER_OFFSETS:
>>          case PIPE_CAP_TGSI_VS_WINDOW_SPACE_POSITION:
>> +        case PIPE_CAP_TGSI_FS_LAYER_VIEWPORT:
>>              return 0;
>>
>>          /* SWTCL-only features. */
>> diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c
>> index 6f87c78..d7292ee 100644
>> --- a/src/gallium/drivers/r600/r600_pipe.c
>> +++ b/src/gallium/drivers/r600/r600_pipe.c
>> @@ -317,6 +317,7 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
>>         case PIPE_CAP_TEXTURE_QUERY_LOD:
>>         case PIPE_CAP_SAMPLE_SHADING:
>>         case PIPE_CAP_TEXTURE_GATHER_OFFSETS:
>> +       case PIPE_CAP_TGSI_FS_LAYER_VIEWPORT:
>>                 return 0;
>>
>>         /* Stream output. */
>> diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c
>> index 07f4291..e9d237a 100644
>> --- a/src/gallium/drivers/radeonsi/si_pipe.c
>> +++ b/src/gallium/drivers/radeonsi/si_pipe.c
>> @@ -252,6 +252,7 @@ static int si_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
>>         case PIPE_CAP_FAKE_SW_MSAA:
>>         case PIPE_CAP_TEXTURE_GATHER_OFFSETS:
>>         case PIPE_CAP_TGSI_VS_WINDOW_SPACE_POSITION:
>> +       case PIPE_CAP_TGSI_FS_LAYER_VIEWPORT:
>>                 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 d82fed9..7ad4cb9 100644
>> --- a/src/gallium/drivers/softpipe/sp_screen.c
>> +++ b/src/gallium/drivers/softpipe/sp_screen.c
>> @@ -192,6 +192,7 @@ softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
>>     case PIPE_CAP_SAMPLE_SHADING:
>>     case PIPE_CAP_TEXTURE_GATHER_OFFSETS:
>>     case PIPE_CAP_TGSI_VS_WINDOW_SPACE_POSITION:
>> +   case PIPE_CAP_TGSI_FS_LAYER_VIEWPORT:
>>        return 0;
>>     case PIPE_CAP_FAKE_SW_MSAA:
>>        return 1;
>> diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c
>> index 4e1e331..e895df7 100644
>> --- a/src/gallium/drivers/svga/svga_screen.c
>> +++ b/src/gallium/drivers/svga/svga_screen.c
>> @@ -276,6 +276,7 @@ svga_get_param(struct pipe_screen *screen, enum pipe_cap param)
>>     case PIPE_CAP_SAMPLE_SHADING:
>>     case PIPE_CAP_TEXTURE_GATHER_OFFSETS:
>>     case PIPE_CAP_TGSI_VS_WINDOW_SPACE_POSITION:
>> +   case PIPE_CAP_TGSI_FS_LAYER_VIEWPORT:
>>        return 0;
>>     case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT:
>>        return 64;
>> diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
>> index 90f6493..d1ddaad 100644
>> --- a/src/gallium/include/pipe/p_defines.h
>> +++ b/src/gallium/include/pipe/p_defines.h
>> @@ -558,7 +558,8 @@ enum pipe_cap {
>>     PIPE_CAP_MAX_TEXTURE_GATHER_OFFSET = 96,
>>     PIPE_CAP_SAMPLE_SHADING = 97,
>>     PIPE_CAP_TEXTURE_GATHER_OFFSETS = 98,
>> -   PIPE_CAP_TGSI_VS_WINDOW_SPACE_POSITION = 99
>> +   PIPE_CAP_TGSI_VS_WINDOW_SPACE_POSITION = 99,
>> +   PIPE_CAP_TGSI_FS_LAYER_VIEWPORT = 100,
>>  };
>>
>>  #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 e938046..8a5448e 100644
>> --- a/src/mesa/state_tracker/st_extensions.c
>> +++ b/src/mesa/state_tracker/st_extensions.c
>> @@ -427,6 +427,7 @@ void st_init_extensions(struct st_context *st)
>>        { o(ARB_texture_multisample),          PIPE_CAP_TEXTURE_MULTISAMPLE              },
>>        { o(ARB_texture_query_lod),            PIPE_CAP_TEXTURE_QUERY_LOD                },
>>        { o(ARB_sample_shading),               PIPE_CAP_SAMPLE_SHADING                   },
>> +      { o(ARB_fragment_layer_viewport),      PIPE_CAP_TGSI_FS_LAYER_VIEWPORT           },
>>     };
>>
>>     /* Required: render target and sampler support */
>> --
>> 1.8.5.5
>>


More information about the mesa-dev mailing list