context/llpcCompiler.cpp
Result Compiler::CreateShaderCache(
    const ShaderCacheCreateInfo* pCreateInfo,    // [in] Shader cache create info
    IShaderCache**               ppShaderCache)  // [out] Shader cache object
{
    Result result = Result::Success;

    ShaderCacheAuxCreateInfo auxCreateInfo = {};
    auxCreateInfo.shaderCacheMode = ShaderCacheMode::ShaderCacheEnableRuntime;
    auxCreateInfo.gfxIp           = m_gfxIp;
    auxCreateInfo.hash            = m_optionHash;

    ShaderCache* pShaderCache = new ShaderCache();

    if (pShaderCache != nullptr)
    {
        result = pShaderCache->Init(pCreateInfo, &auxCreateInfo);
        if (result != Result::Success)
        {
            pShaderCache->Destroy();
            pShaderCache = nullptr;
        }
    }
    else
    {
        result = Result::ErrorOutOfMemory;
    }

    *ppShaderCache = pShaderCache;

    if ((result == Result::Success) &&
        ((cl::ShaderCacheMode == ShaderCacheEnableRuntime) ||
         (cl::ShaderCacheMode == ShaderCacheEnableOnDisk)) &&
        (pCreateInfo->initialDataSize > 0))
    {
        m_shaderCache->Merge(1, const_cast<const IShaderCache**>(ppShaderCache));
    }

    return result;
}
// =====================================================================================================================
// Creates shader cache object with the requested properties.
Creates shader cache object with the requested properties.
Creates shader cache object with the requested properties .
Result Compiler::CreateShaderCache(
    const ShaderCacheCreateInfo* pCreateInfo,    
    IShaderCache**               ppShaderCache)  
{
    Result result = Result::Success;
    ShaderCacheAuxCreateInfo auxCreateInfo = {};
    auxCreateInfo.shaderCacheMode = ShaderCacheMode::ShaderCacheEnableRuntime;
    auxCreateInfo.gfxIp           = m_gfxIp;
    auxCreateInfo.hash            = m_optionHash;
    ShaderCache* pShaderCache = new ShaderCache();
    if (pShaderCache != nullptr)
    {
        result = pShaderCache->Init(pCreateInfo, &auxCreateInfo);
        if (result != Result::Success)
        {
            pShaderCache->Destroy();
            pShaderCache = nullptr;
        }
    }
    else
    {
        result = Result::ErrorOutOfMemory;
    }
    *ppShaderCache = pShaderCache;
    if ((result == Result::Success) &&
        ((cl::ShaderCacheMode == ShaderCacheEnableRuntime) ||
         (cl::ShaderCacheMode == ShaderCacheEnableOnDisk)) &&
        (pCreateInfo->initialDataSize > 0))
    {
        m_shaderCache->Merge(1, const_cast<const IShaderCache**>(ppShaderCache));
    }
    return result;
}
Result Compiler :: CreateShaderCache ( const ShaderCacheCreateInfo * pCreateInfo , IShaderCache * * ppShaderCache ) { Result result = Result :: Success ; ShaderCacheAuxCreateInfo auxCreateInfo = { } ; auxCreateInfo . shaderCacheMode = ShaderCacheMode :: ShaderCacheEnableRuntime ; auxCreateInfo . gfxIp = m_gfxIp ; auxCreateInfo . hash = m_optionHash ; ShaderCache * pShaderCache = new ShaderCache ( ) ; if ( pShaderCache != nullptr ) { result = pShaderCache -> Init ( pCreateInfo , & auxCreateInfo ) ; if ( result != Result :: Success ) { pShaderCache -> Destroy ( ) ; pShaderCache = nullptr ; } } else { result = Result :: ErrorOutOfMemory ; } * ppShaderCache = pShaderCache ; if ( ( result == Result :: Success ) && ( ( cl :: ShaderCacheMode == ShaderCacheEnableRuntime ) || ( cl :: ShaderCacheMode == ShaderCacheEnableOnDisk ) ) && ( pCreateInfo -> initialDataSize > 0 ) ) { m_shaderCache -> Merge ( 1 , const_cast < const IShaderCache * * > ( ppShaderCache ) ) ; } return result ; }
Creates shader cache object with the requested properties.
Creates shader cache object with the requested properties .
// [in] Shader cache create info // [out] Shader cache object