[Mesa-dev] [PATCH] glsl: extend GLSLSkipStrictMaxUniformLimitCheck to uniform block size

Roland Scheidegger sroland at vmware.com
Mon Apr 13 15:05:25 PDT 2015


FWIW fsexceed crashes badly with llvmpipe (this is because we copy the
constants into scene data, and the block size there is 64kB). I've
actually wondered if it's the state tracker's job or that of the driver
to ensure nothing bad happens. It is however happening due to the actual
buffer being larger, the declaration in the shader is irrelevant for
this crash.

Roland

Am 13.04.2015 um 23:17 schrieb Ian Romanick:
> On 04/11/2015 09:48 AM, Marcin Ĺšlusarz wrote:
>> ARB_uniform_buffer_object spec says:
>> "The total amount of buffer object storage available for any given uniform
>> block is subject to an implementation-dependent limit; the maximum amount
>> of available space, in basic machine units, can be queried by calling
>> GetIntegerv with the constant MAX_UNIFORM_BLOCK_SIZE.  If the amount
>> of storage required for a uniform block exceeds this limit, a program may
>> fail to link."
>>
>> Fixes these piglit tests:
>> spec at arb_uniform_buffer_object@maxuniformblocksize at fsexceed
>> spec at arb_uniform_buffer_object@maxuniformblocksize at vsexceed
>> on nouveau/gk107.
> 
> Can you elaborate on how this fixes the test?  The fsexceed and vsexceed
> tests are supposed to pass if linking fails.
> 
>> ---
>>  src/glsl/linker.cpp | 19 +++++++++++++++++++
>>  1 file changed, 19 insertions(+)
>>
>> diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
>> index 85830e6..88a4548 100644
>> --- a/src/glsl/linker.cpp
>> +++ b/src/glsl/linker.cpp
>> @@ -2308,6 +2308,25 @@ check_resources(struct gl_context *ctx, struct gl_shader_program *prog)
>>                           _mesa_shader_stage_to_string(i));
>>           }
>>        }
>> +
>> +      for (unsigned j = 0; j < sh->NumUniformBlocks; ++j) {
>> +         if (sh->UniformBlocks[j].UniformBufferSize >
>> +                  ctx->Const.MaxUniformBlockSize) {
>> +            if (ctx->Const.GLSLSkipStrictMaxUniformLimitCheck) {
>> +               linker_warning(prog,
>> +                              "%s shader uses uniform block whose size exceeds "
>> +                              "MAX_UNIFORM_BLOCK_SIZE, but the driver will try "
>> +                              "to optimize them out; this is non-portable "
>> +                              "out-of-spec behaviour\n",
>> +                              _mesa_shader_stage_to_string(i));
>> +            } else {
>> +               linker_error(prog,
>> +                            "%s shader uses uniform block whose size exceeds "
>> +                            "MAX_UNIFORM_BLOCK_SIZE\n",
>> +                            _mesa_shader_stage_to_string(i));
>> +            }
>> +         }
>> +      }
>>     }
>>  
>>     unsigned blocks[MESA_SHADER_STAGES] = {0};
>>
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.freedesktop.org_mailman_listinfo_mesa-2Ddev&d=AwIGaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=Vjtt0vs_iqoI31UfJxBl7yv9I2FeiaeAYgMTLKRBc_I&m=5HuaYz6dkFzuFmgzCLGfhl8ulgIBgcm3sKgjUB1uirk&s=GkMQac6K3V4fguotgnoLPdtRKc9YHZyLTNurk1amtPo&e= 
> 



More information about the mesa-dev mailing list