context/llpcCompiler.cpp
MetroHash::Hash Compiler::GenerateHashForCompileOptions(
    uint32_t          optionCount,    // Count of compilation-option strings
    const char*const* pOptions        // [in] An array of compilation-option strings
    )
{
    // Options which needn't affect compilation results
    static StringRef IgnoredOptions[] =
    {
        cl::PipelineDumpDir.ArgStr,
        cl::EnablePipelineDump.ArgStr,
        cl::ShaderCacheFileDir.ArgStr,
        cl::ShaderCacheMode.ArgStr,
        cl::EnableOuts.ArgStr,
        cl::EnableErrs.ArgStr,
        cl::LogFileDbgs.ArgStr,
        cl::LogFileOuts.ArgStr,
        cl::EnableShadowDescriptorTable.ArgStr,
        cl::ShadowDescTablePtrHigh.ArgStr,
    };

    std::set<StringRef> effectingOptions;
    // Build effecting options
    for (uint32_t i = 1; i < optionCount; ++i)
    {
        StringRef option = pOptions[i] + 1;  // Skip '-' in options
        bool ignore = false;
        for (uint32_t j = 0; j < sizeof(IgnoredOptions) / sizeof(IgnoredOptions[0]); ++j)
        {
            if (option.startswith(IgnoredOptions[j]))
            {
                ignore = true;
                break;
            }
        }

        if (ignore == false)
        {
            effectingOptions.insert(option);
        }
    }

    MetroHash64 hasher;

    // Build hash code from effecting options
    for (auto option : effectingOptions)
    {
        hasher.Update(reinterpret_cast<const uint8_t*>(option.data()), option.size());
    }

    MetroHash::Hash hash = {};
    hasher.Finalize(hash.bytes);

    return hash;
}
// =====================================================================================================================
// Builds hash code from compilation-options
Builds hash code from compilation-options
Builds hash code from compilation - options
MetroHash::Hash Compiler::GenerateHashForCompileOptions(
    uint32_t          optionCount,    
    const char*const* pOptions        
    )
{
    static StringRef IgnoredOptions[] =
    {
        cl::PipelineDumpDir.ArgStr,
        cl::EnablePipelineDump.ArgStr,
        cl::ShaderCacheFileDir.ArgStr,
        cl::ShaderCacheMode.ArgStr,
        cl::EnableOuts.ArgStr,
        cl::EnableErrs.ArgStr,
        cl::LogFileDbgs.ArgStr,
        cl::LogFileOuts.ArgStr,
        cl::EnableShadowDescriptorTable.ArgStr,
        cl::ShadowDescTablePtrHigh.ArgStr,
    };
    std::set<StringRef> effectingOptions;
    for (uint32_t i = 1; i < optionCount; ++i)
    {
        StringRef option = pOptions[i] + 1;  
        bool ignore = false;
        for (uint32_t j = 0; j < sizeof(IgnoredOptions) / sizeof(IgnoredOptions[0]); ++j)
        {
            if (option.startswith(IgnoredOptions[j]))
            {
                ignore = true;
                break;
            }
        }
        if (ignore == false)
        {
            effectingOptions.insert(option);
        }
    }
    MetroHash64 hasher;
    for (auto option : effectingOptions)
    {
        hasher.Update(reinterpret_cast<const uint8_t*>(option.data()), option.size());
    }
    MetroHash::Hash hash = {};
    hasher.Finalize(hash.bytes);
    return hash;
}
MetroHash :: Hash Compiler :: GenerateHashForCompileOptions ( uint32_t optionCount , const char * const * pOptions ) { static StringRef IgnoredOptions [ ] = { cl :: PipelineDumpDir . ArgStr , cl :: EnablePipelineDump . ArgStr , cl :: ShaderCacheFileDir . ArgStr , cl :: ShaderCacheMode . ArgStr , cl :: EnableOuts . ArgStr , cl :: EnableErrs . ArgStr , cl :: LogFileDbgs . ArgStr , cl :: LogFileOuts . ArgStr , cl :: EnableShadowDescriptorTable . ArgStr , cl :: ShadowDescTablePtrHigh . ArgStr , } ; std :: set < StringRef > effectingOptions ; for ( uint32_t i = 1 ; i < optionCount ; ++ i ) { StringRef option = pOptions [ i ] + 1 ; bool ignore = false ; for ( uint32_t j = 0 ; j < sizeof ( IgnoredOptions ) / sizeof ( IgnoredOptions [ 0 ] ) ; ++ j ) { if ( option . startswith ( IgnoredOptions [ j ] ) ) { ignore = true ; break ; } } if ( ignore == false ) { effectingOptions . insert ( option ) ; } } MetroHash64 hasher ; for ( auto option : effectingOptions ) { hasher . Update ( reinterpret_cast < const uint8_t * > ( option . data ( ) ) , option . size ( ) ) ; } MetroHash :: Hash hash = { } ; hasher . Finalize ( hash . bytes ) ; return hash ; }
Builds hash code from compilation-options
Builds hash code from compilation - options
// Count of compilation-option strings // [in] An array of compilation-option strings // Options which needn't affect compilation results // Build effecting options // Skip '-' in options // Build hash code from effecting options