3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/linkValidate.cpp
// Accumulate xfb buffer ranges and check for collisions as the accumulation is done.
//
// Returns < 0 if no collision, >= 0 if collision and the value returned is a colliding value.
//
Accumulate xfb buffer ranges and check for collisions as the accumulation is done.
Returns < 0 if no collision, >= 0 if collision and the value returned is a colliding value.
Accumulate xfb buffer ranges and check for collisions as the accumulation is done . Returns < 0 if no collision > = 0 if collision and the value returned is a colliding value .
int TIntermediate::addXfbBufferOffset(const TType& type)
{
    const TQualifier& qualifier = type.getQualifier();
    assert(qualifier.hasXfbOffset() && qualifier.hasXfbBuffer());
    TXfbBuffer& buffer = xfbBuffers[qualifier.layoutXfbBuffer];
    unsigned int size = computeTypeXfbSize(type, buffer.containsDouble);
    buffer.implicitStride = std::max(buffer.implicitStride, qualifier.layoutXfbOffset + size);
    TRange range(qualifier.layoutXfbOffset, qualifier.layoutXfbOffset + size - 1);
    for (size_t r = 0; r < buffer.ranges.size(); ++r) {
        if (range.overlap(buffer.ranges[r])) {
            return std::max(range.start, buffer.ranges[r].start);
        }
    }
    buffer.ranges.push_back(range);
    return -1;  
}
int TIntermediate :: addXfbBufferOffset ( const TType & type ) { const TQualifier & qualifier = type . getQualifier ( ) ; assert ( qualifier . hasXfbOffset ( ) && qualifier . hasXfbBuffer ( ) ) ; TXfbBuffer & buffer = xfbBuffers [ qualifier . layoutXfbBuffer ] ; unsigned int size = computeTypeXfbSize ( type , buffer . containsDouble ) ; buffer . implicitStride = std :: max ( buffer . implicitStride , qualifier . layoutXfbOffset + size ) ; TRange range ( qualifier . layoutXfbOffset , qualifier . layoutXfbOffset + size - 1 ) ; for ( size_t r = 0 ; r < buffer . ranges . size ( ) ; ++ r ) { if ( range . overlap ( buffer . ranges [ r ] ) ) { return std :: max ( range . start , buffer . ranges [ r ] . start ) ; } } buffer . ranges . push_back ( range ) ; return -1 ; }
Accumulate xfb buffer ranges and check for collisions as the accumulation is done.
Accumulate xfb buffer ranges and check for collisions as the accumulation is done .
// compute the range // check for collisions // there is a collision; pick an example to return // no collision