[Mesa-dev] [PATCH] glsl: Fail linkage when UBO exceeds GL_MAX_UNIFORM_BLOCK_SIZE.

Jose Fonseca jfonseca at vmware.com
Tue Jun 16 09:52:15 PDT 2015

On 16/06/15 15:29, Ilia Mirkin wrote:
> On Tue, Jun 16, 2015 at 10:22 AM, Roland Scheidegger <sroland at vmware.com> wrote:
>> This looks like a good idea to me.
>> That said, llvmpipe would still crash if the declared size in the shader
>> wouldn't exceed the max uniform block size, but the bound buffer does
>> IIRC (the test doesn't test this but could be easily modified to do so).
>> So, I'm wondering if we should do both - fail to link if the declared
>> size exceeds the limit, and just limit the size we copy in llvmpipe to
>> the limit, though it's possible this would require some more changes to
>> be really safe so we don't try to access such elements (with indirect
>> access, though we don't verify direct ones at all) in the shader.
> Not to derail this too much, but just FWIW I just checked this patch
> in to prevent gpu errors:
> http://cgit.freedesktop.org/mesa/mesa/commit/?id=8b24388647f626a5cad10fd48e61335ed26a8560
> Didn't fix the trace, but at least it no longer complained about
> illegal sizes. Trace available at
> http://people.freedesktop.org/~imirkin/traces/gzdoom.trace
> It just renders black now. The claim is that the game (but not
> necessarily the trace) works OK on NVIDIA blob drivers. I haven't
> analyzed the trace in much detail yet.
>    -ilia

Interesting. I don't get errors from NVIDIA.  So it does look like 
binding large UBOs is treated differently.  (And understandibly, since 
one can bind a range of a UBO too.)

I think Roland's right, in llvmpipe we'll need to handle that better by 
truncating the constant buffer copied to the display lists.

BTW, the trace use PERSISTENT mappings, which aren't supported in 
apitrace.  So I suspect it will never render well.


More information about the mesa-dev mailing list