[Mesa-dev] [PATCH v2 4/9] gallium: add a cap for max vertex streams

Marek Olšák maraeo at gmail.com
Sat Jun 28 05:48:23 PDT 2014


We already have PIPE_CAP_GLSL_FEATURE_LEVEL. Once everybody (who can) supports
GLSL 4.00, we can drop some caps in favor of that.

Marek

On Sat, Jun 28, 2014 at 2:44 PM, Roland Scheidegger <sroland at vmware.com> wrote:
> 3-4 look alright to me. I wonder if the cap name is actually "correct"
> or if it should have some STREAM_OUT in it. But doesn't really matter I
> guess.
> Longer term I think we might want to merge some caps. Everybody
> (supporting stream out) will either support 1 or 4 streams along with
> other functionality anyway.
>
> Roland
>
>
> Am 28.06.2014 05:50, schrieb Ilia Mirkin:
>> Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
>> Reviewed-by: Marek Olšák <marek.olsak at amd.com>
>> Reviewed-by: Brian Paul <brianp at vmware.com>
>> ---
>>
>> v1 -> v2:
>>  - add an assert to make sure it's <= 4
>>  - add a note in docs about expected values
>>
>>  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   | 2 ++
>>  src/gallium/drivers/nouveau/nvc0/nvc0_screen.c   | 2 ++
>>  src/gallium/drivers/r300/r300_screen.c           | 1 +
>>  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           | 1 +
>>  src/gallium/include/pipe/p_defines.h             | 3 ++-
>>  src/mesa/state_tracker/st_extensions.c           | 5 +++++
>>  15 files changed, 28 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst
>> index 1a80b04..5e01df5 100644
>> --- a/src/gallium/docs/source/screen.rst
>> +++ b/src/gallium/docs/source/screen.rst
>> @@ -205,6 +205,9 @@ 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_MAX_VERTEX_STREAMS``: The maximum number of vertex streams
>> +  supported by the geometry shader. If stream-out is supported, this should be
>> +  at least 1. If stream-out is not supported, this should be 0.
>>
>>
>>  .. _pipe_capf:
>> diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c b/src/gallium/drivers/freedreno/freedreno_screen.c
>> index e7a185d..9200962 100644
>> --- a/src/gallium/drivers/freedreno/freedreno_screen.c
>> +++ b/src/gallium/drivers/freedreno/freedreno_screen.c
>> @@ -227,6 +227,7 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>>       /* Geometry shader output, unsupported. */
>>       case PIPE_CAP_MAX_GEOMETRY_OUTPUT_VERTICES:
>>       case PIPE_CAP_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS:
>> +     case PIPE_CAP_MAX_VERTEX_STREAMS:
>>               return 0;
>>
>>       /* Texturing. */
>> diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c
>> index 79d8659..036f706 100644
>> --- a/src/gallium/drivers/i915/i915_screen.c
>> +++ b/src/gallium/drivers/i915/i915_screen.c
>> @@ -270,6 +270,7 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap cap)
>>     /* Geometry shader output, unsupported. */
>>     case PIPE_CAP_MAX_GEOMETRY_OUTPUT_VERTICES:
>>     case PIPE_CAP_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS:
>> +   case PIPE_CAP_MAX_VERTEX_STREAMS:
>>        return 0;
>>
>>     /* Fragment coordinate conventions. */
>> diff --git a/src/gallium/drivers/ilo/ilo_screen.c b/src/gallium/drivers/ilo/ilo_screen.c
>> index b08ae20..8f8e152 100644
>> --- a/src/gallium/drivers/ilo/ilo_screen.c
>> +++ b/src/gallium/drivers/ilo/ilo_screen.c
>> @@ -375,6 +375,7 @@ ilo_get_param(struct pipe_screen *screen, enum pipe_cap param)
>>        return ILO_MAX_SO_BINDINGS;
>>     case PIPE_CAP_MAX_GEOMETRY_OUTPUT_VERTICES:
>>     case PIPE_CAP_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS:
>> +   case PIPE_CAP_MAX_VERTEX_STREAMS:
>>        return 0;
>>     case PIPE_CAP_STREAM_OUTPUT_PAUSE_RESUME:
>>        if (is->dev.gen >= ILO_GEN(7))
>> diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c
>> index a6b712a..26ab294 100644
>> --- a/src/gallium/drivers/llvmpipe/lp_screen.c
>> +++ b/src/gallium/drivers/llvmpipe/lp_screen.c
>> @@ -192,6 +192,8 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
>>     case PIPE_CAP_MAX_GEOMETRY_OUTPUT_VERTICES:
>>     case PIPE_CAP_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS:
>>        return 1024;
>> +   case PIPE_CAP_MAX_VERTEX_STREAMS:
>> +      return 1;
>>     case PIPE_CAP_STREAM_OUTPUT_PAUSE_RESUME:
>>        return 1;
>>     case PIPE_CAP_TGSI_CAN_COMPACT_CONSTANTS:
>> diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.c b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
>> index 5c3d783..c79626b 100644
>> --- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c
>> +++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
>> @@ -117,6 +117,7 @@ nv30_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>>     case PIPE_CAP_MAX_STREAM_OUTPUT_INTERLEAVED_COMPONENTS:
>>     case PIPE_CAP_MAX_GEOMETRY_OUTPUT_VERTICES:
>>     case PIPE_CAP_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS:
>> +   case PIPE_CAP_MAX_VERTEX_STREAMS:
>>     case PIPE_CAP_TGSI_CAN_COMPACT_CONSTANTS:
>>     case PIPE_CAP_TEXTURE_BARRIER:
>>     case PIPE_CAP_SEAMLESS_CUBE_MAP:
>> diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.c b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
>> index c09a8c6..40ad4a4 100644
>> --- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c
>> +++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
>> @@ -116,6 +116,8 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>>     case PIPE_CAP_MAX_GEOMETRY_OUTPUT_VERTICES:
>>     case PIPE_CAP_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS:
>>        return 1024;
>> +   case PIPE_CAP_MAX_VERTEX_STREAMS:
>> +      return 1;
>>     case PIPE_CAP_CONSTANT_BUFFER_OFFSET_ALIGNMENT:
>>        return 256;
>>     case PIPE_CAP_TEXTURE_BUFFER_OFFSET_ALIGNMENT:
>> diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
>> index 52a067e..510368b 100644
>> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
>> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
>> @@ -103,6 +103,8 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>>     case PIPE_CAP_MAX_GEOMETRY_OUTPUT_VERTICES:
>>     case PIPE_CAP_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS:
>>        return 1024;
>> +   case PIPE_CAP_MAX_VERTEX_STREAMS:
>> +      return 1;
>>     case PIPE_CAP_CONSTANT_BUFFER_OFFSET_ALIGNMENT:
>>        return 256;
>>     case PIPE_CAP_TEXTURE_BUFFER_OFFSET_ALIGNMENT:
>> diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c
>> index d4bb6ab..bcd0e8e 100644
>> --- a/src/gallium/drivers/r300/r300_screen.c
>> +++ b/src/gallium/drivers/r300/r300_screen.c
>> @@ -156,6 +156,7 @@ static int r300_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
>>          case PIPE_CAP_MAX_STREAM_OUTPUT_INTERLEAVED_COMPONENTS:
>>          case PIPE_CAP_MAX_GEOMETRY_OUTPUT_VERTICES:
>>          case PIPE_CAP_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS:
>> +        case PIPE_CAP_MAX_VERTEX_STREAMS:
>>          case PIPE_CAP_STREAM_OUTPUT_PAUSE_RESUME:
>>          case PIPE_CAP_FRAGMENT_COLOR_CLAMPED:
>>          case PIPE_CAP_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION:
>> diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c
>> index 6f87c78..78a85ab 100644
>> --- a/src/gallium/drivers/r600/r600_pipe.c
>> +++ b/src/gallium/drivers/r600/r600_pipe.c
>> @@ -333,6 +333,8 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
>>               return 1024;
>>       case PIPE_CAP_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS:
>>               return 16384;
>> +     case PIPE_CAP_MAX_VERTEX_STREAMS:
>> +             return 1;
>>
>>       /* Texturing. */
>>       case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
>> diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c
>> index 07f4291..d4dfdd6 100644
>> --- a/src/gallium/drivers/radeonsi/si_pipe.c
>> +++ b/src/gallium/drivers/radeonsi/si_pipe.c
>> @@ -271,6 +271,8 @@ static int si_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
>>               return 1024;
>>       case PIPE_CAP_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS:
>>               return 4095;
>> +     case PIPE_CAP_MAX_VERTEX_STREAMS:
>> +             return 1;
>>
>>       /* Texturing. */
>>       case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
>> diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c
>> index d82fed9..ee3e0f2 100644
>> --- a/src/gallium/drivers/softpipe/sp_screen.c
>> +++ b/src/gallium/drivers/softpipe/sp_screen.c
>> @@ -120,6 +120,8 @@ softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
>>     case PIPE_CAP_MAX_GEOMETRY_OUTPUT_VERTICES:
>>     case PIPE_CAP_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS:
>>        return 1024;
>> +   case PIPE_CAP_MAX_VERTEX_STREAMS:
>> +      return 1;
>>     case PIPE_CAP_PRIMITIVE_RESTART:
>>        return 1;
>>     case PIPE_CAP_SHADER_STENCIL_EXPORT:
>> diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c
>> index 4e1e331..0e88132 100644
>> --- a/src/gallium/drivers/svga/svga_screen.c
>> +++ b/src/gallium/drivers/svga/svga_screen.c
>> @@ -255,6 +255,7 @@ svga_get_param(struct pipe_screen *screen, enum pipe_cap param)
>>     case PIPE_CAP_STREAM_OUTPUT_PAUSE_RESUME:
>>     case PIPE_CAP_MAX_GEOMETRY_OUTPUT_VERTICES:
>>     case PIPE_CAP_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS:
>> +   case PIPE_CAP_MAX_VERTEX_STREAMS:
>>     case PIPE_CAP_TGSI_CAN_COMPACT_CONSTANTS:
>>     case PIPE_CAP_VERTEX_BUFFER_OFFSET_4BYTE_ALIGNED_ONLY:
>>     case PIPE_CAP_VERTEX_BUFFER_STRIDE_4BYTE_ALIGNED_ONLY:
>> diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
>> index 90f6493..702bb0b 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_MAX_VERTEX_STREAMS = 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..3b6681e 100644
>> --- a/src/mesa/state_tracker/st_extensions.c
>> +++ b/src/mesa/state_tracker/st_extensions.c
>> @@ -287,6 +287,11 @@ void st_init_limits(struct st_context *st)
>>        screen->get_param(screen, PIPE_CAP_MAX_STREAM_OUTPUT_SEPARATE_COMPONENTS);
>>     c->MaxTransformFeedbackInterleavedComponents =
>>        screen->get_param(screen, PIPE_CAP_MAX_STREAM_OUTPUT_INTERLEAVED_COMPONENTS);
>> +   c->MaxVertexStreams =
>> +      MAX2(1, screen->get_param(screen, PIPE_CAP_MAX_VERTEX_STREAMS));
>> +
>> +   /* The vertex stream must fit into pipe_stream_output_info::stream */
>> +   assert(c->MaxVertexStreams <= 4);
>>
>>     c->StripTextureBorder = GL_TRUE;
>>
>>


More information about the mesa-dev mailing list