Esempio n. 1
0
bool TParseContext::structNestingErrorCheck(TSourceLoc line, const TType& fieldType)
{
    if (shaderSpec != SH_WEBGL_SPEC) {
        return false;
    }

    if (fieldType.getBasicType() != EbtStruct) {
        return false;
    }

    // We're already inside a structure definition at this point, so add
    // one to the field's struct nesting.
    if (1 + fieldType.getDeepestStructNesting() > kWebGLMaxStructNesting) {
        error(line, "", "", "Reference of struct type %s exceeds maximum struct nesting of %d",
              fieldType.getTypeName().c_str(), kWebGLMaxStructNesting);
        return true;
    }

    return false;
}
Esempio n. 2
0
bool TParseContext::structNestingErrorCheck(TSourceLoc line, const TType& fieldType)
{
    if (!isWebGLBasedSpec(shaderSpec)) {
        return false;
    }

    if (fieldType.getBasicType() != EbtStruct) {
        return false;
    }

    // We're already inside a structure definition at this point, so add
    // one to the field's struct nesting.
    if (1 + fieldType.getDeepestStructNesting() > kWebGLMaxStructNesting) {
        std::stringstream extraInfoStream;
        extraInfoStream << "Reference of struct type " << fieldType.getTypeName() 
                        << " exceeds maximum struct nesting of " << kWebGLMaxStructNesting;
        std::string extraInfo = extraInfoStream.str();
        error(line, "", "", extraInfo.c_str());
        return true;
    }

    return false;
}