[Mesa-dev] [PATCH 0/3] verify max vertex attrib stride

Ian Romanick idr at freedesktop.org
Fri Jul 6 23:12:27 UTC 2018

On 07/06/2018 09:43 AM, Roland Scheidegger wrote:
> Am 06.07.2018 um 12:03 schrieb Erik Faye-Lund:
>> OpenGL 4.4 and OpenGL ES 3.1 both require the maximum
>> vertex attrib stride to be at least 2048. If this isn't
>> the case, we shouldn't expose these API versions.
>> Unfortunately, the r600 driver only supports 2047. To
>> avoid regressions in the supported GL version, the
>> first patch modifies the returned value.
>> I'm not sure if that last one is a good idea or not, as
>> it's strictly speaking non-conformant. But applications
>> won't expect GL errors generated when using strides of
>> 2048 either, which is what currently happens.
>> The initial motivation for this patch-series is to avoid
>> exposing a too high spec version in virgl and then get
>> dEQP failures when running on old hardware. The virgl
>> specific bits are being sent separately, because they
>> depend on some other not-yet-upstream things ATM.
>> Thoughts?
>> Erik Faye-Lund (3):
>>   r600: report incorrect max-vertex-attrib for GL 4.4
>>   mesa: verify MaxVertexAttribStride for GL 4.4
>>   mesa: verify MaxVertexAttribStride for GLES 3.1
>>  src/gallium/drivers/r600/r600_pipe.c | 3 ++-
>>  src/mesa/main/version.c              | 2 ++
>>  2 files changed, 4 insertions(+), 1 deletion(-)
> Personally I think it's _much_ better to lie about the supported GL
> version rather than the maximum vertex attrib stride (I don't know if
> dEQP would actually have a test which tests for the max stride also
> working than just being advertized, which would be way more relevant and
> fail in any case).
> (Because if you're going to use stride 2048, it is hugely unlikely you'd
> just rely on GL 4.4 for that, hence it wouldn't work with older versions
> of GL anyway neither, where ALL strides are just supposed to work.)

I believe the query was added in the same GL version that added 2048 as
the minimum maximum.  My guess is that any application that cares will
just assume 2048.  In this particular case, I believe lying about the
GL version and lying about the limit are equivalent.

> Roland
> FWIW, I think it should be possible to work around that limitation on
> r600. Since vertex fetch just uses a fetch shader, you could have a
> shader key bit indicating strides of 2048, program a stride of 1024
> instead and multiply the index to fetch by 2 in the shader. Of course
> that could cause shader recompiles (never in practice...) and there's
> some overhead associated with it, so might not be worth it...
> Roland
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev

More information about the mesa-dev mailing list