src/third_party/angle/src/libANGLE/renderer/glslang_wrapper_utils.cpp
// Calculates XFB layout qualifier arguments for each tranform feedback varying.  Stores calculated
// values for the SPIR-V transformation.
Calculates XFB layout qualifier arguments for each tranform feedback varying.  Stores calculated
values for the SPIR-V transformation.
Calculates XFB layout qualifier arguments for each tranform feedback varying . Stores calculated values for the SPIR - V transformation .
void GenerateTransformFeedbackExtensionOutputs(const gl::ProgramState &programState,
                                               const gl::ProgramLinkedResources &resources,
                                               std::string *vertexShader,
                                               uint32_t *locationsUsedForXfbExtensionOut)
{
    const std::vector<gl::TransformFeedbackVarying> &tfVaryings =
        programState.getLinkedTransformFeedbackVaryings();
    std::string xfbDecl;
    std::string xfbOut;
    for (uint32_t varyingIndex = 0; varyingIndex < tfVaryings.size(); ++varyingIndex)
    {
        const gl::TransformFeedbackVarying &tfVarying = tfVaryings[varyingIndex];
        const std::string &tfVaryingName              = tfVarying.mappedName;
        if (tfVarying.isBuiltIn())
        {
            uint32_t xfbVaryingLocation = resources.varyingPacking.getMaxSemanticIndex() +
                                          ++(*locationsUsedForXfbExtensionOut);
            std::string xfbVaryingName = kXfbBuiltInPrefix + tfVaryingName;
            std::string varyingType = gl::GetGLSLTypeString(tfVarying.type);
            xfbDecl += "layout(location = " + Str(xfbVaryingLocation) + ") out " + varyingType +
                       " " + xfbVaryingName + ";\n";
            xfbOut += xfbVaryingName + " = " + tfVaryingName + ";\n";
        }
    }
    *vertexShader = SubstituteTransformFeedbackMarkers(*vertexShader, xfbDecl, xfbOut);
}
void GenerateTransformFeedbackExtensionOutputs ( const gl :: ProgramState & programState , const gl :: ProgramLinkedResources & resources , std :: string * vertexShader , uint32_t * locationsUsedForXfbExtensionOut ) { const std :: vector < gl :: TransformFeedbackVarying > & tfVaryings = programState . getLinkedTransformFeedbackVaryings ( ) ; std :: string xfbDecl ; std :: string xfbOut ; for ( uint32_t varyingIndex = 0 ; varyingIndex < tfVaryings . size ( ) ; ++ varyingIndex ) { const gl :: TransformFeedbackVarying & tfVarying = tfVaryings [ varyingIndex ] ; const std :: string & tfVaryingName = tfVarying . mappedName ; if ( tfVarying . isBuiltIn ( ) ) { uint32_t xfbVaryingLocation = resources . varyingPacking . getMaxSemanticIndex ( ) + ++ ( * locationsUsedForXfbExtensionOut ) ; std :: string xfbVaryingName = kXfbBuiltInPrefix + tfVaryingName ; std :: string varyingType = gl :: GetGLSLTypeString ( tfVarying . type ) ; xfbDecl += " " + Str ( xfbVaryingLocation ) + " " + varyingType + " " + xfbVaryingName + " \n " ; xfbOut += xfbVaryingName + " " + tfVaryingName + " \n " ; } } * vertexShader = SubstituteTransformFeedbackMarkers ( * vertexShader , xfbDecl , xfbOut ) ; }
Calculates XFB layout qualifier arguments for each tranform feedback varying.
Calculates XFB layout qualifier arguments for each tranform feedback varying .
// For simplicity, create a copy of every builtin that's captured so xfb qualifiers // could be added to that instead.  This allows the SPIR-V transformation to ignore // OpMemberName and OpMemberDecorate instructions.  Note that capturing gl_Position // already requires such a copy, since the translator modifies this value at the end of // main.  Capturing the rest of the built-ins are niche enough that the inefficiency // involved in doing this is not a concern. // Add declaration and initialization code for the new varying.