def _select_between_braces(s, original_name):
    """ Assuming s starts with an opening brace, return the part between
    braces and the position of the comma's at the root level.
    """
    assert s[0] == '('
    level = 0
    commas = []
    for i in range(len(s)):
        if s[i] == '(':
            level += 1
        elif s[i] == ')':
            level -= 1
            if level == 0:
                break
        elif level == 1 and s[i] == ',':
            commas.append(i - 1)
    if level != 0:
        raise TypeError(
            f"No end-brace in ShaderType string '{original_name}': '{s}'")
    return s[1:i], commas
