[Mesa-dev] [PATCH V4 2/3] gallium: add cap for MAX_VERTEX_ATTRIB_STRIDE

Roland Scheidegger sroland at vmware.com
Wed Aug 27 13:00:13 PDT 2014


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

Though I think most drivers can probably support a lot more (everything
draw based should be able to support virtually unlimited strides I
believe, up to max_int32 probably though this doesn't make much sense,
and I suspect that's true for all d3d10-level hw).
It is quite a funny new cap in GL really, you can only query it starting
from 4.4 but most likely if you use larger strides with older versions
than what the hw can handle things won't work anyway...

Roland


Am 27.08.2014 20:18, schrieb Timothy Arceri:
> Any comments on this patch from the gallium devs?
> 
> On Tue, 2014-08-19 at 22:14 -1000, Timothy Arceri wrote:
>> Signed-off-by: Timothy Arceri <t_arceri at yahoo.com.au>
>> ---
>>  Note: I have only compile tested this patch with ilo.
>>
>>  src/gallium/docs/source/screen.rst               | 1 +
>>  src/gallium/drivers/freedreno/freedreno_screen.c | 3 +++
>>  src/gallium/drivers/i915/i915_screen.c           | 3 +++
>>  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           | 3 +++
>>  src/gallium/drivers/r600/r600_pipe.c             | 3 +++
>>  src/gallium/drivers/radeonsi/si_pipe.c           | 3 +++
>>  src/gallium/drivers/softpipe/sp_screen.c         | 2 ++
>>  src/gallium/drivers/svga/svga_screen.c           | 2 ++
>>  src/gallium/drivers/vc4/vc4_screen.c             | 3 +++
>>  src/gallium/include/pipe/p_defines.h             | 1 +
>>  src/mesa/state_tracker/st_extensions.c           | 3 +++
>>  16 files changed, 37 insertions(+)
>>
>> diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst
>> index eee254e..13bf705 100644
>> --- a/src/gallium/docs/source/screen.rst
>> +++ b/src/gallium/docs/source/screen.rst
>> @@ -225,6 +225,7 @@ The integer capabilities:
>>    memory and GART.
>>  * ``PIPE_CAP_CONDITIONAL_RENDER_INVERTED``: Whether the driver supports inverted
>>    condition for conditional rendering.
>> +* ``PIPE_CAP_MAX_VERTEX_ATTRIB_STRIDE``: The maximum supported vertex stride.
>>  
>>
>>  .. _pipe_capf:
>> diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c b/src/gallium/drivers/freedreno/freedreno_screen.c
>> index ab1a740..81a6c84 100644
>> --- a/src/gallium/drivers/freedreno/freedreno_screen.c
>> +++ b/src/gallium/drivers/freedreno/freedreno_screen.c
>> @@ -233,6 +233,9 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>>  	case PIPE_CAP_MAX_VERTEX_STREAMS:
>>  		return 0;
>>  
>> +	case PIPE_CAP_MAX_VERTEX_ATTRIB_STRIDE:
>> +		return 2048;
>> +
>>  	/* Texturing. */
>>  	case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
>>  	case PIPE_CAP_MAX_TEXTURE_3D_LEVELS:
>> diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c
>> index 40976b3..55f8e71 100644
>> --- a/src/gallium/drivers/i915/i915_screen.c
>> +++ b/src/gallium/drivers/i915/i915_screen.c
>> @@ -275,6 +275,9 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap cap)
>>     case PIPE_CAP_MAX_VERTEX_STREAMS:
>>        return 0;
>>  
>> +   case PIPE_CAP_MAX_VERTEX_ATTRIB_STRIDE:
>> +      return 2048;
>> +
>>     /* Fragment coordinate conventions. */
>>     case PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT:
>>     case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER:
>> diff --git a/src/gallium/drivers/ilo/ilo_screen.c b/src/gallium/drivers/ilo/ilo_screen.c
>> index 15658da..1e034f8 100644
>> --- a/src/gallium/drivers/ilo/ilo_screen.c
>> +++ b/src/gallium/drivers/ilo/ilo_screen.c
>> @@ -382,6 +382,8 @@ ilo_get_param(struct pipe_screen *screen, enum pipe_cap param)
>>     case PIPE_CAP_VERTEX_BUFFER_STRIDE_4BYTE_ALIGNED_ONLY:
>>     case PIPE_CAP_VERTEX_ELEMENT_SRC_OFFSET_4BYTE_ALIGNED_ONLY:
>>        return false;
>> +   case PIPE_CAP_MAX_VERTEX_ATTRIB_STRIDE:
>> +      return 2048;
>>     case PIPE_CAP_COMPUTE:
>>        return false; /* TODO */
>>     case PIPE_CAP_USER_INDEX_BUFFERS:
>> diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c
>> index 2a6e673..8625f0c 100644
>> --- a/src/gallium/drivers/llvmpipe/lp_screen.c
>> +++ b/src/gallium/drivers/llvmpipe/lp_screen.c
>> @@ -195,6 +195,8 @@ llvmpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
>>        return 1024;
>>     case PIPE_CAP_MAX_VERTEX_STREAMS:
>>        return 1;
>> +   case PIPE_CAP_MAX_VERTEX_ATTRIB_STRIDE:
>> +      return 2048;
>>     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 80d6943..15aba8a 100644
>> --- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c
>> +++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c
>> @@ -71,6 +71,8 @@ nv30_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>>        return 16;
>>     case PIPE_CAP_MAX_VIEWPORTS:
>>        return 1;
>> +   case PIPE_CAP_MAX_VERTEX_ATTRIB_STRIDE:
>> +      return 2048;
>>     /* supported capabilities */
>>     case PIPE_CAP_TWO_SIDED_STENCIL:
>>     case PIPE_CAP_ANISOTROPIC_FILTER:
>> diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.c b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
>> index 99dcdc5..1c08c3b 100644
>> --- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c
>> +++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c
>> @@ -117,6 +117,8 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>>        return 1024;
>>     case PIPE_CAP_MAX_VERTEX_STREAMS:
>>        return 1;
>> +   case PIPE_CAP_MAX_VERTEX_ATTRIB_STRIDE:
>> +      return 2048;
>>     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 84025ef..cf461b2 100644
>> --- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
>> +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c
>> @@ -104,6 +104,8 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>>        return 1024;
>>     case PIPE_CAP_MAX_VERTEX_STREAMS:
>>        return 4;
>> +   case PIPE_CAP_MAX_VERTEX_ATTRIB_STRIDE:
>> +      return 2048;
>>     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 a64f5f5..92cdc51 100644
>> --- a/src/gallium/drivers/r300/r300_screen.c
>> +++ b/src/gallium/drivers/r300/r300_screen.c
>> @@ -211,6 +211,9 @@ static int r300_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
>>          case PIPE_CAP_MAX_VIEWPORTS:
>>              return 1;
>>  
>> +        case PIPE_CAP_MAX_VERTEX_ATTRIB_STRIDE:
>> +            return 2048;
>> +
>>          case PIPE_CAP_VENDOR_ID:
>>                  return 0x1002;
>>          case PIPE_CAP_DEVICE_ID:
>> diff --git a/src/gallium/drivers/r600/r600_pipe.c b/src/gallium/drivers/r600/r600_pipe.c
>> index e02c053..2e134b0 100644
>> --- a/src/gallium/drivers/r600/r600_pipe.c
>> +++ b/src/gallium/drivers/r600/r600_pipe.c
>> @@ -339,6 +339,9 @@ static int r600_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
>>  	case PIPE_CAP_MAX_VERTEX_STREAMS:
>>  		return 1;
>>  
>> +	case PIPE_CAP_MAX_VERTEX_ATTRIB_STRIDE:
>> +		return 2047;
>> +
>>  	/* Texturing. */
>>  	case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
>>  	case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS:
>> diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c
>> index ae1d043..761c71b 100644
>> --- a/src/gallium/drivers/radeonsi/si_pipe.c
>> +++ b/src/gallium/drivers/radeonsi/si_pipe.c
>> @@ -278,6 +278,9 @@ static int si_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
>>  	case PIPE_CAP_MAX_VERTEX_STREAMS:
>>  		return 1;
>>  
>> +	case PIPE_CAP_MAX_VERTEX_ATTRIB_STRIDE:
>> +		return 2048;
>> +
>>  	/* Texturing. */
>>  	case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
>>  	case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS:
>> diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c
>> index d54112c..76b93d4 100644
>> --- a/src/gallium/drivers/softpipe/sp_screen.c
>> +++ b/src/gallium/drivers/softpipe/sp_screen.c
>> @@ -123,6 +123,8 @@ softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param)
>>        return 1024;
>>     case PIPE_CAP_MAX_VERTEX_STREAMS:
>>        return 1;
>> +   case PIPE_CAP_MAX_VERTEX_ATTRIB_STRIDE:
>> +      return 2048;
>>     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 544d929..4e618bb 100644
>> --- a/src/gallium/drivers/svga/svga_screen.c
>> +++ b/src/gallium/drivers/svga/svga_screen.c
>> @@ -285,6 +285,8 @@ svga_get_param(struct pipe_screen *screen, enum pipe_cap param)
>>        return 64;
>>     case PIPE_CAP_VERTEX_ELEMENT_SRC_OFFSET_4BYTE_ALIGNED_ONLY:
>>        return 1;
>> +   case PIPE_CAP_MAX_VERTEX_ATTRIB_STRIDE:
>> +      return 2048;
>>     case PIPE_CAP_MAX_VIEWPORTS:
>>        return 1;
>>     case PIPE_CAP_ENDIANNESS:
>> diff --git a/src/gallium/drivers/vc4/vc4_screen.c b/src/gallium/drivers/vc4/vc4_screen.c
>> index 4a86e21..26b9a2d 100644
>> --- a/src/gallium/drivers/vc4/vc4_screen.c
>> +++ b/src/gallium/drivers/vc4/vc4_screen.c
>> @@ -197,6 +197,9 @@ vc4_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
>>          case PIPE_CAP_MIN_TEXEL_OFFSET:
>>                  return 0;
>>  
>> +        case PIPE_CAP_MAX_VERTEX_ATTRIB_STRIDE:
>> +                return 2048;
>> +
>>          case PIPE_CAP_ENDIANNESS:
>>                  return PIPE_ENDIAN_LITTLE;
>>  
>> diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
>> index 04e4798..aae8229 100644
>> --- a/src/gallium/include/pipe/p_defines.h
>> +++ b/src/gallium/include/pipe/p_defines.h
>> @@ -569,6 +569,7 @@ enum pipe_cap {
>>     PIPE_CAP_VIDEO_MEMORY = 106,
>>     PIPE_CAP_UMA = 107,
>>     PIPE_CAP_CONDITIONAL_RENDER_INVERTED = 108,
>> +   PIPE_CAP_MAX_VERTEX_ATTRIB_STRIDE = 109,
>>  };
>>  
>>  #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 4110eb5..9db648c 100644
>> --- a/src/mesa/state_tracker/st_extensions.c
>> +++ b/src/mesa/state_tracker/st_extensions.c
>> @@ -289,6 +289,9 @@ void st_init_limits(struct pipe_screen *screen,
>>     /* The vertex stream must fit into pipe_stream_output_info::stream */
>>     assert(c->MaxVertexStreams <= 4);
>>  
>> +   c->MaxVertexAttribStride
>> +      = screen->get_param(screen, PIPE_CAP_MAX_VERTEX_ATTRIB_STRIDE);
>> +
>>     c->StripTextureBorder = GL_TRUE;
>>  
>>     c->GLSLSkipStrictMaxUniformLimitCheck =
> 
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://urldefense.proofpoint.com/v1/url?u=http://lists.freedesktop.org/mailman/listinfo/mesa-dev&k=oIvRg1%2BdGAgOoM1BIlLLqw%3D%3D%0A&r=F4msKE2WxRzA%2BwN%2B25muztFm5TSPwE8HKJfWfR2NgfY%3D%0A&m=cD9DYRtI%2FSABioWubPXmUFSl2PpCA6cWNMXBqNBQ5lg%3D%0A&s=5ee572d0abde3d3282e65cac6d60b35a13ea3e02ddc5d58cec00a24b025e1853
> 



More information about the mesa-dev mailing list