src/third_party/angle/src/libANGLE/renderer/glslang_wrapper_utils.cpp
// Test if there are non-zero indices in the uniform name, returning false in that case.  This
// happens for multi-dimensional arrays, where a uniform is created for every possible index of the
// array (except for the innermost dimension).  When assigning decorations (set/binding/etc), only
// the indices corresponding to the first element of the array should be specified.  This function
// is used to skip the other indices.
//
// If useOldRewriteStructSamplers, there are multiple samplers extracted out of struct arrays
// though, so the above only applies to the sampler array defined in the struct.
Test if there are non-zero indices in the uniform name, returning false in that case.  This
happens for multi-dimensional arrays, where a uniform is created for every possible index of the
array (except for the innermost dimension).  When assigning decorations (set/binding/etc), only
the indices corresponding to the first element of the array should be specified.  This function
is used to skip the other indices.

If useOldRewriteStructSamplers, there are multiple samplers extracted out of struct arrays
though, so the above only applies to the sampler array defined in the struct.
Test if there are non - zero indices in the uniform name returning false in that case . This happens for multi - dimensional arrays where a uniform is created for every possible index of the array ( except for the innermost dimension ) . When assigning decorations ( set / binding / etc ) only the indices corresponding to the first element of the array should be specified . This function is used to skip the other indices . If useOldRewriteStructSamplers there are multiple samplers extracted out of struct arrays though so the above only applies to the sampler array defined in the struct .
bool UniformNameIsIndexZero(const std::string &name, bool excludeCheckForOwningStructArrays)
{
    size_t lastBracketClose = 0;
    if (excludeCheckForOwningStructArrays)
    {
        size_t lastDot = name.find_last_of('.');
        if (lastDot != std::string::npos)
        {
            lastBracketClose = lastDot;
        }
    }
    while (true)
    {
        size_t openBracket = name.find('[', lastBracketClose);
        if (openBracket == std::string::npos)
        {
            break;
        }
        size_t closeBracket = name.find(']', openBracket);
        if (name.substr(openBracket + 1, closeBracket - openBracket - 1) != "0")
        {
            return false;
        }
        lastBracketClose = closeBracket;
    }
    return true;
}
bool UniformNameIsIndexZero ( const std :: string & name , bool excludeCheckForOwningStructArrays ) { size_t lastBracketClose = 0 ; if ( excludeCheckForOwningStructArrays ) { size_t lastDot = name . find_last_of ( ' ' ) ; if ( lastDot != std :: string :: npos ) { lastBracketClose = lastDot ; } } while ( true ) { size_t openBracket = name . find ( ' ' , lastBracketClose ) ; if ( openBracket == std :: string :: npos ) { break ; } size_t closeBracket = name . find ( ' ' , openBracket ) ; if ( name . substr ( openBracket + 1 , closeBracket - openBracket - 1 ) != " " ) { return false ; } lastBracketClose = closeBracket ; } return true ; }
Test if there are non-zero indices in the uniform name, returning false in that case.
Test if there are non - zero indices in the uniform name returning false in that case .
// If the index between the brackets is not zero, ignore this uniform.