3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/linkValidate.cpp
//
// Satisfy rules for location qualifiers on inputs and outputs
//
Satisfy rules for location qualifiers on inputs and outputs
Satisfy rules for location qualifiers on inputs and outputs
void TIntermediate::inOutLocationCheck(TInfoSink& infoSink)
{
    bool fragOutWithNoLocation = false;
    int numFragOut = 0;
    TIntermSequence& linkObjects = findLinkerObjects();
    for (size_t i = 0; i < linkObjects.size(); ++i) {
        const TType& type = linkObjects[i]->getAsTyped()->getType();
        const TQualifier& qualifier = type.getQualifier();
        if (language == EShLangFragment) {
            if (qualifier.storage == EvqVaryingOut && qualifier.builtIn == EbvNone) {
                ++numFragOut;
                if (!qualifier.hasAnyLocation())
                    fragOutWithNoLocation = true;
            }
        }
    }
    if (profile == EEsProfile) {
        if (numFragOut > 1 && fragOutWithNoLocation)
            error(infoSink, "when more than one fragment shader output, all must have location qualifiers");
    }
}
void TIntermediate :: inOutLocationCheck ( TInfoSink & infoSink ) { bool fragOutWithNoLocation = false ; int numFragOut = 0 ; TIntermSequence & linkObjects = findLinkerObjects ( ) ; for ( size_t i = 0 ; i < linkObjects . size ( ) ; ++ i ) { const TType & type = linkObjects [ i ] -> getAsTyped ( ) -> getType ( ) ; const TQualifier & qualifier = type . getQualifier ( ) ; if ( language == EShLangFragment ) { if ( qualifier . storage == EvqVaryingOut && qualifier . builtIn == EbvNone ) { ++ numFragOut ; if ( ! qualifier . hasAnyLocation ( ) ) fragOutWithNoLocation = true ; } } } if ( profile == EEsProfile ) { if ( numFragOut > 1 && fragOutWithNoLocation ) error ( infoSink , " " ) ; } }
Satisfy rules for location qualifiers on inputs and outputs
Satisfy rules for location qualifiers on inputs and outputs
// ES 3.0 requires all outputs to have location qualifiers if there is more than one output // TODO: linker functionality: location collision checking