[Optimaization] (MG_Backend/DirectVulkan): optimize perf

- Properly reuse descriptor sets rather than always allocating
- Add program lookup cache
This commit is contained in:
2026-05-11 23:20:55 +08:00
parent 4972ebf914
commit 9e0e03d4c0
11 changed files with 117 additions and 30 deletions
@@ -41,6 +41,11 @@ namespace MobileGL::MG_Backend::DirectVulkan {
const VertexInputStateFactory::BackendVertexInputState& VertexInputStateFactory::GetOrCreateVertexInputState(
const MG_State::GLState::VertexArrayObject& vao) {
const HashType hash = ComputeHash(vao);
return GetOrCreateVertexInputState(vao, hash);
}
const VertexInputStateFactory::BackendVertexInputState& VertexInputStateFactory::GetOrCreateVertexInputState(
const MG_State::GLState::VertexArrayObject& vao, HashType hash) {
auto it = m_cache.find(hash);
if (it != m_cache.end()) {
return it->second;