src/third_party/angle/src/libANGLE/renderer/glslang_wrapper_utils.cpp
// TODO: http://anglebug.com/4512: Need to combine descriptor set bindings across
// shader stages.
anglebug.com/4512: Need to combine descriptor set bindings across
shader stages.
anglebug . com / 4512 : Need to combine descriptor set bindings across shader stages .
void AssignTextureBindings(const GlslangSourceOptions &options,
                           const gl::ProgramExecutable &programExecutable,
                           const gl::ShaderType shaderType,
                           GlslangProgramInterfaceInfo *programInterfaceInfo,
                           ShaderMapInterfaceVariableInfoMap *variableInfoMapOut)
{
    const std::vector<gl::LinkedUniform> &uniforms = programExecutable.getUniforms();
    for (unsigned int uniformIndex : programExecutable.getSamplerUniformRange())
    {
        const gl::LinkedUniform &samplerUniform = uniforms[uniformIndex];
        if (!options.useOldRewriteStructSamplers &&
            gl::SamplerNameContainsNonZeroArrayElement(samplerUniform.name))
        {
            continue;
        }
        if (UniformNameIsIndexZero(samplerUniform.name, options.useOldRewriteStructSamplers))
        {
            const std::string samplerName = options.useOldRewriteStructSamplers
                                                ? GetMappedSamplerNameOld(samplerUniform.name)
                                                : GlslangGetMappedSamplerName(samplerUniform.name);
            if (programExecutable.hasLinkedShaderStage(shaderType) &&
                samplerUniform.isActive(shaderType))
            {
                AddResourceInfo(&(*variableInfoMapOut)[shaderType], samplerName,
                                programInterfaceInfo->textureDescriptorSetIndex,
                                programInterfaceInfo->currentTextureBindingIndex, shaderType);
                ++programInterfaceInfo->currentTextureBindingIndex;
            }
        }
    }
}
void AssignTextureBindings ( const GlslangSourceOptions & options , const gl :: ProgramExecutable & programExecutable , const gl :: ShaderType shaderType , GlslangProgramInterfaceInfo * programInterfaceInfo , ShaderMapInterfaceVariableInfoMap * variableInfoMapOut ) { const std :: vector < gl :: LinkedUniform > & uniforms = programExecutable . getUniforms ( ) ; for ( unsigned int uniformIndex : programExecutable . getSamplerUniformRange ( ) ) { const gl :: LinkedUniform & samplerUniform = uniforms [ uniformIndex ] ; if ( ! options . useOldRewriteStructSamplers && gl :: SamplerNameContainsNonZeroArrayElement ( samplerUniform . name ) ) { continue ; } if ( UniformNameIsIndexZero ( samplerUniform . name , options . useOldRewriteStructSamplers ) ) { const std :: string samplerName = options . useOldRewriteStructSamplers ? GetMappedSamplerNameOld ( samplerUniform . name ) : GlslangGetMappedSamplerName ( samplerUniform . name ) ; if ( programExecutable . hasLinkedShaderStage ( shaderType ) && samplerUniform . isActive ( shaderType ) ) { AddResourceInfo ( & ( * variableInfoMapOut ) [ shaderType ] , samplerName , programInterfaceInfo -> textureDescriptorSetIndex , programInterfaceInfo -> currentTextureBindingIndex , shaderType ) ; ++ programInterfaceInfo -> currentTextureBindingIndex ; } } } }
TODO: http://anglebug.com/4512: Need to combine descriptor set bindings across
shader stages.
TODO : http : // anglebug . com / 4512 : Need to combine descriptor set bindings across shader stages .
// Assign textures to a descriptor set and binding. // Samplers in structs are extracted and renamed. // TODO: http://anglebug.com/4523: All uniforms should be active