vk_pipeline_cache: Fix invalid iterator

This commit is contained in:
IndecisiveTurtle 2024-08-27 22:25:08 +03:00
parent 97770e258d
commit d36292873b
2 changed files with 5 additions and 4 deletions

View File

@ -92,8 +92,7 @@ struct BufferResource {
u64 GetKey(const Info& info) const {
const auto sharp = GetVsharp(info);
const u32 stride = sharp.GetStride();
u64 key = stride | (sharp.data_format << 14) | (sharp.num_format << 18);
u64 key = sharp.GetStride();
if (!is_written) {
key <<= 1;
key |= IsStorage(sharp);

View File

@ -73,6 +73,7 @@ private:
Program* program = it_pgm->second;
const auto& info = program->info;
vk::ShaderModule module{};
// Compile specialized module with current runtime state.
const auto it = std::ranges::find(program->modules, stage_key, &Program::Module::first);
@ -80,14 +81,15 @@ private:
auto new_info = MakeShaderInfo(stage, pgm->user_data, info.pgm_base, info.pgm_hash,
liverpool->regs);
const size_t perm_idx = program->modules.size();
const auto module = CompileModule(new_info, pgm->Code(), perm_idx, binding);
module = CompileModule(new_info, pgm->Code(), perm_idx, binding);
program->modules.emplace_back(stage_key, module);
} else {
binding += info.NumBindings();
module = it->second;
}
const u64 full_hash = HashCombine(hash, stage_key);
return std::make_tuple(&info, it->second, full_hash);
return std::make_tuple(&info, module, full_hash);
}
private: