GFX Pipeline Cache. (#14759)

This commit is contained in:
Zach Lee
2023-04-13 17:41:30 +08:00
committed by GitHub
parent eefa3401ea
commit 3fab846f7b
28 changed files with 771 additions and 39 deletions
@@ -1122,6 +1122,14 @@ void populatePipelineLayoutInfo(
}
}
template <typename T>
static ccstd::hash_t getShaderHash(ccstd::hash_t src, const T &val) {
if (src != gfx::INVALID_SHADER_HASH) {
ccstd::hash_combine(src, val);
}
return src;
}
} // namespace
void NativeProgramLibrary::init(gfx::Device *deviceIn) {
@@ -1492,6 +1500,7 @@ ProgramProxy *NativeProgramLibrary::getProgramVariant(
info.shaderInfo.attributes = getActiveAttributes(programInfo, info.attributes, defines);
info.shaderInfo.name = getShaderInstanceName(name, macroArray);
info.shaderInfo.hash = getShaderHash(programInfo.hash, prefix);
IntrusivePtr<gfx::Shader> shader = device->createShader(info.shaderInfo);
auto res = phase.programProxies.emplace(